Closed Ierdna100 closed 10 months ago
I was in the process of adding the Stormworks addon API myself about a year ago. Kind of glad I didn't because of the required work to keep it up to date. I have rewritten the addon API definitions about 3 times over the last few years, the API, like the game, is very volatile, I wish you luck with keeping it up to date 🙂.
There is also some basic support for global callbacks using an alias, although not ideal:
---@meta
---@alias stormworks.callbacks.onVehicleSpawn fun(vehicle_id: integer, owner: integer)
---@type stormworks.callbacks.onVehicleSpawn
function onVehicleSpawn(vehicle_id, owner) end
I'll see then about adding callbacks, thanks!
I'll see then about adding callbacks, thanks!
We use aliases for hooks over at RosaServer; you can check out how a full implementation with a lot of callbacks would look like here: https://github.com/jpxs-intl/RosaServerCore/blob/master/.meta/template/hook_meta.lua
They're also fully typed in our hook adding functions, which gets messy but is actually extremely useful to avoid having to go read our wiki page since the anonymous function w/parameters is just autocompleted by the LSP: https://github.com/jpxs-intl/RosaServerCore/blob/master/main/plugins.lua#L90 https://github.com/jpxs-intl/RosaServerCore/blob/master/main/hook.lua#L116
This might be a helpful example!
Added support for Stormworks addon Lua. Contains definition for the server class, custom math class and others. Currently lacking server callbacks due to LuaLS not supporting them.
Related issue: #105