diff --git a/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm b/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm
index e21d6dc72bfc8..a8f84509c1816 100644
--- a/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm
+++ b/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm
@@ -8,9 +8,19 @@
#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)
-#define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct" //! from base of obj/deconstruct(): (disassembled)
+///from base of [/obj/proc/update_integrity]: (old_value, new_value)
+#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
#define COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH "obj_default_unfasten_wrench"
-#define COMSIG_OBJ_HIDE "obj_hide" //from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide
+///from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide
+#define COMSIG_OBJ_HIDE "obj_hide"
+
+/// from /obj/proc/obj_break: ()
+#define COMSIG_OBJ_BREAK "obj_break"
+/// from base of [/obj/proc/obj_fix]: ()
+#define COMSIG_OBJ_FIX "obj_fix"
/// from /obj/proc/make_unfrozen()
#define COMSIG_OBJ_UNFREEZE "obj_unfreeze"
@@ -21,3 +31,4 @@
#define COMPONENT_OBJ_CANCEL_CHARGE (1<<0)
///Called when a payment component changes value
#define COMSIG_OBJ_ATTEMPT_CHARGE_CHANGE "obj_attempt_simple_charge_change"
+
diff --git a/code/datums/components/dejavu.dm b/code/datums/components/dejavu.dm
index b2a2cddf9c9b3..5eef11348077b 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_REF(rewind_obj)
addtimer(CALLBACK(src, rewind_type), rewind_interval)
@@ -103,5 +103,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/elements/art.dm b/code/datums/elements/art.dm
index 3f9a5e9e5a610..ca28d0037e4e5 100644
--- a/code/datums/elements/art.dm
+++ b/code/datums/elements/art.dm
@@ -49,6 +49,6 @@
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 a2b6a80357e39..c27d23adee610 100644
--- a/code/datums/elements/obj_regen.dm
+++ b/code/datums/elements/obj_regen.dm
@@ -1,5 +1,5 @@
/** Object integrity regeneration element added by alien alloy.
- */
+ */
/datum/element/obj_regen
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH
id_arg_index = 2
@@ -22,7 +22,7 @@
rate = _rate
RegisterSignal(target, COMSIG_OBJ_TAKE_DAMAGE, PROC_REF(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
@@ -35,6 +35,7 @@
/// Handles beginning processing objects.
/datum/element/obj_regen/proc/on_take_damage(obj/target, damage_amt)
+ SIGNAL_HANDLER
if(!damage_amt)
return
if(!length(processing))
@@ -72,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 2efbe213726c1..cb25e403e242c 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -549,7 +549,7 @@ Class Procs:
. = new_frame
new_frame.set_anchored(TRUE)
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)
/obj/machinery/obj_break(damage_flag)
diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm
index ecb65e728e377..eac10a08fbc9f 100644
--- a/code/game/machinery/airlock_cycle_control.dm
+++ b/code/game/machinery/airlock_cycle_control.dm
@@ -821,7 +821,7 @@
new /obj/item/stack/sheet/iron(loc, 2)
var/obj/item/I = new /obj/item/electronics/advanced_airlock_controller(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/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm
index 4a5835ce82a60..217860ccbbbb8 100644
--- a/code/game/machinery/aug_manipulator.dm
+++ b/code/game/machinery/aug_manipulator.dm
@@ -4,7 +4,6 @@
icon = 'icons/obj/robotics.dmi'
icon_state = "robocolorer"
density = TRUE
- obj_integrity = 200
max_integrity = 200
var/obj/item/bodypart/storedpart
var/initial_icon_state
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index cfbf3077f42ed..829dad51359f0 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -398,7 +398,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0)
assembly_ref = 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/digital_clock.dm b/code/game/machinery/digital_clock.dm
index 8793d113cabd7..a833cbcd8669a 100644
--- a/code/game/machinery/digital_clock.dm
+++ b/code/game/machinery/digital_clock.dm
@@ -7,7 +7,6 @@
verb_ask = "bloops"
verb_exclaim = "blares"
max_integrity = 250
- obj_integrity = 250
density = FALSE
layer = ABOVE_WINDOW_LAYER
var/station_minutes
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 800b94656ea1f..89bc71c57e7d8 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -1451,8 +1451,7 @@
A.update_icon()
if(!disassembled)
- if(A)
- A.obj_integrity = A.max_integrity * 0.5
+ A?.update_integrity(A.max_integrity * 0.5)
else
if(user)
to_chat(user, "You remove the airlock electronics.")
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index 792ccd29664c5..b116e9250aa2b 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -361,7 +361,7 @@
F.constructionStep = CONSTRUCTION_PANEL_OPEN
else
F.constructionStep = CONSTRUCTION_WIRES_EXPOSED
- F.obj_integrity = F.max_integrity * 0.5
+ F.update_integrity(F.max_integrity * 0.5)
F.update_icon()
qdel(src)
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 6cab7c56d7e0f..a8f5d048da866 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -302,7 +302,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/firealarm, 26)
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/machinery/shuttle/custom_shuttle.dm b/code/game/machinery/shuttle/custom_shuttle.dm
index 9bf721b80c83b..9e57eb46b10ea 100644
--- a/code/game/machinery/shuttle/custom_shuttle.dm
+++ b/code/game/machinery/shuttle/custom_shuttle.dm
@@ -2,7 +2,6 @@
name = "shuttle component"
desc = "Something for shuttles."
density = TRUE
- obj_integrity = 250
max_integrity = 250
icon = 'icons/turf/shuttle.dmi'
icon_state = "burst_plasma"
diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm
index 262c26e1111c3..24d3af7b2e243 100644
--- a/code/game/machinery/shuttle/shuttle_engine.dm
+++ b/code/game/machinery/shuttle/shuttle_engine.dm
@@ -10,7 +10,6 @@
desc = "A thruster for shuttles."
density = TRUE
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
- obj_integrity = 250
max_integrity = 250
icon = 'icons/turf/shuttle.dmi'
icon_state = "burst_plasma"
diff --git a/code/game/objects/items/devices/reverse_bear_trap.dm b/code/game/objects/items/devices/reverse_bear_trap.dm
index 296bc9981a0df..f1159d676953e 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
item_state = "rack_parts"
lefthand_file = 'icons/mob/inhands/items_lefthand.dmi'
diff --git a/code/game/objects/items/mjolnir.dm b/code/game/objects/items/mjolnir.dm
index 0d25fe18150e6..279edbcbe96b3 100644
--- a/code/game/objects/items/mjolnir.dm
+++ b/code/game/objects/items/mjolnir.dm
@@ -156,7 +156,7 @@
if (isobj(target))
var/obj/hit_structure = target
hit_structure.take_damage(120)
- if (hit_structure.obj_integrity > 0)
+ if (hit_structure.get_integrity() > 0)
qdel(src)
if (isliving(target))
var/mob/living/hit_mob = target
diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm
index 1eba50f4b5fd1..0a4d9d7d8f926 100644
--- a/code/game/objects/obj_defense.dm
+++ b/code/game/objects/obj_defense.dm
@@ -18,8 +18,9 @@
if(SEND_SIGNAL(src, COMSIG_OBJ_TAKE_DAMAGE, damage_amount, damage_type, damage_flag, sound_effect, attack_dir, armour_penetration) & COMPONENT_NO_TAKE_DAMAGE)
return
. = damage_amount
- var/old_integ = obj_integrity
- obj_integrity = max(old_integ - damage_amount, 0)
+
+ update_integrity(obj_integrity - damage_amount)
+
//BREAKING FIRST
if(integrity_failure && obj_integrity <= integrity_failure * max_integrity)
obj_break(damage_flag)
@@ -28,6 +29,32 @@
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)
switch(damage_type)
@@ -257,9 +284,15 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
SEND_SIGNAL(src, COMSIG_OBJ_DECONSTRUCT, disassembled)
qdel(src)
-//what happens when the obj's health is below integrity_failure level.
+/// Called after the obj takes damage and integrity is below integrity_failure level
/obj/proc/obj_break(damage_flag)
- return
+ 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)
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index 11785b80c298d..b9dcdeb11204b 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -13,7 +13,7 @@
var/datum/armor/armor
/// The integrity the object starts at. Defaults to max_integrity.
- var/obj_integrity
+ VAR_PRIVATE/obj_integrity //defaults to max_integrity
/// The maximum integrity the object can have.
var/max_integrity = 500
/// The object will break once obj_integrity reaches this amount in take_damage(). 0 if we have no special broken behavior, otherwise is a percentage of at what point the obj breaks. 0.5 being 50%
@@ -72,8 +72,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/aliens.dm b/code/game/objects/structures/aliens.dm
index 5b45e8b8ef67a..8517bb98133d6 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -332,6 +332,7 @@
break
/obj/structure/alien/egg/obj_break(damage_flag)
+ . = ..()
if(!(flags_1 & NODECONSTRUCT_1))
if(status != BURST)
Burst(kill=TRUE)
diff --git a/code/game/objects/structures/barsigns.dm b/code/game/objects/structures/barsigns.dm
index 66f5a204c1ffc..d47d71b3fa1d0 100644
--- a/code/game/objects/structures/barsigns.dm
+++ b/code/game/objects/structures/barsigns.dm
@@ -43,6 +43,7 @@
return set_sign(new_sign)
/obj/structure/sign/barsign/obj_break(damage_flag)
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
broken = TRUE
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 9498c3350c2be..7b8ad020717bc 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -315,6 +315,7 @@
qdel(src)
/obj/structure/closet/obj_break(damage_flag)
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
bust_open()
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index bcad7aebed77f..6678f8a7a8d52 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -100,6 +100,7 @@
qdel(src)
/obj/structure/displaycase/obj_break(damage_flag)
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
set_density(FALSE)
broken = TRUE
diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm
index 7077817e482b2..ece0c709fbcad 100644
--- a/code/game/objects/structures/extinguisher.dm
+++ b/code/game/objects/structures/extinguisher.dm
@@ -136,6 +136,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29)
icon_state = "extinguisher_empty"
/obj/structure/extinguisher_cabinet/obj_break(damage_flag)
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
broken = 1
opened = 1
diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm
index 83f2ed32d760e..b417c19d64091 100644
--- a/code/game/objects/structures/fireaxe.dm
+++ b/code/game/objects/structures/fireaxe.dm
@@ -86,10 +86,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/fireaxecabinet, 32)
update_appearance()
/obj/structure/fireaxecabinet/obj_break(damage_flag)
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
update_appearance()
broken = TRUE
- playsound(src, 'sound/effects/glassbr3.ogg', 100, 1)
+ playsound(src, 'sound/effects/glassbr3.ogg', 100, TRUE)
new /obj/item/shard(loc)
new /obj/item/shard(loc)
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 269dd4b96ba77..8d68cfdb57219 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -238,6 +238,7 @@
..()
/obj/structure/grille/obj_break()
+ . = ..()
if(!broken && !(flags_1 & NODECONSTRUCT_1))
new broken_type(src.loc)
var/drop_loc = drop_location()
@@ -296,13 +297,16 @@
/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
grille_type = /obj/structure/grille
broken_type = null
+/obj/structure/grille/broken/Initialize(mapload)
+ . = ..()
+ take_damage(max_integrity * 0.6)
+
/obj/structure/grille/prison //grilles that trigger prison lockdown under some circumstances
name = "prison grille"
desc = "a set of rods under current used to protect the prison wing. An alarm will go off if they are breached."
diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm
index f01e2f2cdbb35..a154713a4ddf6 100644
--- a/code/game/objects/structures/mirror.dm
+++ b/code/game/objects/structures/mirror.dm
@@ -56,13 +56,15 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
return ..()
/obj/structure/mirror/obj_break(damage_flag, mapload)
- if(!broken && !(flags_1 & NODECONSTRUCT_1))
- icon_state = "mirror_broke"
- if(!mapload)
- playsound(src, "shatter", 70, 1)
- if(desc == initial(desc))
- desc = "Oh no, seven years of bad luck!"
- broken = TRUE
+ . = ..()
+ if(broken || (flags_1 & NODECONSTRUCT_1))
+ return
+ icon_state = "mirror_broke"
+ if(!mapload)
+ playsound(src, "shatter", 70, 1)
+ if(desc == initial(desc))
+ desc = "Oh no, seven years of bad luck!"
+ broken = TRUE
/obj/structure/mirror/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
diff --git a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm
index 34b82011cd1e7..ca64a3aeb3822 100644
--- a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm
+++ b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm
@@ -52,7 +52,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)
- overmind.blob_core.obj_integrity = min(overmind.blob_core.max_integrity, overmind.blob_core.obj_integrity+core_regen)
+ overmind.blob_core.repair_damage(core_regen)
/datum/blobstrain/proc/attack_living(var/mob/living/L) // When the blob attacks people
send_message(L)
diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm
index dc4033f2f2284..9d95096285b9a 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 fed527ad1f0e6..4b562ea6b902c 100644
--- a/code/modules/antagonists/blob/blobstrains/reactive_spines.dm
+++ b/code/modules/antagonists/blob/blobstrains/reactive_spines.dm
@@ -12,7 +12,7 @@
reagent = /datum/reagent/blob/reactive_spines
/datum/blobstrain/reagent/reactive_spines/damage_reaction(obj/structure/blob/B, damage, damage_type, damage_flag)
- if(damage && damage_type == BRUTE && B.obj_integrity - damage > 0) //is there any damage, is it brute, and will we be alive
+ if(damage && damage_type == BRUTE && B.get_integrity() - damage > 0) //is there any damage, is it brute, and will we be alive
if(damage_flag == MELEE)
B.visible_message("The blob retaliates, lashing out!")
for(var/atom/A as() in range(1, B))
diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm
index c9cdba3224f84..58c5cf96346a2 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_icon()
return ..()
diff --git a/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm b/code/modules/antagonists/blob/blobstrains/shifting_fragments.dm
index c36e27c79a282..9ba70ffbc69ee 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/blobstrains/zombifying_pods.dm b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm
index 66625f40fbdaf..06e97d89a66c0 100644
--- a/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm
+++ b/code/modules/antagonists/blob/blobstrains/zombifying_pods.dm
@@ -12,7 +12,7 @@
reagent = /datum/reagent/blob/zombifying_pods
/datum/blobstrain/reagent/zombifying_pods/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(30)) //if the cause isn't fire or a bomb, the damage is less than 21, we're going to die from that damage, 20% chance of a shitty spore.
+ if((damage_flag == MELEE || damage_flag == BULLET || damage_flag == LASER) && damage <= 20 && B.get_integrity() - damage <= 0 && prob(30)) //if the cause isn't fire or a bomb, the damage is less than 21, we're going to die from that damage, 20% 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/overmind.dm b/code/modules/antagonists/blob/overmind.dm
index fb2e7fba7d486..295ca0a6e8fa9 100644
--- a/code/modules/antagonists/blob/overmind.dm
+++ b/code/modules/antagonists/blob/overmind.dm
@@ -211,10 +211,11 @@ GLOBAL_LIST_EMPTY(blob_nodes)
/mob/camera/blob/update_health_hud()
if(blob_core)
- hud_used.healths.maptext = MAPTEXT("
[round(blob_core.obj_integrity)]
")
+ 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?.blobpwrdisplay)
- B.hud_used.blobpwrdisplay.maptext = MAPTEXT("[round(blob_core.obj_integrity)]
")
+ B.hud_used.blobpwrdisplay.maptext = MAPTEXT("[current_health]
")
/mob/camera/blob/proc/add_points(points)
blob_points = clamp(blob_points + points, 0, max_blob_points)
@@ -264,7 +265,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
/mob/camera/blob/get_stat_tab_status()
var/list/tab_data = ..()
if(blob_core)
- tab_data["Core Health"] = GENERATE_STAT_TEXT("[blob_core.obj_integrity]")
+ tab_data["Core Health"] = GENERATE_STAT_TEXT("[blob_core.get_integrity()]")
tab_data["Power Stored"] = GENERATE_STAT_TEXT("[blob_points]/[max_blob_points]")
tab_data["Blobs to Win"] = GENERATE_STAT_TEXT("[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 e7964f479467a..4cff5d61a3f47 100644
--- a/code/modules/antagonists/blob/powers.dm
+++ b/code/modules/antagonists/blob/powers.dm
@@ -128,7 +128,7 @@
if(S)
if(!can_buy(BLOB_REFLECTOR_COST))
return
- if(S.obj_integrity < S.max_integrity * 0.5)
+ if(S.get_integrity() < S.max_integrity * 0.5)
add_points(BLOB_REFLECTOR_COST)
to_chat(src, "This shield blob is too damaged to be modified properly!")
return
@@ -167,7 +167,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(40))
@@ -177,8 +177,7 @@
to_chat(src, "You attempt to produce a blobbernaut.")
var/list/mob/dead/observer/candidates = poll_ghost_candidates("Do you want to play as a [blobstrain.name] blobbernaut?", ROLE_BLOB, /datum/role_preference/midround_ghost/blob, 7.5 SECONDS, ignore_category = POLL_IGNORE_BLOB_HELPER) //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_icon()
B.visible_message("The blobbernaut [pick("rips", "tears", "shreds")] its way out of the factory blob!")
playsound(B.loc, 'sound/effects/splat.ogg', 50, 1)
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index b08aa5276472d..e7870b87acfaf 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -332,11 +332,14 @@
name = "normal blob"
icon_state = "blob"
light_range = 0
- obj_integrity = 21 //doesn't start at full health
max_integrity = 25
health_regen = 1
brute_resist = 0.25
+/obj/structure/blob/normal/Initialize(mapload)
+ . = ..()
+ update_integrity(21) //doesn't start at full health
+
/obj/structure/blob/normal/scannerreport()
if(obj_integrity <= 15)
return "Currently weak to brute damage."
diff --git a/code/modules/antagonists/clock_cult/clockwork_turfs.dm b/code/modules/antagonists/clock_cult/clockwork_turfs.dm
index ad2d939e21422..329b56ba411c8 100644
--- a/code/modules/antagonists/clock_cult/clockwork_turfs.dm
+++ b/code/modules/antagonists/clock_cult/clockwork_turfs.dm
@@ -500,7 +500,6 @@
/obj/structure/grille/ratvar/broken
icon_state = "brokenratvargrille"
density = FALSE
- obj_integrity = 20
broken = TRUE
rods_type = /obj/item/stack/sheet/brass
rods_amount = 1
@@ -508,6 +507,10 @@
grille_type = /obj/structure/grille/ratvar
broken_type = null
+/obj/structure/grille/ratvar/broken/Initialize(mapload)
+ . = ..()
+ take_damage(max_integrity * 0.6)
+
//=================================================
//Ratvar Window: A transparent window
//=================================================
diff --git a/code/modules/antagonists/clock_cult/items/replica_fabricator.dm b/code/modules/antagonists/clock_cult/items/replica_fabricator.dm
index 3ede705c2568a..069bbeb1f9b1b 100644
--- a/code/modules/antagonists/clock_cult/items/replica_fabricator.dm
+++ b/code/modules/antagonists/clock_cult/items/replica_fabricator.dm
@@ -44,12 +44,12 @@
if(GLOB.clockcult_power < 200)
to_chat(user, "You need [200 - GLOB.clockcult_power]W more to repair the [C]...")
return
- if(C.max_integrity == C.obj_integrity)
+ if(C.max_integrity == C.get_integrity())
to_chat(user, "\The [C] is already repaired!")
return
to_chat(user, "You begin repairing [C]...")
if(do_after(user, 60, target=target))
- if(C.max_integrity == C.obj_integrity)
+ if(C.max_integrity == C.get_integrity())
to_chat(user, "\The [C] is already repaired!")
return
if(GLOB.clockcult_power < 200)
@@ -57,7 +57,7 @@
return
GLOB.clockcult_power -= 200
to_chat(user, "You repair some of the damage on \the [C].")
- C.obj_integrity = clamp(C.obj_integrity + 15, 0, C.max_integrity)
+ C.repair_damage(clamp(C.get_integrity() + 15, 0, C.max_integrity))
else
to_chat(user, "You fail to repair the damage of \the [C]...")
diff --git a/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm b/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm
index 9879bc03fa191..8df79d2861c15 100644
--- a/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm
+++ b/code/modules/antagonists/clock_cult/scriptures/abstraction_crystal.dm
@@ -85,7 +85,7 @@ GLOBAL_LIST_INIT(abstraction_crystals, list())
var/health_lost = last_check_health - health
if(health_lost > 0)
damage_crystal(health_lost)
- var/required_health = (linked_crystal.obj_integrity / linked_crystal.max_integrity) * maxHealth
+ var/required_health = (linked_crystal.get_integrity() / linked_crystal.max_integrity) * maxHealth
var/health_delta_needed = max(health - required_health, 0)
adjustCloneLoss(health_delta_needed) //Adjust clone loss so that our health = crystals health
last_check_health = health
diff --git a/code/modules/antagonists/clock_cult/scriptures/interdiction_lens.dm b/code/modules/antagonists/clock_cult/scriptures/interdiction_lens.dm
index 89bec9d8fad8c..39b5e43984879 100644
--- a/code/modules/antagonists/clock_cult/scriptures/interdiction_lens.dm
+++ b/code/modules/antagonists/clock_cult/scriptures/interdiction_lens.dm
@@ -20,7 +20,6 @@
anchored = TRUE
break_message = "The interdiction lens breaks into multiple fragments, which gently float to the ground."
max_integrity = 150
- obj_integrity = 150
minimum_power = 5
var/enabled = FALSE //Misnomer - Whether we want to be enabled or not, processing would be if we are enabled
var/processing = FALSE
diff --git a/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm b/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm
index 3a954e39edd8d..7eb2b5e49d47b 100644
--- a/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm
+++ b/code/modules/antagonists/clock_cult/scriptures/prosperity_prism.dm
@@ -22,7 +22,6 @@
anchored = TRUE
break_message = "The prism falls apart, toxic liquid leaking out into the air."
max_integrity = 150
- obj_integrity = 150
minimum_power = 4
var/powered = FALSE
var/toggled_on = TRUE
diff --git a/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm b/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm
index 4f331d7abd43d..d951eb4e22e5f 100644
--- a/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm
+++ b/code/modules/antagonists/clock_cult/traps/receivers/skewer.dm
@@ -12,7 +12,6 @@
unwrench_path = /obj/item/clockwork/trap_placer/skewer
buckle_lying = FALSE
max_integrity = 40
- obj_integrity = 40
var/cooldown = 0
var/extended = FALSE
var/mutable_appearance/stab_overlay
diff --git a/code/modules/antagonists/clock_cult/traps/senders/delay.dm b/code/modules/antagonists/clock_cult/traps/senders/delay.dm
index 58597b4927f31..2ae5b7dd28b5f 100644
--- a/code/modules/antagonists/clock_cult/traps/senders/delay.dm
+++ b/code/modules/antagonists/clock_cult/traps/senders/delay.dm
@@ -11,7 +11,6 @@
component_datum = /datum/component/clockwork_trap/delay
unwrench_path = /obj/item/wallframe/clocktrap/delay
max_integrity = 15
- obj_integrity = 15
/datum/component/clockwork_trap/delay
takes_input = TRUE
diff --git a/code/modules/antagonists/clock_cult/traps/senders/lever.dm b/code/modules/antagonists/clock_cult/traps/senders/lever.dm
index c5bc5f074dfd3..b2fb0c7989b7f 100644
--- a/code/modules/antagonists/clock_cult/traps/senders/lever.dm
+++ b/code/modules/antagonists/clock_cult/traps/senders/lever.dm
@@ -11,7 +11,6 @@
unwrench_path = /obj/item/wallframe/clocktrap/lever
component_datum = /datum/component/clockwork_trap/lever
max_integrity = 75
- obj_integrity = 75
/datum/component/clockwork_trap/lever
sends_input = TRUE
diff --git a/code/modules/antagonists/clock_cult/traps/senders/pressure_sensor.dm b/code/modules/antagonists/clock_cult/traps/senders/pressure_sensor.dm
index 8673d10476393..159afb8ace32e 100644
--- a/code/modules/antagonists/clock_cult/traps/senders/pressure_sensor.dm
+++ b/code/modules/antagonists/clock_cult/traps/senders/pressure_sensor.dm
@@ -13,7 +13,6 @@
alpha = 60
layer = PRESSURE_PLATE_LAYER
max_integrity = 5
- obj_integrity = 5
/datum/component/clockwork_trap/pressure_sensor
sends_input = TRUE
diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm
index 3332b7e412fc1..bbc744eae9834 100644
--- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm
+++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm
@@ -424,7 +424,6 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/AI_Module/large/upgrade_turrets/upgrade(mob/living/silicon/ai/AI)
for(var/obj/machinery/porta_turret/ai/turret in GLOB.machines)
turret.max_integrity = 200
- turret.obj_integrity = 200
turret.emp_proofing = TRUE
turret.AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
turret.stun_projectile = /obj/projectile/beam/disabler/pass_glass //// AI defenses are often built with glass, so this is big.
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index 5a0b6dbc6590b..f02f560c3ab11 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -865,7 +865,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 24)
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 4078955b94e27..f484ea71a372d 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -249,7 +249,7 @@
var/obj/item/pipe/stored = new construction_type(loc, null, dir, src)
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/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm
index 19bd2559278a8..47ae713d1678e 100644
--- a/code/modules/awaymissions/capture_the_flag.dm
+++ b/code/modules/awaymissions/capture_the_flag.dm
@@ -424,7 +424,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/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 44d399d74d434..9b3cce7e14807 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -277,6 +277,7 @@
. = "[.]"
/obj/item/clothing/obj_break(damage_flag)
+ . = ..()
if(!damaged_clothes)
update_clothes_damaged_state(TRUE)
if(ismob(loc)) //It's not important enough to warrant a message if nobody's wearing it
diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm
index eebf6f200c896..97236848b2e4e 100644
--- a/code/modules/events/immovable_rod.dm
+++ b/code/modules/events/immovable_rod.dm
@@ -132,7 +132,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
else if (isobj(clong))
if(clong.density)
var/obj/hit_obj = clong
- hit_obj.take_damage(hit_obj.obj_integrity, armour_penetration = 100)
+ hit_obj.take_damage(hit_obj.get_integrity(), armour_penetration = 100)
else if(isliving(clong))
penetrate(clong)
else if(istype(clong, type))
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 0f3a56cd1de40..b1e12c936440e 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -278,8 +278,7 @@
/datum/spacevine_mutation/woodening/on_grow(obj/structure/spacevine/holder)
if(holder.energy)
holder.set_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?.is_sharp())
diff --git a/code/modules/holoparasite/abilities/major/healing.dm b/code/modules/holoparasite/abilities/major/healing.dm
index 7b770b8e0fcc1..6806c36edbd67 100644
--- a/code/modules/holoparasite/abilities/major/healing.dm
+++ b/code/modules/holoparasite/abilities/major/healing.dm
@@ -188,12 +188,12 @@
* Heals an object.
*/
/datum/holoparasite_ability/major/healing/proc/heal_obj(obj/target)
- var/old_integrity = target.obj_integrity
- target.obj_integrity = min(target.obj_integrity + (target.max_integrity * 0.1), target.max_integrity)
- if(old_integrity > target.obj_integrity)
+ var/old_integrity = target.get_integrity()
+ target.repair_damage(target.get_integrity() + (target.max_integrity * 0.1), target.max_integrity)
+ if(old_integrity > target.get_integrity())
SSblackbox.record_feedback("associative", "holoparasite_obj_damage_healed", 1, list(
"target" = replacetext("[target.type]", "/obj/", ""),
- "amount" = max(old_integrity - target.obj_integrity, 0)
+ "amount" = max(old_integrity - target.get_integrity(), 0)
))
/**
diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm
index 848a74e0b792c..dec029001110a 100644
--- a/code/modules/mining/aux_base.dm
+++ b/code/modules/mining/aux_base.dm
@@ -56,7 +56,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
Unit | Condition | Status | Direction | Distance
"
for(var/PDT in turrets)
var/obj/machinery/porta_turret/aux_base/T = PDT
- var/integrity = max((T.obj_integrity-T.integrity_failure * T.max_integrity)/(T.max_integrity-T.integrity_failure * max_integrity)*100, 0)
+ var/integrity = max((T.get_integrity()-T.integrity_failure * T.max_integrity)/(T.max_integrity-T.integrity_failure * max_integrity)*100, 0)
var/status
if(T.machine_stat & BROKEN)
status = "ERROR"
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 48af70c824969..8c377c10caac9 100644
--- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm
@@ -123,7 +123,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
@@ -217,7 +217,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
@@ -228,7 +228,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/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm
index 472922fe2cd65..ece1e6f2915bd 100644
--- a/code/modules/mob/living/simple_animal/hostile/mimic.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm
@@ -123,7 +123,7 @@
..()
// death of this mob means the destruction of the original stuff of the copied mob.
if(istype(original_of_this, /obj/machinery/vending))
- original_of_this.take_damage(original_of_this.obj_integrity, BRUTE, 0, FALSE)
+ original_of_this.take_damage(original_of_this.max_integrity, BRUTE, 0, FALSE)
// currently do this to vending machines only.
// because the destruction of stuff (especially items) is annoying.
diff --git a/code/modules/modular_computers/computers/item/processor.dm b/code/modules/modular_computers/computers/item/processor.dm
index 8ca04d3ce357d..c01d014d6e9c7 100644
--- a/code/modules/modular_computers/computers/item/processor.dm
+++ b/code/modules/modular_computers/computers/item/processor.dm
@@ -32,7 +32,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 4c358a2718c50..16fe3c9b40c64 100644
--- a/code/modules/modular_computers/computers/machinery/modular_computer.dm
+++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm
@@ -72,7 +72,7 @@
else
add_overlay(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)
add_overlay("bsod")
add_overlay("broken")
diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm
index 27d740ea60072..d761ec5a1d4e3 100644
--- a/code/modules/power/lighting/light.dm
+++ b/code/modules/power/lighting/light.dm
@@ -380,7 +380,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 e26fb9848c3cd..dc0461daa9e91 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -638,18 +638,19 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
qdel(src)
return gain
-/obj/machinery/power/supermatter_crystal/blob_act(obj/structure/blob/B)
- if(B && !isspaceturf(loc)) //does nothing in space
- playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, 1)
- damage += B.obj_integrity * 0.5 //take damage equal to 50% of remaining blob health before it tried to eat us
- if(B.obj_integrity > 100)
- B.visible_message("\The [B] strikes at \the [src] and flinches away!",\
- "You hear a loud crack as you are washed with a wave of heat.")
- B.take_damage(100, BURN)
- else
- B.visible_message("\The [B] strikes at \the [src] and rapidly flashes to ash.",\
- "You hear a loud crack as you are washed with a wave of heat.")
- Consume(B)
+/obj/machinery/power/supermatter_crystal/blob_act(obj/structure/blob/blob)
+ if(!blob || isspaceturf(loc)) //does nothing in space
+ return
+ playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, TRUE)
+ 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)
+ else
+ blob.visible_message("\The [blob] strikes at \the [src] and rapidly flashes to ash.",\
+ "You hear a loud crack as you are washed with a wave of heat.")
+ Consume(blob)
/obj/machinery/power/supermatter_crystal/attack_tk(mob/user)
if(!iscarbon(user))
diff --git a/code/modules/security/genpop.dm b/code/modules/security/genpop.dm
index 3b1128d06a88e..307b984cff784 100644
--- a/code/modules/security/genpop.dm
+++ b/code/modules/security/genpop.dm
@@ -10,7 +10,6 @@
power_channel = AREA_USAGE_ENVIRON
density = TRUE
pass_flags_self = PASSTRANSPARENT | PASSGRILLE | PASSSTRUCTURE
- obj_integrity = 600
max_integrity = 600
integrity_failure = 0.35
//Robust! It'll be tough to break...
diff --git a/code/modules/vehicles/mecha/combat/durand.dm b/code/modules/vehicles/mecha/combat/durand.dm
index 090fa2553f4ee..e436afcaab9ee 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 52faec6cd5390..89c3f16316c46 100644
--- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm
+++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm
@@ -248,8 +248,8 @@
chassis.clearInternalDamage(int_dam_flag)
repaired = 1
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 = 1
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 2768426699830..9c8a8c6dd774f 100644
--- a/code/modules/vehicles/mecha/equipment/tools/work_tools.dm
+++ b/code/modules/vehicles/mecha/equipment/tools/work_tools.dm
@@ -487,10 +487,10 @@
equipment.attach(marktwo)
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 6fa463e15709f..cf2a0d9b2aa00 100644
--- a/code/modules/vehicles/mecha/mech_bay.dm
+++ b/code/modules/vehicles/mecha/mech_bay.dm
@@ -127,7 +127,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 cf91e1672318d..b2194d82b028e 100644
--- a/code/modules/vehicles/mecha/mecha_control_console.dm
+++ b/code/modules/vehicles/mecha/mecha_control_console.dm
@@ -33,7 +33,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(),
@@ -100,7 +100,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 048577cd73994..62b6b7dec5251 100644
--- a/code/modules/vehicles/mecha/working/ripley.dm
+++ b/code/modules/vehicles/mecha/working/ripley.dm
@@ -160,6 +160,9 @@
//Attach hydraulic clamp
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
+
var/obj/item/mecha_parts/mecha_equipment/mining_scanner/scanner = new
scanner.attach(src)
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm
index 4c556a919ea81..eefe2027c1ed3 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm
@@ -223,12 +223,12 @@
/datum/xenoartifact_trait/minor/delicate/on_init(obj/item/xenoartifact/X)
X.max_integrity = pick(200, 300, 500, 800, 1000)
- X.obj_integrity = X.max_integrity
+ X.update_integrity(X.max_integrity)
X.alpha = X.alpha * 0.55
/datum/xenoartifact_trait/minor/delicate/activate(obj/item/xenoartifact/X, atom/user)
- if(X.obj_integrity > 0)
- X.obj_integrity -= 100
+ if(X.get_integrity() > 0)
+ X.update_integrity(-100)
X.visible_message("The [X.name] cracks!", "The [X.name] cracks!")
else
X.visible_message("The [X.name] shatters!", "The [X.name] shatters!")