====== Defs (Module) ======
The ''Defs'' 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, ''idLookup'' 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 ''order'' 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 ''__order__''.
$ len(Defs.things.order)
⇒ 140
$ Defs.things.order[1].id
⇒ POSSESSED
===== Constants =====
The ''Defs.SN_*'' constants are used as indices in the ''states'' array of [[ded:thing|Thing definitions]].
The ''Defs.SDN_*'' constants are used as indices in the ''sounds'' array of [[ded:thing|Thing definitions]].
===== Functions =====
The following return the internal index number for a given ID:
#@Identifier_HTML~getSoundNum~@# ( #@Arg_HTML~Text,name~@# )
#@Identifier_HTML~getStateNum~@# ( #@Arg_HTML~Text,stateId~@# )
#@Identifier_HTML~getThingNum~@# ( #@Arg_HTML~Text,thingId~@# )