Skip to content

Commit

Permalink
If spiritName is not defined for setup object then just assume it's i…
Browse files Browse the repository at this point in the history
…n the correct player area and run setup
  • Loading branch information
iakona committed Dec 6, 2023
1 parent 6481775 commit fc3a467
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3783,14 +3783,17 @@ function handleDoSetup(obj, color)
end
if not json.setupComplete then
local spiritName = obj.getVar("spiritName")
local spiritColor = getSpiritColor({name = spiritName})
if color == spiritColor then
local success = obj.call("doSetup", {color=color})
json.setupComplete = success
obj.script_state = JSON.encode(json)
else
Player[color].broadcast("You have not picked "..spiritName.."!", Color.Red)
if spiritName then
local spiritColor = getSpiritColor({name = spiritName})
if color ~= spiritColor then
Player[color].broadcast("You have not picked "..spiritName.."!", Color.Red)
return
end
end

local success = obj.call("doSetup", {color=color})
json.setupComplete = success
obj.script_state = JSON.encode(json)
end
end

Expand Down

0 comments on commit fc3a467

Please sign in to comment.