From bec822a04930184cf88ec5ced433fc4131ea3bd2 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sat, 5 May 2012 22:28:05 +0100 Subject: [PATCH] TG: Rewrote the cinematic system to be centralised and controlled by the gameticker, rather than handled per mob with like, 3 loops and a seperate process for each mob.dmPlease report any bugs/derps to me asap. I've tested it as much as I can locally, but because it relates to events that require a large number of players it's very hard to test. TODO: I was intending to use dust to kill players off on a nuclear-loss. However dust() is very very broken. So I've hardcoded everything to die until I can fix dust(). Added an adminverb for 'Game Master's. It was a debug verb so I could test cinematics but I've left it in as it might be handy for events, especially if we get more cinematics. To access it type "cinematic" in full into the input bar as a Game Master, then follow the prompts. At the moment, it only handles nuclear stuff (that's all there is anyway). You can choose where the nuke detonated 0= on station; 1= near station but in space; 2= off the z-level. You can also force a cinematic from another game-mode to play with the prompt after that one. Note: All mobs are buckled to a bed located inside the gameticker (odd I know) whilst a cinematic is playing. The bed is deleted afterwards releasing all players. If off_station=0 then all mobs will be killed too. This is to stop people running around and doing stuff during the cinematic. I really didn't want to add more variables/checks to mobs. Revision: r3481 Author: elly1...@rocketmail.com --- baystation12.dme | 1 + code/defines/obj.dm | 4 +- code/game/gamemodes/epidemic/epidemic.dm | 12 +-- code/game/gamemodes/gameticker.dm | 101 ++++++++++++++++++ .../game/gamemodes/malfunction/malfunction.dm | 13 +-- code/game/gamemodes/nuclear/nuclearbomb.dm | 66 ++++++------ code/modules/admin/admin_verbs.dm | 6 +- code/modules/admin/verbs/cinematic.dm | 17 +++ code/modules/mob/dead/observer/hud.dm | 7 +- .../mob/living/carbon/alien/humanoid/hud.dm | 8 -- .../mob/living/carbon/alien/larva/hud.dm | 8 -- code/modules/mob/living/carbon/brain/hud.dm | 6 -- code/modules/mob/living/carbon/human/hud.dm | 8 -- code/modules/mob/living/carbon/metroid/hud.dm | 8 -- code/modules/mob/living/carbon/monkey/hud.dm | 8 -- code/modules/mob/living/silicon/ai/hud.dm | 8 -- code/modules/mob/living/silicon/robot/hud.dm | 8 -- code/modules/mob/mob.dm | 38 ------- code/modules/mob/new_player/hud.dm | 7 +- 19 files changed, 167 insertions(+), 167 deletions(-) create mode 100644 code/modules/admin/verbs/cinematic.dm diff --git a/baystation12.dme b/baystation12.dme index 28a9fa0df46..786e75059d7 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -795,6 +795,7 @@ #include "code\modules\admin\verbs\adminsay.dm" #include "code\modules\admin\verbs\atmosdebug.dm" #include "code\modules\admin\verbs\BrokenInhands.dm" +#include "code\modules\admin\verbs\cinematic.dm" #include "code\modules\admin\verbs\custom_event.dm" #include "code\modules\admin\verbs\deadsay.dm" #include "code\modules\admin\verbs\debug.dm" diff --git a/code/defines/obj.dm b/code/defines/obj.dm index e2b975d4d50..e1facd0a59a 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -383,7 +383,6 @@ opacity = 0 density = 0 - /obj/hud name = "hud" unacidable = 1 @@ -400,9 +399,8 @@ var/obj/screen/g_dither = null var/obj/screen/blurry = null var/list/darkMask = null - var/obj/screen/station_explosion = null - var/h_type = /obj/screen + var/h_type = /obj/screen //this is like...the most pointless thing ever. Use a god damn define! /obj/item name = "item" diff --git a/code/game/gamemodes/epidemic/epidemic.dm b/code/game/gamemodes/epidemic/epidemic.dm index 9a45abbb274..60ad9123a7b 100644 --- a/code/game/gamemodes/epidemic/epidemic.dm +++ b/code/game/gamemodes/epidemic/epidemic.dm @@ -179,13 +179,11 @@ world << "\blue[i].." sleep(10) enter_allowed = 0 - for(var/mob/M in world) - if(M.client) - spawn(0) - M.client.station_explosion_cinematic() - sleep(110) - ticker.mode:station_was_nuked = 1 - ticker.mode:explosion_in_progress = 0 + if(ticker) + ticker.station_explosion_cinematic(0,null) + if(ticker.mode) + ticker.mode:station_was_nuked = 1 + ticker.mode:explosion_in_progress = 0 return diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index dc2fe2e28cd..82ff91696cc 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -138,6 +138,107 @@ var/datum/roundinfo/roundinfo = new() 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! + + //initialise our cinematic screen object + cinematic = new(src) + cinematic.icon = 'station_explosion.dmi' + cinematic.icon_state = "start" + cinematic.layer = 20 + cinematic.mouse_opacity = 0 + cinematic.screen_loc = "1,3" //TODO resize them + + 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 world) + 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 world) + M.buckled = temp_buckle + if(M.client) + M.client.screen += cinematic + switch(M.z) + if(0) //inside a crate or something + var/turf/T = get_turf(M) + if(T && T.z==1) //we don't use M.death(0) because it calls a for(/mob) loop and + M.health = 0 + M.stat = DEAD + if(1) //on a z-level 1 turf. + M.health = 0 + M.stat = DEAD + + //Now animate the cinematic + switch(station_missed) + if(2) //nuke was nowhere nearby //TODO: a really distant explosion animation + sleep(50) + world << sound('explosionfar.ogg') + + if(1) //nuke was nearby but (mostly) missed + if( mode && !override ) + override = mode.name + switch( override ) + if("nuclear emergency") + flick("start_nuke",cinematic) + sleep(50) + world << sound('explosionfar.ogg') + flick("explode2",cinematic) + cinematic.icon_state = "loss_nuke2" + else + sleep(50) + world << sound('explosionfar.ogg') + flick("explode2",cinematic) + + else //station was destroyed + if( mode && !override ) + override = mode.name + switch( override ) + if("nuclear emergency") + flick("start_nuke",cinematic) + sleep(50) + world << sound('explosionfar.ogg') + cinematic.icon_state = "end" + flick("explode",cinematic) + cinematic.icon_state = "loss_nuke" + + if("AI malfunction") + flick("start_malf",cinematic) + sleep(50) + world << sound('explosionfar.ogg') + cinematic.icon_state = "end" + flick("explode",cinematic) + cinematic.icon_state = "loss_malf" + + if("blob") + flick("start_blob",cinematic) //TODO: make a blob one + sleep(50) + world << sound('explosionfar.ogg') + cinematic.icon_state = "end" + flick("explode",cinematic) + cinematic.icon_state = "loss_blob" //TODO: make a blob one + + else + //default station-destroyed ending + sleep(50) + world << sound('explosionfar.ogg') + cinematic.icon_state = "end" + flick("explode",cinematic) + cinematic.icon_state = "loss_general" + sleep(100) + + //Tidy-up time! + if(cinematic) del(cinematic) //end the cinematic + if(temp_buckle) del(temp_buckle) //release everybody + return + proc/create_characters() for(var/mob/new_player/player in world) diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index 3669561f82c..9869f29ff7e 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -188,14 +188,11 @@ world << i sleep(10) enter_allowed = 0 - for(var/mob/M in world) - if(M.client) - spawn(0) - M.client.station_explosion_cinematic() - sleep(110) - ticker.mode:station_was_nuked = 1 - ticker.mode:explosion_in_progress = 0 - //world << "Everyone was killed by the self-destruct!" + if(ticker) + ticker.station_explosion_cinematic(0,null) + if(ticker.mode) + ticker.mode:station_was_nuked = 1 + ticker.mode:explosion_in_progress = 0 return diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index ca568f6bf9d..c744d9fd1e3 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -159,6 +159,7 @@ return +#define NUKERANGE 80 /obj/machinery/nuclearbomb/proc/explode() if (src.safety) src.timing = 0 @@ -176,47 +177,40 @@ enter_allowed = 0 var/off_station = 0 - var/area/A = get_area(src.loc) - if(A && (istype(A,/area/syndicate_station) || A.type == "/area")) - off_station = 1 - if (ticker && ticker.mode && ticker.mode.name == "nuclear emergency") - ticker.mode:herp = syndicate_station_at_station - ticker.mode:nuke_off_station = off_station + var/turf/bomb_location = get_turf(src) + if( bomb_location && (bomb_location.z == 1) ) + if( (bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE)) ) + off_station = 1 + else + off_station = 2 - for(var/mob/M in world) - if(M.client) - spawn(0) - M.client.station_explosion_cinematic(off_station) - sleep(110) + if (ticker) + if(ticker.mode && ticker.mode.name == "nuclear emergency") + ticker.mode:herp = syndicate_station_at_station + ticker.mode:nuke_off_station = off_station + ticker.station_explosion_cinematic(off_station,null) + if(ticker.mode) + ticker.mode.explosion_in_progress = 0 + if(ticker.mode.name == "nuclear emergency") + ticker.mode:nukes_left -- + else + world << "The station was destoyed by the nuclear blast!" - if (ticker && ticker.mode) - ticker.mode.explosion_in_progress = 0 - if(ticker.mode.name == "nuclear emergency") - ticker.mode:nukes_left -- - ticker.mode.station_was_nuked = (off_station==0) + ticker.mode.station_was_nuked = (off_station<2) //offstation==1 is a draw. the station becomes irradiated and needs to be evacuated. + //kinda shit but I couldn't get permission to do what I wanted to do. - else - world << "The station was destoyed by the nuclear blast!" - ticker.mode.station_was_nuked = 1 - /* - TODO: derped blast should partially damage nearest objects - and do not reboot the game. Also make it work properly on other z-levels --rastaf0 - Further TODO: make nuke detonation work with objectives. Right now, you can't track player - location because they are viewing the cinematic (can't get_turf on them to determine z_level - as it will return null). Leaving this for you since you apparently plan to work this further. /N - */ + if(!ticker.mode.check_finished())//If the mode does not deal with the nuke going off so just reboot because everyone is stuck as is + world << "Resetting in 30 seconds!" - if(!ticker.mode.check_finished())//If the mode does not deal with the nuke going off so just reboot because everyone is stuck as is - world << "Resetting in 30 seconds!" - - //feedback_set_details("end_error","nuke - unhandled ending") - if(blackbox) - blackbox.save_all_data_to_sql() - sleep(300) - log_game("Rebooting due to nuclear detonation") - world.Reboot() - return + feedback_set_details("end_error","nuke - unhandled ending") + if(blackbox) + blackbox.save_all_data_to_sql() + sleep(300) + log_game("Rebooting due to nuclear detonation") + world.Reboot() + return + return /obj/item/weapon/disk/nuclear/Del() if(blobstart.len > 0) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f7fe7379972..17ea9b05167 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -289,7 +289,8 @@ verbs += /client/proc/everyone_random verbs += /client/proc/only_one verbs += /client/proc/deadmin_self - verbs += /client/proc/getruntimelog //used by coders to retrieve runtime logs +// verbs += /client/proc/giveruntimelog //used by coders to retrieve runtime logs + verbs += /client/proc/cinematic //used by coders to retrieve runtime logs verbs += /client/proc/enable_debug_verbs verbs += /client/proc/kill_air verbs += /client/proc/callprocgen @@ -418,6 +419,9 @@ verbs -= /client/proc/deadmin_self verbs -= /client/proc/jumptocoord verbs -= /client/proc/everyone_random +// verbs -= /client/proc/giveruntimelog //used by coders to retrieve runtime logs +// verbs -= /client/proc/getserverlog + verbs -= /client/proc/cinematic verbs -= /client/proc/cmd_admin_change_custom_event verbs -= /client/proc/admin_invis verbs -= /client/proc/callprocgen diff --git a/code/modules/admin/verbs/cinematic.dm b/code/modules/admin/verbs/cinematic.dm new file mode 100644 index 00000000000..d7b572e2849 --- /dev/null +++ b/code/modules/admin/verbs/cinematic.dm @@ -0,0 +1,17 @@ +/client/proc/cinematic(var/cinematic as anything in list("explosion",null)) + set name = "cinematic" + set category = "Fun" + 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/override + switch(parameter) + if(1) + override = input(src,"mode = ?","Enter Parameter",null) as anything in list("nuclear emergency","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 diff --git a/code/modules/mob/dead/observer/hud.dm b/code/modules/mob/dead/observer/hud.dm index 0a1ca725a36..3969992c4ed 100644 --- a/code/modules/mob/dead/observer/hud.dm +++ b/code/modules/mob/dead/observer/hud.dm @@ -1,8 +1,3 @@ + /obj/hud/proc/ghost_hud() - station_explosion = new h_type( src ) - station_explosion.icon = 'station_explosion.dmi' - station_explosion.icon_state = "start" - station_explosion.layer = 20 - station_explosion.mouse_opacity = 0 - station_explosion.screen_loc = "1,3" return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/humanoid/hud.dm b/code/modules/mob/living/carbon/alien/humanoid/hud.dm index cbcb149464e..37ec382bc7e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/hud.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/hud.dm @@ -37,14 +37,6 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - var/obj/screen/using using = new src.h_type( src ) diff --git a/code/modules/mob/living/carbon/alien/larva/hud.dm b/code/modules/mob/living/carbon/alien/larva/hud.dm index cfe29e2b5e7..e51b8b48de5 100644 --- a/code/modules/mob/living/carbon/alien/larva/hud.dm +++ b/code/modules/mob/living/carbon/alien/larva/hud.dm @@ -39,14 +39,6 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - var/obj/screen/using using = new src.h_type( src ) diff --git a/code/modules/mob/living/carbon/brain/hud.dm b/code/modules/mob/living/carbon/brain/hud.dm index 0a2a2f226fb..f575d5ffbb2 100644 --- a/code/modules/mob/living/carbon/brain/hud.dm +++ b/code/modules/mob/living/carbon/brain/hud.dm @@ -1,10 +1,4 @@ /obj/hud/proc/brain_hud(var/ui_style='screen1_old.dmi') - station_explosion = new h_type( src ) - station_explosion.icon = 'station_explosion.dmi' - station_explosion.icon_state = "start" - station_explosion.layer = 20 - station_explosion.mouse_opacity = 0 - station_explosion.screen_loc = "1,3" blurry = new h_type( src ) blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" diff --git a/code/modules/mob/living/carbon/human/hud.dm b/code/modules/mob/living/carbon/human/hud.dm index aa8b28715bb..281e451624f 100644 --- a/code/modules/mob/living/carbon/human/hud.dm +++ b/code/modules/mob/living/carbon/human/hud.dm @@ -41,14 +41,6 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - var/obj/screen/using using = new src.h_type( src ) diff --git a/code/modules/mob/living/carbon/metroid/hud.dm b/code/modules/mob/living/carbon/metroid/hud.dm index 40e4bf9f868..f1d73166958 100644 --- a/code/modules/mob/living/carbon/metroid/hud.dm +++ b/code/modules/mob/living/carbon/metroid/hud.dm @@ -44,12 +44,4 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - */ \ No newline at end of file diff --git a/code/modules/mob/living/carbon/monkey/hud.dm b/code/modules/mob/living/carbon/monkey/hud.dm index c3c692643e3..d0596badac5 100644 --- a/code/modules/mob/living/carbon/monkey/hud.dm +++ b/code/modules/mob/living/carbon/monkey/hud.dm @@ -43,14 +43,6 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - var/obj/screen/using using = new src.h_type( src ) diff --git a/code/modules/mob/living/silicon/ai/hud.dm b/code/modules/mob/living/silicon/ai/hud.dm index 0e563e2cf44..2db6674a9a3 100644 --- a/code/modules/mob/living/silicon/ai/hud.dm +++ b/code/modules/mob/living/silicon/ai/hud.dm @@ -1,10 +1,2 @@ /obj/hud/proc/ai_hud() - - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - return \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/hud.dm b/code/modules/mob/living/silicon/robot/hud.dm index 691b0a98065..8c1f6a5f3dc 100644 --- a/code/modules/mob/living/silicon/robot/hud.dm +++ b/code/modules/mob/living/silicon/robot/hud.dm @@ -38,14 +38,6 @@ src.druggy.layer = 17 src.druggy.mouse_opacity = 0 - // station explosion cinematic - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" - var/obj/screen/using diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index fa96b2641f4..90f333f4bf3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1038,44 +1038,6 @@ note dizziness decrements automatically in the mob's Life() proc. statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S) -/client/proc/station_explosion_cinematic(var/station_missed) - if(!mob || !ticker) return - if(!mob.client || !mob.hud_used || !ticker.mode) return -// M.loc = null this might make it act weird but fuck putting them in nullspace, it causes issues. - var/obj/screen/boom = mob.hud_used.station_explosion - if(!istype(boom)) return - - mob.client.screen += boom - - switch(ticker.mode.name) - if("nuclear emergency") - flick("start_nuke", boom) - if("AI malfunction") - flick("start_malf", boom) - else - boom.icon_state = "start" - - sleep(40) - if(boom && mob) - mob << sound('explosionfar.ogg') - boom.icon_state = "end" - if(!station_missed) flick("explode", boom) - else flick("explode2", boom) - sleep(40) - - if(boom) - switch(ticker.mode.name) - if("nuclear emergency") - if(!station_missed) boom.icon_state = "loss_nuke" - else boom.icon_state = "loss_nuke2" - if("malfunction") - boom.icon_state = "loss_malf" - if("blob") - return//Nothin here yet and the general one does not fit. - else - boom.icon_state = "loss_general" - return - // facing verbs /mob/proc/canface() diff --git a/code/modules/mob/new_player/hud.dm b/code/modules/mob/new_player/hud.dm index 6df982d16dd..3f2d074e31a 100644 --- a/code/modules/mob/new_player/hud.dm +++ b/code/modules/mob/new_player/hud.dm @@ -1,8 +1,3 @@ + /obj/hud/proc/unplayer_hud() - src.station_explosion = new src.h_type( src ) - src.station_explosion.icon = 'station_explosion.dmi' - src.station_explosion.icon_state = "start" - src.station_explosion.layer = 20 - src.station_explosion.mouse_opacity = 0 - src.station_explosion.screen_loc = "1,3" return \ No newline at end of file