User Tools

Site Tools


script:module:defs

Differences

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

Link to this comparison view

script:module:defs [2015-11-15 20:29] (current)
Line 1: Line 1:
 +The <​code>​Defs</​code>​ module provides access to the definitions read from [[ded]] files.
 +
 +
 +$ dir(Defs)
 +⇒ [ SDN_ACTIVE, SDN_ATTACK, SDN_DEATH, SDN_PAIN, SDN_SEE, SN_CRASH, SN_DEATH, SN_MELEE, SN_MISSILE, SN_PAIN, SN_RAISE, SN_SEE, SN_SPAWN, SN_XDEATH, decorations,​ episodes, finales, flags, mapInfos, materials, models, musics, skies, states, things ]
 +
 +
 +
 +====== Lookups ======
 +
 +
 +Each collection of definitions contains various lookup tables and indices:
 +
 +
 +$ dir(Defs.things)
 +⇒ [ idLookup, nameLookup, order ]
 +
 +
 +For example, <​code>​idLookup</​code>​ is a dictionary that maps IDs to definition records.
 +
 +
 +$ Defs.things.idLookup['​possessed'​]
 +⇒ __order__: ​  1
 +  custom: ​     False
 +  damage: ​     0
 +  doomEdNum: ​  3004
 +  flags: ​      [ 0x400006, 0x40000, 0 ]
 +  height: ​     56
 +  id:          POSSESSED
 +  mass:        100
 +  misc:        [ 0, 0, 0, 0 ]
 +  name:        Zombieman
 +  painChance: ​ 200
 +  radius: ​     20
 +  reactionTime:​8
 +  sounds: ​     [ popain, podth1, posact, , posit1 ]
 +  spawnHealth:​ 20
 +  speed: ​      8
 +  states: ​     [ POSS_STND, POSS_RUN1, POSS_PAIN, NULL, POSS_ATK1, , POSS_DIE1, POSS_XDIE1, POSS_RAISE1 ]
 +
 +
 +
 +====== Order ======
 +
 +
 +The <​code>​order</​code>​ variable contains a regular array where the definitions are stored in the order they were read from the [[ded]] files. The order is meaningful because generally later definitions override earlier ones. The indices in this list are also available in the definition records as <​code>​__order__</​code>​.
 +
 +
 +$ len(Defs.things.order)
 +⇒ 140
 +$ Defs.things.order[1].id
 +⇒ POSSESSED
 +
 +
 +
 +====== Constants ======
 +
 +
 +The <​code>​Defs.SN_*</​code>​ constants are used as indices in the <​code>​states</​code>​ array of thing definitions.
 +
 +The <​code>​Defs.SDN_*</​code>​ constants are used as indices in the <​code>​sounds</​code>​ array of thing definitions.
 +
 +
 +
  
script/module/defs.txt · Last modified: 2015-11-15 20:29 (external edit)