Difference between revisions of "Lua-based equipment"
(Short C++-side documentation for new-equipment) |
(add a TODO item) |
||
Line 14: | Line 14: | ||
As the UI is being ported to new-ui and thus is defined in Lua, you shouldn't need to access the equipment directly. If you need more interaction with the equipment than simple modifiers, as it will probably be the case for lasers (not yet implemented at the time of writing), it might be worth it to write specific Lua interfaces that are to be called by the relevant pieces of equipment at install/uninstall time. | As the UI is being ported to new-ui and thus is defined in Lua, you shouldn't need to access the equipment directly. If you need more interaction with the equipment than simple modifiers, as it will probably be the case for lasers (not yet implemented at the time of writing), it might be worth it to write specific Lua interfaces that are to be called by the relevant pieces of equipment at install/uninstall time. | ||
+ | |||
+ | TODO: A list of all the modifiers used in the C++ code. |
Revision as of 15:23, 1 March 2013
As of March 2013, there's been an ongoing effort for about a year to rewrite the equipment system to be able to define and modify random pieces of equipment through Lua. The resulting system is entirely Lua-based, and communicates with C++ only through string->integers pairs called modifiers.
From the C++ side
If you wish to know if there is an ECM installed on ship
, you would just do
int ecm_mod = ship->GetModifier("ecm"); // This gets you the actual value of the modifier, ie the strength of the ECM if (ecm_mod > 0) { BlastAwayThisMissileWithStrength(ecm_mod); }
As the UI is being ported to new-ui and thus is defined in Lua, you shouldn't need to access the equipment directly. If you need more interaction with the equipment than simple modifiers, as it will probably be the case for lasers (not yet implemented at the time of writing), it might be worth it to write specific Lua interfaces that are to be called by the relevant pieces of equipment at install/uninstall time.
TODO: A list of all the modifiers used in the C++ code.