From ead6759782ec6d25abea36d080767602fd3589b0 Mon Sep 17 00:00:00 2001 From: GPeckman <21979502+GPeckman@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:31:01 -0400 Subject: [PATCH] Miscellaneous Robotic Limb Fixes (#78905) ## About The Pull Request In PR #76817, the damage reduction for robotic limbs was changed from being flat to being multiplicative in nature. This wasn't supposed to have secondary mechanical effects on robot limbs, but as always a few slipped by. This PR just cleans up a few of these unintended mechanical changes. First of all, the change made robotic limbs not fully immune to space damage. They remained immune to damage from pressure but not damage from temperature. Now people with only robotic limbs are immune to the temperature damage and the moodlets caused by low or high temperature. I have tested it, and it works for people who have all robotic limbs, people who have some robotic limbs and some missing, and even the extreme case of a nugget with H.A.R.S. who has nothing _but_ a robotic chest. Due to technical limitations (`apply_damage` doesn't have a `required_bodytype` argument), people with some robotic limbs and some organic will still take temperature damage on their robotic limbs. Second of all, androids are once again immune to crit damage. Normally, crit damage is just constant oxyloss, but this obviously doesn't work for species that don't breath. Instead, those species take a small amount of brute damage. Prior to the damage reduction change, this meant that Androids were effectively immune to crit damage. Now they're immune once again. Finally, you can now cancel surgery on robotic limbs. I don't think this bug was actually caused by the above PR, but I decided to fix it while I was here. Closes #77033. ## Why It's Good For The Game The damage reduction change was explicitly not intended to make robotic limbs not-spaceproof, so the first change is by definition a bugfix. As far as I know, crit damage being brute for nobreath species is a much more recent change than the existence of androids, so I think that also qualifies as a bugfix. ## Changelog :cl: fix: Having all augmented limbs will make you properly spaceproof once again. fix: Androids are immune to crit damage again. fix: Surgery on robotic limbs can be canceled. /:cl: --- .../signals/signals_mob/signals_mob_carbon.dm | 2 +- code/__DEFINES/traits.dm | 2 + .../datums/weather/weather_types/ash_storm.dm | 2 +- .../carbon/human/species_types/android.dm | 1 + .../surgery/bodyparts/robot_bodyparts.dm | 38 +++++++++++++++++++ code/modules/surgery/organ_manipulation.dm | 2 +- 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm index 1d5ab544d10..a6e60f1ced8 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm @@ -33,7 +33,7 @@ ///from base of /obj/item/bodypart/proc/try_attach_limb(): (new_limb, special) #define COMSIG_CARBON_ATTACH_LIMB "carbon_attach_limb" /// Called from bodypart being attached /obj/item/bodypart/proc/try_attach_limb(mob/living/carbon/new_owner, special) -#define COMSIG_BODYPART_ATTACHED "bodypart_removed" +#define COMSIG_BODYPART_ATTACHED "bodypart_attached" ///from base of /obj/item/bodypart/proc/try_attach_limb(): (new_limb, special) #define COMSIG_CARBON_POST_ATTACH_LIMB "carbon_post_attach_limb" ///from /obj/item/bodypart/proc/receive_damage, sent from the limb owner (limb, brute, burn) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index f4d3c5aebca..4f838691d4b 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -940,6 +940,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define DISEASE_TRAIT "disease" #define SPECIES_TRAIT "species" #define ORGAN_TRAIT "organ" +/// Trait given by augmented limbs +#define AUGMENTATION_TRAIT "augments" /// Trait given by organ gained via abductor surgery #define ABDUCTOR_GLAND_TRAIT "abductor_gland" /// cannot be removed without admin intervention diff --git a/code/datums/weather/weather_types/ash_storm.dm b/code/datums/weather/weather_types/ash_storm.dm index 92a1ba1eed6..bb4e5af63f3 100644 --- a/code/datums/weather/weather_types/ash_storm.dm +++ b/code/datums/weather/weather_types/ash_storm.dm @@ -66,7 +66,7 @@ return FALSE /datum/weather/ash_storm/weather_act(mob/living/victim) - victim.adjustFireLoss(4) + victim.adjustFireLoss(4, required_bodytype = BODYTYPE_ORGANIC) /datum/weather/ash_storm/end() GLOB.ash_storm_sounds -= weak_sounds diff --git a/code/modules/mob/living/carbon/human/species_types/android.dm b/code/modules/mob/living/carbon/human/species_types/android.dm index 570aa91dc34..e4f8b5824c5 100644 --- a/code/modules/mob/living/carbon/human/species_types/android.dm +++ b/code/modules/mob/living/carbon/human/species_types/android.dm @@ -21,6 +21,7 @@ TRAIT_RESISTHIGHPRESSURE, TRAIT_RESISTLOWPRESSURE, TRAIT_TOXIMMUNE, + TRAIT_NOCRITDAMAGE, ) inherent_biotypes = MOB_ROBOTIC|MOB_HUMANOID diff --git a/code/modules/surgery/bodyparts/robot_bodyparts.dm b/code/modules/surgery/bodyparts/robot_bodyparts.dm index 99591daaa4b..26ef6656411 100644 --- a/code/modules/surgery/bodyparts/robot_bodyparts.dm +++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm @@ -235,8 +235,46 @@ /obj/item/bodypart/chest/robot/Destroy() QDEL_NULL(cell) + UnregisterSignal(src, COMSIG_BODYPART_ATTACHED) return ..() +/obj/item/bodypart/chest/robot/Initialize(mapload) + . = ..() + RegisterSignal(src, COMSIG_BODYPART_ATTACHED, PROC_REF(on_attached)) + RegisterSignal(src, COMSIG_BODYPART_REMOVED, PROC_REF(on_detached)) + +/obj/item/bodypart/chest/robot/proc/on_attached(obj/item/bodypart/chest/robot/this_bodypart, mob/living/carbon/human/new_owner) + SIGNAL_HANDLER + + RegisterSignals(new_owner, list(COMSIG_CARBON_POST_ATTACH_LIMB, COMSIG_CARBON_POST_REMOVE_LIMB), PROC_REF(check_limbs)) + +/obj/item/bodypart/chest/robot/proc/on_detached(obj/item/bodypart/chest/robot/this_bodypart, mob/living/carbon/human/old_owner) + SIGNAL_HANDLER + + UnregisterSignal(old_owner, list(COMSIG_CARBON_POST_ATTACH_LIMB, COMSIG_CARBON_POST_REMOVE_LIMB)) + +/obj/item/bodypart/chest/robot/proc/check_limbs() + SIGNAL_HANDLER + + var/all_robotic = TRUE + for(var/obj/item/bodypart/part in owner.bodyparts) + all_robotic = all_robotic && IS_ROBOTIC_LIMB(part) + + if(all_robotic) + owner.add_traits(list( + TRAIT_RESISTCOLD, + TRAIT_RESISTHEAT, + TRAIT_RESISTLOWPRESSURE, + TRAIT_RESISTHIGHPRESSURE, + ), AUGMENTATION_TRAIT) + else + owner.remove_traits(list( + TRAIT_RESISTCOLD, + TRAIT_RESISTHEAT, + TRAIT_RESISTLOWPRESSURE, + TRAIT_RESISTHIGHPRESSURE, + ), AUGMENTATION_TRAIT) + /obj/item/bodypart/chest/robot/attackby(obj/item/weapon, mob/user, params) if(istype(weapon, /obj/item/stock_parts/cell)) if(cell) diff --git a/code/modules/surgery/organ_manipulation.dm b/code/modules/surgery/organ_manipulation.dm index c194c150d6d..aaa0bc765e1 100644 --- a/code/modules/surgery/organ_manipulation.dm +++ b/code/modules/surgery/organ_manipulation.dm @@ -87,7 +87,7 @@ var/obj/item/tool = user.get_active_held_item() if(step.try_op(user, target, user.zone_selected, tool, src, try_to_fail)) return TRUE - if(tool && tool.item_flags) //Mechanic organ manipulation isn't done with just surgery tools + if(tool && tool.tool_behaviour) //Mechanic organ manipulation isn't done with just surgery tools to_chat(user, span_warning("This step requires a different tool!")) return TRUE