Removes shitty "status" variable on organs, makes them use organ_flags instead (#76350)

## About The Pull Request

Title.

## Why It's Good For The Game

Seriously this shit pisses me off, why are ORGAN_SYNTHETIC and
ORGAN_ROBOTIC two different things?

## Changelog

not applicable unless i fucked up

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
This commit is contained in:
ChungusGamer666
2023-06-29 21:09:55 +00:00
committed by GitHub
co-authored by Time-Green
parent b090e404dd
commit 82cf9ea499
65 changed files with 214 additions and 210 deletions
+8 -8
View File
@@ -66,20 +66,16 @@
var/speed_modifier = 0
// Limb disabling variables
///Whether it is possible for the limb to be disabled whatsoever. TRUE means that it is possible.
var/can_be_disabled = FALSE //Defaults to FALSE, as only human limbs can be disabled, and only the appendages.
///Controls if the limb is disabled. TRUE means it is disabled (similar to being removed, but still present for the sake of targeted interactions).
var/bodypart_disabled = FALSE
///Handles limb disabling by damage. If 0 (0%), a limb can't be disabled via damage. If 1 (100%), it is disabled at max limb damage. Anything between is the percentage of damage against maximum limb damage needed to disable the limb.
var/disabling_threshold_percentage = 0
///Whether it is possible for the limb to be disabled whatsoever. TRUE means that it is possible.
var/can_be_disabled = FALSE //Defaults to FALSE, as only human limbs can be disabled, and only the appendages.
// Damage state variables
// Damage variables
///A mutiplication of the burn and brute damage that the limb's stored damage contributes to its attached mob's overall wellbeing.
var/body_damage_coeff = 1
///Used in determining overlays for limb damage states. As the mob receives more burn/brute damage, their limbs update to reflect.
var/brutestate = 0
var/burnstate = 0
///The current amount of brute damage the limb has
var/brute_dam = 0
///The current amount of burn damage the limb has
@@ -87,6 +83,10 @@
///The maximum brute OR burn damage a bodypart can take. Once we hit this cap, no more damage of either type!
var/max_damage = 0
//Used in determining overlays for limb damage states. As the mob receives more burn/brute damage, their limbs update to reflect.
var/brutestate = 0
var/burnstate = 0
///Gradually increases while burning when at full damage, destroys the limb when at 100
var/cremation_progress = 0
@@ -1170,7 +1170,7 @@
/obj/item/bodypart/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_WIRES || !(bodytype & BODYTYPE_ROBOTIC))
if(. & EMP_PROTECT_WIRES || !IS_ROBOTIC_LIMB(src))
return FALSE
owner.visible_message(span_danger("[owner]'s [src.name] seems to malfunction!"))
+31 -19
View File
@@ -4,26 +4,32 @@
icon = 'icons/obj/medical/organs/organs.dmi'
w_class = WEIGHT_CLASS_SMALL
throwforce = 0
///The mob that owns this organ.
/// The mob that owns this organ.
var/mob/living/carbon/owner = null
var/status = ORGAN_ORGANIC
///The body zone this organ is supposed to inhabit.
/// The body zone this organ is supposed to inhabit.
var/zone = BODY_ZONE_CHEST
///The organ slot this organ is supposed to inhabit. This should be unique by type. (Lungs, Appendix, Stomach, etc)
/**
* The organ slot this organ is supposed to inhabit. This should be unique by type. (Lungs, Appendix, Stomach, etc)
* Do NOT add slots with matching names to different zones - it will break the organs_slot list!
*/
var/slot
// DO NOT add slots with matching names to different zones - it will break organs_slot list!
var/organ_flags = ORGAN_EDIBLE
/// Random flags that describe this organ
var/organ_flags = ORGAN_ORGANIC | ORGAN_EDIBLE
/// Maximum damage the organ can take, ever.
var/maxHealth = STANDARD_ORGAN_THRESHOLD
/// Total damage this organ has sustained
/// Should only ever be modified by apply_organ_damage
/**
* Total damage this organ has sustained.
* Should only ever be modified by apply_organ_damage!
*/
var/damage = 0
///Healing factor and decay factor function on % of maxhealth, and do not work by applying a static number per tick
/// Healing factor and decay factor function on % of maxhealth, and do not work by applying a static number per tick
var/healing_factor = 0 //fraction of maxhealth healed per on_life(), set to 0 for generic organs
var/decay_factor = 0 //same as above but when without a living owner, set to 0 for generic organs
var/high_threshold = STANDARD_ORGAN_THRESHOLD * 0.45 //when severe organ damage occurs
var/low_threshold = STANDARD_ORGAN_THRESHOLD * 0.1 //when minor organ damage occurs
var/severe_cooldown //cooldown for severe effects, used for synthetic organ emp effects.
///Organ variables for determining what we alert the owner with when they pass/clear the damage thresholds
// Organ variables for determining what we alert the owner with when they pass/clear the damage thresholds
var/prev_damage = 0
var/low_threshold_passed
var/high_threshold_passed
@@ -32,16 +38,22 @@
var/high_threshold_cleared
var/low_threshold_cleared
///When you take a bite you cant jam it in for surgery anymore.
/// When set to false, this can't be used in surgeries and such - Honestly a terrible variable.
var/useable = TRUE
/// Food reagents if the organ is edible
var/list/food_reagents = list(/datum/reagent/consumable/nutriment = 5)
///The size of the reagent container
/// The size of the reagent container if the organ is edible
var/reagent_vol = 10
/// Time this organ has failed for
var/failure_time = 0
///Do we effect the appearance of our mob. Used to save time in preference code
/// Do we affect the appearance of our mob. Used to save time in preference code
var/visual = TRUE
/// Traits that are given to the holder of the organ. If you want an effect that changes this, don't add directly to this. Use the add_organ_trait() proc
/**
* Traits that are given to the holder of the organ.
* If you want an effect that changes this, don't add directly to this. Use the add_organ_trait() proc.
*/
var/list/organ_traits
/// Status Effects that are given to the holder of the organ.
var/list/organ_effects
@@ -201,7 +213,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
. += span_notice("It should be inserted in the [parse_zone(zone)].")
if(organ_flags & ORGAN_FAILING)
if(status == ORGAN_ROBOTIC)
if(IS_ROBOTIC_ORGAN(src))
. += span_warning("[src] seems to be broken.")
return
. += span_warning("[src] has decayed for too long, and has turned a sickly color. It probably won't work without repairs.")
@@ -225,12 +237,12 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
return //so we don't grant the organ's action to mobs who pick up the organ.
///Adjusts an organ's damage by the amount "damage_amount", up to a maximum amount, which is by default max damage
/obj/item/organ/proc/apply_organ_damage(damage_amount, maximum = maxHealth, required_organtype) //use for damaging effects
/obj/item/organ/proc/apply_organ_damage(damage_amount, maximum = maxHealth, required_organ_flag = NONE) //use for damaging effects
if(!damage_amount) //Micro-optimization.
return
if(maximum < damage)
return
if(required_organtype && (status != required_organtype))
if(required_organ_flag && !(organ_flags & required_organ_flag))
return
damage = clamp(damage + damage_amount, 0, maximum)
var/mess = check_damage_thresholds(owner)
@@ -245,8 +257,8 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
to_chat(owner, mess)
///SETS an organ's damage to the amount "damage_amount", and in doing so clears or sets the failing flag, good for when you have an effect that should fix an organ if broken
/obj/item/organ/proc/set_organ_damage(damage_amount, required_organtype) //use mostly for admin heals
apply_organ_damage(damage_amount - damage, required_organtype = required_organtype)
/obj/item/organ/proc/set_organ_damage(damage_amount, required_organ_flag = NONE) //use mostly for admin heals
return apply_organ_damage(damage_amount - damage, required_organ_flag = required_organ_flag)
/** check_damage_thresholds
* input: mob/organ_owner (a mob, the owner of the organ we call the proc on)
+1 -1
View File
@@ -7,7 +7,7 @@
name = "external organ"
desc = "An external organ that is too external."
organ_flags = ORGAN_EDIBLE
organ_flags = ORGAN_ORGANIC | ORGAN_EDIBLE
visual = TRUE
///The overlay datum that actually draws stuff on the limb
@@ -174,6 +174,7 @@
/obj/item/organ/external/wings/functional/robotic
name = "robotic wings"
desc = "Using microscopic hover-engines, or \"microwings,\" as they're known in the trade, these tiny devices are able to lift a few grams at a time. Gathering enough of them, and you can lift impressively large things."
organ_flags = ORGAN_ROBOTIC
sprite_accessory_override = /datum/sprite_accessory/wings/robotic
///skeletal wings, which relate to skeletal races.
@@ -41,7 +41,7 @@
on_death(seconds_per_tick, times_fired) //Kinda hate doing it like this, but I really don't want to call process directly.
/obj/item/organ/internal/on_death(seconds_per_tick, times_fired) //runs decay when outside of a person
if(organ_flags & (ORGAN_SYNTHETIC | ORGAN_FROZEN))
if(organ_flags & (ORGAN_ROBOTIC | ORGAN_FROZEN))
return
apply_organ_damage(decay_factor * maxHealth * seconds_per_tick)
@@ -57,7 +57,7 @@
if(failure_time > 0)
failure_time--
if(organ_flags & ORGAN_SYNTHETIC_EMP) //Synthetic organ has been emped, is now failing.
if(organ_flags & ORGAN_EMP) //Synthetic organ has been emped, is now failing.
apply_organ_damage(decay_factor * maxHealth * seconds_per_tick)
return
@@ -28,14 +28,13 @@
return ..()
/obj/item/organ/internal/appendix/on_life(seconds_per_tick, times_fired)
..()
var/mob/living/carbon/organ_owner = owner
if(!organ_owner)
. = ..()
if(!owner)
return
if(organ_flags & ORGAN_FAILING)
// forced to ensure people don't use it to gain tox as slime person
organ_owner.adjustToxLoss(2 * seconds_per_tick, updating_health = TRUE, forced = TRUE)
owner.adjustToxLoss(2 * seconds_per_tick, updating_health = TRUE, forced = TRUE)
else if(inflamation_stage)
inflamation(seconds_per_tick)
else if(SPT_PROB(APPENDICITIS_PROB, seconds_per_tick))
@@ -4,7 +4,7 @@
desc = "This expanded digestive chamber allows golems to smelt minerals, provided that they are immersed in lava."
icon_state = "ethereal_heart"
color = COLOR_GOLEM_GRAY
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
/// Action which performs smelting
var/datum/action/cooldown/internal_smelting/smelter
@@ -60,7 +60,7 @@
/obj/item/organ/internal/cyberimp/arm/examine(mob/user)
. = ..()
if(status == ORGAN_ROBOTIC)
if(IS_ROBOTIC_ORGAN(src))
. += span_info("[src] is assembled in the [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm configuration. You can use a screwdriver to reassemble it.")
/obj/item/organ/internal/cyberimp/arm/screwdriver_act(mob/living/user, obj/item/screwtool)
@@ -98,7 +98,7 @@
/obj/item/organ/internal/cyberimp/arm/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF || status == ORGAN_ORGANIC)
if(. & EMP_PROTECT_SELF || !IS_ROBOTIC_ORGAN(src))
return
if(prob(15/severity) && owner)
to_chat(owner, span_warning("The electromagnetic pulse causes [src] to malfunction!"))
@@ -44,7 +44,6 @@
desc = "These cybernetic eye implants will display a security HUD over everything you see."
HUD_type = DATA_HUD_SECURITY_ADVANCED
HUD_trait = TRAIT_SECURITY_HUD
organ_flags = ALL
/obj/item/organ/internal/cyberimp/eyes/hud/diagnostic
name = "Diagnostic HUD implant"
@@ -54,4 +53,4 @@
/obj/item/organ/internal/cyberimp/eyes/hud/security/syndicate
name = "Contraband Security HUD Implant"
desc = "A Cybersun Industries brand Security HUD Implant. These illicit cybernetic eye implants will display a security HUD over everything you see."
organ_flags = ORGAN_SYNTHETIC | ORGAN_HIDDEN
organ_flags = ORGAN_ROBOTIC | ORGAN_HIDDEN
@@ -3,8 +3,7 @@
name = "cybernetic implant"
desc = "A state-of-the-art implant that improves a baseline's functionality."
visual = FALSE
status = ORGAN_ROBOTIC
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
var/implant_color = "#FFFFFF"
var/implant_overlay
@@ -104,7 +104,7 @@
icon_state = "ears-c"
desc = "A basic cybernetic organ designed to mimic the operation of ears."
damage_multiplier = 0.9
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
/obj/item/organ/internal/ears/cybernetic/upgraded
name = "upgraded cybernetic ears"
@@ -151,7 +151,7 @@
eye_color_left = initial(eye_color_left)
eye_color_right = initial(eye_color_right)
/obj/item/organ/internal/eyes/apply_organ_damage(damage_amount, maximum, required_organtype)
/obj/item/organ/internal/eyes/apply_organ_damage(damage_amount, maximum = maxHealth, required_organ_flag)
. = ..()
if(!owner)
return
@@ -261,7 +261,7 @@
desc = "Golems somehow measure external light levels and detect nearby ore using this sensitive mineral lattice."
color = COLOR_GOLEM_GRAY
visual = FALSE
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
color_cutoffs = list(10, 15, 5)
actions_types = list(/datum/action/cooldown/golem_ore_sight)
@@ -284,12 +284,11 @@
name = "robotic eyes"
icon_state = "cybernetic_eyeballs"
desc = "Your vision is augmented."
status = ORGAN_ROBOTIC
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
/obj/item/organ/internal/eyes/robotic/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
if((. & EMP_PROTECT_SELF) || !owner)
return
if(prob(10 * severity))
return
@@ -201,7 +201,7 @@
desc = "A basic electronic device designed to mimic the functions of an organic human heart."
icon_state = "heart-c-on"
base_icon_state = "heart-c"
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
maxHealth = STANDARD_ORGAN_THRESHOLD*0.75 //This also hits defib timer, so a bit higher than its less important counterparts
var/dose_available = FALSE
@@ -241,7 +241,7 @@
owner.losebreath += 10
COOLDOWN_START(src, severe_cooldown, 20 SECONDS)
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
organ_flags |= ORGAN_EMP //Starts organ faliure - gonna need replacing soon.
Stop()
owner.visible_message(span_danger("[owner] clutches at [owner.p_their()] chest as if [owner.p_their()] heart is stopping!"), \
span_userdanger("You feel a terrible pain in your chest, as if your heart has stopped!"))
@@ -263,7 +263,7 @@
/obj/item/organ/internal/heart/freedom
name = "heart of freedom"
desc = "This heart pumps with the passion to give... something freedom."
organ_flags = ORGAN_SYNTHETIC //the power of freedom prevents heart attacks
organ_flags = ORGAN_ROBOTIC //the power of freedom prevents heart attacks
/// The cooldown until the next time this heart can give the host an adrenaline boost.
COOLDOWN_DECLARE(adrenaline_cooldown)
@@ -139,7 +139,7 @@
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
for(var/datum/reagent/toxin/toxin in cached_reagents)
if(status != toxin.affected_organtype) //this particular toxin does not affect this type of organ
if(toxin.affected_organ_flags && !(organ_flags & toxin.affected_organ_flags)) //this particular toxin does not affect this type of organ
continue
var/amount = round(toxin.volume, CHEMICAL_QUANTISATION_LEVEL) // this is an optimization
if(belly)
@@ -245,7 +245,7 @@
name = "basic cybernetic liver"
desc = "A very basic device designed to mimic the functions of a human liver. Handles toxins slightly worse than an organic liver."
icon_state = "liver-c"
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
toxTolerance = 2
liver_resistance = 0.9 * LIVER_DEFAULT_TOX_RESISTANCE // -10%
maxHealth = STANDARD_ORGAN_THRESHOLD*0.5
@@ -278,7 +278,7 @@
owner.adjustToxLoss(10)
COOLDOWN_START(src, severe_cooldown, 10 SECONDS)
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
organ_flags |= ORGAN_EMP //Starts organ faliure - gonna need replacing soon.
#undef HAS_SILENT_TOXIN
#undef HAS_NO_TOXIN
@@ -9,7 +9,7 @@
name = "porous rock"
desc = "A spongy rock capable of absorbing chemicals."
icon_state = "liver-p"
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
color = COLOR_GOLEM_GRAY
/obj/item/organ/internal/liver/golem/handle_chemical(mob/living/carbon/organ_owner, datum/reagent/chem, seconds_per_tick, times_fired)
@@ -6,7 +6,7 @@
name = "reagent processing crystal"
desc = "A large crystal that is somehow capable of metabolizing chemicals, these are found in plasmamen."
icon_state = "liver-p"
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
organ_traits = list(TRAIT_PLASMA_LOVER_METABOLISM)
/obj/item/organ/internal/liver/bone/plasmaman/handle_chemical(mob/living/carbon/organ_owner, datum/reagent/chem, seconds_per_tick, times_fired)
@@ -820,7 +820,7 @@
name = "basic cybernetic lungs"
desc = "A basic cybernetic version of the lungs found in traditional humanoid entities."
icon_state = "lungs-c"
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
maxHealth = STANDARD_ORGAN_THRESHOLD * 0.5
var/emp_vulnerability = 80 //Chance of permanent effects if emp-ed.
@@ -855,7 +855,7 @@
owner.losebreath += 20
COOLDOWN_START(src, severe_cooldown, 30 SECONDS)
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
organ_flags |= ORGAN_EMP //Starts organ faliure - gonna need replacing soon.
/obj/item/organ/internal/lungs/lavaland
@@ -289,7 +289,7 @@
name = "basic cybernetic stomach"
desc = "A basic device designed to mimic the functions of a human stomach"
icon_state = "stomach-c"
organ_flags = ORGAN_SYNTHETIC
organ_flags = ORGAN_ROBOTIC
maxHealth = STANDARD_ORGAN_THRESHOLD * 0.5
var/emp_vulnerability = 80 //Chance of permanent effects if emp-ed.
metabolism_efficiency = 0.035 // not as good at digestion
@@ -320,7 +320,7 @@
owner.vomit(stun = FALSE)
COOLDOWN_START(src, severe_cooldown, 10 SECONDS)
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
organ_flags |= ORGAN_EMP //Starts organ faliure - gonna need replacing soon.
#undef STOMACH_METABOLISM_CONSTANT
@@ -3,7 +3,7 @@
icon_state = "stomach-p"
desc = "A rocklike organ which grinds and processes nutrition from minerals."
color = COLOR_GOLEM_GRAY
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
organ_traits = list(TRAIT_ROCK_EATER)
hunger_modifier = 10 // golems burn fuel quickly
/// How slow are you when the "hungry" icon appears?
@@ -143,7 +143,7 @@
ADD_TRAIT(tongue_owner, TRAIT_AGEUSIA, NO_TONGUE_TRAIT)
tongue_owner.voice_filter = initial(tongue_owner.voice_filter)
/obj/item/organ/internal/tongue/apply_organ_damage(damage_amount, maximum, required_organtype)
/obj/item/organ/internal/tongue/apply_organ_damage(damage_amount, maximum = maxHealth, required_organ_flag)
. = ..()
if(!owner)
return
@@ -467,8 +467,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
/obj/item/organ/internal/tongue/robot
name = "robotic voicebox"
desc = "A voice synthesizer that can interface with organic lifeforms."
status = ORGAN_ROBOTIC
organ_flags = NONE
organ_flags = ORGAN_ROBOTIC
icon_state = "tonguerobot"
say_mod = "states"
attack_verb_continuous = list("beeps", "boops")
@@ -575,7 +574,7 @@ GLOBAL_LIST_INIT(english_to_zombie, list())
name = "golem tongue"
desc = "This silicate plate doesn't seem particularly mobile, but golems use it to form sounds."
color = COLOR_WEBSAFE_DARK_GRAY
status = ORGAN_MINERAL
organ_flags = ORGAN_MINERAL
say_mod = "rumbles"
sense_of_taste = FALSE
liked_foodtypes = STONE