Skip to content

Commit

Permalink
Fix recall finishing early
Browse files Browse the repository at this point in the history
teammates was not teamsize
  • Loading branch information
lL1l1 committed Oct 19, 2024
1 parent ecf9ace commit 3dd93a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/shared/RecallParams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ TeamVoteCooldown = 0--1 * 60 * 10
--- ticks that the recall vote is open (30 seconds)
VoteTime = 30000--30 * 10

---@param acceptanceVotes number
---@param totalVotes number
function RecallRequestAccepted(acceptanceVotes, totalVotes)
if totalVotes <= 3 then
return acceptanceVotes >= totalVotes
Expand Down
5 changes: 3 additions & 2 deletions lua/sim/Recall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,11 @@ function SetRecallVote(data)
if not lastVote then
if vote then
-- will succeed with our vote
lastVote = RecallRequestAccepted(likeVotes + 1, teammates)
lastVote = RecallRequestAccepted(likeVotes + 1, teammates + 1)
else
-- won't ever be able to succeed
lastVote = not RecallRequestAccepted(teammates - (likeVotes + 1), teammates)
-- teammates - votes against = teammates that could vote for recall
lastVote = not RecallRequestAccepted(teammates + 1 - (likeVotes + 1), teammates + 1)
end
end
ArmyVoteRecall(army, vote, lastVote)
Expand Down

0 comments on commit 3dd93a8

Please sign in to comment.