Skip to content

Buffs nightmares to make them playable again #3777

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

Merged
merged 12 commits into from
Oct 22, 2024
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/__DEFINES/~monkestation/dcs/signals/signals_element.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
#define COMSIG_TURF_CHECKER_UPDATE_STATE "turf_checker_update_state"
#define COMPONENT_CHECKER_VALID_TURF (1<<0)
#define COMPONENT_CHECKER_INVALID_TURF (2<<0)

/// Used to externally force /datum/element/light_eater to handle eating a light without physical contact. Used by nightmares. (food, eater, silent)
#define COMSIG_LIGHT_EATER_EAT "light_eater_eat"
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
#define COMSIG_LIVING_GIVE_ITEM_CHECK "living_give_item_check"

#define COMSIG_LIVING_ITEM_OFFERED_PRECHECK "living_item_offer_precheck"

/// Initiates a nightmare snuff check (eats dim lights on everything within 2 tiles) with the given args. (turf/start_turf)
#define COMSIG_NIGHTMARE_SNUFF_CHECK "nightmare_snuff_check"
10 changes: 5 additions & 5 deletions code/datums/elements/light_eaten.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

. = ..()
var/atom/atom_target = target
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_POWER, PROC_REF(block_light_power))
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_RANGE, PROC_REF(block_light_range))
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_ON, PROC_REF(block_light_on))
RegisterSignal(atom_target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_POWER, PROC_REF(block_light_power), override = TRUE) // monkestation edit
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_RANGE, PROC_REF(block_light_range), override = TRUE) // monkestation edit
RegisterSignal(atom_target, COMSIG_ATOM_SET_LIGHT_ON, PROC_REF(block_light_on), override = TRUE) // monkestation edit
RegisterSignal(atom_target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine), override = TRUE) // monkestation edit

/// Because the lighting system does not like movable lights getting set_light() called.
switch(atom_target.light_system)
Expand Down Expand Up @@ -64,7 +64,7 @@
/datum/element/light_eaten/proc/on_examine(atom/eaten_light, mob/examiner, list/examine_text)
SIGNAL_HANDLER
examine_text += span_warning("It's dark and empty...")
if(isliving(examiner) && prob(20))
if(isliving(examiner) && prob(20) && !isnightmare(examiner)) // monkestation edit
var/mob/living/target = examiner
examine_text += span_danger("You can feel something in [eaten_light.p_them()] gnash at your eyes!")
target.adjust_temp_blindness(10 SECONDS)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/elements/light_eater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* - [food][/atom]: The atom to start the search for lights at.
* - [eater][/datum]: The light eater being used in this case.
*/
/datum/element/light_eater/proc/eat_lights(atom/food, datum/eater)
/datum/element/light_eater/proc/eat_lights(atom/food, datum/eater, silent) // monkestation edit
var/list/buffet = table_buffet(food)
if(!LAZYLEN(buffet))
return 0
Expand All @@ -53,7 +53,7 @@
for(var/morsel in buffet)
. += devour(morsel, eater)

if(!.)
if(!. || silent) // monkestation edit
return

food.visible_message(
Expand Down
23 changes: 23 additions & 0 deletions code/modules/antagonists/nightmare/nightmare_abilities.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/datum/action/cooldown/spell/jaunt/shadow_walk
check_flags = AB_CHECK_PHASED

/datum/action/cooldown/spell/jaunt/shadow_walk/IsAvailable(feedback)
if(!..())
return FALSE
if(owner.stat >= UNCONSCIOUS)
if(feedback)
owner.balloon_alert(owner, "unconscious!")
return FALSE
return TRUE

/datum/action/cooldown/spell/jaunt/shadow_walk/enter_jaunt(mob/living/jaunter, turf/loc_override)
. = ..()
RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(on_death))

/datum/action/cooldown/spell/jaunt/shadow_walk/exit_jaunt(mob/living/unjaunter, turf/loc_override)
. = ..()
UnregisterSignal(owner, COMSIG_LIVING_DEATH)

/datum/action/cooldown/spell/jaunt/shadow_walk/proc/on_death(datum/source, gibbed)
SIGNAL_HANDLER
exit_jaunt(owner)
3 changes: 2 additions & 1 deletion code/modules/antagonists/nightmare/nightmare_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
armour_penetration = 35
lefthand_file = 'icons/mob/inhands/antag/changeling_lefthand.dmi'
righthand_file = 'icons/mob/inhands/antag/changeling_righthand.dmi'
item_flags = ABSTRACT | DROPDEL | ACID_PROOF
item_flags = ABSTRACT | DROPDEL
resistance_flags = INDESTRUCTIBLE | ACID_PROOF | FIRE_PROOF | LAVA_PROOF | UNACIDABLE
w_class = WEIGHT_CLASS_HUGE
sharpness = SHARP_EDGED
tool_behaviour = TOOL_MINING
Expand Down
1 change: 1 addition & 0 deletions code/modules/antagonists/nightmare/nightmare_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
/obj/item/organ/internal/brain/shadow/nightmare/proc/dodge_bullets(mob/living/carbon/human/source, obj/projectile/hitting_projectile, def_zone)
SIGNAL_HANDLER
var/turf/dodge_turf = source.loc
SEND_SIGNAL(source, COMSIG_NIGHTMARE_SNUFF_CHECK, dodge_turf) // monkestation edit
if(!istype(dodge_turf) || dodge_turf.get_lumcount() >= SHADOW_SPECIES_LIGHT_THRESHOLD)
return NONE
source.visible_message(
Expand Down
1 change: 1 addition & 0 deletions code/modules/antagonists/nightmare/nightmare_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
TRAIT_NODISMEMBER,
TRAIT_NOHUNGER,
TRAIT_NOBLOOD,
TRAIT_NO_PAIN_EFFECTS, // monkestation edit
)

mutantheart = /obj/item/organ/internal/heart/nightmare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
return
var/light_amount = owner_turf.get_lumcount()

if(light_amount > SHADOW_SPECIES_LIGHT_THRESHOLD) //if there's enough light, start dying
if(light_amount >= SHADOW_SPECIES_LIGHT_THRESHOLD) //if there's enough light, start dying -minor monke edit
owner.take_overall_damage(brute = 0.5 * seconds_per_tick, burn = 0.5 * seconds_per_tick, required_bodytype = BODYTYPE_ORGANIC)
else if (light_amount < SHADOW_SPECIES_LIGHT_THRESHOLD) //heal in the dark
else //heal in the dark -minor monke edit
owner.heal_overall_damage(brute = 0.5 * seconds_per_tick, burn = 0.5 * seconds_per_tick, required_bodytype = BODYTYPE_ORGANIC)

/obj/item/organ/internal/eyes/shadow
Expand Down
11 changes: 8 additions & 3 deletions code/modules/spells/spell_types/jaunt/shadow_walk.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/datum/action/cooldown/spell/jaunt/shadow_walk
name = "Shadow Walk"
desc = "Grants unlimited movement in darkness."
desc = "Grants unlimited movement and increased healing in darkness." // monkestation edit
background_icon_state = "bg_alien"
overlay_icon_state = "bg_alien_border"
button_icon = 'icons/mob/actions/actions_minor_antag.dmi'
Expand Down Expand Up @@ -45,7 +45,7 @@
exit_jaunt(cast_on)
return

playsound(get_turf(owner), 'sound/magic/ethereal_enter.ogg', 50, TRUE, -1)
playsound(get_turf(owner), 'sound/effects/nightmare_poof.ogg', 50, TRUE, -1, ignore_walls = FALSE)
cast_on.visible_message(span_boldwarning("[cast_on] melts into the shadows!"))
cast_on.SetAllImmobility(0)
cast_on.setStaminaLoss(0, FALSE)
Expand Down Expand Up @@ -96,6 +96,11 @@
to_chat(user, span_warning("It really would not be wise to go into space."))
return FALSE
if(check_light_level(.))
// MONKESTATION EDIT START
SEND_SIGNAL(user, COMSIG_NIGHTMARE_SNUFF_CHECK, .) // Snuffs nearby lights as if we had already moved to the tile.
if(!check_light_level(.)) // Now we check again after snuffing any dim lights.
return
// MONKESTATION EDIT END
if(!light_step_warning())
return FALSE

Expand All @@ -107,7 +112,7 @@
reveal_turf.visible_message(span_boldwarning("[jaunter] is revealed by the light!"))
else
reveal_turf.visible_message(span_boldwarning("[jaunter] emerges from the darkness!"))
playsound(reveal_turf, 'sound/magic/ethereal_exit.ogg', 50, TRUE, -1)
playsound(reveal_turf, 'sound/effects/nightmare_reappear.ogg', 50, TRUE, -1, ignore_walls = FALSE)

return ..()

Expand Down
7 changes: 7 additions & 0 deletions monkestation/code/datums/elements/light_eater.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/datum/element/light_eater/Attach(datum/target)
. = ..()
RegisterSignal(target, COMSIG_LIGHT_EATER_EAT, PROC_REF(on_eat_signal))

/datum/element/light_eater/proc/on_eat_signal(datum/source, food, eater, silent)
SIGNAL_HANDLER
eat_lights(food, eater, silent)
123 changes: 123 additions & 0 deletions monkestation/code/modules/_nightmare/nightmare_equipment.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#define PASSIVE_SNUFF_LIMIT 0.5

/obj/item/light_eater
COOLDOWN_DECLARE(message_cooldown)
COOLDOWN_DECLARE(snuff_message_cooldown)

/obj/item/light_eater/equipped(mob/user, slot, initial)
. = ..()
var/static/list/containers_connections = list(COMSIG_MOVABLE_MOVED = PROC_REF(on_moved))
AddComponent(/datum/component/connect_containers, user, containers_connections)
RegisterSignal(user, COMSIG_NIGHTMARE_SNUFF_CHECK, PROC_REF(do_snuff_check))
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
START_PROCESSING(SSprocessing, src)

/obj/item/light_eater/dropped(mob/user, silent)
. = ..()
UnregisterSignal(user, list(COMSIG_NIGHTMARE_SNUFF_CHECK, COMSIG_MOVABLE_MOVED))
STOP_PROCESSING(SSprocessing, src)

/obj/item/light_eater/proc/on_moved(atom/movable/source, atom/old_loc, dir, forced, list/old_locs)
SIGNAL_HANDLER
do_snuff_check(loc, get_turf(source))

/obj/item/light_eater/proc/do_snuff_check(mob/user, turf/start_turf)
if(!start_turf)
return

var/lumcount = start_turf.get_lumcount()
if(lumcount > PASSIVE_SNUFF_LIMIT)
return

var/snuffed_something = FALSE

for(var/atom/nearby as anything in view(2, start_turf))
if(!nearby.light || !nearby.light_on)
continue

if(istype(nearby, /obj/machinery/light))
var/obj/machinery/light/light_fixture = nearby
if(!light_fixture.low_power_mode) // Otherwise the emergency lights caused by tripping a fire alarm get snuffed and we don't want that.
continue

var/hsl = rgb2num(nearby.light_color, COLORSPACE_HSL)
if(nearby.light_power * (hsl[3] / 100) > 0.8) // The power of the light multiplied by its lightness is a good indicator of its overall brightness.
return

SEND_SIGNAL(src, COMSIG_LIGHT_EATER_EAT, nearby, src, TRUE)
snuffed_something = TRUE

if(!snuffed_something || !COOLDOWN_FINISHED(src, snuff_message_cooldown))
return

COOLDOWN_START(src, snuff_message_cooldown, 1 SECOND)

user.visible_message(
message = span_danger("Something dark in [src] lashes out at nearby lights!"),
self_message = span_notice("Your [name] lashes out at nearby lights!"),
blind_message = span_danger("You feel a gnawing pulse eat at your sight.")
)

/obj/item/light_eater/process(seconds_per_tick)
do_snuff_check(loc, get_turf(loc))

/obj/item/light_eater/pre_attack(atom/target, mob/living/user)
. = ..()
if(.)
return

if(user.istate & ISTATE_HARM) // In this case, you want to hit the door instead of prying it open.
return

var/is_fire_door = istype(target, /obj/machinery/door/firedoor)

if(!is_fire_door && !istype(target, /obj/machinery/door/airlock) && !istype(target, /obj/machinery/door/window))
return

var/obj/machinery/door/opening = target

if(!opening.density) // Don't bother opening that which is already open.
return

var/has_power = opening.hasPower() && !is_fire_door

if((!opening.requiresID() || opening.allowed(user)) && has_power) // Blocks useless messages for doors we can open normally.
return

if(has_power)
if(check_message_cd())
opening.balloon_alert(user, "powered!")
return TRUE

if(opening.locked)
if(check_message_cd())
opening.balloon_alert(user, "bolted!")
return TRUE

if(opening.welded)
if(check_message_cd())
opening.balloon_alert(user, "welded!")
return TRUE

user.visible_message(
message = span_warning("[user] forces [opening] to open with [user.p_their()] [src]!"),
self_message = span_warning("We force [opening] to open."),
blind_message = span_hear("You hear a metal screeching sound.")
)

if(is_fire_door)
var/obj/machinery/door/firedoor/fire_door = opening
if(user.istate & ISTATE_SECONDARY)
fire_door.try_to_crowbar_secondary(src, user)
else
fire_door.try_to_crowbar(src, user)
else
opening.open(BYPASS_DOOR_CHECKS)
return TRUE

/obj/item/light_eater/proc/check_message_cd()
. = COOLDOWN_FINISHED(src, message_cooldown)
if(.)
COOLDOWN_START(src, message_cooldown, 5 SECONDS)

#undef PASSIVE_SNUFF_LIMIT
8 changes: 8 additions & 0 deletions monkestation/code/modules/_nightmare/nightmare_organs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/obj/item/organ/internal/brain/shadow/nightmare/on_life(seconds_per_tick, times_fired)
. = ..()
if(length(owner.all_wounds) && SPT_PROB(10, seconds_per_tick))
var/turf/owner_turf = get_turf(owner)
if(owner_turf.get_lumcount() < SHADOW_SPECIES_LIGHT_THRESHOLD)
var/datum/wound/wound = pick(owner.all_wounds)
to_chat(owner, span_green("The darkness soothes the [lowertext(wound.name)] in your [wound.limb.plaintext_zone]!"))
qdel(wound) // Occasionally heal a random wound while in the dark.
4 changes: 4 additions & 0 deletions sound/attributions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,7 @@ https://freesound.org/people/steaq/sounds/560124/
refinery.ogg, smelter.ogg, and wooping_teleport.ogg are all original works by ArcaneMusic,
with smelter.ogg using samples from rock_break alongside original sound effects from a warrior electric drill,
where refinery and wooping_teleport are modifications of that same electric drill recording.

nightmare_poof.ogg and nightmare_reappear.ogg are comprised of breath_01.wav by Nightflame (CC0) and slide-click.wav by Qat (CC0)
https://freesound.org/people/Qat/sounds/108332/
https://freesound.org/people/Nightflame/sounds/368615/
Binary file added sound/effects/nightmare_poof.ogg
Binary file not shown.
Binary file added sound/effects/nightmare_reappear.ogg
Binary file not shown.
4 changes: 4 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2946,6 +2946,7 @@
#include "code\modules\antagonists\malf_ai\malf_ai_modules.dm"
#include "code\modules\antagonists\morph\morph_antag.dm"
#include "code\modules\antagonists\nightmare\nightmare.dm"
#include "code\modules\antagonists\nightmare\nightmare_abilities.dm"
#include "code\modules\antagonists\nightmare\nightmare_equipment.dm"
#include "code\modules\antagonists\nightmare\nightmare_organs.dm"
#include "code\modules\antagonists\nightmare\nightmare_species.dm"
Expand Down Expand Up @@ -5856,6 +5857,7 @@
#include "monkestation\code\datums\diseases\advance\symptoms\clockwork.dm"
#include "monkestation\code\datums\elements\area_locked.dm"
#include "monkestation\code\datums\elements\basic_eating.dm"
#include "monkestation\code\datums\elements\light_eater.dm"
#include "monkestation\code\datums\elements\loomable.dm"
#include "monkestation\code\datums\elements\trash_if_empty.dm"
#include "monkestation\code\datums\elements\uncompressed_storage.dm"
Expand Down Expand Up @@ -5986,6 +5988,8 @@
#include "monkestation\code\game\objects\structures\crates_lockers\crates\secure.dm"
#include "monkestation\code\game\turfs\open\water.dm"
#include "monkestation\code\game\turfs\open\floor\misc_floor.dm"
#include "monkestation\code\modules\_nightmare\nightmare_equipment.dm"
#include "monkestation\code\modules\_nightmare\nightmare_organs.dm"
#include "monkestation\code\modules\_paperwork\paper_premade.dm"
#include "monkestation\code\modules\a_medical_day\internal_bleeding.dm"
#include "monkestation\code\modules\a_medical_day\lungless.dm"
Expand Down
21 changes: 17 additions & 4 deletions tgui/packages/tgui/interfaces/AntagInfoNightmare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const noticestyle = {

export const AntagInfoNightmare = (props) => {
return (
<Window width={620} height={340}>
<Window width={620} height={470}>
<Window.Content backgroundColor="#0d0d0d">
<Stack fill>
<Stack.Item width="46.2%">
Expand Down Expand Up @@ -42,6 +42,14 @@ export const AntagInfoNightmare = (props) => {
<span style={tipstyle}>Tip #3:&ensp;</span>
Fully destroy APCs when possible. Instead of hunting lights
that can be fixed, hunt the APCs which are harder to repair.
Additionally, breaking APCs will dim lighting, which your
light eater can automatically snuff out for you.
<br />
<span style={tipstyle}>Tip #4:&ensp;</span>
Since your light eater automatically snuffs out nearby lights,
you don&apos;t have to worry about things like the green glow
of APCs. This works even while jaunting, allowing you to black
out entire rooms in seconds if the power is off.
</Stack.Item>
</Stack>
</Section>
Expand All @@ -51,19 +59,24 @@ export const AntagInfoNightmare = (props) => {
<LabeledList>
<LabeledList.Item label="Shadow Dance">
Whilst in the shadows, you are immune to all ranged attacks,
whilst also rapidly regenerating health.
whilst also rapidly regenerating health and slowly recovering
from wounds. However, lasers will bypass this, as they produce
a lot of light.
</LabeledList.Item>
<LabeledList.Item label="Shadow Walk">
You are allowed unlimited, unrestricted movement in the dark.
Light will pull you out of this.
While jaunting, your natural healing is amplified. Light will
pull you out of this.
</LabeledList.Item>
<LabeledList.Item label="Heart of Darkness">
Your heart invites the shadows. If you die in the darkness,
you will eventually revive if left alone.
</LabeledList.Item>
<LabeledList.Item label="Light Eater">
Your twisted appendage. It will consume the light of what it
touches, be it victim or object.
touches, be it victim or object. When unobstructed by bright
light, it&apos;ll lash out at anything dim in your vicinity,
completely hiding you in the shadows.
</LabeledList.Item>
</LabeledList>
</Section>
Expand Down
Loading