Skip to content

Commit

Permalink
Make Russia account for the Endless Dark in a player area.
Browse files Browse the repository at this point in the history
When checking Russia's loss condition, if a beast is in the player
area, raycast from it to see if it's over an island tile, and count
it if it is. This allows people to keep the Endless Dark in the
player area.
  • Loading branch information
pyrrhicPachyderm committed Oct 16, 2023
1 parent 3367aec commit c575da1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions objects/1ea4cf/script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,22 @@ function checkLoss()
local count = 0
local beasts = getObjectsWithTag("Beasts")
for _,obj in pairs(beasts) do
-- Beast is not in player area
if #obj.getZones() == 0 then
-- 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
Expand Down

0 comments on commit c575da1

Please sign in to comment.