diff --git a/code/game/master_controller.dm b/code/game/master_controller.dm index 1a404e2c3a5..ab925dc6960 100644 --- a/code/game/master_controller.dm +++ b/code/game/master_controller.dm @@ -20,6 +20,7 @@ datum/controller/game_controller var/global/networks_ready = 0 var/global/powernets_ready = 0 var/global/ticker_ready = 0 + var/global/next_crew_shuttle_vote = 2 // the next automatic vote to call the crew shuttle proc keepalive() @@ -145,6 +146,11 @@ datum/controller/game_controller var/start_time = world.timeofday + // Start an automatic crew shuttle vote every hour starting with the second hour + if(world.time > 10 * 60 * 60 * next_crew_shuttle_vote) + next_crew_shuttle_vote++ + automatic_crew_shuttle_vote() + air_master_ready = 0 tension_master_ready = 0 sun_ready = 0 diff --git a/code/game/vote.dm b/code/game/vote.dm index a8483b2d619..36e39eaa4fd 100644 --- a/code/game/vote.dm +++ b/code/game/vote.dm @@ -447,3 +447,34 @@ usr.vote() return + +proc/automatic_crew_shuttle_vote() + + if(vote.voting) + return + + if(!vote.canvote() ) // double check even though this shouldn't happen + return + + vote.mode = 0 + vote.instant_restart = 0 + + vote.voting = 1 // now voting + vote.votetime = world.timeofday + config.vote_period*10 // when the vote will end + + spawn(config.vote_period*10) + vote.endvote() + + world << "\red*** An *automatic* vote to call the crew transfer shuttle has been initiated." + world << "\red You have [vote.timetext(config.vote_period)] to vote. Note that your vote defaults to *yes*." + + log_vote("Automatic vote to call the crew transfer shuttle.") + + for(var/mob/CM in world) + if(CM.client) + if( !CM.is_player_active() ) + CM.client.vote = "none" + else + CM.client.vote = "restart" + + return \ No newline at end of file diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index a844f2cc780..80d52c6ea2f 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -358,3 +358,11 @@ It's fairly easy to fix if dealing with single letters but not so much with comp else I.loc = get_turf(src) update_clothing() + + +/mob/proc/is_player_active() + if(!src.client) return 0 + if(src.client.inactivity > 10 * 60 * 10) return 0 + if(src.stat == 2) return 0 + + return 1 \ No newline at end of file