From 931b7123ebb2ab2c272cfd693651e60e9f4249d6 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 16 Oct 2023 04:53:52 +0200 Subject: [PATCH] [MIRROR] Miscellaneous Robotic Limb Fixes [MDB IGNORE] (#24339) * Miscellaneous Robotic Limb Fixes * Update android.dm * Apply suggestions from code review * Update robot_bodyparts.dm --------- Co-authored-by: GPeckman <21979502+GPeckman@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- .../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 | 42 +++++++++++++++++++ code/modules/surgery/organ_manipulation.dm | 2 +- 6 files changed, 48 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 e8e44e96867..569f019cab5 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -939,6 +939,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 ed8163a1538..a6f6a484afc 100644 --- a/code/modules/mob/living/carbon/human/species_types/android.dm +++ b/code/modules/mob/living/carbon/human/species_types/android.dm @@ -22,6 +22,7 @@ TRAIT_NOBLOOD, TRAIT_NO_DNA_COPY, TRAIT_NO_TRANSFORMATION_STING, + 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..d967f2da9ec 100644 --- a/code/modules/surgery/bodyparts/robot_bodyparts.dm +++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm @@ -235,8 +235,50 @@ /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( + /* SKYRAT EDIT REMOVAL BEGIN - Synths are not immune to temperature + TRAIT_RESISTCOLD, + TRAIT_RESISTHEAT, + SKYRAT EDIT REMOVAL END */ + TRAIT_RESISTLOWPRESSURE, + TRAIT_RESISTHIGHPRESSURE, + ), AUGMENTATION_TRAIT) + else + owner.remove_traits(list( + /* SKYRAT EDIT REMOVAL BEGIN - Synths are not immune to temperature + TRAIT_RESISTCOLD, + TRAIT_RESISTHEAT, + SKYRAT EDIT REMOVAL END */ + 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 17a8e147fb3..25004d20d20 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