This is an old revision of the document!
Native module that provides bindings to objects in the game world.
spawnThing ( type : Text, pos : Array, angle : Number = None, flags : Number = 0 )
Spawns a new thing at the specified coordinates pos. The type must be an existing Thing ID, for example “POSSESSED”.
The pos can be specified either in 2D or 3D:
Note that positions of existing things can be queried with
angle is the compass direction where the new thing will be facing (degrees). If None, a random direction is chosen.
flags is for spawn flags. See the World.MSF constants.
Base class for mobjs.
addMom ( momentum : Array )
Modifies the momentum of the thing by adding the 3D vector momentum. For example, this would throw the thing up in the air a bit:
self.addMom([0, 0, 10])
attack ( damage : Number, missileId : Text )
(Availability: 2.2, only in Heretic.)
Starts the attack action of an enemy by calling the native function
P_Attack(). If the current target of the enemy is in the melee range, damage points of damage will be dealt. Otherwise, a missile is spawned. missileId must be a valid Thing ID.
changeFlags ( index : Number, flags : Number, doSet : Number )
Changes thing flags. Each thing has three 32-bit integers for storing flags: index is 1, 2 or 3, for
flags3. flags is a bitmask specifying which flags are being changed. If doSet evaluates to True, the flags will be set. Otherwise they will be unset.
flags ( index : Number )
Returns thing flags. Each thing has three 32-bit integers for storing flags: index is 1, 2 or 3, for
dropItem ( type : Text, force : Number = 1.0, lift : Number = 0.0, height : Number = 0.5, prob : Number = 1.0 )
Spawns an item at the position of the self thing.
Returns the dropped thing as a World.Thing, or None.
health ( )
Returns the remaining hit points of the thing (as a Number).
height ( )
Returns the current height of the thing.
id ( )
Returns the ID number of the thing.
info ( )
Returns the definition of the thing.
mom ( )
Returns the 3D momentum of the thing as an array (XYZ).
player ( )
If the thing belongs to a player, returns an object representing that player (see App.Player). Otherwise returns
pos ( )
Returns the 3D position of the thing as an array (XYZ). This position is at the bottom center of the thing's bounding box.
One can add
Thing.height() to the returned Z coordinate to get the top of the thing's bounding box.
recoil ( force : Number )
Pushes the thing backwards by force units. For example, the Heretic Phoenix Rod uses a recoil of 4 units. The current direction of the thing determines which direction the recoil is applied.
setNoBlocking ( )
Unsets the MF_SOLID (0x2) flag.
startSound ( id : Text, volume : Number = 1.0 )
Starts playing a sound using the thing as the emitter. By default, the volume is at maximum (1.0). There must be a Sound definition with a matching id.
type ( )
Returns the internal type number of the thing. This is an element index number in the Defs.things.order array.
Note that the Thing definition ID (a text string) can be queried by