Skip to content

Commit

Permalink
Its time to go to heaven my child (Divine Warning) (#3303)
Browse files Browse the repository at this point in the history
* feat: its time to go to heaven my child

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* fix: thing

* fix: use cooldown macros and fix things

* temporary: jesus christ.

* back to normal

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

* Update monkestation/code/modules/divine_warning/code/effects.dm

Co-authored-by: Lucy <[email protected]>

---------

Co-authored-by: Lucy <[email protected]>
  • Loading branch information
flleeppyy and Absolucy authored Sep 25, 2024
1 parent a03edea commit 3be9b7c
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 3 deletions.
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
77 changes: 77 additions & 0 deletions monkestation/code/modules/divine_warning/code/effects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#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, force = FALSE)
if(client?.prefs?.read_preference(/datum/preference/toggle/darkened_flash))
clear_fullscreen("divine", time)
return
if (COOLDOWN_FINISHED(src, divine_cooldown) || force)
soundvolume *= 0.8
SEND_SOUND(src, sound('monkestation/code/modules/divine_warning/sounds/divine.ogg', volume = soundvolume))
overlay_fullscreen("divine", /atom/movable/screen/fullscreen/divine, 1, alpha)
COOLDOWN_START(src, divine_cooldown, 2.5 SECONDS)
clear_fullscreen("divine", time)

/mob/living/death(gibbed)
. = ..()
if (QDELETED(client) || stat == DEAD)
return

if (HAS_TRAIT(src, TRAIT_SPIRITUAL) || mind?.holy_role)
SEND_SOUND(src, sound('monkestation/code/modules/divine_warning/sounds/divine.ogg', 80))
COOLDOWN_START(src, divine_cooldown, 2.5 SECONDS)

/mob/living
COOLDOWN_DECLARE(divine_cooldown)
var/heaven_flags = 0

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

if(health <= hardcrit_threshold && (HAS_TRAIT(src, TRAIT_SPIRITUAL) || mind?.holy_role) && 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 = NONE
if(-50 to -40)
severity = 1
heaven_flags = 0
if(-50 to -40)
severity = 2
heaven_flags = 0
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 (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/alpha = /atom/movable/screen/fullscreen/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 @@ -6970,6 +6970,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,
};

0 comments on commit 3be9b7c

Please sign in to comment.