feat: Add API for DMF to get mod data

This commit is contained in:
Lucas Schwiderski 2023-02-27 10:06:49 +01:00
parent 70b7529fc4
commit 23a15cc692
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -68,6 +68,25 @@ ModLoader.remove_gui = function(self)
self._gui = nil self._gui = nil
end end
ModLoader.mod_data = function(self, id)
-- Since this primarily exists for DMF,
-- we can optimize the search for its use case of looking for the
-- mod currently being loaded
local mod_data = self._mods[self._mod_load_index]
if mod_data.id ~= id then
mod_data = nil
for _, v in ipairs(self._mods) do
if v.id == id then
mod_data = v
end
end
end
return mod_data
end
ModLoader._check_reload = function() ModLoader._check_reload = function()
return Keyboard.pressed(BUTTON_INDEX_R) and return Keyboard.pressed(BUTTON_INDEX_R) and
Keyboard.button(BUTTON_INDEX_LEFT_SHIFT) + Keyboard.button(BUTTON_INDEX_LEFT_SHIFT) +