PetLuaTable

public final class PetLuaTable

The c.pet table a behavior module reads: the pet's state, and the Java helpers that keep per-tick work fast. One table per pet; bind points it at the current callback's Mind context first.

Its properties, and route_target, are a snapshot per pet tick: each is read on its first use in a tick and kept through every callback of that tick. A new pet tick, game tick or body reads them afresh, and so does every read after c.pet:teleport_near_owner or c.pet:stop. Nothing else does: after c.entity:teleport, set_velocity or push, or the stop MagmaCore makes when a behavior gives up its controls, the properties show the change on the next tick. speed is the exception, read fresh every time, since that stop changes it. A location property gives a fresh table on every read, so a module may change the one it gets.

Modules get it read-only: assigning to c.pet or c.pet.species, rawset on them and setmetatable all raise a Lua error, so no module can shadow a property or replace a method for the rest of its pet's life. c.pet never acts in another world: a location it would return from another world than the body's reads as nil, and a location argument naming another world counts as nothing there (nil, false or 0, and an infinite distance_to). Number arguments must be finite; radii, depths, heights, multipliers, amplifiers, durations and lists are capped below, so the Java work stays bounded, and no method loads a chunk. A Java failure inside a property or method is logged through the load's Warnings, then reaches Lua as a short error that fails the callback. Server thread only.

Properties

Link copied to clipboard
public final static Set<String> METHODS
Every method a module can call on c.pet.
Link copied to clipboard
public final static Set<String> PROPERTIES
Every name a module can read on c.pet.
Link copied to clipboard
public final static Set<String> SPECIES_FIELDS
The fields of c.pet.species.