Coming soon toSteam
Modding docsAPI 1

API reference

Events

Subscribe with events.on(name, handler). A mod's own events are named freely and scoped to the mod; other mods' events are "their.mod-id:name".

Modding events

EventSidesWhenPayload
map.loadedclient, serverA map finished loading. The payload says which one and whether a mod made it.{ id = string, mod = string? }
map.unloadingclient, serverThe current map is about to be left.{ id = string }
player.joinedclient, serverA player joined the session.Player
player.leftclient, serverA player left the session. The Player is no longer valid.Player
ui.screen.closedclientOne of the game's screens closed.{ id = string }
ui.screen.openedclientOne of the game's screens opened, so a mod can change it again.{ id = string }

Game events

Events the game itself raises, read-only. The payload holds the event's fields.

EventSidesWhenPayload
game.AfterSceneLoadEventclient, serverThe game's AfterSceneLoadEvent event, read-only.{ sceneName }
game.BeforeSceneLoadEventclient, serverThe game's BeforeSceneLoadEvent event, read-only.{ sceneName }
game.BlockAddedEventclient, serverThe game's BlockAddedEvent event, read-only. Travels between peers, so positions in it are absolute.{ structureId, blockId, position }
game.BlockInteractRequestclient, serverThe game's BlockInteractRequest event, read-only. Travels between peers, so positions in it are absolute.{ blockUuid }
game.BlockRemovedEventclient, serverThe game's BlockRemovedEvent event, read-only. Travels between peers, so positions in it are absolute.{ structureId, blockId, position }
game.BuildingStructureEvents.Initialization.RequestSpawnclient, serverThe game's BuildingStructureEvents.Initialization.RequestSpawn event, read-only. Travels between peers, so positions in it are absolute.{ ownerUuid, forceNew }
game.BuildingStructureEvents.Initialization.SpawnResponseclient, serverThe game's BuildingStructureEvents.Initialization.SpawnResponse event, read-only. Travels between peers, so positions in it are absolute.{ isSuccess, structureUuid, reason }
game.BuildingStructureEvents.Ownership.OnOwnershipChangedclient, serverThe game's BuildingStructureEvents.Ownership.OnOwnershipChanged event, read-only. Travels between peers, so positions in it are absolute.{ structure, prevOwner, newOwner }
game.BuildingStructureEvents.Ownership.OnOwnershipRecalledclient, serverThe game's BuildingStructureEvents.Ownership.OnOwnershipRecalled event, read-only. Travels between peers, so positions in it are absolute.{ structure, prevOwner }
game.BuildingStructureEvents.Ownership.RequestTransferclient, serverThe game's BuildingStructureEvents.Ownership.RequestTransfer event, read-only. Travels between peers, so positions in it are absolute.{ toPlayer }
game.BuildingStructureEvents.Ownership.TransferResponseclient, serverThe game's BuildingStructureEvents.Ownership.TransferResponse event, read-only. Travels between peers, so positions in it are absolute.{ isSuccess, newOwner }
game.BuildingStructureEvents.Placement.RequestMoveBesidePlayerclient, serverThe game's BuildingStructureEvents.Placement.RequestMoveBesidePlayer event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid }
game.BuildingStructureEvents.Placement.RequestMoveStructureclient, serverThe game's BuildingStructureEvents.Placement.RequestMoveStructure event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid, position, rotation }
game.BuildingStructureEvents.Retrieve.RequestDeleteStructureclient, serverThe game's BuildingStructureEvents.Retrieve.RequestDeleteStructure event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid }
game.BuildingStructureEvents.Retrieve.RequestOwnedStructuresclient, serverThe game's BuildingStructureEvents.Retrieve.RequestOwnedStructures event, read-only. Travels between peers, so positions in it are absolute.{ ownerUuid }
game.BuildingStructureEvents.Retrieve.RequestStructureBlocksclient, serverThe game's BuildingStructureEvents.Retrieve.RequestStructureBlocks event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid }
game.BuildingStructureEvents.Retrieve.ReturnOwnedStructuresclient, serverThe game's BuildingStructureEvents.Retrieve.ReturnOwnedStructures event, read-only. Travels between peers, so positions in it are absolute.{ structureUuids, summaries }
game.BuildingStructureEvents.Retrieve.ReturnStructureBlocksclient, serverThe game's BuildingStructureEvents.Retrieve.ReturnStructureBlocks event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid, results }
game.BuildingStructureEvents.Retrieve.StructureRemovedclient, serverThe game's BuildingStructureEvents.Retrieve.StructureRemoved event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid }
game.ChangeBuildingMode.Approvedclient, serverThe game's ChangeBuildingMode.Approved event, read-only.{ open }
game.ChangeBuildingMode.Completeclient, serverThe game's ChangeBuildingMode.Complete event, read-only. Travels between peers, so positions in it are absolute.{ open, isSuccess }
game.ChangeBuildingMode.Requestclient, serverThe game's ChangeBuildingMode.Request event, read-only. Travels between peers, so positions in it are absolute.{ open }
game.ChangeBuildingMode.Responseclient, serverThe game's ChangeBuildingMode.Response event, read-only. Travels between peers, so positions in it are absolute.{ open, isSuccess }
game.ClientCameraViewSyncEventclient, serverThe game's ClientCameraViewSyncEvent event, read-only. Travels between peers, so positions in it are absolute.{ playerUuid, cameraUuid }
game.ClientVehicleInputSyncEventclient, serverThe game's ClientVehicleInputSyncEvent event, read-only. Travels between peers, so positions in it are absolute.{ playerUuid, pressedKeys, yaw, pitch, hasAim }
game.PlayerPlacementEventclient, serverThe game's PlayerPlacementEvent event, read-only. Travels between peers, so positions in it are absolute.{ playerNetId, position, reason }
game.SeatHopRequestclient, serverThe game's SeatHopRequest event, read-only. Travels between peers, so positions in it are absolute.{ backwards }
game.SeatInteractionRequestclient, serverThe game's SeatInteractionRequest event, read-only. Travels between peers, so positions in it are absolute.{ playerUuid, blockUuid }
game.SeatOccupancyChangedEventclient, serverThe game's SeatOccupancyChangedEvent event, read-only. Travels between peers, so positions in it are absolute.{ blockUuid, playerNetId, occupied, exitPosition, hasExit }
game.StructureBuiltEventclient, serverThe game's StructureBuiltEvent event, read-only. Travels between peers, so positions in it are absolute.{ structureId, position }
game.StructureDesignPoseSyncEventclient, serverThe game's StructureDesignPoseSyncEvent event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid, position, rotation, subGroups }
game.StructureTransformSyncEventclient, serverThe game's StructureTransformSyncEvent event, read-only. Travels between peers, so positions in it are absolute.{ structureUuid, position, rotation }
game.WeaponFiredEventclient, serverThe game's WeaponFiredEvent event, read-only. Travels between peers, so positions in it are absolute.{ blockUuid, origin, hit, kind, didHit, effectVariant, blockDataId, isOffline }