Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fm timeing changes #6097

Merged
merged 12 commits into from
May 1, 2024
110 changes: 88 additions & 22 deletions code/game/cas_manager/datums/cas_fire_envelope.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
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/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
var/soundeffect //what sound effect to play
Expand Down Expand Up @@ -38,7 +41,7 @@


/datum/cas_fire_envelope/proc/get_total_duration()
return grace_period+flyto_period+flyoff_period
return flyoff_period
Drulikar marked this conversation as resolved.
Show resolved Hide resolved

/datum/cas_fire_envelope/proc/update_weapons(list/obj/structure/dropship_equipment/weapon/weapons)
for(var/datum/cas_fire_mission/mission in missions)
Expand Down Expand Up @@ -245,22 +248,12 @@
/**
* Execute firemission.
*/
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
/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, soundeffect , vol = 70, vary = TRUE, sound_range = 50, falloff = 8)
cuberound marked this conversation as resolved.
Show resolved Hide resolved

/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"
Expand All @@ -273,15 +266,85 @@
SPAN_HIGHDANGER("YOU HEAR SOMETHING FLYING CLOSER TO YOU!") , SHOW_MESSAGE_AUDIBLE \
)

sleep(flyto_period)
/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 \
)
cuberound marked this conversation as resolved.
Show resolved Hide resolved

/datum/cas_fire_envelope/proc/open_fire(atom/target_turf,datum/cas_fire_mission/mission,dir)
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
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()
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
stat = FIRE_MISSION_STATE_COOLDOWN
sleep(cooldown_period)

/datum/cas_fire_envelope/proc/end_cooldown()
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
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

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( 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)
cuberound marked this conversation as resolved.
Show resolved Hide resolved

/**
* Change attack vector for firemission
*/
Expand Down Expand Up @@ -324,10 +387,13 @@

/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
first_warning = 6 SECONDS
second_warning = 9 SECONDS
third_warning = 10 SECONDS
cuberound marked this conversation as resolved.
Show resolved Hide resolved
execution_start = 10 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
Expand Down
46 changes: 1 addition & 45 deletions code/game/cas_manager/datums/cas_fire_mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,55 +160,11 @@
return "Weapon [weapon_string] has not enough ammunition to complete this Fire Mission"
return "Unknown Error"


cuberound marked this conversation as resolved.
Show resolved Hide resolved
/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

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
Expand Down
Loading