SpawnTestItem: Difference between revisions
Jump to navigation
Jump to search
Document server-owned monsters and interactions |
Complete Lua function catalog |
||
| Line 35: | Line 35: | ||
* This function deliberately spawns only the validated test apple. It is not a generic arbitrary asset loader. | * This function deliberately spawns only the validated test apple. It is not a generic arbitrary asset loader. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:World Functions]] | [[Category:World Functions]] | ||
[[Category:Inventory Functions]] | [[Category:Inventory Functions]] | ||
Revision as of 09:55, 15 August 2026
spawnTestItem
Spawns the catalog-backed synchronized test apple near a player.
Syntax
bool spawnTestItem(int playerId [, number heightOffset = 0])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
heightOffset |
number |
no | Optional vertical offset in metres, clamped to the validated test range. |
Returns
Returns true when the authoritative spawn request is accepted; otherwise returns false.
Examples
Spawn a pickup at the invoking player's feet:
addCommandHandler("spawnitem", function(playerId)
if not spawnTestItem(playerId) then
outputChatBox("The item could not be spawned.", playerId)
end
end)
Notes
- Available only in server-side resource scripts.
- The server owns the item identity, revision, visibility, pickup validation, inventory award, and late-join state.
- This function deliberately spawns only the validated test apple. It is not a generic arbitrary asset loader.