User Tools

Site Tools


script:module:world

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
script:module:world [2019-12-22 11:24]
skyjake [World.Thing]
script:module:world [2020-01-18 07:44] (current)
skyjake
Line 5: Line 5:
  
 ===== Functions ===== ===== Functions =====
- 
-#​@Identifier_HTML~consolePlayer~@#​ ( ) 
- 
-Returns an object representing the console player ([[script:​module:​App#​app.player|App.Player]]). 
  
 #​@Identifier_HTML~spawnThing~@#​ ( #​@Identifier_HTML~spawnThing~@#​ (
Line 28: Line 24:
  
 //flags// is for spawn flags. [[#​flags_for_spawnthing|See the World.MSF constants.]] //flags// is for spawn flags. [[#​flags_for_spawnthing|See the World.MSF constants.]]
 +
 +
 ===== World.Thing ===== ===== World.Thing =====
  
 Base class for mobjs. Base class for mobjs.
 +
 +#​@Identifier_HTML~addMom~@#​ ( #​@Arg_HTML~Array,​momentum~@#​ )
 +
 +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])
  
 #​@Identifier_HTML~attack~@#​ ( #​@Identifier_HTML~attack~@#​ (
  #​@Arg_HTML~Number,​damage~@#,​  #​@Arg_HTML~Number,​damage~@#,​
- #​@Arg_HTML~Number,​missileId~@#​ )+ #​@Arg_HTML~Text,​missileId~@#​ )
  
 (Availability:​ [[version:​2.2]],​ only in Heretic.) (Availability:​ [[version:​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.+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 [[ded:​Thing]] ID. 
 + 
 +#​@Identifier_HTML~changeFlags~@#​ ( 
 + #​@Arg_HTML~Number,​index~@#,​ 
 + #​@Arg_HTML~Number,​flags~@#,​ 
 + #​@Arg_HTML~Number,​doSet~@#​ ) 
 + 
 +Changes thing flags. Each thing has three 32-bit integers for storing flags: //index// is 1, 2 or 3, for ''​flags'',​ ''​flags2''​ and ''​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.
  
  
Line 50: Line 61:
 Spawns an item at the position of the //self// thing. Spawns an item at the position of the //self// thing.
  
-  ; //type// : [[ded:​Thing]] ​ID of the dropped item.+  ; //type// : [[ded:Thing#ID|Thing definition ID]] of the dropped item.
   ; //force// : XY momentum of the dropped item (direction is randomly chosen).   ; //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.   ; //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 spawn at the middle of the dropper ​thing. 1.0 would spawn the item at the top of the dropper.+  ; //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.   ; //prob// : Chance of dropping. The default 1.0 means 100% certainty.
   ​   ​
 Returns the dropped thing as a World.Thing,​ or None. Returns the dropped thing as a World.Thing,​ or None.
 +
 +
 +#​@Identifier_HTML~flags~@#​ (
 + #​@Arg_HTML~Number,​index~@#​ )
 +
 +Returns thing flags. Each thing has three 32-bit integers for storing flags: //index// is 1, 2 or 3, for ''​flags'',​ ''​flags2''​ and ''​flags3''​.
  
  
Line 62: Line 79:
  
 Returns the remaining hit points of the thing (as a Number). Returns the remaining hit points of the thing (as a Number).
 +
 +#​@Identifier_HTML~height~@#​ ( )
 +
 +Returns the current height of the thing.
  
 #​@Identifier_HTML~id~@#​ ( ) #​@Identifier_HTML~id~@#​ ( )
Line 70: Line 91:
  
 Returns the [[ded:​Thing|definition]] of the thing. Returns the [[ded:​Thing|definition]] of the thing.
 +
 +#​@Identifier_HTML~mom~@#​ ( )
 +
 +Returns the 3D momentum of the thing as an array (XYZ).
  
 #​@Identifier_HTML~player~@#​ ( ) #​@Identifier_HTML~player~@#​ ( )
Line 77: Line 102:
 #​@Identifier_HTML~pos~@#​ ( ) #​@Identifier_HTML~pos~@#​ ( )
  
-Returns the 3D position of the thing as an array (XYZ).+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.
  
 #​@Identifier_HTML~recoil~@#​ ( #​@Arg_HTML~Number,​force~@#​ ) #​@Identifier_HTML~recoil~@#​ ( #​@Arg_HTML~Number,​force~@#​ )
  
 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. ​ 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. ​
 +
 +#​@Identifier_HTML~setNoBlocking~@#​ ( )
 +
 +Unsets the MF_SOLID (0x2) flag.
  
 #​@Identifier_HTML~startSound~@#​ ( #​@Identifier_HTML~startSound~@#​ (
Line 92: Line 123:
  
 Returns the internal type number of the thing. This is an element index number in the [[script:​module:​defs#​order|Defs.things.order]] array. Returns the internal type number of the thing. This is an element index number in the [[script:​module:​defs#​order|Defs.things.order]] array.
 +
 +Note that the [[ded:​Thing|Thing definition ID]] (a text string) can be queried by ''​Thing.info().id''​.
  
 ===== Constants ===== ===== Constants =====
Line 101: Line 134:
   ; MSF_Z_FLOOR : Spawn thing at the floor.   ; MSF_Z_FLOOR : Spawn thing at the floor.
  
 +===== Old versions =====
 +
 +  * [[/​script/​module/​world?​rev=1576428056|2.2]]
  
script/module/world.1577006669.txt.gz · Last modified: 2019-12-22 11:24 by skyjake