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

Added Ability to turn on and turn off a dropship alarm. (Requires pro… #4858

Merged
merged 14 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
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
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved

.["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")
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
shuttle.alarm_sound_loop.start()
shuttle.playing_Launch_Announcement_Alarm = 1
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
return TRUE
if ("stopplaylaunchannouncementalarm")
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
shuttle.alarm_sound_loop.stop()
shuttle.playing_Launch_Announcement_Alarm = 0
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
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
Drulikar marked this conversation as resolved.
Show resolved Hide resolved

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

#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;
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
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) => {
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
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
Loading