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
…jecting-looping-sounds branch made 5 November 2023 to work)
  • Loading branch information
hislittlecuzingames committed Nov 6, 2023
1 parent 1cee6df commit 9bd2668
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
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.ogg' = 1)
start_sound = list('sound/items/taperecorder/taperecorder_hiss_start.ogg' = 1)
11 changes: 11 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 @@ -469,6 +472,14 @@
if("cancel-flyby")
if(shuttle.in_flyby && shuttle.timer && shuttle.timeLeft(1) >= DROPSHIP_WARMUP_TIME)
shuttle.setTimer(DROPSHIP_WARMUP_TIME)
if("playlaunchannouncementalarm")
shuttle.alarm_sound_loop.start()
shuttle.playing_Launch_Announcement_Alarm = 1
return TRUE
if ("stopplaylaunchannouncementalarm")
shuttle.alarm_sound_loop.stop()
shuttle.playing_Launch_Announcement_Alarm = 0
return TRUE

/obj/structure/machinery/computer/shuttle/dropship/flight/lz1
icon = 'icons/obj/structures/machinery/computer.dmi'
Expand Down
11 changes: 11 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 = 0 // 0 = off ; 1 = 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 @@ -410,6 +413,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

Check failure on line 421 in code/modules/shuttle/shuttle.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined field: "is_sound_projecting" on /datum/looping_sound/looping_launch_announcement_alarm
alarm_sound_loop.falloff_distance = 7

Check failure on line 422 in code/modules/shuttle/shuttle.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined field: "falloff_distance" on /datum/looping_sound/looping_launch_announcement_alarm

#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 added sound/vehicles/Dropships/Single Alarm brr.ogg
Binary file not shown.
60 changes: 60 additions & 0 deletions tgui/packages/tgui/interfaces/DropshipFlightControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ interface DropshipNavigationProps extends NavigationProps {
primary_lz?: string;
automated_control: AutomatedControl;
has_flyby_skill: 0 | 1;

playing_Launch_Announcement_Alarm: 0 | 1;
launchAnnouncementAlarmTimer: number /* the timer that counts */;
launchAnnouncementAlarmExpireTime: number /* When the timer expires. How long the alarm can play. */;
}

const DropshipDoorControl = (_, context) => {
Expand Down Expand Up @@ -276,6 +280,61 @@ const AutopilotConfig = (props, context) => {
);
};

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

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

export 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 === 0 && (
<PlayLaunchAnnouncementAlarm />
)}

{data.playing_Launch_Announcement_Alarm === 1 && (
<Button
onClick={() => act('stopplaylaunchannouncementalarm')}
icon="triangle-exclamation">
Stop Launch Alarm
</Button>
)}
</>
}
/>
);
};

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

0 comments on commit 9bd2668

Please sign in to comment.