Skip to content

KenshiLua v0.3.8-alpha

Choose a tag to compare

@Genpretz Genpretz released this 17 Oct 10:36
· 109 commits to main since this release

This release brings major improvements to UI scripting with first-class MyGUI object returns, over 250 new engine GUI event hooks, MyGUI layer and enumerator bindings, a native C++ extension API, and rich LuaLS hover documentation. It also bundles a complete Animal Husbandry example mod.

Downloads

  • KenshiLua v0.3.8-alpha.zip: the mod. Install it into your Kenshi/mods/ directory.
  • KenshiLua-LuaLS-Addon-v0.3.8-alpha.zip: editor definitions for the KenshiLua API. Optional.

Highlights

Typed MyGUI Widget Returns

127 Kenshi engine methods and fields that previously returned MyGUI widgets as raw pointers (lightuserdata) now return typed MyGUI widget instances (e.g. BaseLayout.mMainWidget, DatapanelGUI.scrollView, DataPanelLine widgets, and InventorySectionGUI:getWidget()). Scripts can now directly manipulate and inspect widgets returned by engine calls, and add custom widgets to existing game windows via wraps::BaseLayout::initialise.

Expanded GUI Engine Events

Added over 250 engine hooks across GUI subsystems (GUIWindow, CharacterStatsWindow, DatapanelGUI, DataPanelLine, and ForgottenGUI). These events enable subscribing to window lifecycle events, button clicks, line callbacks, layout initialization, and destructors.

Versioned C++ Extension API

Native mod authors can now build binary extensions for KenshiLua via include/KenshiLua.h. Third-party C++ DLLs can access the KenshiLua runtime, retrieve the lua_State*, and register native modules.

Animal Husbandry Example Mod

Bundled a full example mod demonstrating custom MyGUI interfaces, dialogue integration, animal breeding, harvesting, and livestock trading.

Added

  • MyGUI LayerManager & ILayer: Bound MyGUI.LayerManager (and global LayerManager) and MyGUI.ILayer to control UI layers, widget z-ordering, and layer enumerations.
  • MyGUI Enumerators: Added Gui:getEnumerator(), widget:getEnumerator(), and LayerManager:getEnumerator() implementing MyGUI's next() and current() iterators.
  • Frame Event: Added MyGUI::Gui::eventFrameStart event fired at the start of each frame (including while paused).
  • CharacterStatsWindow Setters: Added writable setters for CharacterStatsWindow.character and all eight *Datapanel fields.
  • Diagnostic Logging: Added executable SHA-256 hash logging at startup when log_level=debug or debug_logging=true is enabled.
  • LuaLS IDE Documentation: Added rich hover descriptions for the KenshiLua table, engine events, global accessors, hand handles, and container methods (indexers, snapshot iterators, toTable()). Expanded class inheritance hierarchy in definitions from 56 to 154 classes.

Fixed & Changed

  • Script Reloading Path Matching: KenshiLua.reloadScript now matches script paths via filesystem equivalence rather than exact string matching, fixing reload failures caused by mixed path separators.
  • Binding Reference Docs: Fixed doc generator handling of pushWidget and checkWidget<T>, correcting missing argument documentation and return types in BindingsReference.md.
  • Event Deprecation Notice: Deprecated redundant KenshiLua.on and KenshiLua.off aliases with advisory log warnings directing scripts to canonical Events.on and Events.off. Removed the unused KenshiLua.Events table.
  • Removed Unbound Mutex Accessors: Removed raw mutex accessors that were not safely callable from Lua.

Full Changelog: v0.3.7-alpha...v0.3.8-alpha