User Tools

Site Tools


This is an old revision of the document!

World (Module)

Native module that provides bindings to objects in the game world.


consolePlayer ( )

Returns an object representing the console player (App.Player).

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:

  • [350, -1000] would place the new thing on the floor at X=350, Y=-1000.
  • [350, -1000, 50] would place the new thing at X=350, Y=-1000, Z=50.

Note that positions of existing things can be queried with Thing.pos().

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.

attack ( damage : Number, missileId : Number )

(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.

health ( )

Returns the remaining hit points of the thing (as a Number).

id ( )

Returns the ID number of the thing.

player ( )

If the thing belongs to a player, returns an object representing that player (see App.Player). Otherwise returns None.

pos ( )

Returns the 3D position of the thing as an array (XYZ).

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.

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.


Flags for spawnThing()

Spawn thing as deaf.
Spawn thing in the ceiling.
Spawn thing at the floor.
script/module/world.1577005844.txt.gz · Last modified: 2019-12-22 11:10 by skyjake