Skip to content

Commit

Permalink
Added Ability to turn on and turn off a dropship alarm. (Requires pro… (
Browse files Browse the repository at this point in the history
#4858)

…jecting-looping-sounds branch made 5 November 2023 to work)

#ATTENTION!!!!!
Requires this PR to be approved first to work:
#4857
# About the pull request
Makes an alarm the pilots can use on alamo or normandy to tell ground
forces "Hey I plan on taking off soon."

# Explain why it's good for the game

The ship takeoff sound to taking off is like 7 seconds. 
Ground combat is mad intense & people can miss people talking. So having
that alarm may make it so people hear that they're leaving before the
ship leaves.


# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

oh... 

</details>


# Changelog

:cl:
add: Launch Announcement Alarm for dropships to notify ground forces of
departure.
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
hislittlecuzingames and Drulikar authored Nov 21, 2023
1 parent 56a0b3e commit 9c274b6
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 1 deletion.
3 changes: 3 additions & 0 deletions code/datums/looping_sounds/misc_sounds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/looping_sound/looping_launch_announcement_alarm
mid_sounds = list('sound/vehicles/Dropships/single_alarm_brr_dropship_1.ogg' = 1)
start_sound = list('sound/vehicles/Dropships/single_alarm_brr_dropship_1.ogg' = 1)
22 changes: 22 additions & 0 deletions code/modules/shuttle/computers/dropship_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@
.["door_status"] = is_remote ? list() : shuttle.get_door_data()
.["has_flyby_skill"] = skillcheck(user, SKILL_PILOT, SKILL_PILOT_EXPERT)

// Launch Alarm Variables
.["playing_launch_announcement_alarm"] = shuttle.playing_launch_announcement_alarm

.["destinations"] = list()
// add flight
.["destinations"] += list(
Expand Down Expand Up @@ -381,6 +384,7 @@
msg_admin_niche(log)
log_interact(user, msg = "[log]")
shuttle.send_for_flyby()
stop_playing_launch_announcement_alarm()
return TRUE

update_equipment(is_optimised, FALSE)
Expand Down Expand Up @@ -410,6 +414,7 @@
var/log = "[key_name(user)] launched the dropship [src.shuttleId] on transport."
msg_admin_niche(log)
log_interact(user, msg = "[log]")
stop_playing_launch_announcement_alarm()
return TRUE
if("button-push")
playsound(loc, get_sfx("terminal_button"), KEYBOARD_SOUND_VOLUME, 1)
Expand Down Expand Up @@ -469,6 +474,23 @@
if("cancel-flyby")
if(shuttle.in_flyby && shuttle.timer && shuttle.timeLeft(1) >= DROPSHIP_WARMUP_TIME)
shuttle.setTimer(DROPSHIP_WARMUP_TIME)
if("play_launch_announcement_alarm")
if (shuttle.mode != SHUTTLE_IDLE && shuttle.mode != SHUTTLE_RECHARGING)
to_chat(usr, SPAN_WARNING("The Launch Announcement Alarm is designed to tell people that you're going to take off soon."))
return
shuttle.alarm_sound_loop.start()
shuttle.playing_launch_announcement_alarm = TRUE
return
if ("stop_playing_launch_announcement_alarm")
stop_playing_launch_announcement_alarm()
return

/obj/structure/machinery/computer/shuttle/dropship/flight/proc/stop_playing_launch_announcement_alarm()
var/obj/docking_port/mobile/marine_dropship/shuttle = SSshuttle.getShuttle(shuttleId)

shuttle.alarm_sound_loop.stop()
shuttle.playing_launch_announcement_alarm = FALSE
return

/obj/structure/machinery/computer/shuttle/dropship/flight/lz1
icon = 'icons/obj/structures/machinery/computer.dmi'
Expand Down
12 changes: 12 additions & 0 deletions code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@
var/rechargeTime = 0 //time spent after arrival before being able to launch again
var/prearrivalTime = 0 //delay after call time finishes for sound effects, explosions, etc.

var/playing_launch_announcement_alarm = FALSE // FALSE = off ; TRUE = on
var/datum/looping_sound/looping_launch_announcement_alarm/alarm_sound_loop

var/landing_sound = 'sound/effects/engine_landing.ogg'
var/ignition_sound = 'sound/effects/engine_startup.ogg'
/// Default shuttle audio ambience while flying
Expand Down Expand Up @@ -383,6 +386,7 @@

/obj/docking_port/mobile/Destroy(force)
if(force)
QDEL_NULL(alarm_sound_loop)
SSshuttle.mobile -= src
destination = null
previous = null
Expand Down Expand Up @@ -410,6 +414,14 @@
initial_engines = count_engines()
current_engines = initial_engines

//Launch Announcement Alarm variables setup
alarm_sound_loop = new(src)
alarm_sound_loop.mid_length = 20
alarm_sound_loop.extra_range = 30
alarm_sound_loop.volume = 100
alarm_sound_loop.is_sound_projecting = TRUE
alarm_sound_loop.falloff_distance = 7

#ifdef DOCKING_PORT_HIGHLIGHT
highlight("#0f0")
#endif
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@
#include "code\datums\langchat\langchat.dm"
#include "code\datums\looping_sounds\_looping_sound.dm"
#include "code\datums\looping_sounds\item_sounds.dm"
#include "code\datums\looping_sounds\misc_sounds.dm"
#include "code\datums\origin\civilian.dm"
#include "code\datums\origin\origin.dm"
#include "code\datums\origin\upp.dm"
Expand Down
Binary file not shown.
55 changes: 54 additions & 1 deletion tgui/packages/tgui/interfaces/DropshipFlightControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface DropshipNavigationProps extends NavigationProps {
primary_lz?: string;
automated_control: AutomatedControl;
has_flyby_skill: 0 | 1;

playing_launch_announcement_alarm: boolean;
}

const DropshipDoorControl = (_, context) => {
Expand All @@ -42,7 +44,10 @@ const DropshipDoorControl = (_, context) => {
<Button
disabled={disable_door_controls}
onClick={() =>
act('door-control', { interaction: 'lock', location: 'all' })
act('door-control', {
interaction: 'lock',
location: 'all',
})
}
icon="triangle-exclamation">
Lockdown
Expand Down Expand Up @@ -276,6 +281,53 @@ const AutopilotConfig = (props, context) => {
);
};

const StopLaunchAnnouncementAlarm = (_, context) => {
const { act } = useBackend<NavigationProps>(context);
return (
<Button
icon="ban"
onClick={() => {
act('stop_playing_launch_announcement_alarm');
}}>
Stop Alarm
</Button>
);
};

const PlayLaunchAnnouncementAlarm = (_, context) => {
const { act } = useBackend<NavigationProps>(context);
return (
<Button
icon="rocket"
onClick={() => {
act('play_launch_announcement_alarm');
}}>
Start Alarm
</Button>
);
};

const LaunchAnnouncementAlarm = (_, context) => {
const { data, act } = useBackend<DropshipNavigationProps>(context);
const [siteselection, setSiteSelection] = useSharedState<string | undefined>(
context,
'target_site',
undefined
);
return (
<Section
title="Launch Announcement Alarm"
buttons={
!data.playing_launch_announcement_alarm ? (
<PlayLaunchAnnouncementAlarm />
) : (
<StopLaunchAnnouncementAlarm />
)
}
/>
);
};

const RenderScreen = (props, context) => {
const { data } = useBackend<DropshipNavigationProps>(context);
return (
Expand All @@ -292,6 +344,7 @@ const RenderScreen = (props, context) => {
<DropshipDestinationSelection />
)}
{data.door_status.length > 0 && <DropshipDoorControl />}
{<LaunchAnnouncementAlarm />}
</>
);
};
Expand Down

0 comments on commit 9c274b6

Please sign in to comment.