Quick navigation

Go to

server runtime · Lua API

Open77.playerInteractions

Runs on the dedicated server and is authoritative: state written here is the truth every client is told about.

server runtime6 functionsOpen in explorerMarkdown
On this page6 sections

cancel

NETWORK
Signaturelua
Open77.playerInteractions.cancel(interactionId, [reason])

Cancel an interaction owned by this resource.

Requires players.interactions.control -- the handler chooses the name per operation, and players.interactions.read covers only the inspection calls (get, current, list, isReserved); without it the answer is nil, permission_denied:players.interactions.control. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Custom reason accepts 1–64 ASCII alphanumeric/underscore characters; invalid reasons normalize to cancelled. Delayed callbacks should retain the interaction ID, never cancel whatever action happens to occupy the player later.

Parameters 2

Parameters of Open77.playerInteractions.cancel
NameTypeUseDefault
interactionIdstringrequired—
reasonstringoptional—

Returns

  • terminal state or nil, reason

Example

example.lualua
-- The item vanished mid-handover: cancel the interaction with a reason
Open77.playerInteractions.cancel(interactionId, "item_removed")

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7974).

current

NETWORK
Signaturelua
Open77.playerInteractions.current(playerId)

Read the interaction reserving a player, including an unanswered invitation.

Requires players.interactions.read -- the handler chooses the name per operation, and players.interactions.control is what request and cancel need instead; without it the answer is nil, permission_denied:players.interactions.read. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Terminal states are removed from the active registry. Read access never grants cancellation of another resource's action.

Parameters 1

Parameters of Open77.playerInteractions.current
NameTypeUseDefault
playerIdintegerrequired—

Returns

  • active state or nil; nil, reason on rejection

Example

example.lualua
-- Refuse a trade while the player is already in an interaction
local busy = Open77.playerInteractions.current(playerId)
if busy then return Open77.chat.send(playerId, "Finish what you are doing first.") end

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7971).

get

NETWORK
Signaturelua
Open77.playerInteractions.get(interactionId)

Read a copied active state by opaque interaction ID.

Requires players.interactions.read -- the handler chooses the name per operation, and players.interactions.control is what request and cancel need instead; without it the answer is nil, permission_denied:players.interactions.read. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Terminal states are removed from the active registry. Read access never grants cancellation of another resource's action.

Parameters 1

Parameters of Open77.playerInteractions.get
NameTypeUseDefault
interactionIdstringrequired—

Returns

  • active state or nil; nil, reason on rejection

Example

example.lualua
-- Read the state of the interaction we started
local state = Open77.playerInteractions.get(interactionId)
if state then print(state.kind, state.phase) end

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7970).

isReserved

NETWORK
Signaturelua
Open77.playerInteractions.isReserved(playerId)

Check whether a player is exclusively reserved by this service.

Requires players.interactions.read -- the handler chooses the name per operation, and players.interactions.control is what request and cancel need instead; without it the answer is nil, permission_denied:players.interactions.read. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Terminal states are removed from the active registry. Read access never grants cancellation of another resource's action.

Parameters 1

Parameters of Open77.playerInteractions.isReserved
NameTypeUseDefault
playerIdintegerrequired—

Returns

  • boolean; nil, reason on rejection

Example

example.lualua
-- A reserved player cannot be teleported by the event script
if Open77.playerInteractions.isReserved(playerId) then return end

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7972).

list

NETWORK
Signaturelua
Open77.playerInteractions.list()

List active interactions owned by this resource only.

Requires players.interactions.read -- the handler chooses the name per operation, and players.interactions.control is what request and cancel need instead; without it the answer is nil, permission_denied:players.interactions.read. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Terminal states are removed from the active registry. Read access never grants cancellation of another resource's action.

Returns

  • state[]; nil, reason on rejection

Example

example.lualua
-- /interactions: what is this resource coordinating right now?
RegisterCommand("interactions", function(source)
    for _, state in ipairs(Open77.playerInteractions.list() or {}) do
        Open77.chat.send(source, ("%s: %d -> %d (%s)"):format(state.kind, state.actorId, state.targetId, state.phase))
    end
end, true)

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7973).

request

NETWORK
Signaturelua
Open77.playerInteractions.request(actorId, targetId, kind, [options])

Reserve and coordinate a two-player interaction.

Requires players.interactions.control -- the handler chooses the name per operation, and players.interactions.read covers only the inspection calls (get, current, list, isReserved); without it the answer is nil, permission_denied:players.interactions.control. Uses canonical player IDs. The coordinator reserves both players and cancels on death, disconnect, vehicle entry, bucket change, resource stop, timeout or presentation failure. Gameplay effects remain the resource's responsibility. See player-interactions.md. Kinds: give, heal, carry, escort, custom. Options: durationMs (500–600000, default4000), startDistance (.25–10, default3), breakDistance (startDistance–20, default5), inviteTimeoutMs (1000–60000, default15000), consent (defaulttrue), optional actorAnimation/targetAnimation RP profiles for stationary kinds. Carry/escort reject profile overrides. Both players must be alive, on foot, near and in the same bucket. Acceptance is not proof of native playback; observe lifecycle events.

Parameters 4

Parameters of Open77.playerInteractions.request
NameTypeUseDefault
actorIdintegerrequired—
targetIdintegerrequired—
kindstringrequired—
optionstableoptional—

Returns

  • state table or nil, reason

Example

example.lualua
-- /give <id>: hand an item over with a four-second synchronized animation
RegisterCommand("give", function(source, args)
    local target = tonumber(args[1])
    if not target then return end
    local state, reason = Open77.playerInteractions.request(source, target, "give", { durationMs = 4000 })
    if not state then Open77.chat.send(source, "Cannot give: " .. reason) end
end, false)

Player interactions guide · Registered in LuaResourceRuntime.cs as LuaResourceRuntime.Bootstrap (line 7965).

// For agents & LLMsthis page as Markdownllms.txtllms-full.txt

// Guides · Lua API

Search the docs

1,905 guides and functions indexed

Try