Mod Example: Inventory Item
This mod introduces a simple inventory item that gives credits to a player on usage.
About[edit | edit source]
creditcard.lua[edit | edit source]
Represents the credit card item inventory item that can be added to the player's inventory.
item.stackable = trueThe item can be stacked in the inventory
item.depleteOnUse = trueThe item will be removed from the inventory after it was used
function create(item, rarity)The function that is called when a new object of this type is created by the game
function activate(item)The function that is called when the object is used by the player
modinfo.lua[edit | edit source]
serverSideOnly = falseThe mod adds a new inventory item to the game, and the client has to be able to display tooltips, so the client has to know about it. Also: Localization.
clientSideOnly = falseClient side only is impossible, since new inventory items have to be created and added on the server.
saveGameAltering = trueThe mod adds a new script
data/scripts/items/creditcard.luawhose path will be saved into the database. Once the mod is disabled, the script is no longer existant and the savegame will be slightly corrupted (not unplayable though).
Localization =[edit | edit source]
data/localization/ folder you can find an example for a German localization of texts that appear in the mod.