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 all commits
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_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
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 @@ -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
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
alarm_sound_loop.falloff_distance = 7
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 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;
hislittlecuzingames marked this conversation as resolved.
Show resolved Hide resolved
}

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