From 091a2854aac88103a65d7fa9c3cb98b50f1834c1 Mon Sep 17 00:00:00 2001 From: vincibrv Date: Sat, 10 Feb 2024 16:57:28 +0100 Subject: [PATCH 1/3] notworking status --- .../cas_manager/datums/cas_fire_envelope.dm | 57 ++++++++++++------- .../cas_manager/datums/cas_fire_mission.dm | 1 + 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/code/game/cas_manager/datums/cas_fire_envelope.dm b/code/game/cas_manager/datums/cas_fire_envelope.dm index cc38b034c764..d229f6498a30 100644 --- a/code/game/cas_manager/datums/cas_fire_envelope.dm +++ b/code/game/cas_manager/datums/cas_fire_envelope.dm @@ -3,7 +3,8 @@ var/list/datum/cas_fire_mission/missions var/fire_length var/grace_period //how much time you have after initiating fire mission and before you can't change firemissions - var/flyto_period //how much time it takes from sound alarm start to first hit. CAS is vulnerable here + var/chat_warning + var/execution_start var/flyoff_period //how much time it takes after shots fired to get off the map. CAS is vulnerable here var/cooldown_period //how much time you have to wait before new Fire Mission run var/soundeffect //what sound effect to play @@ -38,7 +39,7 @@ /datum/cas_fire_envelope/proc/get_total_duration() - return grace_period+flyto_period+flyoff_period + return cooldown_period /datum/cas_fire_envelope/proc/update_weapons(list/obj/structure/dropship_equipment/weapon/weapons) for(var/datum/cas_fire_mission/mission in missions) @@ -245,22 +246,12 @@ /** * Execute firemission. */ -/datum/cas_fire_envelope/proc/execute_firemission_unsafe(datum/cas_signal/signal, turf/target_turf, dir, datum/cas_fire_mission/mission) - stat = FIRE_MISSION_STATE_IN_TRANSIT - to_chat(usr, SPAN_ALERT("Firemission underway!")) - sleep(grace_period) +/datum/cas_fire_envelope/proc/play_sound(atom/target_turf) stat = FIRE_MISSION_STATE_ON_TARGET - if(!target_turf) - stat = FIRE_MISSION_STATE_IDLE - mission_error = "Target Lost." - return - if(!target_turf || !check_firemission_loc(signal)) - stat = FIRE_MISSION_STATE_IDLE - mission_error = "Target is off bounds or obstructed." - return change_current_loc(target_turf) - playsound(source = target_turf, soundin = soundeffect, vol = 70, vary = TRUE, sound_range = 50, falloff = 8) + playsound(target_turf, 'sound/weapons/dropship_sonic_boom.ogg', vol = 70, vary = TRUE, sound_range = 50, falloff = 8) +/datum/cas_fire_envelope/proc/warning(atom/target_turf) for(var/mob/mob in range(15, target_turf)) var/ds_identifier = "LARGE BIRD" var/fm_identifier = "SPIT FIRE" @@ -273,15 +264,36 @@ SPAN_HIGHDANGER("YOU HEAR SOMETHING FLYING CLOSER TO YOU!") , SHOW_MESSAGE_AUDIBLE \ ) - sleep(flyto_period) +/datum/cas_fire_envelope/proc/open_fire(atom/target_turf,datum/cas_fire_mission/mission,dir) stat = FIRE_MISSION_STATE_FIRING mission.execute_firemission(linked_console, target_turf, dir, fire_length, step_delay, src) stat = FIRE_MISSION_STATE_OFF_TARGET - sleep(flyoff_period) + +/datum/cas_fire_envelope/proc/flyoff() stat = FIRE_MISSION_STATE_COOLDOWN - sleep(cooldown_period) + +/datum/cas_fire_envelope/proc/end_cooldown() stat = FIRE_MISSION_STATE_IDLE + +/datum/cas_fire_envelope/proc/execute_firemission_unsafe(datum/cas_signal/signal, turf/target_turf, dir, datum/cas_fire_mission/mission) + stat = FIRE_MISSION_STATE_IN_TRANSIT + to_chat(usr, SPAN_ALERT("Firemission underway!")) + if(!target_turf) + stat = FIRE_MISSION_STATE_IDLE + mission_error = "Target Lost." + return + if(!target_turf || !check_firemission_loc(signal)) + stat = FIRE_MISSION_STATE_IDLE + mission_error = "Target is off bounds or obstructed." + return + + addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, play_sound), target_turf), grace_period) + addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, warning), target_turf), chat_warning) + addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, open_fire), target_turf, mission,dir), execution_start) + addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, flyoff)), flyoff_period) + addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, end_cooldown)), cooldown_period) + /** * Change attack vector for firemission */ @@ -324,10 +336,11 @@ /datum/cas_fire_envelope/uscm_dropship fire_length = 12 - grace_period = 5 SECONDS - flyto_period = 4 SECONDS //sleep in the FM itself has been increased by one more second - flyoff_period = 5 SECONDS - cooldown_period = 10 SECONDS + grace_period = 5 SECONDS + chat_warning = 6.5 SECONDS + execution_start = 8.5 SECONDS + flyoff_period = 15 SECONDS + cooldown_period = 25 SECONDS soundeffect = 'sound/weapons/dropship_sonic_boom.ogg' //BOOM~WOOOOOSH~HSOOOOOW~BOOM step_delay = 3 max_offset = 12 diff --git a/code/game/cas_manager/datums/cas_fire_mission.dm b/code/game/cas_manager/datums/cas_fire_mission.dm index 927dded210f0..bebb8a5f37a4 100644 --- a/code/game/cas_manager/datums/cas_fire_mission.dm +++ b/code/game/cas_manager/datums/cas_fire_mission.dm @@ -160,6 +160,7 @@ return "Weapon [weapon_string] has not enough ammunition to complete this Fire Mission" return "Unknown Error" + /datum/cas_fire_mission/proc/execute_firemission(obj/structure/machinery/computer/dropship_weapons/linked_console, turf/initial_turf, direction = NORTH, steps = 12, step_delay = 3, datum/cas_fire_envelope/envelope = null) if(initial_turf == null || check(linked_console) != FIRE_MISSION_ALL_GOOD) return FIRE_MISSION_NOT_EXECUTABLE From 4849e167f7a4b23c2f1651aee79980a2ef6021ad Mon Sep 17 00:00:00 2001 From: vincibrv Date: Sat, 10 Feb 2024 19:07:04 +0100 Subject: [PATCH 2/3] makes it work right --- code/game/cas_manager/datums/cas_fire_envelope.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/game/cas_manager/datums/cas_fire_envelope.dm b/code/game/cas_manager/datums/cas_fire_envelope.dm index d229f6498a30..aac0e5df459c 100644 --- a/code/game/cas_manager/datums/cas_fire_envelope.dm +++ b/code/game/cas_manager/datums/cas_fire_envelope.dm @@ -39,7 +39,7 @@ /datum/cas_fire_envelope/proc/get_total_duration() - return cooldown_period + return flyoff_period /datum/cas_fire_envelope/proc/update_weapons(list/obj/structure/dropship_equipment/weapon/weapons) for(var/datum/cas_fire_mission/mission in missions) @@ -288,11 +288,11 @@ mission_error = "Target is off bounds or obstructed." return - addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, play_sound), target_turf), grace_period) - addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, warning), target_turf), chat_warning) - addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, open_fire), target_turf, mission,dir), execution_start) - addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, flyoff)), flyoff_period) - addtimer(CALLBACK( TYPE_PROC_REF(/datum/cas_fire_envelope, end_cooldown)), cooldown_period) + addtimer(CALLBACK(src, PROC_REF( play_sound), target_turf), grace_period) + addtimer(CALLBACK(src, PROC_REF( warning), target_turf), chat_warning) + addtimer(CALLBACK(src, PROC_REF( open_fire), target_turf, mission,dir), execution_start) + addtimer(CALLBACK(src, PROC_REF( flyoff)), flyoff_period) + addtimer(CALLBACK(src, PROC_REF( end_cooldown)), cooldown_period) /** * Change attack vector for firemission From e84db44af2c3ded62c13e50b52940718d8ea40f7 Mon Sep 17 00:00:00 2001 From: vincibrv Date: Sat, 10 Feb 2024 21:49:50 +0100 Subject: [PATCH 3/3] looks finished, might not be --- .../cas_manager/datums/cas_fire_envelope.dm | 65 +++++++++++++++++-- .../cas_manager/datums/cas_fire_mission.dm | 45 ------------- 2 files changed, 59 insertions(+), 51 deletions(-) diff --git a/code/game/cas_manager/datums/cas_fire_envelope.dm b/code/game/cas_manager/datums/cas_fire_envelope.dm index aac0e5df459c..8c6c97334003 100644 --- a/code/game/cas_manager/datums/cas_fire_envelope.dm +++ b/code/game/cas_manager/datums/cas_fire_envelope.dm @@ -3,7 +3,9 @@ var/list/datum/cas_fire_mission/missions var/fire_length var/grace_period //how much time you have after initiating fire mission and before you can't change firemissions - var/chat_warning + var/first_warning + var/second_warning + var/third_warning var/execution_start var/flyoff_period //how much time it takes after shots fired to get off the map. CAS is vulnerable here var/cooldown_period //how much time you have to wait before new Fire Mission run @@ -249,9 +251,9 @@ /datum/cas_fire_envelope/proc/play_sound(atom/target_turf) stat = FIRE_MISSION_STATE_ON_TARGET change_current_loc(target_turf) - playsound(target_turf, 'sound/weapons/dropship_sonic_boom.ogg', vol = 70, vary = TRUE, sound_range = 50, falloff = 8) + playsound(target_turf, soundeffect , vol = 70, vary = TRUE, sound_range = 50, falloff = 8) -/datum/cas_fire_envelope/proc/warning(atom/target_turf) +/datum/cas_fire_envelope/proc/first_chat_warning(atom/target_turf) for(var/mob/mob in range(15, target_turf)) var/ds_identifier = "LARGE BIRD" var/fm_identifier = "SPIT FIRE" @@ -264,6 +266,40 @@ SPAN_HIGHDANGER("YOU HEAR SOMETHING FLYING CLOSER TO YOU!") , SHOW_MESSAGE_AUDIBLE \ ) +/datum/cas_fire_envelope/proc/second_chat_warning(atom/initial_turf) + var/relative_dir + for(var/mob/mob in range(15, initial_turf)) + if(get_turf(mob) == initial_turf) + relative_dir = 0 + else + relative_dir = Get_Compass_Dir(mob, initial_turf) + + var/ds_identifier = "LARGE BIRD" + if (mob.mob_flags & KNOWS_TECHNOLOGY) + ds_identifier = "DROPSHIP" + + mob.show_message( \ + SPAN_HIGHDANGER("A [ds_identifier] FLIES [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), SHOW_MESSAGE_VISIBLE, \ + SPAN_HIGHDANGER("YOU HEAR SOMETHING GO [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), SHOW_MESSAGE_AUDIBLE \ + ) + +/datum/cas_fire_envelope/proc/third_chat_warning(atom/initial_turf) + var/relative_dir + for(var/mob/mob in range(10, initial_turf)) + if(get_turf(mob) == initial_turf) + relative_dir = 0 + else + relative_dir = Get_Compass_Dir(mob, initial_turf) + + var/ds_identifier = "LARGE BIRD" + if (mob.mob_flags & KNOWS_TECHNOLOGY) + ds_identifier = "DROPSHIP" + + mob.show_message( \ + SPAN_HIGHDANGER("A [ds_identifier] FIRES [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), 1, \ + SPAN_HIGHDANGER("YOU HEAR SOMETHING FIRE [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), 2 \ + ) + /datum/cas_fire_envelope/proc/open_fire(atom/target_turf,datum/cas_fire_mission/mission,dir) stat = FIRE_MISSION_STATE_FIRING mission.execute_firemission(linked_console, target_turf, dir, fire_length, step_delay, src) @@ -288,8 +324,23 @@ mission_error = "Target is off bounds or obstructed." return + var/obj/effect/firemission_effect = new(target_turf) + + firemission_effect.icon = 'icons/obj/items/weapons/projectiles.dmi' + firemission_effect.icon_state = "laser_target2" + firemission_effect.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + firemission_effect.invisibility = INVISIBILITY_MAXIMUM + QDEL_IN(firemission_effect, 12 SECONDS) + + + notify_ghosts(header = "CAS Fire Mission", message = "[usr ? usr : "Someone"] is launching Fire Mission '[mission.name]' at [get_area(target_turf)].", source = firemission_effect) + msg_admin_niche("[usr ? key_name(usr) : "Someone"] is launching Fire Mission '[mission.name]' at ([target_turf.x],[target_turf.y],[target_turf.z]) [ADMIN_JMP(target_turf)]") + + addtimer(CALLBACK(src, PROC_REF( play_sound), target_turf), grace_period) - addtimer(CALLBACK(src, PROC_REF( warning), target_turf), chat_warning) + addtimer(CALLBACK(src, PROC_REF( first_chat_warning), target_turf), first_warning) + addtimer(CALLBACK(src, PROC_REF( second_chat_warning), target_turf), second_warning) + addtimer(CALLBACK(src, PROC_REF( third_chat_warning), target_turf), third_warning) addtimer(CALLBACK(src, PROC_REF( open_fire), target_turf, mission,dir), execution_start) addtimer(CALLBACK(src, PROC_REF( flyoff)), flyoff_period) addtimer(CALLBACK(src, PROC_REF( end_cooldown)), cooldown_period) @@ -337,8 +388,10 @@ /datum/cas_fire_envelope/uscm_dropship fire_length = 12 grace_period = 5 SECONDS - chat_warning = 6.5 SECONDS - execution_start = 8.5 SECONDS + first_warning = 6.5 SECONDS + second_warning = 8.5 SECONDS + third_warning = 10 SECONDS + execution_start = 10 SECONDS flyoff_period = 15 SECONDS cooldown_period = 25 SECONDS soundeffect = 'sound/weapons/dropship_sonic_boom.ogg' //BOOM~WOOOOOSH~HSOOOOOW~BOOM diff --git a/code/game/cas_manager/datums/cas_fire_mission.dm b/code/game/cas_manager/datums/cas_fire_mission.dm index bebb8a5f37a4..65e9eecde84f 100644 --- a/code/game/cas_manager/datums/cas_fire_mission.dm +++ b/code/game/cas_manager/datums/cas_fire_mission.dm @@ -165,51 +165,6 @@ if(initial_turf == null || check(linked_console) != FIRE_MISSION_ALL_GOOD) return FIRE_MISSION_NOT_EXECUTABLE - var/obj/effect/firemission_effect = new(initial_turf) - - firemission_effect.icon = 'icons/obj/items/weapons/projectiles.dmi' - firemission_effect.icon_state = "laser_target2" - firemission_effect.mouse_opacity = MOUSE_OPACITY_TRANSPARENT - firemission_effect.invisibility = INVISIBILITY_MAXIMUM - QDEL_IN(firemission_effect, 5 SECONDS) - - notify_ghosts(header = "CAS Fire Mission", message = "[usr ? usr : "Someone"] is launching Fire Mission '[name]' at [get_area(initial_turf)].", source = firemission_effect) - msg_admin_niche("[usr ? key_name(usr) : "Someone"] is launching Fire Mission '[name]' at ([initial_turf.x],[initial_turf.y],[initial_turf.z]) [ADMIN_JMP(initial_turf)]") - - var/relative_dir - for(var/mob/mob in range(15, initial_turf)) - if(get_turf(mob) == initial_turf) - relative_dir = 0 - else - relative_dir = Get_Compass_Dir(mob, initial_turf) - - var/ds_identifier = "LARGE BIRD" - if (mob.mob_flags & KNOWS_TECHNOLOGY) - ds_identifier = "DROPSHIP" - - mob.show_message( \ - SPAN_HIGHDANGER("A [ds_identifier] FLIES [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), SHOW_MESSAGE_VISIBLE, \ - SPAN_HIGHDANGER("YOU HEAR SOMETHING GO [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), SHOW_MESSAGE_AUDIBLE \ - ) - - // Xenos have time to react to the first message - sleep(1.5 SECONDS) - - for(var/mob/mob in range(10, initial_turf)) - if(get_turf(mob) == initial_turf) - relative_dir = 0 - else - relative_dir = Get_Compass_Dir(mob, initial_turf) - - var/ds_identifier = "LARGE BIRD" - if (mob.mob_flags & KNOWS_TECHNOLOGY) - ds_identifier = "DROPSHIP" - - mob.show_message( \ - SPAN_HIGHDANGER("A [ds_identifier] FIRES [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), 1, \ - SPAN_HIGHDANGER("YOU HEAR SOMETHING FIRE [SPAN_UNDERLINE(relative_dir ? uppertext(("TO YOUR " + dir2text(relative_dir))) : uppertext("right above you"))]!"), 2 \ - ) - var/turf/current_turf = initial_turf var/tally_step = steps / mission_length //how much shots we need before moving to next turf var/next_step = tally_step //when we move to next turf