Files
Jacquerel faf2000100 Rust doesn't apply effects to people who aren't touching it (#94733)
## About The Pull Request

Heretic rusted tiles do not apply any effects to things which are
jaunting or inside vents.
They also don't apply any _negative_ effects to things that are flying
(but they do apply positive ones, just because flight is a cool thing to
have earned and it would be sad to lose your bonuses because you have
wings).

I also renamed the element so that it isn't named after the rust passive
(in fact, the rust heretics with that passive don't use the element) and
simply describes what it does, and removed a subtype in favour of just
passing in some arguments.

I also added a trait which bypasses the negative effects of standing in
rust, in case an admin creates a non-heretic creature and gives it rust
healing. They shouldn't have _both_ healing _and_ gain disgust and minor
damage from starting in rust (possibly the heretical harvester was being
effected by this?)

Finally I adjusted the `rust_heretic_act` and `rust_turf` procs to
remove a footgun I saw a developer fall into recently where they didn't
realise that the generically named "rust turf" proc actually assumes a
wizard did it, now if we add anything else that wants to non-magically
rust a turf then it will work the way you expect.
As a side effect this changes the two item sources of rust that heretics
get to actually use rust resistance rather than rusting every turf, I
set them to effect all inorganic turfs as a default.
And finally I noticed that rust heretic ascension was passing
"RUST_RESISTANCE_ABSOLUTE" as a value into its proc which reads `Should
not be rustable. EVER.` in its comment, which smelled like a bug. So I
changed it to just "things which should be rustable ever".

## Why It's Good For The Game

It is the logical way you would expect these things to work;
Heretics crawling in vents or (for instance) using space crawl should
not be healed for touching rust that they aren't touching, as they are
not readily accessible to other players. The idea of the rust healing is
that it's a tradeoff for exposing yourself in a visible "territory", so
you shouldn't be able to avoid it by being in that territory but
untouchable and invisible.
Similarly, players who have gained the ability to fly would not expect
to get sick from flying over rusty flooring. They're out of range.

## Changelog

🆑
balance: Eldritch rusted tiles don't apply their effects to anyone who
is jaunted or in vents, and don't apply negative effects to people who
are flying.
balance: Heretic items which apply rust (grenades and eldritch reagent)
check the rust resistance level of the turf rather than always rusting
it.
fix: Rust Heretics ascending don't rust unrustable turfs, like space
tiles.
/🆑
2026-01-15 12:43:39 +00:00

69 lines
2.6 KiB
Plaintext

/// Buffs and heals the target while standing on rust.
/datum/element/rust_healing
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// How much HP to heal per second
var/heal_amount
/// How much stamina to heal per second
var/stamina_heal_amount
/datum/element/rust_healing/Attach(atom/target, baton_resistance = TRUE, heal_amount = 3, stamina_heal_amount = 10)
. = ..()
if (!isliving(target))
return ELEMENT_INCOMPATIBLE
if (baton_resistance)
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
RegisterSignal(target, COMSIG_LIVING_LIFE, PROC_REF(on_life))
src.heal_amount = heal_amount
src.stamina_heal_amount = stamina_heal_amount
ADD_TRAIT(target, TRAIT_RUSTIMMUNE, ELEMENT_TRAIT(type))
/datum/element/rust_healing/Detach(atom/source)
. = ..()
UnregisterSignal(source, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_LIFE))
REMOVE_TRAIT(source, TRAIT_RUSTIMMUNE, ELEMENT_TRAIT(type))
/*
* Signal proc for [COMSIG_MOVABLE_MOVED].
*
* Checks if we should have baton resistance on the new turf.
*/
/datum/element/rust_healing/proc/on_move(mob/source, atom/old_loc, dir, forced, list/old_locs)
SIGNAL_HANDLER
if(source.is_touching_rust())
ADD_TRAIT(source, TRAIT_BATON_RESISTANCE, type)
else
REMOVE_TRAIT(source, TRAIT_BATON_RESISTANCE, type)
/**
* Signal proc for [COMSIG_LIVING_LIFE].
*
* Gradually heals the heretic ([source]) on rust,
* including baton knockdown and stamina damage.
*/
/datum/element/rust_healing/proc/on_life(mob/living/source, seconds_per_tick)
SIGNAL_HANDLER
if(!source.is_touching_rust())
return
// Heals all damage + Stamina
var/need_mob_update = FALSE
var/delta_time = DELTA_WORLD_TIME(SSmobs) * 0.5 // SSmobs.wait is 2 secs, so this should be halved.
need_mob_update += source.adjust_brute_loss(-heal_amount * delta_time, updating_health = FALSE)
need_mob_update += source.adjust_fire_loss(-heal_amount * delta_time, updating_health = FALSE)
need_mob_update += source.adjust_tox_loss(-heal_amount * delta_time, updating_health = FALSE, forced = TRUE) // Slimes are people too
need_mob_update += source.adjust_oxy_loss(-heal_amount / 2 * delta_time, updating_health = FALSE)
need_mob_update += source.adjust_stamina_loss(-stamina_heal_amount * delta_time, updating_stamina = FALSE)
if(need_mob_update)
source.updatehealth()
new /obj/effect/temp_visual/heal(get_turf(source), COLOR_BROWN)
// Reduces duration of stuns/etc
source.AdjustAllImmobility((-0.5 SECONDS) * delta_time)
// Heals blood loss
source.adjust_blood_volume(2.5 * delta_time, maximum = BLOOD_VOLUME_NORMAL)
// Slowly regulates your body temp
source.adjust_bodytemperature((source.get_body_temp_normal() - source.bodytemperature) / 5)