Round now ends if no players are alive after 15 minutes (#31962)

* Round now ends if no players are alive

* Skip vote on player list empty

* Adding to sandbox mode too

* Better sandbox thing

Co-authored-by: kanef <kanef9x@protonmail.com>
This commit is contained in:
kane-f
2022-02-04 20:58:25 +00:00
committed by GitHub
parent 310002f698
commit 05b8d5ae7f
5 changed files with 41 additions and 5 deletions

View File

@@ -657,6 +657,9 @@ var/stacking_limit = 90
living_players.Add(M)//yes we're adding a ghost to "living_players", so make sure to properly check for type when testing midround rules
continue
dead_players.Add(M)//Players who actually died (and admins who ghosted, would be nice to avoid counting them somehow)
if(!living_players.len && world.time > 15 MINUTES) //if nobody is around and alive in the current round and enough time has passed
ticker.station_nolife_cinematic()
/datum/gamemode/dynamic/proc/GetInjectionChance()
var/chance = 0

View File

@@ -258,7 +258,7 @@
for(var/datum/role/R in orphaned_roles)
if (R.check_win())
return 1
if(emergency_shuttle.location==2 || ticker.station_was_nuked)
if(emergency_shuttle.location==2 || ticker.station_was_nuked || ticker.no_life_on_station)
return 1
return 0

View File

@@ -15,3 +15,9 @@
/datum/gamemode/sandbox/latespawn(var/mob/mob)
mob.CanBuild()
to_chat(mob, "<B>Build your own station with the sandbox-panel command!</B>")
/datum/gamemode/sandbox/process()
. = ..()
if(!player_list.len && world.time > 15 MINUTES) //if nobody is around in the current round and enough time has passed
CallHook("Reboot",list())
world.Reboot()

View File

@@ -41,6 +41,7 @@ var/datum/controller/gameticker/ticker
var/explosion_in_progress
var/station_was_nuked
var/no_life_on_station
var/revolutionary_victory //If on, Castle can be voted if the conditions are right
var/list/datum/role/antag_types = list() // Associative list of all the antag types in the round (List[id] = roleNumber1) //Seems to be totally unused?
@@ -383,6 +384,32 @@ var/datum/controller/gameticker/ticker
qdel(temp_buckle) //release everybody
return
/datum/controller/gameticker/proc/station_nolife_cinematic(var/override = null)
if( cinematic )
return //already a cinematic in progress!
for (var/datum/html_interface/hi in html_interfaces)
hi.closeAll()
//initialise our cinematic screen object
cinematic = new(src)
cinematic.icon = 'icons/effects/station_explosion.dmi'
cinematic.icon_state = "station_nolife"
cinematic.plane = HUD_PLANE
cinematic.mouse_opacity = 0
cinematic.screen_loc = "1,0"
//actually turn everything off
power_failure(0)
//If its actually the end of the round, wait for it to end.
//Otherwise if its a verb it will continue on afterwards.
sleep(300)
if(cinematic)
qdel(cinematic) //end the cinematic
no_life_on_station = TRUE
/datum/controller/gameticker/proc/create_characters()
for(var/mob/new_player/player in player_list)
@@ -455,7 +482,7 @@ var/datum/controller/gameticker/ticker
declare_completion()
gameend_time = world.time / 10
if(config.map_voting)
if(config.map_voting && player_list.len)
//testing("Vote picked [chosen_map]")
vote.initiate_vote("map","The Server", popup = 1, weighted_vote = config.weighted_votes)
var/options = jointext(vote.choices, " ")
@@ -485,7 +512,7 @@ var/datum/controller/gameticker/ticker
end_credits.on_round_end()
if(blackbox)
if(config.map_voting)
if(config.map_voting && player_list.len)
spawn(restart_timeout + 1)
blackbox.save_all_data_to_sql()
else
@@ -494,8 +521,8 @@ var/datum/controller/gameticker/ticker
stat_collection.Process()
if (watchdog.waiting)
to_chat(world, "<span class='notice'><B>Server will shut down for an automatic update in [config.map_voting ? "[(restart_timeout/10)] seconds." : "a few seconds."]</B></span>")
if(config.map_voting)
to_chat(world, "<span class='notice'><B>Server will shut down for an automatic update in [config.map_voting && player_list.len ? "[(restart_timeout/10)] seconds." : "a few seconds."]</B></span>")
if(config.map_voting && player_list.len)
sleep(restart_timeout) //waiting for a mapvote to end
if(!delay_end)
watchdog.signal_ready()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB