mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-22 22:54:33 +01:00
faf2000100
## 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. /🆑
140 lines
5.2 KiB
Plaintext
140 lines
5.2 KiB
Plaintext
/**
|
|
* Adding this element to an atom will have it automatically render an overlay.
|
|
* The overlay can be specified in new as the first paramter; if not set it defaults to rust_overlay's rust_default
|
|
*/
|
|
/datum/element/rust
|
|
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs
|
|
argument_hash_start_idx = 2
|
|
/// The rust image itself, since the icon and icon state are only used as an argument
|
|
var/image/rust_overlay
|
|
|
|
/datum/element/rust/Attach(atom/target, rust_icon = 'icons/effects/rust_overlay.dmi', rust_icon_state = "rust_default")
|
|
. = ..()
|
|
if(!isatom(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
if(!rust_overlay)
|
|
rust_overlay = image(rust_icon, rust_icon_state)
|
|
ADD_TRAIT(target, TRAIT_RUSTY, ELEMENT_TRAIT(type))
|
|
RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(apply_rust_overlay))
|
|
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(handle_examine))
|
|
RegisterSignal (target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_interaction))
|
|
RegisterSignals(target, list(COMSIG_ATOM_SECONDARY_TOOL_ACT(TOOL_WELDER), COMSIG_ATOM_SECONDARY_TOOL_ACT(TOOL_RUSTSCRAPER)), PROC_REF(secondary_tool_act))
|
|
RegisterSignal(target, COMSIG_ATOM_EXPOSE_REAGENT, PROC_REF(on_reagent_expose))
|
|
// Unfortunately registering with parent sometimes doesn't cause an overlay update
|
|
target.update_appearance()
|
|
|
|
/datum/element/rust/Detach(atom/source)
|
|
. = ..()
|
|
UnregisterSignal(source, COMSIG_ATOM_UPDATE_OVERLAYS)
|
|
UnregisterSignal(source, COMSIG_ATOM_EXAMINE)
|
|
UnregisterSignal(source, COMSIG_ATOM_ITEM_INTERACTION)
|
|
UnregisterSignal(source, list(COMSIG_ATOM_SECONDARY_TOOL_ACT(TOOL_WELDER), COMSIG_ATOM_SECONDARY_TOOL_ACT(TOOL_RUSTSCRAPER)))
|
|
UnregisterSignal(source, COMSIG_ATOM_EXPOSE_REAGENT)
|
|
REMOVE_TRAIT(source, TRAIT_RUSTY, ELEMENT_TRAIT(type))
|
|
source.update_appearance()
|
|
|
|
/datum/element/rust/proc/handle_examine(datum/source, mob/user, list/examine_text)
|
|
SIGNAL_HANDLER
|
|
|
|
examine_text += span_notice("[source] is very rusty, you could probably <i>burn</i> or <i>scrape</i> it off, hell maybe even pour some <i>space cola</i> on it to remove the rust.")
|
|
|
|
/datum/element/rust/proc/apply_rust_overlay(atom/parent_atom, list/overlays)
|
|
SIGNAL_HANDLER
|
|
|
|
if(rust_overlay)
|
|
overlays += rust_overlay
|
|
|
|
/// Because do_after sleeps we register the signal here and defer via an async call
|
|
/datum/element/rust/proc/secondary_tool_act(atom/source, mob/user, obj/item/item)
|
|
SIGNAL_HANDLER
|
|
|
|
INVOKE_ASYNC(src, PROC_REF(handle_tool_use), source, user, item)
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
/// We call this from secondary_tool_act because we sleep with do_after
|
|
/datum/element/rust/proc/handle_tool_use(atom/source, mob/user, obj/item/item)
|
|
switch(item.tool_behaviour)
|
|
if(TOOL_WELDER)
|
|
if(!item.tool_start_check(user, amount=1))
|
|
return
|
|
|
|
user.balloon_alert(user, "burning off rust...")
|
|
|
|
if(!item.use_tool(source, user, 5 SECONDS))
|
|
return
|
|
user.balloon_alert(user, "burned off rust")
|
|
Detach(source)
|
|
return
|
|
|
|
|
|
if(TOOL_RUSTSCRAPER)
|
|
if(!item.tool_start_check(user))
|
|
return
|
|
user.balloon_alert(user, "scraping off rust...")
|
|
if(!item.use_tool(source, user, 2 SECONDS))
|
|
return
|
|
user.balloon_alert(user, "scraped off rust")
|
|
Detach(source)
|
|
return
|
|
|
|
///Immediately removes rust if exposed to space cola.
|
|
/datum/element/rust/proc/on_reagent_expose(atom/source, datum/reagent/reagent_splashed, reac_volume, methods)
|
|
SIGNAL_HANDLER
|
|
if(!istype(reagent_splashed, /datum/reagent/consumable/space_cola))
|
|
return
|
|
if(methods & INHALE)
|
|
return
|
|
Detach(source)
|
|
|
|
/// Prevents placing floor tiles on rusted turf
|
|
/datum/element/rust/proc/on_interaction(datum/source, mob/user, obj/item/tool, modifiers)
|
|
SIGNAL_HANDLER
|
|
if(istype(tool, /obj/item/stack/tile) || istype(tool, /obj/item/stack/rods))
|
|
user.balloon_alert(user, "floor too rusted!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
/// For rust applied by heretics
|
|
/datum/element/rust/heretic
|
|
|
|
/datum/element/rust/heretic/Attach(atom/target, rust_icon, rust_icon_state)
|
|
. = ..()
|
|
if(. == ELEMENT_INCOMPATIBLE)
|
|
return .
|
|
RegisterSignal(target, COMSIG_ATOM_ENTERED, PROC_REF(on_entered))
|
|
RegisterSignal(target, COMSIG_ATOM_EXITED, PROC_REF(on_exited))
|
|
|
|
/datum/element/rust/heretic/Detach(atom/source)
|
|
. = ..()
|
|
UnregisterSignal(source, COMSIG_ATOM_ENTERED)
|
|
UnregisterSignal(source, COMSIG_ATOM_EXITED)
|
|
for(var/obj/effect/glowing_rune/rune_to_remove in source)
|
|
qdel(rune_to_remove)
|
|
for(var/mob/living/victim in source)
|
|
victim.remove_status_effect(/datum/status_effect/rust_corruption)
|
|
|
|
/datum/element/rust/heretic/proc/on_entered(turf/source, atom/movable/entered, ...)
|
|
SIGNAL_HANDLER
|
|
|
|
if (HAS_TRAIT(entered, TRAIT_RUSTIMMUNE) || HAS_TRAIT(entered, TRAIT_MAGICALLY_PHASED) || entered.movement_type & (MOVETYPES_NOT_TOUCHING_GROUND | VENTCRAWLING))
|
|
return
|
|
|
|
if(ismecha(entered))
|
|
var/obj/vehicle/sealed/mecha/victim = entered
|
|
victim.take_damage(20, armour_penetration = 100)
|
|
return
|
|
if(!isliving(entered))
|
|
return
|
|
var/mob/living/victim = entered
|
|
if(IS_HERETIC(victim))
|
|
return
|
|
if(victim.can_block_magic(MAGIC_RESISTANCE))
|
|
return
|
|
victim.apply_status_effect(/datum/status_effect/rust_corruption)
|
|
|
|
/datum/element/rust/heretic/proc/on_exited(turf/source, atom/movable/gone)
|
|
SIGNAL_HANDLER
|
|
if(!isliving(gone))
|
|
return
|
|
var/mob/living/leaver = gone
|
|
leaver.remove_status_effect(/datum/status_effect/rust_corruption)
|