mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Allows crew transfer votes on red alert, weighted for participation in round (#22993)
With massive thanks to @JohnWildkins for help in touching a lot of concepts I've never worked with before, as well as helping me get back into contributing in general. This PR allows crew transfers to be called during red alert and adds support for weighted voting to help favour active participants in these particular rounds. Observers and players still in the lobby are given only half a vote towards transfer/continue. There is also config support to define an active 'participation time' in minutes, which is used to stop potential abuse cases of players respawning/joining from the lobby just before (or even during) the transfer to gain a full vote. By default, this is set to 15 minutes, so anyone who's been actively playing in the round for at least that long is eligible. This is my first time touching things like the config file or any sort of subsystem more advanced than, like, the far more basic PRs I'm used to, but I was encouraged to look at this as a little project. It all appears to work well locally. --------- Signed-off-by: Matt Atlas <mattiathebest2000@hotmail.it> Co-authored-by: Jaraci <mirandatrasen@nt.net> Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> Co-authored-by: hazelrat <83198434+hazelrat@users.noreply.github.com>
This commit is contained in:
co-authored by
Jaraci
Matt Atlas
hazelrat
parent
d47cdb8f04
commit
1a37ba3d26
@@ -120,21 +120,20 @@ SUBSYSTEM_DEF(vote)
|
||||
/datum/controller/subsystem/vote/proc/submit_single_vote(mob/voter, their_vote)
|
||||
if(!current_vote)
|
||||
return
|
||||
if(!voter?.ckey)
|
||||
return
|
||||
if(FALSE && voter.stat == DEAD && !voter.client?.holder) //Used to be "CONFIG_GET(flag/no_dead_vote)"
|
||||
var/vote_power = current_vote.get_voting_power(voter)
|
||||
if(vote_power <= 0)
|
||||
return
|
||||
|
||||
// If user has already voted, remove their specific vote
|
||||
if(voter.ckey in current_vote.choices_by_ckey)
|
||||
var/their_old_vote = current_vote.choices_by_ckey[voter.ckey]
|
||||
current_vote.choices[their_old_vote]--
|
||||
var/list/their_old_vote = current_vote.choices_by_ckey[voter.ckey]
|
||||
current_vote.choices[their_old_vote["choice"]] -= their_old_vote["power"]
|
||||
|
||||
else
|
||||
voted += voter.ckey
|
||||
|
||||
current_vote.choices_by_ckey[voter.ckey] = their_vote
|
||||
current_vote.choices[their_vote]++
|
||||
current_vote.choices_by_ckey[voter.ckey] = list("choice" = their_vote, "power" = vote_power)
|
||||
current_vote.choices[their_vote] += vote_power
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user