diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 0b141f27550..b844c2975aa 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -695,6 +695,8 @@ #define COMSIG_OBJ_TAKE_DAMAGE "obj_take_damage" /// Return bitflags for the above signal which prevents the object taking any damage. #define COMPONENT_NO_TAKE_DAMAGE (1<<0) +///from base of [/obj/proc/update_integrity]: () +#define COMSIG_OBJ_INTEGRITY_CHANGED "obj_integrity_changed" ///from base of obj/deconstruct(): (disassembled) #define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct" ///from base of code/game/machinery @@ -705,6 +707,8 @@ #define COMSIG_OBJ_PAINTED "obj_painted" /// from /obj/proc/obj_break: () #define COMSIG_OBJ_BREAK "obj_break" +/// from base of [/obj/proc/obj_fix]: () +#define COMSIG_OBJ_FIX "obj_fix" // /obj/machinery signals diff --git a/code/datums/components/dejavu.dm b/code/datums/components/dejavu.dm index 62af7e81859..ac19b224cf1 100644 --- a/code/datums/components/dejavu.dm +++ b/code/datums/components/dejavu.dm @@ -56,7 +56,7 @@ else if(isobj(parent)) var/obj/O = parent - integrity = O.obj_integrity + integrity = O.get_integrity() rewind_type = .proc/rewind_obj addtimer(CALLBACK(src, rewind_type), rewind_interval) @@ -107,5 +107,5 @@ /datum/component/dejavu/proc/rewind_obj() var/obj/master = parent - master.obj_integrity = integrity + master.update_integrity(integrity) rewind() diff --git a/code/datums/components/gas_leaker.dm b/code/datums/components/gas_leaker.dm index 3010d91bd12..c8efe8a16f8 100644 --- a/code/datums/components/gas_leaker.dm +++ b/code/datums/components/gas_leaker.dm @@ -72,10 +72,11 @@ return process_machine(master, airs) /datum/component/gas_leaker/proc/process_leak(obj/master, list/airs) - if(master.obj_integrity > master.max_integrity * integrity_leak_percent) + var/current_integrity = master.get_integrity() + if(current_integrity > master.max_integrity * integrity_leak_percent) return PROCESS_KILL var/turf/location = get_turf(master) - var/true_rate = (1 - (master.obj_integrity / master.max_integrity)) * leak_rate + var/true_rate = (1 - (current_integrity / master.max_integrity)) * leak_rate for(var/datum/gas_mixture/mix as anything in airs) var/pressure = mix.return_pressure() if(mix.release_gas_to(location.return_air(), pressure, true_rate)) diff --git a/code/datums/elements/art.dm b/code/datums/elements/art.dm index 87f827c21f1..344608f24d9 100644 --- a/code/datums/elements/art.dm +++ b/code/datums/elements/art.dm @@ -48,7 +48,7 @@ var/mult = 1 if(isobj(source)) var/obj/art_piece = source - mult = art_piece.obj_integrity/art_piece.max_integrity + mult = art_piece.get_integrity() / art_piece.max_integrity apply_moodlet(source, user, impressiveness * mult) diff --git a/code/datums/elements/obj_regen.dm b/code/datums/elements/obj_regen.dm index ee459be5064..e4fbd6b128e 100644 --- a/code/datums/elements/obj_regen.dm +++ b/code/datums/elements/obj_regen.dm @@ -22,7 +22,7 @@ rate = _rate RegisterSignal(target, COMSIG_OBJ_TAKE_DAMAGE, .proc/on_take_damage) - if(target.obj_integrity < target.max_integrity) + if(target.get_integrity() < target.max_integrity) if(!length(processing)) START_PROCESSING(SSobj, src) processing |= target @@ -73,8 +73,7 @@ return continue - regen_obj.obj_integrity = clamp(regen_obj.obj_integrity + (regen_obj.max_integrity * cached_rate), 0, regen_obj.max_integrity) - if(regen_obj.obj_integrity == regen_obj.max_integrity) + if(!regen_obj.repair_damage(regen_obj.max_integrity * cached_rate)) processing -= regen_obj if(!length(processing)) STOP_PROCESSING(SSobj, src) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 26ceb988acd..9d73bc16bc2 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -568,7 +568,7 @@ . = new_frame new_frame.set_anchored(anchored) if(!disassembled) - new_frame.obj_integrity = new_frame.max_integrity * 0.5 //the frame is already half broken + new_frame.update_integrity(new_frame.max_integrity * 0.5) //the frame is already half broken transfer_fingerprints_to(new_frame) diff --git a/code/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm index 92782e1df22..31abe0f2506 100644 --- a/code/game/machinery/aug_manipulator.dm +++ b/code/game/machinery/aug_manipulator.dm @@ -5,7 +5,6 @@ icon_state = "pdapainter" base_icon_state = "pdapainter" density = TRUE - obj_integrity = 200 max_integrity = 200 var/obj/item/bodypart/storedpart var/static/list/style_list_icons = list("standard" = 'icons/mob/augmentation/augments.dmi', "engineer" = 'icons/mob/augmentation/augments_engineer.dmi', "security" = 'icons/mob/augmentation/augments_security.dmi', "mining" = 'icons/mob/augmentation/augments_mining.dmi') diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 7bd817ef2a4..1f3b6d79bc1 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -372,7 +372,7 @@ assembly = null else var/obj/item/I = new /obj/item/wallframe/camera (loc) - I.obj_integrity = I.max_integrity * 0.5 + I.update_integrity(I.max_integrity * 0.5) new /obj/item/stack/cable_coil(loc, 2) qdel(src) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 3d8fe344b8f..9cdb88324ff 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1408,8 +1408,7 @@ A.update_appearance() if(!disassembled) - if(A) - A.obj_integrity = A.max_integrity * 0.5 + A?.update_integrity(A.max_integrity * 0.5) else if(obj_flags & EMAGGED) if(user) to_chat(user, "You discard the damaged electronics.") diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 1321e17ef13..63f06e7955d 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -233,7 +233,7 @@ F.constructionStep = CONSTRUCTION_PANEL_OPEN else F.constructionStep = CONSTRUCTION_NO_CIRCUIT - F.obj_integrity = F.max_integrity * 0.5 + F.update_integrity(F.max_integrity * 0.5) F.update_appearance() else new /obj/item/electronics/firelock (T) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 3de4e634efb..e49ab3de477 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -51,7 +51,7 @@ update_appearance() myarea = get_area(src) LAZYADD(myarea.firealarms, src) - + AddElement(/datum/element/atmos_sensitive, mapload) RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, .proc/check_security_level) @@ -337,7 +337,7 @@ if(!(machine_stat & BROKEN)) var/obj/item/I = new /obj/item/electronics/firealarm(loc) if(!disassembled) - I.obj_integrity = I.max_integrity * 0.5 + I.update_integrity(I.max_integrity * 0.5) new /obj/item/stack/cable_coil(loc, 3) qdel(src) diff --git a/code/game/objects/effects/countdown.dm b/code/game/objects/effects/countdown.dm index 59355563b52..75775502eaf 100644 --- a/code/game/objects/effects/countdown.dm +++ b/code/game/objects/effects/countdown.dm @@ -96,7 +96,7 @@ var/obj/machinery/power/supermatter_crystal/S = attached_to if(!istype(S)) return - return "
[round(S.get_integrity(), 1)]%
" + return "
[round(S.get_integrity_percent(), 1)]%
" /obj/effect/countdown/transformer name = "transformer countdown" diff --git a/code/game/objects/items/devices/reverse_bear_trap.dm b/code/game/objects/items/devices/reverse_bear_trap.dm index 8ea79a7292d..d24b7e21162 100644 --- a/code/game/objects/items/devices/reverse_bear_trap.dm +++ b/code/game/objects/items/devices/reverse_bear_trap.dm @@ -7,7 +7,6 @@ flags_1 = CONDUCT_1 resistance_flags = FIRE_PROOF | UNACIDABLE w_class = WEIGHT_CLASS_NORMAL - obj_integrity = 300 max_integrity = 300 inhand_icon_state = "reverse_bear_trap" lefthand_file = 'icons/mob/inhands/items_lefthand.dmi' diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 4f051850269..13dc1400c2a 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -1,5 +1,5 @@ -///the essential proc to call when an obj must receive damage of any kind. +/// The essential proc to call when an obj must receive damage of any kind. /obj/proc/take_damage(damage_amount, damage_type = BRUTE, damage_flag = "", sound_effect = TRUE, attack_dir, armour_penetration = 0) if(QDELETED(src)) stack_trace("[src] taking damage after deletion") @@ -15,14 +15,43 @@ return . = damage_amount - obj_integrity = max(obj_integrity - damage_amount, 0) + + update_integrity(obj_integrity - damage_amount) + //BREAKING FIRST if(integrity_failure && obj_integrity <= integrity_failure * max_integrity) obj_break(damage_flag) + //DESTROYING SECOND if(obj_integrity <= 0) obj_destruction(damage_flag) +/// Proc for recovering obj_integrity. Returns the amount repaired by +/obj/proc/repair_damage(amount) + if(amount <= 0) // We only recover here + return + var/new_integrity = min(max_integrity, obj_integrity + amount) + . = new_integrity - obj_integrity + + update_integrity(new_integrity) + + if(integrity_failure && obj_integrity > integrity_failure * max_integrity) + obj_fix() + +/// Handles the integrity of an object changing. This must be called instead of changing integrity directly. +/obj/proc/update_integrity(new_value) + SHOULD_NOT_OVERRIDE(TRUE) + new_value = max(0, new_value) + if(obj_integrity == new_value) + return + obj_integrity = new_value + SEND_SIGNAL(src, COMSIG_OBJ_INTEGRITY_CHANGED) + +/// This mostly exists to keep obj_integrity private. Might be useful in the future. +/obj/proc/get_integrity() + SHOULD_BE_PURE(TRUE) + return obj_integrity + ///returns the damage value of the attack after processing the obj's various armor protections /obj/proc/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration = 0) if(damage_flag == MELEE && damage_amount < damage_deflection) @@ -223,11 +252,16 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e SEND_SIGNAL(src, COMSIG_OBJ_DECONSTRUCT, disassembled) qdel(src) -///called after the obj takes damage and integrity is below integrity_failure level +/// Called after the obj takes damage and integrity is below integrity_failure level /obj/proc/obj_break(damage_flag) SHOULD_CALL_PARENT(TRUE) SEND_SIGNAL(src, COMSIG_OBJ_BREAK) +/// Called when integrity is repaired above the breaking point having been broken before +/obj/proc/obj_fix() + SHOULD_CALL_PARENT(TRUE) + SEND_SIGNAL(src, COMSIG_OBJ_FIX) + ///what happens when the obj's integrity reaches zero. /obj/proc/obj_destruction(damage_flag) if(damage_flag == ACID) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index e608e2f87d6..504e7a78bdb 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -14,7 +14,7 @@ var/bare_wound_bonus = 0 var/datum/armor/armor - var/obj_integrity //defaults to max_integrity + VAR_PRIVATE/obj_integrity //defaults to max_integrity var/max_integrity = 500 var/integrity_failure = 0 //0 if we have no special broken behavior, otherwise is a percentage of at what point the obj breaks. 0.5 being 50% ///Damage under this value will be completely ignored @@ -59,8 +59,7 @@ armor = getArmor() else if (!istype(armor, /datum/armor)) stack_trace("Invalid type [armor.type] found in .armor during /obj Initialize()") - if(obj_integrity == null) - obj_integrity = max_integrity + obj_integrity = max_integrity . = ..() //Do this after, else mat datums is mad. diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index afd3a0b6c73..436bdfaba5f 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -334,7 +334,10 @@ /obj/structure/grille/broken // Pre-broken grilles for map placement icon_state = "brokengrille" density = FALSE - obj_integrity = 20 broken = TRUE rods_amount = 1 rods_broken = FALSE + +/obj/structure/grille/broken/Initialize(mapload) + . = ..() + take_damage(max_integrity * 0.6) diff --git a/code/game/objects/structures/plaques/_plaques.dm b/code/game/objects/structures/plaques/_plaques.dm index d6fa837b83c..d0212ea05f4 100644 --- a/code/game/objects/structures/plaques/_plaques.dm +++ b/code/game/objects/structures/plaques/_plaques.dm @@ -53,7 +53,7 @@ unwrenched_plaque.desc = desc unwrenched_plaque.engraved = engraved unwrenched_plaque.icon_state = icon_state - unwrenched_plaque.obj_integrity = obj_integrity + unwrenched_plaque.update_integrity(get_integrity()) unwrenched_plaque.setDir(dir) qdel(src) //The plaque structure on the wall goes poof and only the plaque item from unwrenching remains. return TRUE @@ -183,6 +183,6 @@ placed_plaque.desc = desc placed_plaque.engraved = engraved placed_plaque.icon_state = icon_state - placed_plaque.obj_integrity = obj_integrity + placed_plaque.update_integrity(get_integrity()) placed_plaque.setDir(dir) qdel(src) diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm index dacc3b1b53f..fae46fcccc8 100644 --- a/code/game/objects/structures/signs/_signs.dm +++ b/code/game/objects/structures/signs/_signs.dm @@ -88,7 +88,7 @@ unwrenched_sign.sign_path = type unwrenched_sign.set_custom_materials(custom_materials) //This is here so picture frames and wooden things don't get messed up. unwrenched_sign.is_editable = is_editable - unwrenched_sign.obj_integrity = obj_integrity //Transfer how damaged it is. + unwrenched_sign.update_integrity(get_integrity()) //Transfer how damaged it is. unwrenched_sign.setDir(dir) qdel(src) //The sign structure on the wall goes poof and only the sign item from unwrenching remains. return TRUE @@ -206,7 +206,7 @@ user.visible_message("[user] fastens [src] to [target_turf].", \ "You attach the sign to [target_turf].") playsound(target_turf, 'sound/items/deconstruct.ogg', 50, TRUE) - placed_sign.obj_integrity = obj_integrity + placed_sign.update_integrity(get_integrity()) placed_sign.setDir(dir) qdel(src) diff --git a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm index 70a8e1cfbaa..daa5209c73a 100644 --- a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm +++ b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm @@ -7,23 +7,23 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ /// The color that stuff like healing effects and the overmind camera gets var/complementary_color = COLOR_BLACK /// A short description of the power and its effects - var/shortdesc = null + var/shortdesc = null /// Any long, blob-tile specific effects - var/effectdesc = null + var/effectdesc = null /// Short descriptor of what the strain does damage-wise, generally seen in the reroll menu var/analyzerdescdamage = "Unknown. Report this bug to a coder, or just adminhelp." /// Short descriptor of what the strain does in general, generally seen in the reroll menu var/analyzerdesceffect /// Blobbernaut attack verb - var/blobbernaut_message = "slams" + var/blobbernaut_message = "slams" /// Message sent to any mob hit by the blob - var/message = "The blob strikes you" + var/message = "The blob strikes you" /// Gets added onto 'message' if the mob stuck is of type living var/message_living = null /// Stores world.time to figure out when to next give resources var/resource_delay = 0 /// For blob-mobs and extinguishing-based effects - var/fire_based = FALSE + var/fire_based = FALSE var/mob/camera/blob/overmind /// The amount of health regenned on core_process var/base_core_regen = BLOB_CORE_HP_REGEN @@ -93,8 +93,7 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ F.max_spores += factory_spore_bonus for(var/obj/structure/blob/B as anything in overmind.all_blobs) - B.max_integrity *= max_structure_health_multiplier - B.obj_integrity *= max_structure_health_multiplier + B.modify_max_integrity(B.max_integrity * max_structure_health_multiplier) B.update_appearance() for(var/mob/living/simple_animal/hostile/blob/BM as anything in overmind.blob_mobs) @@ -125,13 +124,12 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ F.max_spores -= factory_spore_bonus for(var/obj/structure/blob/B as anything in overmind.all_blobs) - B.max_integrity /= max_structure_health_multiplier - B.obj_integrity /= max_structure_health_multiplier + B.modify_max_integrity(B.max_integrity / max_structure_health_multiplier) for(var/mob/living/simple_animal/hostile/blob/BM as anything in overmind.blob_mobs) BM.maxHealth /= max_mob_health_multiplier BM.health /= max_mob_health_multiplier - + /datum/blobstrain/proc/on_sporedeath(mob/living/spore) @@ -146,7 +144,7 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ if(resource_delay <= world.time) resource_delay = world.time + 10 // 1 second overmind.add_points(point_rate+point_rate_bonus) - overmind.blob_core.obj_integrity = min(overmind.blob_core.max_integrity, overmind.blob_core.obj_integrity+base_core_regen+core_regen_bonus) + overmind.blob_core.repair_damage(base_core_regen + core_regen_bonus) /datum/blobstrain/proc/attack_living(mob/living/L, list/nearby_blobs) // When the blob attacks people send_message(L) diff --git a/code/modules/antagonists/blob/blobstrains/distributed_neurons.dm b/code/modules/antagonists/blob/blobstrains/distributed_neurons.dm index e90f7d602c3..9e22cca0bf4 100644 --- a/code/modules/antagonists/blob/blobstrains/distributed_neurons.dm +++ b/code/modules/antagonists/blob/blobstrains/distributed_neurons.dm @@ -12,7 +12,7 @@ reagent = /datum/reagent/blob/distributed_neurons /datum/blobstrain/reagent/distributed_neurons/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag) - if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && damage <= 20 && B.obj_integrity - damage <= 0 && prob(15)) //if the cause isn't fire or a bomb, the damage is less than 21, we're going to die from that damage, 15% chance of a shitty spore. + if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && damage <= 20 && B.get_integrity() - damage <= 0 && prob(15)) //if the cause isn't fire or a bomb, the damage is less than 21, we're going to die from that damage, 15% chance of a shitty spore. B.visible_message("A spore floats free of the blob!") var/mob/living/simple_animal/hostile/blob/blobspore/weak/BS = new/mob/living/simple_animal/hostile/blob/blobspore/weak(B.loc) BS.overmind = B.overmind diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm index e647d96c281..349ca1b5722 100644 --- a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm +++ b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm @@ -10,7 +10,7 @@ reagent = /datum/reagent/blob/energized_jelly /datum/blobstrain/reagent/energized_jelly/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag) - if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && B.obj_integrity - damage <= 0 && prob(10)) + if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && B.get_integrity() - damage <= 0 && prob(10)) do_sparks(rand(2, 4), FALSE, B) return ..() diff --git a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm index 8b8f3b563fa..183711e79f9 100644 --- a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm +++ b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm @@ -13,18 +13,18 @@ COOLDOWN_DECLARE(retaliate_cooldown) /datum/blobstrain/reagent/reactive_spines/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag) - if(damage && ((damage_type == BRUTE) || (damage_type == BURN)) && B.obj_integrity - damage > 0 && COOLDOWN_FINISHED(src, retaliate_cooldown)) // Is there any damage, is it burn or brute, will we be alive, and has the cooldown finished? + if(damage && ((damage_type == BRUTE) || (damage_type == BURN)) && B.get_integrity() - damage > 0 && COOLDOWN_FINISHED(src, retaliate_cooldown)) // Is there any damage, is it burn or brute, will we be alive, and has the cooldown finished? COOLDOWN_START(src, retaliate_cooldown, 2.5 SECONDS) // 2.5 seconds before auto-retaliate can whack everything within 1 tile again B.visible_message("The blob retaliates, lashing out!") for(var/atom/A in range(1, B)) var/attacked_turf = get_turf(A) - if(isliving(A) && !isblobmonster(A)) // Make sure to inject strain-reagents with automatic attacks when needed. + if(isliving(A) && !isblobmonster(A)) // Make sure to inject strain-reagents with automatic attacks when needed. B.blob_attack_animation(attacked_turf, overmind) attack_living(A) else if(A.blob_act(B)) // After checking for mobs, whack everything else with the standard attack B.blob_attack_animation(attacked_turf, overmind) // Only play the animation if the attack did something meaningful - + return ..() /datum/reagent/blob/reactive_spines diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm index bdfc0ad7357..83d84618da5 100644 --- a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm +++ b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm @@ -13,10 +13,10 @@ /datum/blobstrain/reagent/replicating_foam/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag) if(damage_type == BRUTE) damage = damage * 2 - else if(damage_type == BURN && damage > 0 && B.obj_integrity - damage > 0 && prob(60)) + else if(damage_type == BURN && damage > 0 && B.get_integrity() - damage > 0 && prob(60)) var/obj/structure/blob/newB = B.expand(null, null, 0) if(newB) - newB.obj_integrity = B.obj_integrity - damage + newB.update_integrity(B.get_integrity() - damage) newB.update_appearance() return ..() diff --git a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm index 1a7b92c99de..3db0041b310 100644 --- a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm +++ b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm @@ -15,7 +15,7 @@ B.forceMove(T) /datum/blobstrain/reagent/shifting_fragments/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag) - if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && damage > 0 && B.obj_integrity - damage > 0 && prob(60-damage)) + if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && damage > 0 && B.get_integrity() - damage > 0 && prob(60-damage)) var/list/blobstopick = list() for(var/obj/structure/blob/OB in orange(1, B)) if((istype(OB, /obj/structure/blob/normal) || (istype(OB, /obj/structure/blob/shield) && prob(25))) && OB.overmind && OB.overmind.blobstrain.type == B.overmind.blobstrain.type) diff --git a/code/modules/antagonists/blob/overmind.dm b/code/modules/antagonists/blob/overmind.dm index 410b87f2727..ed5a2e9765a 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -222,7 +222,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) /mob/camera/blob/update_health_hud() if(blob_core) - var/current_health = round((blob_core.obj_integrity / blob_core.max_integrity) * 100) + var/current_health = round((blob_core.get_integrity() / blob_core.max_integrity) * 100) hud_used.healths.maptext = MAPTEXT("
[current_health]%
") for(var/mob/living/simple_animal/hostile/blob/blobbernaut/B in blob_mobs) if(B.hud_used && B.hud_used.blobpwrdisplay) @@ -273,7 +273,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) /mob/camera/blob/get_status_tab_items() . = ..() if(blob_core) - . += "Core Health: [blob_core.obj_integrity]" + . += "Core Health: [blob_core.get_integrity()]" . += "Power Stored: [blob_points]/[max_blob_points]" . += "Blobs to Win: [blobs_legit.len]/[blobwincount]" if(free_strain_rerolls) diff --git a/code/modules/antagonists/blob/powers.dm b/code/modules/antagonists/blob/powers.dm index 69a1769fef4..2c66956ea9f 100644 --- a/code/modules/antagonists/blob/powers.dm +++ b/code/modules/antagonists/blob/powers.dm @@ -116,7 +116,7 @@ if(S) if(!can_buy(BLOB_UPGRADE_REFLECTOR_COST)) return - if(S.obj_integrity < S.max_integrity * 0.5) + if(S.get_integrity() < S.max_integrity * 0.5) add_points(BLOB_UPGRADE_REFLECTOR_COST) to_chat(src, "This shield blob is too damaged to be modified properly!") return @@ -134,7 +134,7 @@ if(B.naut) //if it already made a blobbernaut, it can't do it again to_chat(src, "This factory blob is already sustaining a blobbernaut.") return - if(B.obj_integrity < B.max_integrity * 0.5) + if(B.get_integrity() < B.max_integrity * 0.5) to_chat(src, "This factory blob is too damaged to sustain a blobbernaut.") return if(!can_buy(BLOBMOB_BLOBBERNAUT_RESOURCE_COST)) @@ -144,8 +144,7 @@ to_chat(src, "You attempt to produce a blobbernaut.") var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as a [blobstrain.name] blobbernaut?", ROLE_BLOB, ROLE_BLOB, 50) //players must answer rapidly if(LAZYLEN(candidates)) //if we got at least one candidate, they're a blobbernaut now. - B.max_integrity = initial(B.max_integrity) * 0.25 //factories that produced a blobbernaut have much lower health - B.obj_integrity = min(B.obj_integrity, B.max_integrity) + B.modify_max_integrity(initial(B.max_integrity) * 0.25) //factories that produced a blobbernaut have much lower health B.update_appearance() B.visible_message("The blobbernaut [pick("rips", "tears", "shreds")] its way out of the factory blob!") playsound(B.loc, 'sound/effects/splat.ogg', 50, TRUE) diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm index 9215d8f2c87..84836f1f44e 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -817,7 +817,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) /datum/ai_module/upgrade/upgrade_turrets/upgrade(mob/living/silicon/ai/AI) for(var/obj/machinery/porta_turret/ai/turret in GLOB.machines) - turret.obj_integrity += 30 + turret.repair_damage(30) turret.lethal_projectile = /obj/projectile/beam/laser/heavylaser //Once you see it, you will know what it means to FEAR. turret.lethal_projectile_sound = 'sound/weapons/lasercannonfire.ogg' diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 7a2218c2cc2..6ca9e571512 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -880,7 +880,7 @@ new /obj/item/stack/sheet/iron(loc, 2) var/obj/item/I = new /obj/item/electronics/airalarm(loc) if(!disassembled) - I.obj_integrity = I.max_integrity * 0.5 + I.take_damage(I.max_integrity * 0.5, sound_effect=FALSE) new /obj/item/stack/cable_coil(loc, 3) qdel(src) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index cbcd040b0d9..91dcc721a9b 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -417,7 +417,7 @@ var/obj/item/pipe/stored = new construction_type(loc, null, dir, src, pipe_color) stored.setPipingLayer(piping_layer) if(!disassembled) - stored.obj_integrity = stored.max_integrity * 0.5 + stored.take_damage(stored.max_integrity * 0.5, sound_effect=FALSE) transfer_fingerprints_to(stored) . = stored ..() diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm index 57b0520944f..7d8199c3c7b 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm @@ -259,7 +259,7 @@ data["power_level"] = connected_core.power_level data["iron_content"] = connected_core.iron_content - data["integrity"] = connected_core.get_integrity() + data["integrity"] = connected_core.get_integrity_percent() data["start_power"] = connected_core.start_power data["start_cooling"] = connected_core.start_cooling diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm index 16462780efc..47c05c9a22c 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm @@ -204,7 +204,7 @@ * Check the integrity level and returns the status of the machine */ /obj/machinery/atmospherics/components/unary/hypertorus/core/proc/get_status() - var/integrity = get_integrity() + var/integrity = get_integrity_percent() if(integrity < HYPERTORUS_MELTING_PERCENT) return HYPERTORUS_MELTING @@ -239,7 +239,7 @@ /** * Getter for the machine integrity */ -/obj/machinery/atmospherics/components/unary/hypertorus/core/proc/get_integrity() +/obj/machinery/atmospherics/components/unary/hypertorus/core/proc/get_integrity_percent() var/integrity = critical_threshold_proximity / melting_point integrity = round(100 - integrity * 100, 0.01) integrity = integrity < 0 ? 0 : integrity @@ -257,18 +257,18 @@ alarm() if(critical_threshold_proximity > emergency_point) - radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity()]%", common_channel) + radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity_percent()]%", common_channel) lastwarning = REALTIMEOFDAY if(!has_reached_emergency) investigate_log("has reached the emergency point for the first time.", INVESTIGATE_HYPERTORUS) message_admins("[src] has reached the emergency point [ADMIN_JMP(src)].") has_reached_emergency = TRUE else if(critical_threshold_proximity >= critical_threshold_proximity_archived) // The damage is still going up - radio.talk_into(src, "[warning_alert] Integrity: [get_integrity()]%", engineering_channel) + radio.talk_into(src, "[warning_alert] Integrity: [get_integrity_percent()]%", engineering_channel) lastwarning = REALTIMEOFDAY - (WARNING_TIME_DELAY * 5) else // Phew, we're safe - radio.talk_into(src, "[safe_alert] Integrity: [get_integrity()]%", engineering_channel) + radio.talk_into(src, "[safe_alert] Integrity: [get_integrity_percent()]%", engineering_channel) lastwarning = REALTIMEOFDAY //Melt diff --git a/code/modules/capture_the_flag/capture_the_flag.dm b/code/modules/capture_the_flag/capture_the_flag.dm index dae361b3ef6..4f593896f05 100644 --- a/code/modules/capture_the_flag/capture_the_flag.dm +++ b/code/modules/capture_the_flag/capture_the_flag.dm @@ -453,7 +453,7 @@ continue if(isstructure(atm)) var/obj/structure/S = atm - S.obj_integrity = S.max_integrity + S.repair_damage(S.max_integrity - S.get_integrity()) else if(!is_type_in_typecache(atm, ctf_object_typecache)) qdel(atm) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index c50148d59fe..a3e66ec1a9d 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -292,8 +292,7 @@ /datum/spacevine_mutation/woodening/on_grow(obj/structure/spacevine/holder) if(holder.energy) holder.density = TRUE - holder.max_integrity = 100 - holder.obj_integrity = holder.max_integrity + holder.modify_max_integrity(100) /datum/spacevine_mutation/woodening/on_hit(obj/structure/spacevine/holder, mob/living/hitter, obj/item/I, expected_damage) if(I?.get_sharpness()) diff --git a/code/modules/explorer_drone/control_console.dm b/code/modules/explorer_drone/control_console.dm index 91bfe077543..8e50c3420e6 100644 --- a/code/modules/explorer_drone/control_console.dm +++ b/code/modules/explorer_drone/control_console.dm @@ -57,7 +57,7 @@ if(controlled_drone) .["drone_status"] = controlled_drone.drone_status .["drone_name"] = controlled_drone.name - .["drone_integrity"] = controlled_drone.obj_integrity + .["drone_integrity"] = controlled_drone.get_integrity() .["drone_max_integrity"] = controlled_drone.max_integrity .["drone_log"] = controlled_drone.drone_log .["configurable"] = controlled_drone.drone_status == EXODRONE_IDLE diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index 78ce793a169..0ae32d893db 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -72,7 +72,7 @@ if(LAZYLEN(turrets)) for(var/turret in turrets) var/obj/machinery/porta_turret/aux_base/base_turret = turret - var/turret_integrity = max((base_turret.obj_integrity - base_turret.integrity_failure * base_turret.max_integrity) / (base_turret.max_integrity - base_turret.integrity_failure * max_integrity) * 100, 0) + var/turret_integrity = max((base_turret.get_integrity() - base_turret.integrity_failure * base_turret.max_integrity) / (base_turret.max_integrity - base_turret.integrity_failure * max_integrity) * 100, 0) var/turret_status if(base_turret.machine_stat & BROKEN) turret_status = "ERROR" diff --git a/code/modules/mob/living/simple_animal/hostile/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebot.dm index 644ec6e8a90..6a03aa12a26 100644 --- a/code/modules/mob/living/simple_animal/hostile/hivebot.dm +++ b/code/modules/mob/living/simple_animal/hostile/hivebot.dm @@ -116,12 +116,12 @@ /mob/living/simple_animal/hostile/hivebot/mechanic/AttackingTarget() if(istype(target, /obj/machinery)) var/obj/machinery/fixable = target - if(fixable.obj_integrity >= fixable.max_integrity) + if(fixable.get_integrity() >= fixable.max_integrity) to_chat(src, "Diagnostics indicate that this machine is at peak integrity.") return to_chat(src, "You begin repairs...") if(do_after(src, 50, target = fixable)) - fixable.obj_integrity = fixable.max_integrity + fixable.repair_damage(fixable.max_integrity - fixable.get_integrity()) do_sparks(3, TRUE, fixable) to_chat(src, "Repairs complete.") return diff --git a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm index a77e976add7..a9abfac451e 100644 --- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm +++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm @@ -121,7 +121,7 @@ return FALSE if(!M.has_charge(required_mecha_charge)) return FALSE - if(M.obj_integrity < M.max_integrity*0.5) + if(M.get_integrity() < M.max_integrity*0.5) return FALSE return TRUE @@ -215,7 +215,7 @@ return //Too Much Damage - Eject - if(mecha.obj_integrity < mecha.max_integrity*0.1) + if(mecha.get_integrity() < mecha.max_integrity*0.1) exit_mecha(mecha) return @@ -226,7 +226,7 @@ action.Trigger() //Heavy damage - Defense Power or Retreat - if(mecha.obj_integrity < mecha.max_integrity*0.25) + if(mecha.get_integrity() < mecha.max_integrity*0.25) if(prob(defense_mode_chance)) if(LAZYACCESSASSOC(mecha.occupant_actions, src, /datum/action/vehicle/sealed/mecha/mech_defense_mode) && !mecha.defense_mode) var/datum/action/action = mecha.occupant_actions[src][/datum/action/vehicle/sealed/mecha/mech_defense_mode] diff --git a/code/modules/modular_computers/computers/item/processor.dm b/code/modules/modular_computers/computers/item/processor.dm index 05ce1faadbc..5003ca98aba 100644 --- a/code/modules/modular_computers/computers/item/processor.dm +++ b/code/modules/modular_computers/computers/item/processor.dm @@ -33,7 +33,7 @@ hardware_flag = machinery_computer.hardware_flag max_hardware_size = machinery_computer.max_hardware_size steel_sheet_cost = machinery_computer.steel_sheet_cost - obj_integrity = machinery_computer.obj_integrity + update_integrity(machinery_computer.get_integrity()) max_integrity = machinery_computer.max_integrity integrity_failure = machinery_computer.integrity_failure base_active_power_usage = machinery_computer.base_active_power_usage diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 1e57e0861a8..764fe792794 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -82,7 +82,7 @@ else . += cpu.active_program?.program_icon_state || screen_icon_state_menu - if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity) + if(cpu && cpu.get_integrity() <= cpu.integrity_failure * cpu.max_integrity) . += "bsod" . += "broken" diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 432f7cbbd2a..18d8bb89b34 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -129,7 +129,7 @@ return data["active"] = TRUE - data["SM_integrity"] = active.get_integrity() + data["SM_integrity"] = active.get_integrity_percent() data["SM_power"] = active.power data["SM_ambienttemp"] = air.temperature data["SM_ambientpressure"] = air.return_pressure() @@ -159,7 +159,7 @@ if(A) SMS.Add(list(list( "area_name" = A.name, - "integrity" = S.get_integrity(), + "integrity" = S.get_integrity_percent(), "uid" = S.uid ))) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index ffc96868d65..58a457f1373 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -607,7 +607,7 @@ newlight.setDir(src.dir) newlight.stage = cur_stage if(!disassembled) - newlight.obj_integrity = newlight.max_integrity * 0.5 + newlight.take_damage(newlight.max_integrity * 0.5, sound_effect=FALSE) if(status != LIGHT_BROKEN) break_light_tube() if(status != LIGHT_EMPTY) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 16f524c5654..07b046825ec 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -280,7 +280,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(!air) return SUPERMATTER_ERROR - var/integrity = get_integrity() + var/integrity = get_integrity_percent() if(integrity < SUPERMATTER_DELAM_PERCENT) return SUPERMATTER_DELAMINATING @@ -315,7 +315,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(SUPERMATTER_WARNING) playsound(src, 'sound/machines/terminal_alert.ogg', 75) -/obj/machinery/power/supermatter_crystal/proc/get_integrity() +/obj/machinery/power/supermatter_crystal/proc/get_integrity_percent() var/integrity = damage / explosion_point integrity = round(100 - integrity * 100, 0.01) integrity = integrity < 0 ? 0 : integrity @@ -487,7 +487,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) //Check for holes in the SM inner chamber for(var/turf/open/space/turf_to_check in RANGE_TURFS(1, loc)) if(LAZYLEN(turf_to_check.atmos_adjacent_turfs)) - var/integrity = get_integrity() + var/integrity = get_integrity_percent() if(integrity < 10) damage += clamp((power * 0.0005) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE) else if(integrity < 25) @@ -724,7 +724,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) //Oh shit it's bad, time to freak out if(damage > emergency_point) - radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity()]%", common_channel) + radio.talk_into(src, "[emergency_alert] Integrity: [get_integrity_percent()]%", common_channel) SEND_SIGNAL(src, COMSIG_SUPERMATTER_DELAM_ALARM) lastwarning = REALTIMEOFDAY if(!has_reached_emergency) @@ -732,12 +732,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) message_admins("[src] has reached the emergency point [ADMIN_JMP(src)].") has_reached_emergency = TRUE else if(damage >= damage_archived) // The damage is still going up - radio.talk_into(src, "[warning_alert] Integrity: [get_integrity()]%", engineering_channel) + radio.talk_into(src, "[warning_alert] Integrity: [get_integrity_percent()]%", engineering_channel) SEND_SIGNAL(src, COMSIG_SUPERMATTER_DELAM_ALARM) lastwarning = REALTIMEOFDAY - (WARNING_DELAY * 5) else // Phew, we're safe - radio.talk_into(src, "[safe_alert] Integrity: [get_integrity()]%", engineering_channel) + radio.talk_into(src, "[safe_alert] Integrity: [get_integrity_percent()]%", engineering_channel) lastwarning = REALTIMEOFDAY if(power > POWER_PENALTY_THRESHOLD) @@ -787,8 +787,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(!blob || isspaceturf(loc)) //does nothing in space return playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, TRUE) - damage += blob.obj_integrity * 0.5 //take damage equal to 50% of remaining blob health before it tried to eat us - if(blob.obj_integrity > 100) + damage += blob.get_integrity() * 0.5 //take damage equal to 50% of remaining blob health before it tried to eat us + if(blob.get_integrity() > 100) blob.visible_message("\The [blob] strikes at \the [src] and flinches away!", "You hear a loud crack as you are washed with a wave of heat.") blob.take_damage(100, BURN) diff --git a/code/modules/surgery/organs/tongue.dm b/code/modules/surgery/organs/tongue.dm index 212f35f3ee9..2c77db9ed17 100644 --- a/code/modules/surgery/organs/tongue.dm +++ b/code/modules/surgery/organs/tongue.dm @@ -165,7 +165,7 @@ statue.set_visuals(becoming_statue.appearance) statue.forceMove(get_turf(becoming_statue)) becoming_statue.forceMove(statue) - statue.obj_integrity = becoming_statue.health + statue.update_integrity(becoming_statue.health) RegisterSignal(becoming_statue, COMSIG_MOVABLE_MOVED, .proc/human_left_statue) //somehow they used an exploit/teleportation to leave statue, lets clean up diff --git a/code/modules/vehicles/mecha/combat/durand.dm b/code/modules/vehicles/mecha/combat/durand.dm index 311bcbe8682..708df8880f9 100644 --- a/code/modules/vehicles/mecha/combat/durand.dm +++ b/code/modules/vehicles/mecha/combat/durand.dm @@ -140,7 +140,6 @@ own integrity back to max. Shield is automatically dropped if we run out of powe invisibility = INVISIBILITY_MAXIMUM //no showing on right-click pixel_y = 4 max_integrity = 10000 - obj_integrity = 10000 anchored = TRUE light_system = MOVABLE_LIGHT light_range = MINIMUM_USEFUL_LIGHT_RANGE diff --git a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm index 04d45d23de2..74b990c9c00 100644 --- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm @@ -253,8 +253,8 @@ chassis.clear_internal_damage(int_dam_flag) repaired = TRUE break - if(h_boost<0 || chassis.obj_integrity < chassis.max_integrity) - chassis.obj_integrity += min(h_boost, chassis.max_integrity-chassis.obj_integrity) + if(h_boost<0 || chassis.get_integrity() < chassis.max_integrity) + chassis.repair_damage(h_boost) repaired = TRUE if(repaired) if(!chassis.use_power(energy_drain)) diff --git a/code/modules/vehicles/mecha/equipment/tools/work_tools.dm b/code/modules/vehicles/mecha/equipment/tools/work_tools.dm index 1e7bf37b020..419182cf5fb 100644 --- a/code/modules/vehicles/mecha/equipment/tools/work_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/work_tools.dm @@ -376,10 +376,10 @@ marktwo.dna_lock = markone.dna_lock marktwo.mecha_flags = markone.mecha_flags marktwo.strafe = markone.strafe - marktwo.obj_integrity = round((markone.obj_integrity / markone.max_integrity) * marktwo.obj_integrity) //Integ set to the same percentage integ as the old mecha, rounded to be whole number + //Integ set to the same percentage integ as the old mecha, rounded to be whole number + marktwo.update_integrity(round((markone.get_integrity() / markone.max_integrity) * marktwo.get_integrity())) if(markone.name != initial(markone.name)) marktwo.name = markone.name markone.wreckage = FALSE qdel(markone) playsound(get_turf(marktwo),'sound/items/ratchet.ogg',50,TRUE) - return diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 9f1a17469f1..bd66a6f5cc8 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -110,7 +110,7 @@ if(recharge_port && !QDELETED(recharge_port)) data["recharge_port"] = list("mech" = null) if(recharge_port.recharging_mech && !QDELETED(recharge_port.recharging_mech)) - data["recharge_port"]["mech"] = list("health" = recharge_port.recharging_mech.obj_integrity, "maxhealth" = recharge_port.recharging_mech.max_integrity, "cell" = null, "name" = recharge_port.recharging_mech.name,) + data["recharge_port"]["mech"] = list("health" = recharge_port.recharging_mech.get_integrity(), "maxhealth" = recharge_port.recharging_mech.max_integrity, "cell" = null, "name" = recharge_port.recharging_mech.name,) if(recharge_port.recharging_mech.cell && !QDELETED(recharge_port.recharging_mech.cell)) data["recharge_port"]["mech"]["cell"] = list( "charge" = recharge_port.recharging_mech.cell.charge, diff --git a/code/modules/vehicles/mecha/mecha_control_console.dm b/code/modules/vehicles/mecha/mecha_control_console.dm index cc76561f00b..2b0e841e930 100644 --- a/code/modules/vehicles/mecha/mecha_control_console.dm +++ b/code/modules/vehicles/mecha/mecha_control_console.dm @@ -26,7 +26,7 @@ var/obj/vehicle/sealed/mecha/M = MT.chassis var/list/mech_data = list( name = M.name, - integrity = round((M.obj_integrity / M.max_integrity) * 100), + integrity = round((M.get_integrity() / M.max_integrity) * 100), charge = M.cell ? round(M.cell.percent()) : null, airtank = M.internal_tank ? M.return_pressure() : null, pilot = M.return_drivers(), @@ -94,7 +94,7 @@ var/cell_charge = chassis.get_charge() var/answer = {"Name: [chassis.name]
- Integrity: [round((chassis.obj_integrity/chassis.max_integrity * 100), 0.01)]%
+ Integrity: [round((chassis.get_integrity()/chassis.max_integrity * 100), 0.01)]%
Cell Charge: [isnull(cell_charge) ? "Not Found":"[chassis.cell.percent()]%"]
Airtank: [chassis.internal_tank ? "[round(chassis.return_pressure(), 0.01)]" : "Not Equipped"] kPa
Pilot: [chassis.return_drivers() || "None"]
diff --git a/code/modules/vehicles/mecha/working/ripley.dm b/code/modules/vehicles/mecha/working/ripley.dm index e4c531adc31..14b898bd08f 100644 --- a/code/modules/vehicles/mecha/working/ripley.dm +++ b/code/modules/vehicles/mecha/working/ripley.dm @@ -117,7 +117,10 @@ /obj/vehicle/sealed/mecha/working/ripley/mining desc = "An old, dusty mining Ripley." name = "\improper APLU \"Miner\"" - obj_integrity = 75 //Low starting health + +/obj/vehicle/sealed/mecha/working/ripley/mining/Initialize() + . = ..() + take_damage(125) // Low starting health /obj/vehicle/sealed/mecha/working/ripley/mining/Initialize() . = ..() @@ -147,7 +150,6 @@ icon_state = "hauler" base_icon_state = "hauler" max_equip = 2 - obj_integrity = 50 //Low starting health max_integrity = 100 //Has half the health of a normal RIPLEY mech, so it's harder to use as a weapon. /obj/vehicle/sealed/mecha/working/ripley/cargo/Initialize() @@ -159,6 +161,8 @@ var/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp/HC = new HC.attach(src) + take_damage(max_integrity * 0.5, sound_effect=FALSE) //Low starting health + /obj/vehicle/sealed/mecha/working/ripley/Exit(atom/movable/O) if(O in cargo) return FALSE diff --git a/modular_skyrat/master_files/code/modules/events/spacevine.dm b/modular_skyrat/master_files/code/modules/events/spacevine.dm index 20cdfd08961..6678b7c3462 100644 --- a/modular_skyrat/master_files/code/modules/events/spacevine.dm +++ b/modular_skyrat/master_files/code/modules/events/spacevine.dm @@ -292,8 +292,7 @@ /datum/spacevine_mutation/woodening/on_grow(obj/structure/spacevine/holder) if(holder.energy) holder.density = TRUE - holder.max_integrity = 100 - holder.obj_integrity = holder.max_integrity + holder.modify_max_integrity(100) /datum/spacevine_mutation/woodening/on_hit(obj/structure/spacevine/holder, mob/living/hitter, obj/item/I, expected_damage) if(I?.get_sharpness()) diff --git a/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_controller.dm b/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_controller.dm index 3d7fd4b19ff..d29c4038013 100644 --- a/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_controller.dm +++ b/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_controller.dm @@ -72,7 +72,7 @@ var/struct = new spawn_type(location, blob_type) other_structures[struct] = TRUE our_core.max_integrity += 10 - our_core.obj_integrity += 10 + our_core.repair_damage(10) return struct /datum/biohazard_blob_controller/Destroy() @@ -170,7 +170,7 @@ active_resin[new_resin] = TRUE new_resin.CalcDir() our_core.max_integrity += 2 - our_core.obj_integrity += 2 + our_core.repair_damage(2) return new_resin /datum/biohazard_blob_controller/proc/ActivateAdjacentResinRecursive(turf/centrum_turf, iterations = 1) diff --git a/modular_skyrat/modules/firefighter/code/firefighter.dm b/modular_skyrat/modules/firefighter/code/firefighter.dm index 25260a0ed57..51118e60a8c 100644 --- a/modular_skyrat/modules/firefighter/code/firefighter.dm +++ b/modular_skyrat/modules/firefighter/code/firefighter.dm @@ -91,7 +91,7 @@ mkf.dna_lock = markone.dna_lock mkf.mecha_flags = markone.mecha_flags mkf.strafe = markone.strafe - mkf.obj_integrity = round((markone.obj_integrity / markone.max_integrity) * mkf.obj_integrity) //Integ set to the same percentage integ as the old mecha, rounded to be whole number + mkf.update_integrity(round((markone.get_integrity() / markone.max_integrity) * mkf.get_integrity())) //Integ set to the same percentage integ as the old mecha, rounded to be whole number if(markone.name != initial(markone.name)) mkf.name = markone.name markone.wreckage = FALSE diff --git a/modular_skyrat/modules/sec_haul/code/peacekeeper/peacekeeper_hammer.dm b/modular_skyrat/modules/sec_haul/code/peacekeeper/peacekeeper_hammer.dm index d6f11f1ca97..b5c8aad0ead 100644 --- a/modular_skyrat/modules/sec_haul/code/peacekeeper/peacekeeper_hammer.dm +++ b/modular_skyrat/modules/sec_haul/code/peacekeeper/peacekeeper_hammer.dm @@ -97,7 +97,7 @@ if(!(user.Adjacent(target))) remove_track(user) return FALSE - if(target.obj_integrity < 1) + if(target.get_integrity() < 1) do_smoke(3, target.loc) remove_track(user) qdel(target, TRUE) @@ -111,7 +111,7 @@ if(do_after(user, breaching_delay)) if(QDELETED(target)) return FALSE - target.obj_integrity -= force*breaching_multipler + target.take_damage(force*breaching_multipler) playsound(target, 'sound/weapons/sonic_jackhammer.ogg', 70) visible_message("[user] smashes the [target] forcefully with the [src]") user.do_attack_animation(target, used_item = src) diff --git a/modular_skyrat/modules/tableflip/code/flipped_table.dm b/modular_skyrat/modules/tableflip/code/flipped_table.dm index e4440ecf1e7..905f0da3f73 100644 --- a/modular_skyrat/modules/tableflip/code/flipped_table.dm +++ b/modular_skyrat/modules/tableflip/code/flipped_table.dm @@ -55,7 +55,7 @@ user.visible_message("[user] starts flipping [src]!", "You start flipping over the [src]!") if(do_after(user, max_integrity/4)) var/obj/structure/table/T = new table_type(src.loc) - T.obj_integrity = src.obj_integrity + T.update_integrity(src.get_integrity()) user.visible_message("[user] flips over the [src]!", "You flip over the [src]!") playsound(src, 'sound/items/trayhit2.ogg', 100) qdel(src) @@ -78,7 +78,7 @@ if(new_dir == NORTH) T.layer = BELOW_MOB_LAYER T.max_integrity = src.max_integrity - T.obj_integrity = src.obj_integrity + T.update_integrity(src.get_integrity()) T.table_type = src.type user.visible_message("[user] flips over the [src]!", "You flip over the [src]!") playsound(src, 'sound/items/trayhit2.ogg', 100)