Skip to content

Commit

Permalink
Working Alarm Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hislittlecuzingames committed May 27, 2024
1 parent 7c476f8 commit 803a6d2
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 13 deletions.
5 changes: 5 additions & 0 deletions code/datums/looping_sounds/misc_sounds.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/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)


/datum/looping_sound/looping_cycle_launch_announcement_alarm
mid_sounds = list('sound/vehicles/Dropships/single_alarm_cycle_dropship_1.ogg')
start_sound = list('sound/vehicles/Dropships/single_alarm_cycle_dropship_1.ogg')
33 changes: 29 additions & 4 deletions code/modules/shuttle/computers/dropship_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
if(xeno.hive_pos != XENO_QUEEN)
// If the 'about to launch' alarm is playing, a xeno can whack the computer to stop it.
if(dropship.playing_launch_announcement_alarm)
stop_playing_launch_announcement_alarm()
stop_all_alarms()
xeno.animation_attack_on(src)
to_chat(xeno, SPAN_XENONOTICE("We slash at [src], silencing its squawking!"))
playsound(loc, 'sound/machines/terminal_shutdown.ogg', 20)
Expand Down Expand Up @@ -252,7 +252,7 @@
addtimer(CALLBACK(GLOB.almayer_orbital_cannon, TYPE_PROC_REF(/obj/structure/orbital_cannon, enable)), 10 MINUTES, TIMER_UNIQUE)
if(!GLOB.resin_lz_allowed)
set_lz_resin_allowed(TRUE)
stop_playing_launch_announcement_alarm()
stop_all_alarms()

to_chat(xeno, SPAN_XENONOTICE("You override the doors."))
xeno_message(SPAN_XENOANNOUNCE("The doors of the metal bird have been overridden! Rejoice!"), 3, xeno.hivenumber)
Expand Down Expand Up @@ -359,6 +359,7 @@

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

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

update_equipment(is_optimised, FALSE)
Expand Down Expand Up @@ -452,7 +453,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()
stop_all_alarms()
return TRUE
if("button-push")
playsound(loc, get_sfx("terminal_button"), KEYBOARD_SOUND_VOLUME, 1)
Expand Down Expand Up @@ -523,13 +524,37 @@
stop_playing_launch_announcement_alarm()
return

//Cycle alarms - for cycling, not evacuating.
if("play_cycle_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.cycle_alarm_sound_loop.start()
shuttle.playing_cycle_launch_announcement_alarm = TRUE
return
if ("stop_playing_cycle_launch_announcement_alarm")
stop_playing_launch_cycle_announcement_alarm()
return


/obj/structure/machinery/computer/shuttle/dropship/flight/proc/stop_all_alarms()
stop_playing_launch_announcement_alarm()
stop_playing_launch_cycle_announcement_alarm()

/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/proc/stop_playing_launch_cycle_announcement_alarm()
var/obj/docking_port/mobile/marine_dropship/shuttle = SSshuttle.getShuttle(shuttleId)

shuttle.cycle_alarm_sound_loop.stop()
shuttle.playing_cycle_launch_announcement_alarm = FALSE
return

/obj/structure/machinery/computer/shuttle/dropship/flight/lz1
icon = 'icons/obj/structures/machinery/computer.dmi'
icon_state = "shuttle"
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,8 @@

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

var/landing_sound = 'sound/effects/engine_landing.ogg'
var/ignition_sound = 'sound/effects/engine_startup.ogg'
Expand Down Expand Up @@ -457,6 +459,7 @@
/obj/docking_port/mobile/Destroy(force)
if(force)
QDEL_NULL(alarm_sound_loop)
QDEL_NULL(cycle_alarm_sound_loop)
SSshuttle.mobile -= src
destination = null
previous = null
Expand Down Expand Up @@ -492,6 +495,14 @@
alarm_sound_loop.is_sound_projecting = TRUE
alarm_sound_loop.falloff_distance = 7

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

#ifdef DOCKING_PORT_HIGHLIGHT
highlight("#0f0")
#endif
Expand Down
Binary file not shown.
Binary file not shown.
65 changes: 56 additions & 9 deletions tgui/packages/tgui/interfaces/DropshipFlightControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ interface DropshipNavigationProps extends NavigationProps {
has_flyby_skill: 0 | 1;

playing_launch_announcement_alarm: boolean;
playing_cycle_launch_announcement_alarm: boolean
}

const DropshipDoorControl = () => {
Expand Down Expand Up @@ -329,7 +330,7 @@ const StopLaunchAnnouncementAlarm = () => {
act('stop_playing_launch_announcement_alarm');
}}
>
Stop Alarm
Stop Main Alarm
</Button>
);
};
Expand All @@ -343,7 +344,35 @@ const PlayLaunchAnnouncementAlarm = () => {
act('play_launch_announcement_alarm');
}}
>
Start Alarm
Start Main Alarm
</Button>
);
};

const StopCycleLaunchAnnouncementAlarm = () => {
const { act } = useBackend<NavigationProps>();
return (
<Button
icon="ban"
onClick={() => {
act('stop_playing_cycle_launch_announcement_alarm');
}}
>
Stop Cycle Alarm
</Button>
);
};

const PlayCycleLaunchAnnouncementAlarm = () => {
const { act } = useBackend<NavigationProps>();
return (
<Button
icon="rocket"
onClick={() => {
act('play_cycle_launch_announcement_alarm');
}}
>
Play Cycle Alarm
</Button>
);
};
Expand All @@ -358,13 +387,31 @@ const LaunchAnnouncementAlarm = () => {
<Section
title="Launch Announcement Alarm"
buttons={
!data.playing_launch_announcement_alarm ? (
<PlayLaunchAnnouncementAlarm />
) : (
<StopLaunchAnnouncementAlarm />
)
(!data.playing_launch_announcement_alarm ?
( <PlayLaunchAnnouncementAlarm /> )
:
( <StopLaunchAnnouncementAlarm /> )
)
}
/>
>
<Stack vertical className="AnnouncementAlarms">
{
(!data.playing_launch_announcement_alarm ?
( <PlayLaunchAnnouncementAlarm /> )
:
( <StopLaunchAnnouncementAlarm /> )
)
}

{
(!data.playing_cycle_launch_announcement_alarm ?
( <PlayCycleLaunchAnnouncementAlarm /> )
:
( <StopCycleLaunchAnnouncementAlarm /> )
)
}
</Stack>
</Section>
);
};

Expand Down Expand Up @@ -392,7 +439,7 @@ const RenderScreen = (props) => {
export const DropshipFlightControl = (props) => {
const { data } = useBackend<DropshipNavigationProps>();
return (
<Window theme="crtgreen" height={500} width={700}>
<Window theme="crtgreen" height={650} width={700}>
<Window.Content className="NavigationMenu">
{data.is_disabled === 1 && <DisabledScreen />}
{data.is_disabled === 0 && <RenderScreen />}
Expand Down

0 comments on commit 803a6d2

Please sign in to comment.