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
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"
2 changes: 1 addition & 1 deletion code/datums/elements/light_eaten.dm
Original file line number Diff line number Diff line change
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
11 changes: 11 additions & 0 deletions code/modules/antagonists/nightmare/nightmare_abilities.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/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
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_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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 @@ -85,9 +85,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
2 changes: 2 additions & 0 deletions code/modules/spells/spell_types/jaunt/shadow_walk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
if(is_jaunting(owner))
return TRUE
var/turf/cast_turf = get_turf(owner)
check_passive_nightmare_snuff(owner, start = cast_turf) // monkestation edit
if(cast_turf.get_lumcount() >= light_threshold)
if(feedback)
to_chat(owner, span_warning("It isn't dark enough here!"))
Expand Down Expand Up @@ -121,6 +122,7 @@
*/

/obj/effect/dummy/phased_mob/shadow/proc/check_light_level(atom/location_to_check)
check_passive_nightmare_snuff(jaunter, start = location_to_check) // monkestation edit
var/turf/light_turf = get_turf(location_to_check)
return light_turf.get_lumcount() > light_max // jaunt ends on TRUE

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)
29 changes: 29 additions & 0 deletions monkestation/code/modules/nightmare/nightmare_equipment.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/obj/item/light_eater/attack_atom(atom/attacked_atom, mob/living/user, params)
if(!istype(attacked_atom, /obj/machinery/door/airlock) && !istype(attacked_atom, /obj/machinery/door/window))
return ..()

var/obj/machinery/door/opening = attacked_atom

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

var/has_power = opening.hasPower()

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

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

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

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.")
)

opening.open(BYPASS_DOOR_CHECKS)
50 changes: 50 additions & 0 deletions monkestation/code/modules/nightmare/nightmare_helpers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#define PASSIVE_SNUFF_LIMIT 0.5

/// Handles checking for nearby weak lights to auto-snuff as a nightmare. Start turf arg is optional and can be any atom, it'll just have get_turf called on it.
/proc/check_passive_nightmare_snuff(mob/living/carbon/nightmare, turf/start)
if(!istype(nightmare))
return

if(!istype(start))
start = get_turf(start || nightmare)

if(!istype(start)) // Really? How did you even... whatever, just ignore it.
return

var/lumcount = start.get_lumcount()
if(lumcount < SHADOW_SPECIES_LIGHT_THRESHOLD || lumcount > PASSIVE_SNUFF_LIMIT)
return

var/obj/item/organ/internal/heart/nightmare/heart = nightmare.get_organ_slot(ORGAN_SLOT_HEART)

if(!istype(heart) || !heart.blade)
return

var/snuffed_something = FALSE

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

if(istype(nearby, /obj/machinery/light))
var/obj/machinery/light/light_fixture = nearby
if(!light_fixture.low_power_mode) // prevents an issue where nightmares could just turn on a fire alarm to obliterate lights
continue

var/hsl = rgb2num(nearby.light_color, COLORSPACE_HSL)
if(nearby.light_power * (hsl[3] / 100) > 0.8) // power * lightness is a pretty good measure of "how bright is this thing"
return

SEND_SIGNAL(heart.blade, COMSIG_LIGHT_EATER_EAT, nearby, heart.blade, TRUE)
snuffed_something = TRUE

if(!snuffed_something)
return

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

#undef PASSIVE_SNUFF_LIMIT
19 changes: 19 additions & 0 deletions monkestation/code/modules/nightmare/nightmare_organs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/obj/item/organ/internal/brain/shadow/nightmare/on_insert(mob/living/carbon/brain_owner)
. = ..()
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_owner_moved))

/obj/item/organ/internal/brain/shadow/nightmare/on_life(seconds_per_tick, times_fired)
check_passive_nightmare_snuff(owner)

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.

return ..()

/obj/item/organ/internal/brain/shadow/nightmare/proc/on_owner_moved(datum/source, atom/old_loc, dir, forced, list/old_locs)
SIGNAL_HANDLER
check_passive_nightmare_snuff(owner)
5 changes: 5 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2945,6 +2945,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 @@ -5853,6 +5854,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 @@ -7434,6 +7436,9 @@
#include "monkestation\code\modules\modular_guns\components\gun_stat_modifiers.dm"
#include "monkestation\code\modules\modular_guns\crafting\part_recipes.dm"
#include "monkestation\code\modules\modular_guns\makeshift_effects\__base_effect.dm"
#include "monkestation\code\modules\nightmare\nightmare_equipment.dm"
#include "monkestation\code\modules\nightmare\nightmare_helpers.dm"
#include "monkestation\code\modules\nightmare\nightmare_organs.dm"
#include "monkestation\code\modules\ocean_content\department_consoles\engineering.dm"
#include "monkestation\code\modules\ocean_content\fluff\barrier.dm"
#include "monkestation\code\modules\ocean_content\fluff\base_turf_editor.dm"
Expand Down
Loading