Add 2.0 support to core lua

This commit is contained in:
Cooldude2606 committed 2024-11-23 14:26:10 +00:00
1 parent 201a201f05
commit ad836d3776
6 files changed
+46 -54

No files matched your search

+4 -3
View File
@@ -1,11 +1,12 @@
local function send_json(channel, data)
data = game.table_to_json(data)
data = helpers and helpers.table_to_json(data) or game.table_to_json(data)
print("\f$ipc:" .. channel .. "?j" .. data)
end
script.on_init(function()
send_json("mod_list", game.active_mods)
for name, mod_setting in pairs(game.mod_setting_prototypes) do
send_json("mod_list", script.active_mods)
local mod_settings = prototypes and prototypes.mod_setting or game.mod_setting_prototypes
for name, mod_setting in pairs(mod_settings) do
send_json("mod_setting_mod", { name = name, mod = mod_setting.mod })
end
end)