-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaces rigged storyteller with automatic transfer votes (#3278)
* Replaces rigged storyteller with automatic transfer votes * meow * Refactor to use `SSautotransfer`
- Loading branch information
Showing
11 changed files
with
156 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
SUBSYSTEM_DEF(autotransfer) | ||
name = "Autotransfer Vote" | ||
flags = SS_KEEP_TIMING | SS_BACKGROUND | ||
wait = 1 MINUTES | ||
runlevels = RUNLEVEL_GAME | ||
|
||
var/doing_transfer_vote = FALSE | ||
COOLDOWN_DECLARE(next_transfer_vote) | ||
|
||
/datum/controller/subsystem/autotransfer/Initialize(timeofday) | ||
if(!CONFIG_GET(number/transfer_vote_time)) | ||
flags |= SS_NO_FIRE | ||
return SS_INIT_NO_NEED | ||
SSticker.OnRoundstart(CALLBACK(src, PROC_REF(crew_transfer_setup))) | ||
return SS_INIT_SUCCESS | ||
|
||
/datum/controller/subsystem/autotransfer/fire() | ||
if(can_run_transfer_vote()) | ||
SSvote.initiate_vote(/datum/vote/shuttle_call, "automatic shuttle vote", forced = TRUE) | ||
|
||
/datum/controller/subsystem/autotransfer/proc/can_run_transfer_vote() | ||
. = TRUE | ||
if(doing_transfer_vote) | ||
return FALSE | ||
if(!CONFIG_GET(number/transfer_vote_time)) | ||
return FALSE | ||
if(!next_transfer_vote || !COOLDOWN_FINISHED(src, next_transfer_vote)) | ||
return FALSE | ||
if(SSvote.current_vote) | ||
return FALSE | ||
if(EMERGENCY_PAST_POINT_OF_NO_RETURN) | ||
return FALSE | ||
if(SSshuttle.supermatter_cascade) | ||
return FALSE | ||
|
||
/datum/controller/subsystem/autotransfer/proc/crew_transfer_setup() | ||
COOLDOWN_START(src, next_transfer_vote, CONFIG_GET(number/transfer_vote_time)) | ||
|
||
/datum/controller/subsystem/autotransfer/proc/crew_transfer_passed() | ||
if(!SSticker.IsRoundInProgress()) | ||
CRASH("Somehow tried to initiate crew transfer, even tho there is not ongoing round!") | ||
SSshuttle.admin_emergency_no_recall = TRUE | ||
if(SSshuttle.emergency?.mode == SHUTTLE_DISABLED || EMERGENCY_PAST_POINT_OF_NO_RETURN) | ||
return | ||
if(EMERGENCY_IDLE_OR_RECALLED) | ||
SSshuttle.emergency.request( | ||
red_alert = (SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED) | ||
) | ||
crew_transfer_continue() // safety measure | ||
|
||
/datum/controller/subsystem/autotransfer/proc/crew_transfer_continue() | ||
SSgamemode.point_gain_multipliers[EVENT_TRACK_ROLESET]++ | ||
var/subsequent_transfer_vote_time = CONFIG_GET(number/subsequent_transfer_vote_time) | ||
if(!subsequent_transfer_vote_time) | ||
next_transfer_vote = 0 | ||
return | ||
COOLDOWN_START(src, next_transfer_vote, subsequent_transfer_vote_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/datum/vote/proc/can_vote(mob/voter) | ||
return TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#define CHOICE_CALL "Call Shuttle" | ||
#define CHOICE_CONTINUE "Continue Round" | ||
|
||
/// If a map vote is called before the emergency shuttle leaves the station, the players can call another vote to re-run the vote on the shuttle leaving. | ||
/datum/vote/shuttle_call | ||
name = "Call Shuttle" | ||
message = "Should we go home?" | ||
default_choices = list( | ||
CHOICE_CALL, | ||
CHOICE_CONTINUE, | ||
) | ||
player_startable = FALSE | ||
|
||
/datum/vote/shuttle_call/reset() | ||
. = ..() | ||
SSautotransfer.doing_transfer_vote = FALSE | ||
|
||
/datum/vote/shuttle_call/can_be_initiated(mob/by_who, forced = FALSE) | ||
. = ..() | ||
if(!.) | ||
return FALSE | ||
if(!SSticker.IsRoundInProgress()) | ||
return FALSE | ||
if(EMERGENCY_PAST_POINT_OF_NO_RETURN) | ||
return FALSE | ||
if(SSautotransfer.doing_transfer_vote) | ||
return FALSE | ||
|
||
/datum/vote/shuttle_call/initiate_vote(initiator, duration) | ||
. = ..() | ||
SSautotransfer.doing_transfer_vote = TRUE | ||
|
||
/datum/vote/shuttle_call/finalize_vote(winning_option) | ||
switch(winning_option) | ||
if(CHOICE_CALL) | ||
SSautotransfer.crew_transfer_passed() | ||
if(CHOICE_CONTINUE) | ||
SSautotransfer.crew_transfer_continue() | ||
else | ||
CRASH("[type] wasn't passed a valid winning choice. (Got: [winning_option || "null"])") | ||
|
||
/datum/vote/shuttle_call/can_vote(mob/voter = usr) | ||
. = TRUE | ||
if(voter.client?.holder) | ||
return TRUE | ||
if(isobserver(voter) || voter.stat == DEAD || !(voter.ckey in GLOB.joined_player_list)) // only living crew gets to vote | ||
return FALSE | ||
|
||
#undef CHOICE_CONTINUE | ||
#undef CHOICE_CALL |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters