Skip to content

Commit

Permalink
#67 ImGui is awesome!
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismoh committed May 20, 2023
1 parent 54c6d7d commit d5b3de4
Show file tree
Hide file tree
Showing 9 changed files with 469 additions and 71 deletions.
50 changes: 31 additions & 19 deletions mods/noita-mp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if not EntitySerialisationUtils then
_G.EntitySerialisationUtils = {}
end

EntitySerialisationUtils.ignore = {
EntitySerialisationUtils.ignore = {
--- Components listed in byComponentsName will be ignored in serialisation
byComponentsType = {
"AdvancedFishAIComponent",
Expand Down Expand Up @@ -99,26 +99,29 @@ EntitySerialisationUtils.ignore = {
--- Furthermore it holds ModSettings, which shouldn't be set by Noita, because one computer shares ModSettings in
--- multiple Noita.exe instances.
------------------------------------------------------------------------------------------------------------------------
local NoitaApiModSettingSet = ModSettingSet
local NoitaApiModSettingGet = ModSettingGet
local NoitaApiModSettingSetNextValue = ModSettingSetNextValue
local NoitaApiModSettingGetNextValue = ModSettingGetNextValue

if not Utils then
if require then
Utils = require("Utils")
else
-- when NoitaComponents with their own restricted LuaContext load this file,
-- util isn't available!
Utils = dofile_once("mods/noita-mp/files/scripts/util/Utils.lua")
if not MinaUtils and not require then
----@type MinaUtils
--MinaUtils = dofile_once("mods/noita-mp/files/scripts/util/MinaUtils.lua")
end
end
end
local NoitaApiModSettingSet = ModSettingSet
local NoitaApiModSettingGet = ModSettingGet
local NoitaApiModSettingSetNextValue = ModSettingSetNextValue
local NoitaApiModSettingGetNextValue = ModSettingGetNextValue

-- if not Utils then
-- if require then
-- Utils = require("Utils")
-- else
-- -- when NoitaComponents with their own restricted LuaContext load this file,
-- -- util isn't available!
-- Utils = dofile_once("mods/noita-mp/files/scripts/util/Utils.lua")
-- if not MinaUtils and not require then
-- ----@type MinaUtils
-- --MinaUtils = dofile_once("mods/noita-mp/files/scripts/util/MinaUtils.lua")
-- end
-- end
-- end

ModSettingSet = function(id, value)
if id:contains("noita-mp") then
error("Get rid off ModSettings!", 2)
end
if id == "noita-mp.name" then
MinaUtils.setLocalMinaName(value)
end
Expand All @@ -129,6 +132,9 @@ ModSettingSet = function(id, value)
end

ModSettingGet = function(id)
if id:contains("noita-mp") then
error("Get rid off ModSettings!", 2)
end
if id == "noita-mp.name" then
local name = MinaUtils.getLocalMinaName()
if not Utils.IsEmpty(name) then
Expand All @@ -153,6 +159,9 @@ ModSettingGet = function(id)
end

ModSettingSetNextValue = function(id, value, is_default)
if id:contains("noita-mp") then
error("Get rid off ModSettings!", 2)
end
if id == "noita-mp.name" then
name = value
end
Expand All @@ -163,6 +172,9 @@ ModSettingSetNextValue = function(id, value, is_default)
end

ModSettingGetNextValue = function(id)
if id:contains("noita-mp") then
error("Get rid off ModSettings!", 2)
end
if id == "noita-mp.name" and name then
local name = MinaUtils.getLocalMinaName()
if not Utils.IsEmpty(name) then
Expand Down
10 changes: 10 additions & 0 deletions mods/noita-mp/files/data/entities/imgui_warning.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- https://github.com/dextercd/Noita-Component-Explorer/blob/main/component-explorer/entities/imgui_warning.xml -->
<Entity>
<!-- Script removes the entity after a couple runs -->
<LuaComponent
script_source_file="mods/noita-mp/files/scripts/noita-components/imgui_warning.lua"
execute_every_n_frame="60"
execute_on_added="1"
execute_times="-1"
/>
</Entity>
Loading

0 comments on commit d5b3de4

Please sign in to comment.