Skip to content

Commit

Permalink
Fm timeing changes (#6097)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request

drethek said FMs should be more powerful and told me that the warnings
are a bit too mutch, and they are, you can run on the other side of
colony from start of warning to when CAS opens fire. this PR shortens
the fire

# Explain why it's good for the game

still alows you to awoid CAS if you start running when you hear it,
while increasing the chance of hitings of those who do not run


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->

<!-- !! If you are modifying sprites, you **must** include one or more
in-game screenshots or videos of the new sprites. !! -->

<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl:
balance: FM sound is 4 seconds before CAS open fire from 5
balance: FM direction warning is 1 seconds before CAS open fire from 1.5

/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->

---------

Co-authored-by: vincibrv <[email protected]>
Co-authored-by: Drathek <[email protected]>
  • Loading branch information
3 people committed May 1, 2024
1 parent b5bc999 commit 644020a
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 80 deletions.
114 changes: 80 additions & 34 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 @@ -36,10 +39,6 @@
for(var/datum/cas_fire_mission/mission in missions)
.["missions"] += list(mission.ui_data(user))


/datum/cas_fire_envelope/proc/get_total_duration()
return grace_period+flyto_period+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)
mission.update_weapons(weapons, fire_length)
Expand Down Expand Up @@ -242,14 +241,60 @@
/datum/cas_fire_envelope/proc/check_firemission_loc(datum/cas_signal/target_turf)
return TRUE //redefined in child class

/**
* Execute firemission.
*/
/// Step 1: Sets the stat to FIRE_MISSION_STATE_ON_TARGET and starts the sound effect for the fire mission.
/datum/cas_fire_envelope/proc/play_sound(atom/target_turf)
stat = FIRE_MISSION_STATE_ON_TARGET
change_current_loc(target_turf)
playsound(target_turf, soundeffect, vol = 70, vary = TRUE, sound_range = 50, falloff = 8)

/// Step 2, 3, 4: Warns nearby mobs of the incoming fire mission. Warning as 1 is non-precise, whereas 2 and 3 are precise.
/datum/cas_fire_envelope/proc/chat_warning(atom/target_turf, range = 10, warning_number = 1)
var/ds_identifier = "LARGE BIRD"
var/fm_identifier = "SPIT FIRE"
var/relative_dir
for(var/mob/mob in range(15, target_turf))
if (mob.mob_flags & KNOWS_TECHNOLOGY)
ds_identifier = "DROPSHIP"
fm_identifier = "FIRE"
if(get_turf(mob) == target_turf)
relative_dir = 0
else
relative_dir = Get_Compass_Dir(mob, target_turf)
switch(warning_number)
if(1)
mob.show_message( \
SPAN_HIGHDANGER("YOU HEAR THE [ds_identifier] ROAR AS IT PREPARES TO [fm_identifier] NEAR YOU!"),SHOW_MESSAGE_VISIBLE, \
SPAN_HIGHDANGER("YOU HEAR SOMETHING FLYING CLOSER TO YOU!") , SHOW_MESSAGE_AUDIBLE \
)
if(2)
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 \
)
if(3)
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 \
)

/// Step 5: Actually executes the fire mission updating stat to FIRE_MISSION_STATE_FIRING and then FIRE_MISSION_STATE_OFF_TARGET
/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

/// Step 6: Sets the fire mission stat to FIRE_MISSION_STATE_COOLDOWN
/datum/cas_fire_envelope/proc/flyoff()
stat = FIRE_MISSION_STATE_COOLDOWN

/// Step 7: Sets the fire mission stat to FIRE_MISSION_STATE_IDLE
/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!"))
sleep(grace_period)
stat = FIRE_MISSION_STATE_ON_TARGET
if(!target_turf)
stat = FIRE_MISSION_STATE_IDLE
mission_error = "Target Lost."
Expand All @@ -258,29 +303,27 @@
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)

for(var/mob/mob in range(15, target_turf))
var/ds_identifier = "LARGE BIRD"
var/fm_identifier = "SPIT FIRE"
if (mob.mob_flags & KNOWS_TECHNOLOGY)
ds_identifier = "DROPSHIP"
fm_identifier = "FIRE"
var/obj/effect/firemission_effect = new(target_turf)

mob.show_message( \
SPAN_HIGHDANGER("YOU HEAR THE [ds_identifier] ROAR AS IT PREPARES TO [fm_identifier] NEAR YOU!"),SHOW_MESSAGE_VISIBLE, \
SPAN_HIGHDANGER("YOU HEAR SOMETHING FLYING CLOSER TO YOU!") , SHOW_MESSAGE_AUDIBLE \
)
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)

sleep(flyto_period)
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)
stat = FIRE_MISSION_STATE_COOLDOWN
sleep(cooldown_period)
stat = FIRE_MISSION_STATE_IDLE

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(chat_warning), target_turf, 15, 1), first_warning)
addtimer(CALLBACK(src, PROC_REF(chat_warning), target_turf, 15, 2), second_warning)
addtimer(CALLBACK(src, PROC_REF(chat_warning), target_turf, 10, 3), 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)

/**
* Change attack vector for firemission
Expand Down Expand Up @@ -324,10 +367,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 = 8 SECONDS
third_warning = 9 SECONDS
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
45 changes: 0 additions & 45 deletions code/game/cas_manager/datums/cas_fire_mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,51 +164,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
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/dropship_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@
if (!dropship.in_flyby || dropship.mode != SHUTTLE_CALL)
to_chat(user, SPAN_WARNING("Has to be in Fly By mode"))
return FALSE
if (dropship.timer && dropship.timeLeft(1) < firemission_envelope.get_total_duration())
if (dropship.timer && dropship.timeLeft(1) < firemission_envelope.flyoff_period)
to_chat(user, SPAN_WARNING("Not enough time to complete the Fire Mission"))
return FALSE
var/datum/cas_signal/recorded_loc = firemission_envelope.recorded_loc
Expand Down

0 comments on commit 644020a

Please sign in to comment.