Noverwyn Documentation

Entities and properties

An entity is anything that has a place in the world. A player is an entity with extra functions.

Fields#

Field Content
id number, reused after someone leaves
name name
kind player for a player, otherwise free
isPlayer boolean
account public account identifier; nil without a master

These are copies: changing them changes nothing in the world.

Creating an object#

local broom = entities.create({
	kind = "broom",
	name = "Training broom",
	position = { 4, 2, 0 },
	props = { free = true },
})

It disappears with the script that created it, or with entity:remove.

Properties#

A property is a value attached to an entity: nil, boolean, number or text.

player:set("house", "Brightmoon")           -- everyone who sees them
player:set("money", 120, "private")         -- only them
player:set("warnings", 2, "server")         -- nobody
Limit Value
properties per entity 64
name 64 characters
text 1024 characters

A long text is sent only once per connection: after that, a number is enough.

The names account, vip and vip.… are reserved for VIP items.

Warning

Nothing is saved to disk. Properties disappear with the entity or when the server stops.

Positions#

Wherever a position is expected, these three forms work:

player:teleport({ 1, 2, 0 })
player:teleport({ x = 1, y = 2, z = 0 })
player:teleport(vector.create(1, 2, 0))

Units: metres, Z up, rotations in degrees.

Visibility#

A player only receives entities from their own bucket. They become visible at 60 m, and stop being visible at 70 m. At most 128 players are visible at once: beyond that, the closest ones.

In a crowd, entity:setPriority gives an entity a head start for everyone (a teacher), and player:prefer for one player (a duellist, a friend).