Modding:ModArray

From DoomRL Wiki

Jump to: navigation, search

Starting in v0.9.9.4, in addition items and item sets, there are also ModArray objects, commonly referred to in-game as assemblies. These are produced by adding the right combination of mods to a particular item base and confirming that the assembly is to be created.

Prototype

It is important to note that the id of an item modified by a ModArray object will not change its id to this one: the item base is only being modified by ModArray, and a completely new item is not given to the player.

Item Prototype
string name This is the item's name.
string id This is the item's sid. It must be distinct from other string ids. (The numeric id is automatically generated and stored in the nid field of the prototype.) It defaults to the first word of the name in all lowercase.
list mods This is a list containing the assembly schematic (of the form mod_shorthand = integer). The shorthand for each mod is as follows: A = agility, B = bulk, F = firestorm, N = nano, O = onyx, P = power, S = sniper, T = technical.
integer level This is the degree of complexity relating to the assembly. From a technical standpointg, it is the level of techbonus required for the being to create the assembly. 0 is for basic, 1 is for advanced, 2 is for master.
Item ID request_id This is the sid of the item required to create the assembly, if only a single item can be made into the assembly.
ItemType request_type This is the item type required to create the assembly, if only an item type can be made into the assembly.
string desc This is the portion of the schematic description that explains what item base is required to create the assembly. If request_id or request_type have been included in the prototype, then this can be left blank.

Engine Hooks

Hooks for ModArrays are few, but they serve as the backbone of the entire assembly.

Item Hooks
boolean Match(Item self)
void OnApply(Item self)

Match(Item self)
Triggers whenever all of the mods in the assembly schematic are placed on a particular item, and returns a value determining whether or not the assembly attempting to be created consists of an appropriate item base. If request_id and request_type are insufficient for the needs of a particular assembly, this is used instead. If Match is included in the ModArray prototype, then a desc should also be included.

OnApply(Item self)
Triggers if the player decides to create the assembly (that is, they press 'y' in response to making it). This is where all modifications to the item are made.
Personal tools