diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index b361b66b98e..3b52d9ebcea 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -32,6 +32,8 @@ var/round_start_time = 0 var/triai = 0//Global holder for Triumvirate var/initialtpass = 0 //holder for inital autotransfer vote timer + var/obj/screen/cinematic = null //used for station explosion cinematic + var/round_end_announced = 0 // Spam Prevention. Announce round end only once. /datum/controller/gameticker/proc/pregame() @@ -238,193 +240,179 @@ var/round_start_time = 0 return 1 -/datum/controller/gameticker - //station_explosion used to be a variable for every mob's hud. Which was a waste! - //Now we have a general cinematic centrally held within the gameticker....far more efficient! - var/obj/screen/cinematic = null - //Plus it provides an easy way to make cinematics for other events. Just use this as a template :) - proc/station_explosion_cinematic(var/station_missed=0, var/override = null) - if( cinematic ) return //already a cinematic in progress! +//Plus it provides an easy way to make cinematics for other events. Just use this as a template +/datum/controller/gameticker/proc/station_explosion_cinematic(station_missed = 0, override = null) + if(cinematic) + return //already a cinematic in progress! + auto_toggle_ooc(1) // Turn it on + //initialise our cinematic screen object + cinematic = new /obj/screen{icon='icons/effects/station_explosion.dmi'; icon_state="station_intact"; layer=21; mouse_opacity=0; screen_loc="1,0";}(src) + + var/obj/structure/stool/bed/temp_buckle = new(src) + if(station_missed) + for(var/mob/M in mob_list) + M.buckled = temp_buckle //buckles the mob so it can't do anything + if(M.client) + M.client.screen += cinematic //show every client the cinematic + else //nuke kills everyone on z-level 1 to prevent "hurr-durr I survived" + for(var/mob/M in mob_list) + M.buckled = temp_buckle + if(M.client) + M.client.screen += cinematic + if(M.stat != DEAD) + var/turf/T = get_turf(M) + if(T && T.z == 1) + M.death(0) //no mercy + + //Now animate the cinematic + switch(station_missed) + if(1) //nuke was nearby but (mostly) missed + if(mode && !override) + override = mode.name + switch(override) + if("nuclear emergency") //Nuke wasn't on station when it blew up + flick("intro_nuke", cinematic) + sleep(35) + world << sound('sound/effects/explosionfar.ogg') + flick("station_intact_fade_red", cinematic) + cinematic.icon_state = "summary_nukefail" + if("fake") //The round isn't over, we're just freaking people out for fun + flick("intro_nuke", cinematic) + sleep(35) + world << sound('sound/items/bikehorn.ogg') + flick("summary_selfdes", cinematic) + else + flick("intro_nuke", cinematic) + sleep(35) + world << sound('sound/effects/explosionfar.ogg') + //flick("end",cinematic) + + + if(2) //nuke was nowhere nearby //TODO: a really distant explosion animation + sleep(50) + world << sound('sound/effects/explosionfar.ogg') + else //station was destroyed + if(mode && !override) + override = mode.name + switch(override) + if("nuclear emergency") //Nuke Ops successfully bombed the station + flick("intro_nuke", cinematic) + sleep(35) + flick("station_explode_fade_red", cinematic) + world << sound('sound/effects/explosionfar.ogg') + cinematic.icon_state = "summary_nukewin" + if("AI malfunction") //Malf (screen,explosion,summary) + flick("intro_malf", cinematic) + sleep(76) + flick("station_explode_fade_red", cinematic) + world << sound('sound/effects/explosionfar.ogg') + cinematic.icon_state = "summary_malf" + if("blob") //Station nuked (nuke,explosion,summary) + flick("intro_nuke", cinematic) + sleep(35) + flick("station_explode_fade_red", cinematic) + world << sound('sound/effects/explosionfar.ogg') + cinematic.icon_state = "summary_selfdes" + else //Station nuked (nuke,explosion,summary) + flick("intro_nuke", cinematic) + sleep(35) + flick("station_explode_fade_red", cinematic) + world << sound('sound/effects/explosionfar.ogg') + cinematic.icon_state = "summary_selfdes" + //If its actually the end of the round, wait for it to end. + //Otherwise if its a verb it will continue on afterwards. + spawn(300) + if(cinematic) + qdel(cinematic) //end the cinematic + cinematic = null + if(temp_buckle) + qdel(temp_buckle) //release everybody + + + +/datum/controller/gameticker/proc/create_characters() + for(var/mob/new_player/player in player_list) + if(player.ready && player.mind) + if(player.mind.assigned_role == "AI" || player.mind.special_role == "malfunctioning AI") + player.close_spawn_windows() + player.AIize() + else if(!player.mind.assigned_role) + continue + else + player.create_character() + qdel(player) + + +/datum/controller/gameticker/proc/collect_minds() + for(var/mob/living/player in player_list) + if(player.mind) + ticker.minds += player.mind + + +/datum/controller/gameticker/proc/equip_characters() + var/captainless=1 + for(var/mob/living/carbon/human/player in player_list) + if(player && player.mind && player.mind.assigned_role) + if(player.mind.assigned_role == "Captain") + captainless=0 + if(player.mind.assigned_role != "MODE") + job_master.EquipRank(player, player.mind.assigned_role, 0) + EquipCustomItems(player) + if(captainless) + for(var/mob/M in player_list) + if(!istype(M,/mob/new_player)) + to_chat(M, "Captainship not forced on anyone.") + + +/datum/controller/gameticker/proc/process() + if(current_state != GAME_STATE_PLAYING) + return 0 + + mode.process() + mode.process_job_tasks() + + //emergency_shuttle.process() DONE THROUGH PROCESS SCHEDULER + + var/game_finished = shuttle_master.emergency.mode >= SHUTTLE_ENDGAME || mode.station_was_nuked + if(config.continuous_rounds) + mode.check_finished() // some modes contain var-changing code in here, so call even if we don't uses result + else + game_finished |= mode.check_finished() + + if(!mode.explosion_in_progress && game_finished) + current_state = GAME_STATE_FINISHED auto_toggle_ooc(1) // Turn it on - //initialise our cinematic screen object - cinematic = new(src) - cinematic.icon = 'icons/effects/station_explosion.dmi' - cinematic.icon_state = "station_intact" - cinematic.layer = 20 - cinematic.plane = HUD_PLANE - cinematic.mouse_opacity = 0 - cinematic.screen_loc = "1,0" + spawn + declare_completion() - var/obj/structure/stool/bed/temp_buckle = new(src) - //Incredibly hackish. It creates a bed within the gameticker (lol) to stop mobs running around - if(station_missed) - for(var/mob/M in living_mob_list) - M.buckled = temp_buckle //buckles the mob so it can't do anything - if(M.client) - M.client.screen += cinematic //show every client the cinematic - else //nuke kills everyone on z-level 1 to prevent "hurr-durr I survived" - for(var/mob/M in mob_list) - M.buckled = temp_buckle - if(M.client) - M.client.screen += cinematic + spawn(50) + callHook("roundend") - switch(M.z) - if(0) //inside a crate or something - var/turf/T = get_turf(M) - if(T && (T.z in config.station_levels)) - M.death(0) - if(1) //on a z-level 1 turf. - M.death(0) - for(var/obj/effect/blob/core in blob_cores) - core.health = -10 - core.update_icon() + if(mode.station_was_nuked) + world.Reboot("Station destroyed by Nuclear Device.", "end_proper", "nuke") + else + world.Reboot("Round ended.", "end_proper", "proper completion") - //Now animate the cinematic - switch(station_missed) - if(1) //nuke was nearby but (mostly) missed - if( mode && !override ) - override = mode.name - switch( override ) - if("nuclear emergency") //Nuke wasn't on station when it blew up - flick("intro_nuke",cinematic) - sleep(35) - world << sound('sound/effects/explosionfar.ogg') - flick("station_intact_fade_red",cinematic) - cinematic.icon_state = "summary_nukefail" - else - flick("intro_nuke",cinematic) - sleep(35) - world << sound('sound/effects/explosionfar.ogg') - //flick("end",cinematic) + return 1 +/datum/controller/gameticker/proc/getfactionbyname(var/name) + for(var/datum/faction/F in factions) + if(F.name == name) + return F - if(2) //nuke was nowhere nearby //TODO: a really distant explosion animation - sleep(50) - world << sound('sound/effects/explosionfar.ogg') +/datum/controller/gameticker/proc/karmareminder() + for(var/mob/living/player in player_list) - - else //station was destroyed - if( mode && !override ) - override = mode.name - switch( override ) - if("nuclear emergency") //Nuke Ops successfully bombed the station - flick("intro_nuke",cinematic) - sleep(35) - flick("station_explode_fade_red",cinematic) - world << sound('sound/effects/explosionfar.ogg') - cinematic.icon_state = "summary_nukewin" - if("AI malfunction") //Malf (screen,explosion,summary) - flick("intro_malf",cinematic) - sleep(76) - flick("station_explode_fade_red",cinematic) - world << sound('sound/effects/explosionfar.ogg') - cinematic.icon_state = "summary_malf" - if("blob") //Station nuked (nuke,explosion,summary) - flick("intro_nuke",cinematic) - sleep(35) - flick("station_explode_fade_red",cinematic) - world << sound('sound/effects/explosionfar.ogg') - cinematic.icon_state = "summary_selfdes" - else //Station nuked (nuke,explosion,summary) - flick("intro_nuke",cinematic) - sleep(35) - flick("station_explode_fade_red", cinematic) - world << sound('sound/effects/explosionfar.ogg') - cinematic.icon_state = "summary_selfdes" - for(var/mob/living/M in living_mob_list) - if((M.loc.z in config.station_levels)) - M.death()//No mercy - //If its actually the end of the round, wait for it to end. - //Otherwise if its a verb it will continue on afterwards. - spawn(300) - if(cinematic) qdel(cinematic) //end the cinematic - if(temp_buckle) qdel(temp_buckle) //release everybody - return - - - proc/create_characters() - for(var/mob/new_player/player in player_list) - if(player.ready && player.mind) - if(player.mind.assigned_role == "AI" || player.mind.special_role == "malfunctioning AI") - player.close_spawn_windows() - player.AIize() - else if(!player.mind.assigned_role) - continue - else - player.create_character() - qdel(player) - - - proc/collect_minds() - for(var/mob/living/player in player_list) - if(player.mind) - ticker.minds += player.mind - - - proc/equip_characters() - var/captainless=1 - for(var/mob/living/carbon/human/player in player_list) - if(player && player.mind && player.mind.assigned_role) - if(player.mind.assigned_role == "Captain") - captainless=0 - if(player.mind.assigned_role != "MODE") - job_master.EquipRank(player, player.mind.assigned_role, 0) - EquipCustomItems(player) - if(captainless) - for(var/mob/M in player_list) - if(!istype(M,/mob/new_player)) - to_chat(M, "Captainship not forced on anyone.") - - - proc/process() - if(current_state != GAME_STATE_PLAYING) - return 0 - - mode.process() - mode.process_job_tasks() - - //emergency_shuttle.process() DONE THROUGH PROCESS SCHEDULER - - var/game_finished = shuttle_master.emergency.mode >= SHUTTLE_ENDGAME || mode.station_was_nuked - if(config.continuous_rounds) - mode.check_finished() // some modes contain var-changing code in here, so call even if we don't uses result - else - game_finished |= mode.check_finished() - - if(!mode.explosion_in_progress && game_finished) - current_state = GAME_STATE_FINISHED - auto_toggle_ooc(1) // Turn it on - spawn - declare_completion() - - spawn(50) - callHook("roundend") - - if(mode.station_was_nuked) - world.Reboot("Station destroyed by Nuclear Device.", "end_proper", "nuke") - else - world.Reboot("Round ended.", "end_proper", "proper completion") - - return 1 - - proc/getfactionbyname(var/name) - for(var/datum/faction/F in factions) - if(F.name == name) - return F - - proc/karmareminder() - for(var/mob/living/player in player_list) - - if(player.client) - if(player.client.karma_spent == 0) - if(player.client.prefs && !(player.client.prefs.toggles & DISABLE_KARMA_REMINDER)) - var/dat - dat += {"Karma Reminder

Karma Reminder


- You have not yet spent your karma for the round, surely there is a player who was worthy of receiving
- your reward? Look under 'Special Verbs' for the 'Award Karma' button, and use it once a round for best results!"} - player << browse(dat, "window=karmareminder;size=400x300") + if(player.client) + if(player.client.karma_spent == 0) + if(player.client.prefs && !(player.client.prefs.toggles & DISABLE_KARMA_REMINDER)) + var/dat + dat += {"Karma Reminder

Karma Reminder


+ You have not yet spent your karma for the round, surely there is a player who was worthy of receiving
+ your reward? Look under 'Special Verbs' for the 'Award Karma' button, and use it once a round for best results!"} + player << browse(dat, "window=karmareminder;size=400x300") /datum/controller/gameticker/proc/declare_completion() diff --git a/code/modules/admin/verbs/cinematic.dm b/code/modules/admin/verbs/cinematic.dm index 570d73e19a8..3449350e11f 100644 --- a/code/modules/admin/verbs/cinematic.dm +++ b/code/modules/admin/verbs/cinematic.dm @@ -1,17 +1,17 @@ -/client/proc/cinematic(var/cinematic as anything in list("explosion",null)) - set name = "Play cinematic" +/client/proc/cinematic(cinematic as anything in list("explosion", null)) + set name = "cinematic" set category = "Debug" - set desc = "Shows a cinematic, will work like a normal nuke" // Intended for testing but I thought it might be nice for events on the rare occasion Feel free to comment it out if it's not wanted. - if(alert("Are you sure you want to run [cinematic]?","Confirmation","Yes","No")=="No") return - if(!ticker) return + set desc = "Shows a cinematic." // Intended for testing but I thought it might be nice for events on the rare occasion Feel free to comment it out if it's not wanted. + set hidden = 1 + if(!ticker) + return switch(cinematic) if("explosion") - var/parameter = input(src,"station_missed = ?","Enter Parameter",0) as num + var/parameter = input(src, "station_missed = ?", "Enter Parameter", 0) as num var/override switch(parameter) if(1) - override = input(src,"mode = ?","Enter Parameter",null) as anything in list("nuclear emergency","no override") + override = input(src, "mode = ?","Enter Parameter", null) as anything in list("nuclear emergency", "fake", "no override") if(0) - override = input(src,"mode = ?","Enter Parameter",null) as anything in list("blob","nuclear emergency","AI malfunction","no override") - ticker.station_explosion_cinematic(parameter,override) - return \ No newline at end of file + override = input(src, "mode = ?","Enter Parameter", null) as anything in list("blob", "nuclear emergency", "AI malfunction", "no override") + ticker.station_explosion_cinematic(parameter, override) \ No newline at end of file diff --git a/icons/effects/station_explosion.dmi b/icons/effects/station_explosion.dmi index 908f6f27c90..7dcab377107 100644 Binary files a/icons/effects/station_explosion.dmi and b/icons/effects/station_explosion.dmi differ