EGGOXdevelopers

Things

A thing's script and bricks live in things/, and apply to every one of it in every room.

things/<Thing>.lua is the script on that thing. It is Lua like the room's, in its own block, where on("click"), on("walk_on") and on("walk_off") fire for that thing alone and self.item names it. Everything else in the scripting API works as in a room script. One script per thing, 16 KB.

-- things/Spirit Garden.lua
on("click", function(p)
  local s = members[p.id]
  if s then garden_ui(s) end
end)

things/<Thing>.json is the bricks on every one of that thing:

{ "bricks": [{ "kind": "sign", "text": "The Spirit Garden: plant blooms, come back, harvest Spirit." }] }

One level, not two

A script goes on the thing, never on a single placed copy. If two copies of a thing need to behave differently, give them different bricks in the room (a sign with its own text, a spawn for a team), or tell them apart in the script by where they stand (t.x, t.y) or by a switch target name.

Naming

The file is named like the thing in the game's stock; eggox stock lists the exact names. A things/ file for a name the stock does not hold refuses the push: put the mint in first with eggox stock add.

This page as markdown: /project/things.md