Skip to content

Commit

Permalink
Merge pull request #126 from pyrrhicPachyderm/unconstrained-russia
Browse files Browse the repository at this point in the history
Ignore beasts in player areas for Russia's loss condition.
  • Loading branch information
iakona authored Oct 16, 2023
2 parents fc53e64 + c575da1 commit a34bff6
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions objects/1ea4cf/script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,28 @@ function checkLoss()
local count = 0
local beasts = getObjectsWithTag("Beasts")
for _,obj in pairs(beasts) do
local quantity = obj.getQuantity()
if quantity == -1 then
count = count + 1
else
count = count + quantity
-- Count the beast if it's not in a player area, or if it is in a player area but over the island (e.g. the Endless Dark)
local isOnIsland = (#obj.getZones() == 0)
if not isOnIsland then
local hits = Physics.cast({
origin = obj.getBounds().center,
direction = Vector(0,-1,0),
max_distance = 6,
})
for _,v in pairs(hits) do
if v.hit_object ~= obj and Global.call("isIsland", {obj=v.hit_object}) then
isOnIsland = true
break
end
end
end
if isOnIsland then
local quantity = obj.getQuantity()
if quantity == -1 then
count = count + 1
else
count = count + quantity
end
end
end
if not Global.getVar("SetupChecker").call("isSpiritPickable", {guid="165f82"}) then
Expand Down

0 comments on commit a34bff6

Please sign in to comment.