A module used to inject custom mission elements into the game.
<element name file/>
FoodElement = FoodElement or class(CoreMissionScriptElement.MissionScriptElement)
log("Nom nom nom", tostring(self._values.food))
The editor integrates into this module using a hook, the editor will attempt to load an editor class named <name>ElementEditor.lua, place it in the same directory you'd place your regular element class.
- 1.This guide doesn't cover how to make your own elements (the classes themselves) in depth, this is just a convenient way of injecting them into BeardLib (and the editor) without having to go through the hassle of making hooks and injecting them into BeardLib or the editor.
- 2.The naming convention differs from the game, instead of ElementFood we force the name to be FoodElement. The reason is to avoid clashing with future or existing element names. This happened before to BeardLib itself. So to avoid this situation this element will work best with this naming convention. This includes the editor's integration.