OnPlayerConsumableDetachedSnapshot
onPlayerConsumableDetachedSnapshot
AVAILABLE FROM UPDATE 0.1.3
This event is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.
Triggered during disconnect when a consumable operation is still awaiting its durable inventory result, providing both rollback and success snapshots for detached recovery.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerConsumableDetachedSnapshot(playerId, itemKey, sequence, commitKey, baseHealth, baseMaxHealth, baseMana, baseMaxMana, baseStrength, baseDexterity, baseAlcohol, baseSwampweed, successHealth, successMaxHealth, successMana, successMaxMana, successStrength, successDexterity, successAlcohol, successSwampweed, appliedHealth, appliedMana)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The disconnecting player's last authoritative ID. |
itemKey |
string |
The stable native inventory key of the consumable. |
sequence |
int |
The positive client request sequence. |
commitKey |
string |
The opaque durable-operation key. |
baseHealth |
number |
Health to preserve if stage-one persistence failed. |
baseMaxHealth |
number |
Maximum health to preserve if stage-one persistence failed. |
baseMana |
number |
Mana to preserve if stage-one persistence failed. |
baseMaxMana |
number |
Maximum mana to preserve if stage-one persistence failed. |
baseStrength |
number |
Strength to preserve if stage-one persistence failed. |
baseDexterity |
number |
Dexterity to preserve if stage-one persistence failed. |
baseAlcohol |
number |
Alcohol value to preserve if stage-one persistence failed. |
baseSwampweed |
number |
Swampweed value to preserve if stage-one persistence failed. |
successHealth |
number |
Projected health if the reserved item is durably consumed. |
successMaxHealth |
number |
Projected maximum health after durable success. |
successMana |
number |
Projected mana after durable success. |
successMaxMana |
number |
Projected maximum mana after durable success. |
successStrength |
number |
Projected strength after durable success. |
successDexterity |
number |
Projected dexterity after durable success. |
successAlcohol |
number |
Projected alcohol value after durable success. |
successSwampweed |
number |
Projected swampweed value after durable success. |
appliedHealth |
number |
Projected instant health change for the success outcome. |
appliedMana |
number |
Projected instant mana change for the success outcome. |
Examples
Handle the event:
addEventHandler("onPlayerConsumableDetachedSnapshot", root, function(playerId, itemKey, sequence, commitKey, baseHealth, baseMaxHealth, baseMana, baseMaxMana, baseStrength, baseDexterity, baseAlcohol, baseSwampweed, successHealth, successMaxHealth, successMana, successMaxMana, successStrength, successDexterity, successAlcohol, successSwampweed, appliedHealth, appliedMana)
outputDebugString("Detached consumable recovery: " .. itemKey .. " #" .. sequence)
end)
Notes
- This advanced disconnect-recovery callback is part of the stable server-side Lua contract beginning with update 0.1.3.
- It is emitted only when the player disconnects while stage-one inventory persistence is unresolved. A disconnect during final settlement reuses
onPlayerConsumableFinalizeRequestedinstead. - The bundled
gothic_rpresource selects and persists the correct snapshot after reconciling the durable receipt. Other resources must treat both snapshots as read-only. - The player session is being removed; do not defer ordinary player getters or assume that the player remains connected after this callback.