This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
script:module:world [2020-12-06 19:27] – skyjake | script:module:world [2021-08-01 04:55] (current) – skyjake | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== World (Module) ====== | ||
+ | |||
+ | Native module that provides bindings to objects in the game world. | ||
+ | |||
+ | |||
+ | ===== Functions ===== | ||
+ | |||
+ | # | ||
+ | |||
+ | Searches the map for all things of type //thingId// and returns an array of [[# | ||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ) | ||
+ | |||
+ | Spawns a new thing at the specified coordinates //pos//. The // | ||
+ | |||
+ | 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 '' | ||
+ | |||
+ | //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. [[# | ||
+ | |||
+ | |||
+ | ===== World.Thing ===== | ||
+ | |||
+ | Base class for mobjs. | ||
+ | |||
+ | # | ||
+ | |||
+ | Modifies the momentum of the thing by adding the 3D vector // | ||
+ | |||
+ | self.addMom([0, | ||
+ | |||
+ | # | ||
+ | |||
+ | (Availability: | ||
+ | |||
+ | Returns the angle of the thing: 0 = East, 90 = North, 180 = West, 270 = South. | ||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | (Availability: | ||
+ | |||
+ | Starts the attack action of an enemy by calling the native function '' | ||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | Changes thing flags. Each thing has three 32-bit integers for storing flags: //index// is 1, 2 or 3, for '' | ||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | Spawns an item at the position of the //self// thing. | ||
+ | |||
+ | ; //type// : [[ded: | ||
+ | ; //force// : XY momentum of the dropped item (direction is randomly chosen). | ||
+ | ; //lift// : Z momentum of the dropped item. Positive values cause the item to be thrown upward after being spawned. | ||
+ | ; //height// : Spawn position Z offset. The default value 0.5 causes the item to be spawned at the middle of the dropper. 1.0 would spawn the item at the top of the dropper. | ||
+ | ; //prob// : Chance of dropping. The default 1.0 means 100% certainty. | ||
+ | | ||
+ | Returns the dropped thing as a World.Thing, | ||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | |||
+ | Returns thing flags. Each thing has three 32-bit integers for storing flags: //index// is 1, 2 or 3, for '' | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | Returns the remaining hit points of the thing (as a Number). | ||
+ | |||
+ | # | ||
+ | |||
+ | Returns the current height of the thing. | ||
+ | |||
+ | # | ||
+ | |||
+ | Returns the ID number of the thing. | ||
+ | |||
+ | # | ||
+ | |||
+ | Returns the [[ded: | ||
+ | |||
+ | # | ||
+ | |||
+ | Returns the 3D momentum of the thing as an array (XYZ). | ||
+ | |||
+ | # | ||
+ | |||
+ | If the thing belongs to a player, returns an object representing that player (see [[script: | ||
+ | |||
+ | # | ||
+ | |||
+ | Returns the 3D position of the thing as an array (XYZ). This position is at the bottom center of the thing' | ||
+ | |||
+ | One can add '' | ||
+ | |||
+ | # | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | (Availability: | ||
+ | |||
+ | Changes the angle of the thing to // | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | Unsets the MF_SOLID (0x2) flag. | ||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ) | ||
+ | |||
+ | Spawns a missile originating from the thing. | ||
+ | |||
+ | //id// is the Thing definition ID of the spawned missile. | ||
+ | |||
+ | The //angle// is a compass direction (0...360, degrees). 0 = East, 90 = North, etc. If its value is set, the missile will use this compass direction instead of being aimed at the thing' | ||
+ | |||
+ | //momz// is the vertical momentum of the missile, so this can give it a slope going up or down, but on the XY plane the speed will always be the same regardless. | ||
+ | |||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | Starts playing a sound using the thing as the emitter. By default, the volume is at maximum (1.0). There must be a [[ded: | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | Returns a reference to the thing' | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | Returns a reference to the tracer thing, or None. This is typically used for homing missiles. | ||
+ | |||
+ | |||
+ | # | ||
+ | |||
+ | Returns the internal type number of the thing. This is an element index number in the [[script: | ||
+ | |||
+ | Note that the [[ded: | ||
+ | |||
+ | ===== Constants ===== | ||
+ | |||
+ | ==== Flags for spawnThing() ==== | ||
+ | |||
+ | ; MSF_AMBUSH : Spawn thing as deaf. | ||
+ | ; MSF_Z_CEIL : Spawn thing in the ceiling. | ||
+ | ; MSF_Z_FLOOR : Spawn thing at the floor. | ||
+ | |||
+ | ===== Old versions ===== | ||
+ | |||
+ | * [[/ | ||