world
Place markers, zones, paths and pictures in the map. The engine draws them for you every frame.
Objects belong to the script that made them and disappear when it is turned off. 256 per script. Options are the same for every kind; each kind uses the ones that make sense. world.save() keeps them per map in the script's data folder.
Options: text, name, color, size (dot px), radius (ring units), height (beam units), fade (hide past this distance), thickness, fill (0..1), image + image_size, walls (false = hide when a wall is between you and it), show, arrows, dashed, normal, ttl (seconds).
| Function | What it does |
|---|---|
world.aim([range]) | Where your crosshair points on the map. |
world.marker(pos[, options]) | A dot with optional text, ring, vertical beam and icon. |
world.zone(options) | A circle (pos + radius, height = vertical reach, default 128) or a box (min + max). Fires zone_enter / zone_leave for this script when you walk in or out. |
world.path(points[, options]) | A line through 2 to 512 points. arrows adds direction marks, dashed breaks it up. |
world.decal(image, pos[, options]) | A picture from draw.load_image placed in the world. With normal it lies flat on that surface; without it always faces you. size is in units (default 32). |
world.set(id, options) | Changes options (and pos) of an object. |
world.move(id, pos) | Moves an object. |
world.remove(id) | Deletes an object. |
world.clear() | Deletes all of this script's objects. |
world.count() | How many objects this script has. |
world.inside(id) | True while you stand in that zone. |
world.list() | This script's objects. |
world.save([name]) | Writes markers, zones and paths to world_<name>.json in the data folder. Default name is the map. |
world.load([name]) | Adds the objects saved under that name. |
#world.aim
world.aim([range])Where your crosshair points on the map.
Returns
map.trace. nil when nothing is hit.local hit = world.aim()
if hit and input.key_pressed(0x58) then world.marker(hit.pos, { text = "here" }) end#world.marker
world.marker(pos[, options])A dot with optional text, ring, vertical beam and icon.
Returns
world.marker(pos, { text = "Boost", radius = 24, height = 48, color = color(255, 200, 60), walls = false })#world.zone
world.zone(options)A circle (pos + radius, height = vertical reach, default 128) or a box (min + max). Fires zone_enter / zone_leave for this script when you walk in or out.
Returns
world.zone({ pos = p, radius = 160, name = "Banana" })
events.on("zone_enter", function(e) sound.speak(e.name) end)#world.path
world.path(points[, options])A line through 2 to 512 points. arrows adds direction marks, dashed breaks it up.
Returns
#world.decal
world.decal(image, pos[, options])A picture from draw.load_image placed in the world. With normal it lies flat on that surface; without it always faces you. size is in units (default 32).
Returns
local hit = world.aim()
if hit then world.decal(logo, hit.pos, { normal = hit.normal, size = 48 }) end#world.set
world.set(id, options)Changes options (and pos) of an object.
Returns
#world.move
world.move(id, pos)Moves an object.
Returns
#world.remove
world.remove(id)Deletes an object.
Returns
#world.clear
world.clear()Deletes all of this script's objects.
#world.count
world.count()How many objects this script has.
Returns
#world.inside
world.inside(id)True while you stand in that zone.
Returns
#world.list
world.list()This script's objects.
Returns
id, kind (marker/zone/path/decal), pos, name, text, inside.#world.save
world.save([name])Writes markers, zones and paths to world_<name>.json in the data folder. Default name is the map.
Returns
#world.load
world.load([name])Adds the objects saved under that name.
Returns
world.load()