Skip to content

Commit

Permalink
rebirth prevent repeat adding messagecommands to color/customize stuff
Browse files Browse the repository at this point in the history
this causes a crash if allowed under certain conditions
  • Loading branch information
poco0317 committed Feb 19, 2023
1 parent 2c53bd5 commit 603c0bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Themes/Rebirth/Scripts/01 color_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,11 @@ function registerActorToColorConfigElement(self, category, element, stroke)
end
end
cmd(self)
self:addcommand("ColorConfigUpdatedMessage", cmd)
if self:GetCommand("ColorConfigUpdated") == nil then
self:addcommand("ColorConfigUpdatedMessage", cmd)
else
print("Found duplicate ColorConfigUpdatedMessageCommand in element "..(self:GetName() or "UNNAMED"))
end
end

-- same as the above but instead its for elements that use diffuseramp
Expand All @@ -661,7 +665,11 @@ function registerActorToColorConfigElementForDiffuseRamp(self, category, element
self:effectcolor2(hiColor)
end
cmd(self)
self:addcommand("ColorConfigUpdatedMessage", cmd)
if self:GetCommand("ColorConfigUpdated") == nil then
self:addcommand("ColorConfigUpdatedMessage", cmd)
else
print("Found duplicate ColorConfigUpdatedMessageCommand in element "..(self:GetName() or "UNNAMED"))
end
end

-- run this stuff at init/load
Expand Down
6 changes: 5 additions & 1 deletion Themes/Rebirth/Scripts/02 CustomizeGameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ function registerActorToCustomizeGameplayUI(elementinfo, layer)
local cmd = function(shelf)
shelf:z(layer)
end
self:addcommand("SetUpFinished", cmd)
if self:GetCommand("SetUpFinished") == nil then
self:addcommand("SetUpFinished", cmd)
else
print("Found duplicate SetUpFinished in element "..(self:GetName() or "UNNAMED"))
end
end)
end
end
Expand Down

0 comments on commit 603c0bc

Please sign in to comment.