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

Its time to go to heaven my child (Divine Warning) #3303

Merged
merged 15 commits into from
Sep 25, 2024
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: 2 additions & 1 deletion code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/mob/proc/overlay_fullscreen(category, type, severity)
/mob/proc/overlay_fullscreen(category, type, severity, alpha)
var/atom/movable/screen/fullscreen/screen = screens[category]
if (!screen || screen.type != type)
// needs to be recreated
Expand All @@ -10,6 +10,7 @@

screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity
screen.alpha = alpha || screen.alpha
if (client && screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen += screen
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@

//this handles hud updates
/mob/living/carbon/update_damage_hud()

..() // monkestation edit
if(!client)
return

Expand Down
79 changes: 79 additions & 0 deletions monkestation/code/modules/divine_warning/code/effects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#define HEAVEN_TIMETOGO (1<<0)
#define HEAVEN_TIMETOGO_PLAYED (1<<1)

/atom/movable/screen/fullscreen/divine
icon = 'monkestation/code/modules/divine_warning/icons/divine_warning.dmi'
icon_state = "he_waits_for_you"
layer = EMISSIVE_LAYER_UNBLOCKABLE
alpha = 120

/mob/living/proc/flash_divine_overlay(alpha = 120, soundvolume = 80, time = 2 SECONDS)
if(client?.prefs)
if(client.prefs.read_preference(/datum/preference/toggle/darkened_flash))
clear_fullscreen("divine", time)
return
if (world.time - last_divine_sound > 2.5 SECONDS)
soundvolume *= 0.8
SEND_SOUND(src, sound('monkestation/code/modules/divine_warning/sounds/divine.ogg', volume = soundvolume))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo, playsound_local should be used, so it respects the volume mixer and such

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does playsound_local ignore can_hear()?

overlay_fullscreen("divine", /atom/movable/screen/fullscreen/divine, 1, alpha)
last_divine_sound = world.time

clear_fullscreen("divine", time)

/mob/living/death(gibbed)
. = ..(gibbed)
if (!client || !src.mind || stat == DEAD) return

if (HAS_TRAIT(src, TRAIT_SPIRITUAL) || src.mind.holy_role > 0)
SEND_SOUND(src, sound('monkestation/code/modules/divine_warning/sounds/divine.ogg', 80))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous suggestion regarding playsound_local

last_divine_sound = world.time

/mob/living
var/last_divine_sound = 0
var/heaven_flags = 0

/mob/living/update_damage_hud()
. = ..()
// if (!client || !HAS_TRAIT(src, TRAIT_DIVINE)) return
if (!client || !src?.mind) return

if(health <= hardcrit_threshold && (HAS_TRAIT(src, TRAIT_SPIRITUAL) || src.mind.holy_role > 0) && stat != DEAD)
// playsound(src, 'monkestation/code/modules/divine_warning/sounds/divine.ogg', 60, TRUE, use_reverb = TRUE, pressure_affected = FALSE, )
var/severity = 0.2
switch(health)
if(-40 to -30)
severity = 0.5
heaven_flags = 0
if(-50 to -40)
severity = 1
heaven_flags = 0
if(-50 to -40)
severity = 2
heaven_flags = 0
Comment on lines +47 to +52
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this a typo? there's two duplicate sets of (-50 to -40), that do different things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah typo

if(-60 to -50)
severity = 3
heaven_flags = 0
if(-70 to -60)
severity = 4
heaven_flags = 0
if(-90 to -70)
severity = 5
heaven_flags = 0
if(-95 to -90)
severity = 6
heaven_flags |= HEAVEN_TIMETOGO
if(-INFINITY to -95)
severity = 7
heaven_flags |= HEAVEN_TIMETOGO
if(health < -90)
if (heaven_flags & HEAVEN_TIMETOGO && !(heaven_flags & HEAVEN_TIMETOGO_PLAYED))
SEND_SOUND(src, sound('monkestation/code/modules/divine_warning/sounds/heaven_time.ogg'))
heaven_flags |= HEAVEN_TIMETOGO_PLAYED

var/atom/movable/screen/fullscreen/divine/base_divine
var/alpha = initial(base_divine.alpha) * (severity / 10)
var/soundvolume = 100 * (severity / 10)
flash_divine_overlay(alpha, soundvolume)

#undef HEAVEN_TIMETOGO
#undef HEAVEN_TIMETOGO_PLAYED
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6818,6 +6818,7 @@
#include "monkestation\code\modules\displacement\displacements\assets.dm"
#include "monkestation\code\modules\displacement\displacements\large\apply_large.dm"
#include "monkestation\code\modules\displacement\displacements\large\assets.dm"
#include "monkestation\code\modules\divine_warning\code\effects.dm"
#include "monkestation\code\modules\donator\code\datum\loadout.dm"
#include "monkestation\code\modules\donator\code\item\choice_beacon.dm"
#include "monkestation\code\modules\donator\code\item\clothing.dm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const darkened_flash: FeatureToggle = {
category: 'GAMEPLAY',
description: multiline`
When toggled, being flashed will show a dark screen rather than a
bright one.
bright one. This also disables the divine warning visual.
`,
component: CheckboxInput,
};
Loading