Module:Npcinfo/datagen/doc

From Terraria Wiki
Jump to navigation Jump to search

Lua.svgThis is the documentation page for Module:Npcinfo/datagen.


This helper module is used for generating the NPC database (Module:Npcinfo/data). Invoke the gen function with two NPC IDs, e.g. {{#invoke:Npcinfo/datagen|gen|20|80}}. The module will generate the data for all NPCs whose ID is between 20 and 80 (inclusive) in that case. Make sure to also include the time of generation and the Terraria version used for it in the database; this information is obtained by invoking the genMeta function.

The code of this module reproduces the Terraria.NPC.SetDefaults method from Terraria's source code, ported from C# to Lua. Various other methods or snippets of methods needed to generate NPC information are also included. The code is based on version 1.4.4.9.

As this is a helper module which is only invoked manually, it is not needed in language wikis. Only the final NPC database (Module:Npcinfo/data) is required there.