diff --git a/code/__defines/damage.dm b/code/__defines/damage.dm
new file mode 100644
index 00000000000..e3c45646c79
--- /dev/null
+++ b/code/__defines/damage.dm
@@ -0,0 +1,2 @@
+///The decimal precision for health values. Health will be rounded against this value.
+#define HEALTH_ROUNDING 0.01
diff --git a/code/__defines/temperature.dm b/code/__defines/temperature.dm
index 822c9c20172..1d4846ee9d4 100644
--- a/code/__defines/temperature.dm
+++ b/code/__defines/temperature.dm
@@ -2,6 +2,8 @@
#define ATOM_SHOULD_TEMPERATURE_ENQUEUE(A) (ATOM_IS_TEMPERATURE_SENSITIVE(A) && !QDELETED(A))
#define ATOM_TEMPERATURE_EQUILIBRIUM_THRESHOLD 5
#define ATOM_TEMPERATURE_EQUILIBRIUM_CONSTANT 0.25
+#define MIN_TEMPERATURE_COEFFICIENT 1
+#define MAX_TEMPERATURE_COEFFICIENT 10
#define ADJUST_ATOM_TEMPERATURE(_atom, _temp) \
_atom.temperature = _temp; \
diff --git a/code/game/atoms_temperature.dm b/code/game/atoms_temperature.dm
index 6b884af473b..2e4ba64d232 100644
--- a/code/game/atoms_temperature.dm
+++ b/code/game/atoms_temperature.dm
@@ -1,6 +1,3 @@
-#define MIN_TEMPERATURE_COEFFICIENT 1
-#define MAX_TEMPERATURE_COEFFICIENT 10
-
/atom
var/temperature = T20C
var/temperature_coefficient = MAX_TEMPERATURE_COEFFICIENT
@@ -18,14 +15,6 @@
/turf
temperature_coefficient = MIN_TEMPERATURE_COEFFICIENT
-/obj/Initialize(mapload)
- . = ..()
- temperature_coefficient = isnull(temperature_coefficient) ? clamp(MAX_TEMPERATURE_COEFFICIENT - w_class, MIN_TEMPERATURE_COEFFICIENT, MAX_TEMPERATURE_COEFFICIENT) : temperature_coefficient
- create_matter()
- //Only apply directional offsets if the mappers haven't set any offsets already
- if(!pixel_x && !pixel_y && !pixel_w && !pixel_z)
- update_directional_offset()
-
/obj/proc/HandleObjectHeating(var/obj/item/heated_by, var/mob/user, var/adjust_temp)
if(ATOM_SHOULD_TEMPERATURE_ENQUEUE(src))
visible_message(SPAN_NOTICE("\The [user] carefully heats \the [src] with \the [heated_by]."))
@@ -59,6 +48,3 @@
else
temperature = adjust_temp
return PROCESS_KILL
-
-#undef MIN_TEMPERATURE_COEFFICIENT
-#undef MAX_TEMPERATURE_COEFFICIENT
diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm
index 41c42b43b72..6c2bb0e2eeb 100644
--- a/code/game/gamemodes/cult/runes.dm
+++ b/code/game/gamemodes/cult/runes.dm
@@ -268,13 +268,11 @@
color = "#ff0000"
anchored = TRUE
density = TRUE
+ max_health = 200
var/obj/effect/rune/wall/rune
- var/health
- var/max_health = 200
/obj/effect/cultwall/Initialize(mapload, var/bcolor)
. = ..()
- health = max_health
if(bcolor)
color = bcolor
diff --git a/code/game/gamemodes/godmode/god_structures.dm b/code/game/gamemodes/godmode/god_structures.dm
index f40e5bb4597..6eaed5e088e 100644
--- a/code/game/gamemodes/godmode/god_structures.dm
+++ b/code/game/gamemodes/godmode/god_structures.dm
@@ -17,7 +17,7 @@
/obj/structure/deity
icon = 'icons/obj/cult.dmi'
- maxhealth = 10
+ max_health = 10
density = TRUE
anchored = TRUE
icon_state = "tomealtar"
diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm
index fc10ef624ba..5acf8a304ed 100644
--- a/code/game/machinery/atmoalter/canister.dm
+++ b/code/game/machinery/atmoalter/canister.dm
@@ -3,7 +3,7 @@
icon = 'icons/obj/atmos.dmi'
icon_state = "yellow"
density = TRUE
- var/health = 100.0
+ max_health = 100
obj_flags = OBJ_FLAG_CONDUCTIBLE
w_class = ITEM_SIZE_GARGANTUAN
construct_state = /decl/machine_construction/pipe/welder
diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm
index 7e1f90e854e..a83beb7a1cb 100644
--- a/code/game/machinery/deployable.dm
+++ b/code/game/machinery/deployable.dm
@@ -12,8 +12,7 @@
anchored = FALSE
density = TRUE
icon_state = "barrier0"
- var/health = 100.0
- var/maxhealth = 100.0
+ max_health = 100
var/locked = 0.0
/obj/machinery/deployable/barrier/Initialize()
@@ -39,8 +38,8 @@
return
return
else if(IS_WRENCH(W))
- if (src.health < src.maxhealth)
- src.health = src.maxhealth
+ if (src.health < src.max_health)
+ src.health = src.max_health
src.emagged = 0
src.req_access = list(access_security)
visible_message("[user] repairs \the [src]!")
diff --git a/code/game/machinery/doors/_door.dm b/code/game/machinery/doors/_door.dm
index 693f2565fe9..351cc399dca 100644
--- a/code/game/machinery/doors/_door.dm
+++ b/code/game/machinery/doors/_door.dm
@@ -14,6 +14,7 @@
construct_state = /decl/machine_construction/default/panel_closed/door
uncreated_component_parts = null
required_interaction_dexterity = DEXTERITY_SIMPLE_MACHINES
+ max_health = 300
var/can_open_manually = TRUE
@@ -26,8 +27,6 @@
var/glass = 0
var/normalspeed = 1
var/heat_proof = 0 // For glass airlocks/opacity firedoors
- var/maxhealth = 300
- var/health
var/destroy_hits = 10 //How many strong hits it takes to destroy the door
var/min_force = 10 //minimum amount of force needed to damage the door with a melee weapon
var/hitsound = 'sound/weapons/smash.ogg' //sound door makes when hit with a weapon
@@ -93,7 +92,7 @@
if (turf_hand_priority)
set_extension(src, /datum/extension/turf_hand, turf_hand_priority)
- health = maxhealth
+ health = max_health
#ifdef UNIT_TEST
if(autoset_access && length(req_access))
PRINT_STACK_TRACE("A door with mapped access restrictions was set to autoinitialize access.")
@@ -254,7 +253,7 @@
if(reason_broken & MACHINE_BROKEN_GENERIC)
to_chat(user, "It looks like \the [src] is pretty busted. It's going to need more than just patching up now.")
return TRUE
- if(health >= maxhealth)
+ if(health >= max_health)
to_chat(user, "Nothing to fix!")
return TRUE
if(!density)
@@ -262,7 +261,7 @@
return TRUE
//figure out how much metal we need
- var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT
+ var/amount_needed = (max_health - health) / DOOR_REPAIR_AMOUNT
amount_needed = CEILING(amount_needed)
var/obj/item/stack/stack = I
@@ -294,7 +293,7 @@
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if(do_after(user, 5 * repairing.amount, src) && welder && welder.isOn())
to_chat(user, "You finish repairing the damage to \the [src].")
- health = clamp(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
+ health = clamp(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, max_health)
update_icon()
qdel(repairing)
repairing = null
@@ -349,11 +348,11 @@
if(health <= 0 && initialhealth > 0)
visible_message(SPAN_WARNING("\The [src] breaks down!"))
set_broken(TRUE)
- else if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
+ else if(health < max_health / 4 && initialhealth >= max_health / 4)
visible_message(SPAN_WARNING("\The [src] looks like it's about to break!"))
- else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
+ else if(health < max_health / 2 && initialhealth >= max_health / 2)
visible_message(SPAN_WARNING("\The [src] looks seriously damaged!"))
- else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
+ else if(health < max_health * 3/4 && initialhealth >= max_health * 3/4)
visible_message(SPAN_WARNING("\The [src] shows signs of damage!"))
..(component_damage, damtype)
@@ -361,21 +360,21 @@
//How much damage should be passed to components inside even when door health is non zero
/obj/machinery/door/proc/get_damage_leakthrough(var/damage, damtype=BRUTE)
- if(health > 0.75 * maxhealth && damage < 10)
+ if(health > 0.75 * max_health && damage < 10)
return 0
- . = round((1 - health/maxhealth) * damage)
+ . = round((1 - health/max_health) * damage)
/obj/machinery/door/examine(mob/user)
. = ..()
if(src.health <= 0)
to_chat(user, "\The [src] is broken!")
- else if(src.health < src.maxhealth / 4)
+ else if(src.health < src.max_health / 4)
to_chat(user, "\The [src] looks like it's about to break!")
- else if(src.health < src.maxhealth / 2)
+ else if(src.health < src.max_health / 2)
to_chat(user, "\The [src] looks seriously damaged!")
- else if(src.health < src.maxhealth * 3/4)
+ else if(src.health < src.max_health * 3/4)
to_chat(user, "\The [src] shows signs of damage!")
- else if(src.health < src.maxhealth && get_dist(src, user) <= 1)
+ else if(src.health < src.max_health && get_dist(src, user) <= 1)
to_chat(user, "\The [src] has some minor scuffing.")
var/mob/living/carbon/human/H = user
@@ -502,7 +501,7 @@
dismantle(TRUE)
/obj/machinery/door/proc/CheckPenetration(var/base_chance, var/damage)
- . = damage/maxhealth*180
+ . = damage/max_health*180
if(glass)
. *= 2
. = round(.)
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index e3aae98d10d..63a74398ed3 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -400,7 +400,7 @@ About the new airlock wires panel:
if(stat & BROKEN)
damage_overlay = sparks_broken_file
- else if(health < maxhealth * 3/4)
+ else if(health < max_health * 3/4)
damage_overlay = sparks_damaged_file
if(welded)
@@ -767,7 +767,7 @@ About the new airlock wires panel:
return TRUE
else if(!repairing)
// Add some minor damage as evidence of forcing.
- if(health >= maxhealth)
+ if(health >= max_health)
take_damage(1)
if(arePowerSystemsOn())
to_chat(user, SPAN_WARNING("The airlock's motors resist your efforts to force it."))
@@ -1027,7 +1027,7 @@ About the new airlock wires panel:
glass = TRUE
set_opacity(0)
hitsound = 'sound/effects/Glasshit.ogg'
- maxhealth = 300
+ max_health = 300
explosion_resistance = 5
else
door_color = mat.color
diff --git a/code/game/machinery/doors/airlock_subtypes.dm b/code/game/machinery/doors/airlock_subtypes.dm
index 3f319588f48..179b0d35d2c 100644
--- a/code/game/machinery/doors/airlock_subtypes.dm
+++ b/code/game/machinery/doors/airlock_subtypes.dm
@@ -67,7 +67,7 @@
name = "Glass Airlock"
icon_state = "preview_glass"
hitsound = 'sound/effects/Glasshit.ogg'
- maxhealth = 300
+ max_health = 300
explosion_resistance = 5
opacity = FALSE
glass = TRUE
@@ -193,7 +193,7 @@
opacity = FALSE
/obj/machinery/door/airlock/external/glass
- maxhealth = 300
+ max_health = 300
explosion_resistance = 5
opacity = FALSE
glass = TRUE
diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm
index 2e100cff8e8..144f0129901 100644
--- a/code/game/machinery/doors/blast_door.dm
+++ b/code/game/machinery/doors/blast_door.dm
@@ -158,7 +158,7 @@
to_chat(user, "[src]'s motors resist your effort.")
return
if(istype(C, /obj/item/stack/material) && C.get_material_type() == /decl/material/solid/metal/plasteel)
- var/amt = CEILING((maxhealth - health)/150)
+ var/amt = CEILING((max_health - health)/150)
if(!amt)
to_chat(user, "\The [src] is already fully functional.")
return
@@ -209,7 +209,7 @@
// Parameters: None
// Description: Fully repairs the blast door.
/obj/machinery/door/blast/proc/repair()
- health = maxhealth
+ health = max_health
set_broken(FALSE)
queue_icon_update()
@@ -312,7 +312,7 @@
icon_state_closed_broken = "closed_broken"
min_force = 30
- maxhealth = 1000
+ max_health = 1000
block_air_zones = 1
var/icon_lower_door_open = "open_bottom"
@@ -354,7 +354,7 @@
open_sound = 'sound/machines/shutters_open.ogg'
close_sound = 'sound/machines/shutters_close.ogg'
min_force = 15
- maxhealth = 500
+ max_health = 500
explosion_resistance = 10
pry_mod = 0.55
frame_type = /obj/structure/door_assembly/blast/shutter
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 6ca2897554c..6dca0aa89e1 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -5,7 +5,7 @@
icon_state = "left"
min_force = 4
hitsound = 'sound/effects/Glasshit.ogg'
- maxhealth = 150 //If you change this, consiter changing ../door/window/brigdoor/ health at the bottom of this .dm file
+ max_health = 150 //If you change this, consiter changing ../door/window/brigdoor/ health at the bottom of this .dm file
health = 150
visible = 0.0
use_power = POWER_USE_OFF
@@ -212,7 +212,7 @@
icon = 'icons/obj/doors/windoor.dmi'
icon_state = "leftsecure"
base_state = "leftsecure"
- maxhealth = 300
+ max_health = 300
health = 300.0 //Stronger doors for prison (regular window door health is 150)
pry_mod = 0.65
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 2262a36ba3e..996ade02b66 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -17,11 +17,10 @@
idle_power_usage = 50 //when inactive, this turret takes up constant 50 Equipment power
active_power_usage = 300 //when active, this turret takes up constant 300 Equipment power
power_channel = EQUIP //drains power from the EQUIPMENT channel
+ max_health = 80
var/raised = 0 //if the turret cover is "open" and the turret is raised
var/raising= 0 //if the turret is currently opening or closing its cover
- var/health = 80 //the turret's health
- var/maxhealth = 80 //turrets maximal health.
var/auto_repair = 0 //if 1 the turret slowly repairs itself.
var/locked = 1 //if the turret's behaviour control access is locked
var/controllock = 0 //if the turret responds to control panels
@@ -80,7 +79,7 @@
ailock = 0
malf_upgraded = 1
to_chat(user, "\The [src] has been upgraded. It's damage and rate of fire has been increased. Auto-regeneration system has been enabled. Power usage has increased.")
- maxhealth = round(initial(maxhealth) * 1.5)
+ max_health = round(initial(max_health) * 1.5)
shot_delay = round(initial(shot_delay) / 2)
auto_repair = 1
change_power_consumption(round(initial(active_power_usage) * 5), POWER_USE_ACTIVE)
@@ -415,9 +414,9 @@ var/global/list/turret_icons
if(!tryToShootAt(secondarytargets)) // if no valid targets, go for secondary targets
popDown() // no valid targets, close the cover
- if(auto_repair && (health < maxhealth))
+ if(auto_repair && (health < max_health))
use_power_oneoff(20000)
- health = min(health+1, maxhealth) // 1HP for 20kJ
+ health = min(health+1, max_health) // 1HP for 20kJ
/obj/machinery/porta_turret/proc/assess_and_assign(var/mob/living/L, var/list/targets, var/list/secondarytargets)
switch(assess_living(L))
diff --git a/code/game/objects/effects/decals/posters/_poster.dm b/code/game/objects/effects/decals/posters/_poster.dm
index 66862edd4d1..095039b8084 100644
--- a/code/game/objects/effects/decals/posters/_poster.dm
+++ b/code/game/objects/effects/decals/posters/_poster.dm
@@ -9,7 +9,7 @@
anchored = TRUE
directional_offset = "{'NORTH':{'y':32}, 'SOUTH':{'y':-32}, 'EAST':{'x':32}, 'WEST':{'x':-32}}"
material = /decl/material/solid/organic/paper
- maxhealth = 10
+ max_health = 10
parts_type = /obj/item/poster
parts_amount = 1
diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm
index 9b56c649363..f97d70ac163 100644
--- a/code/game/objects/effects/spiders.dm
+++ b/code/game/objects/effects/spiders.dm
@@ -5,7 +5,7 @@
icon = 'icons/effects/effects.dmi'
anchored = TRUE
density = FALSE
- var/health = 15
+ max_health = 15
//similar to weeds, but only barfed out by nurses manually
/obj/effect/spider/explosion_act(severity)
@@ -143,7 +143,7 @@
icon_state = "lesser"
anchored = FALSE
layer = BELOW_OBJ_LAYER
- health = 3
+ max_health = 3
var/mob/living/simple_animal/hostile/giant_spider/greater_form
var/last_itch = 0
var/amount_grown = -1
@@ -334,7 +334,7 @@
name = "cocoon"
desc = "Something wrapped in silky spider web."
icon_state = "cocoon1"
- health = 60
+ max_health = 60
/obj/effect/spider/cocoon/Initialize()
. = ..()
diff --git a/code/game/objects/item.dm b/code/game/objects/item.dm
index 0566726cea6..2c7c0f34f28 100644
--- a/code/game/objects/item.dm
+++ b/code/game/objects/item.dm
@@ -7,8 +7,6 @@
var/image/blood_overlay = null //this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite
var/randpixel = 6
- var/health
- var/max_health
var/material_health_multiplier = 0.2
var/hitsound
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
@@ -208,7 +206,7 @@
var/desc_comp = "" //For "description composite"
desc_comp += "It is a [w_class_description()] item.
"
- var/desc_damage = get_examined_damage_string(health / max_health)
+ var/desc_damage = get_examined_damage_string()
if(length(desc_damage))
desc_comp += "[desc_damage]
"
diff --git a/code/game/objects/item_damage.dm b/code/game/objects/item_damage.dm
index 1ee4837b9c4..fa8caf7822b 100644
--- a/code/game/objects/item_damage.dm
+++ b/code/game/objects/item_damage.dm
@@ -126,25 +126,3 @@
M.take_organ_damage(7)
SET_STATUS_MAX(M, STAT_BLURRY, rand(3,4))
return
-
-/obj/item/get_examined_damage_string(health_ratio)
- if(!can_take_damage())
- return
- . = ..()
-
-///Returns whether the item can take damages or if its invulnerable
-/obj/item/proc/can_take_damage()
- return (health != ITEM_HEALTH_NO_DAMAGE) && (max_health != ITEM_HEALTH_NO_DAMAGE)
-
-///Returns whether the object is currently damaged.
-/obj/item/proc/is_damaged()
- return can_take_damage() && (health < max_health)
-
-///Returns the percentage of health remaining for this object.
-/obj/item/proc/get_percent_health()
- return can_take_damage()? round((health * 100)/max_health, 0.01) : 100
-
-///Returns the percentage of damage done to this object.
-/obj/item/proc/get_percent_damage()
- //Clamp from 0 to 100 so health values larger than max_health don't return unhelpful numbers
- return clamp(100 - get_percent_health(), 0, 100)
\ No newline at end of file
diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm
index 61ff41a7d97..7b4aa541c86 100644
--- a/code/game/objects/items/weapons/weaponry.dm
+++ b/code/game/objects/items/weapons/weaponry.dm
@@ -117,7 +117,7 @@
anchored = TRUE
can_buckle = 0 //no manual buckling or unbuckling
- var/health = 25
+ max_health = 25
var/countdown = 15
var/temporary = 1
var/mob/living/carbon/captured = null
@@ -129,7 +129,7 @@
desc = "An energized net meant to subdue animals."
anchored = FALSE
- health = 5
+ max_health = 5
temporary = 0
min_free_time = 5
max_free_time = 10
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index 810d96735ef..9476b9a73a2 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -18,6 +18,22 @@
var/holographic = 0 //if the obj is a holographic object spawned by the holodeck
var/tmp/directional_offset ///JSON list of directions to x,y offsets to be applied to the object depending on its direction EX: {'NORTH':{'x':12,'y':5}, 'EAST':{'x':10,'y':50}}
+ ///The current health of the obj. Leave to null, unless you want the object to start at a different health than max_health.
+ var/health
+ ///The maximum health that the object can have. If set to ITEM_HEALTH_NO_DAMAGE, the object won't take any damage.
+ var/max_health = ITEM_HEALTH_NO_DAMAGE
+
+/obj/Initialize(mapload)
+ //Health should be set to max_health only if it's null.
+ if(isnull(health))
+ health = max_health
+ . = ..()
+ temperature_coefficient = isnull(temperature_coefficient) ? clamp(MAX_TEMPERATURE_COEFFICIENT - w_class, MIN_TEMPERATURE_COEFFICIENT, MAX_TEMPERATURE_COEFFICIENT) : temperature_coefficient
+ create_matter()
+ //Only apply directional offsets if the mappers haven't set any offsets already
+ if(!pixel_x && !pixel_y && !pixel_w && !pixel_z)
+ update_directional_offset()
+
/obj/hitby(atom/movable/AM, var/datum/thrownthing/TT)
..()
if(!anchored)
@@ -282,14 +298,17 @@
// Interactions
////////////////////////////////////////////////////////////////
/**Returns a text string to describe the current damage level of the item, or null if non-applicable. */
-/obj/proc/get_examined_damage_string(var/health_ratio)
- if(health_ratio >= 1)
+/obj/proc/get_examined_damage_string()
+ if(!can_take_damage())
+ return
+ var/health_percent = get_percent_health()
+ if(health_percent >= 100)
return SPAN_NOTICE("It looks fully intact.")
- else if(health_ratio > 0.75)
+ else if(health_percent > 75)
return SPAN_NOTICE("It has a few cracks.")
- else if(health_ratio > 0.5)
+ else if(health_percent > 50)
return SPAN_WARNING("It looks slightly damaged.")
- else if(health_ratio > 0.25)
+ else if(health_percent > 25)
return SPAN_WARNING("It looks moderately damaged.")
else
return SPAN_DANGER("It looks heavily damaged.")
diff --git a/code/game/objects/objs_damage.dm b/code/game/objects/objs_damage.dm
new file mode 100644
index 00000000000..b576ef889c0
--- /dev/null
+++ b/code/game/objects/objs_damage.dm
@@ -0,0 +1,25 @@
+/**
+ Returns whether this object is damaged.
+ */
+/obj/proc/is_damaged()
+ return can_take_damage() && (health < max_health)
+
+/**
+ Returns TRUE if this object can take damage.
+ */
+/obj/proc/can_take_damage()
+ return (health != ITEM_HEALTH_NO_DAMAGE) && (max_health != ITEM_HEALTH_NO_DAMAGE)
+
+/**
+ Returns the percentage of health remaining for this object.
+ */
+/obj/proc/get_percent_health()
+ return can_take_damage()? round((health * 100)/max_health, HEALTH_ROUNDING) : 100
+
+/**
+ Returns the percentage of damage done to this object.
+ */
+/obj/proc/get_percent_damages()
+ //Clamp from 0 to 100 so health values larger than max_health don't return unhelpful numbers
+ return clamp(100 - get_percent_health(), 0, 100)
+
diff --git a/code/game/objects/structures/__structure.dm b/code/game/objects/structures/__structure.dm
index 25d9e6a3bac..71c12758222 100644
--- a/code/game/objects/structures/__structure.dm
+++ b/code/game/objects/structures/__structure.dm
@@ -3,11 +3,10 @@
w_class = ITEM_SIZE_STRUCTURE
layer = STRUCTURE_LAYER
abstract_type = /obj/structure
+ max_health = 50
var/structure_flags
var/last_damage_message
- var/health = 0
- var/maxhealth = 50
var/hitsound = 'sound/weapons/smash.ogg'
var/parts_type
var/parts_amount
@@ -39,16 +38,11 @@
if(!CanFluidPass())
fluid_update(TRUE)
-/obj/structure/get_examined_damage_string(health_ratio)
- if(maxhealth == -1)
- return
- . = ..()
-
/obj/structure/examine(mob/user, distance, infix, suffix)
. = ..()
if(distance <= 3)
- var/damage_desc = get_examined_damage_string(health / maxhealth)
+ var/damage_desc = get_examined_damage_string()
if(length(damage_desc))
to_chat(user, damage_desc)
@@ -104,9 +98,9 @@
damage *= STRUCTURE_BRITTLE_MATERIAL_DAMAGE_MULTIPLIER
playsound(loc, hitsound, 75, 1)
- health = clamp(health - damage, 0, maxhealth)
+ health = clamp(health - damage, 0, max_health)
- show_damage_message(health/maxhealth)
+ show_damage_message(health/max_health)
if(health == 0)
physically_destroyed()
@@ -223,7 +217,7 @@
take_damage(rand(5, 15))
/obj/structure/proc/can_repair(var/mob/user)
- if(health >= maxhealth)
+ if(health >= max_health)
to_chat(user, SPAN_NOTICE("\The [src] does not need repairs."))
return FALSE
return TRUE
diff --git a/code/game/objects/structures/_structure_construction.dm b/code/game/objects/structures/_structure_construction.dm
index 9679a2a2e9d..c38aa84cab5 100644
--- a/code/game/objects/structures/_structure_construction.dm
+++ b/code/game/objects/structures/_structure_construction.dm
@@ -104,13 +104,13 @@
/obj/structure/proc/handle_repair(mob/user, obj/item/tool)
var/obj/item/stack/stack = tool
- var/amount_needed = CEILING((maxhealth - health)/DOOR_REPAIR_AMOUNT)
+ var/amount_needed = CEILING((max_health - health)/DOOR_REPAIR_AMOUNT)
var/used = min(amount_needed,stack.amount)
if(used)
to_chat(user, SPAN_NOTICE("You fit [stack.get_string_for_amount(used)] to damaged areas of \the [src]."))
stack.use(used)
last_damage_message = null
- health = clamp(health, health + used*DOOR_REPAIR_AMOUNT, maxhealth)
+ health = clamp(health, health + used*DOOR_REPAIR_AMOUNT, max_health)
/obj/structure/attackby(obj/item/O, mob/user)
diff --git a/code/game/objects/structures/_structure_materials.dm b/code/game/objects/structures/_structure_materials.dm
index 2a8421a82cd..f887575361f 100644
--- a/code/game/objects/structures/_structure_materials.dm
+++ b/code/game/objects/structures/_structure_materials.dm
@@ -22,14 +22,14 @@
else
set_opacity(initial(opacity))
hitsound = material?.hitsound || initial(hitsound)
- if(maxhealth != -1)
- maxhealth = initial(maxhealth) + material?.integrity * get_material_health_modifier()
+ if(max_health != -1)
+ max_health = initial(max_health) + material?.integrity * get_material_health_modifier()
if(reinf_material)
var/bonus_health = reinf_material.integrity * get_material_health_modifier()
- maxhealth += bonus_health
+ max_health += bonus_health
if(!keep_health)
health += bonus_health
- health = keep_health ? min(health, maxhealth) : maxhealth
+ health = keep_health ? min(health, max_health) : max_health
update_icon()
/obj/structure/proc/update_material_name(var/override_name)
diff --git a/code/game/objects/structures/banners.dm b/code/game/objects/structures/banners.dm
index 36ae6ad5b25..03f488f3eac 100644
--- a/code/game/objects/structures/banners.dm
+++ b/code/game/objects/structures/banners.dm
@@ -12,7 +12,7 @@
obj_flags = OBJ_FLAG_ANCHORABLE
tool_interaction_flags = (TOOL_INTERACTION_ANCHOR | TOOL_INTERACTION_DECONSTRUCT)
material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_COLOR
- maxhealth = 50
+ max_health = 50
/// Reference to any banner currently hung on the frame.
var/obj/item/banner/banner
diff --git a/code/game/objects/structures/barricade.dm b/code/game/objects/structures/barricade.dm
index e10b88526d5..caa0034b328 100644
--- a/code/game/objects/structures/barricade.dm
+++ b/code/game/objects/structures/barricade.dm
@@ -8,7 +8,7 @@
atom_flags = ATOM_FLAG_NO_TEMP_CHANGE | ATOM_FLAG_CLIMBABLE
layer = ABOVE_WINDOW_LAYER
material_alteration = MAT_FLAG_ALTERATION_ALL
- maxhealth = 100
+ max_health = 100
var/spike_damage //how badly it smarts when you run into this like a rube
var/list/poke_description = list("gored", "spiked", "speared", "stuck", "stabbed")
diff --git a/code/game/objects/structures/crates_lockers/closets/__closet.dm b/code/game/objects/structures/crates_lockers/closets/__closet.dm
index c0ce1fe5219..892a16828ed 100644
--- a/code/game/objects/structures/crates_lockers/closets/__closet.dm
+++ b/code/game/objects/structures/crates_lockers/closets/__closet.dm
@@ -6,7 +6,7 @@ var/global/list/closets = list()
icon = 'icons/obj/closets/bases/closet.dmi'
icon_state = "base"
density = TRUE
- maxhealth = 100
+ max_health = 100
material = /decl/material/solid/metal/steel
tool_interaction_flags = TOOL_INTERACTION_ANCHOR
diff --git a/code/game/objects/structures/defensive_barrier.dm b/code/game/objects/structures/defensive_barrier.dm
index d3e3a8f7adc..bd3e74d127c 100644
--- a/code/game/objects/structures/defensive_barrier.dm
+++ b/code/game/objects/structures/defensive_barrier.dm
@@ -10,7 +10,7 @@
can_buckle = TRUE
material = /decl/material/solid/metal/steel
material_alteration = MAT_FLAG_ALTERATION_DESC | MAT_FLAG_ALTERATION_NAME
- maxhealth = 200
+ max_health = 200
var/secured
/obj/structure/defensive_barrier/Initialize()
@@ -91,7 +91,7 @@
var/obj/item/defensive_barrier/B = new(get_turf(user), material?.type)
playsound(src, 'sound/items/Deconstruct.ogg', 100, 1)
B.stored_health = health
- B.stored_max_health = maxhealth
+ B.stored_max_health = max_health
B.add_fingerprint(user)
qdel(src)
return TRUE
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index 01a3dd7e61b..dd52ca84fcb 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -6,7 +6,7 @@
density = TRUE
anchored = TRUE
alpha = 150
- maxhealth = 100
+ max_health = 100
hitsound = 'sound/effects/Glasshit.ogg'
req_access = null
material = /decl/material/solid/glass
diff --git a/code/game/objects/structures/doors/_door.dm b/code/game/objects/structures/doors/_door.dm
index ee3d56236f0..4e047589e64 100644
--- a/code/game/objects/structures/doors/_door.dm
+++ b/code/game/objects/structures/doors/_door.dm
@@ -4,7 +4,7 @@
icon_state = "metal"
hitsound = 'sound/weapons/genhit.ogg'
material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC | MAT_FLAG_ALTERATION_COLOR
- maxhealth = 50
+ max_health = 50
density = TRUE
anchored = TRUE
opacity = TRUE
diff --git a/code/game/objects/structures/fishtanks.dm b/code/game/objects/structures/fishtanks.dm
index e36abb928f4..8a730e42916 100644
--- a/code/game/objects/structures/fishtanks.dm
+++ b/code/game/objects/structures/fishtanks.dm
@@ -24,7 +24,7 @@ var/global/list/fishtank_cache = list()
density = TRUE
atom_flags = ATOM_FLAG_CHECKS_BORDER | ATOM_FLAG_CLIMBABLE
mob_offset = TRUE
- maxhealth = 50
+ max_health = 50
var/deleting
var/fill_type
diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm
index 618012d3911..c95d6d96d30 100644
--- a/code/game/objects/structures/girders.dm
+++ b/code/game/objects/structures/girders.dm
@@ -8,7 +8,7 @@
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_COLOR
tool_interaction_flags = (TOOL_INTERACTION_ANCHOR | TOOL_INTERACTION_DECONSTRUCT)
- maxhealth = 100
+ max_health = 100
parts_amount = 2
parts_type = /obj/item/stack/material/strut
@@ -196,7 +196,7 @@
/obj/structure/girder/cult
icon= 'icons/obj/cult.dmi'
icon_state= "cultgirder"
- maxhealth = 150
+ max_health = 150
cover = 70
/obj/structure/girder/cult/dismantle()
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 683a53c58e8..08bfd215d85 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -16,7 +16,7 @@
handle_generic_blending = TRUE
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME
- maxhealth = 20
+ max_health = 20
var/destroyed = 0
var/list/connections
diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm
index 4f94f685433..0acc26f3654 100644
--- a/code/game/objects/structures/inflatable.dm
+++ b/code/game/objects/structures/inflatable.dm
@@ -41,7 +41,7 @@
opacity = FALSE
icon = 'icons/obj/structures/inflatable.dmi'
icon_state = "wall"
- maxhealth = 20
+ max_health = 20
hitsound = 'sound/effects/Glasshit.ogg'
atmos_canpass = CANPASS_DENSITY
material = /decl/material/solid/organic/plastic
@@ -107,7 +107,7 @@
deflate(TRUE)
/obj/structure/inflatable/can_repair_with(obj/item/tool)
- . = istype(tool, /obj/item/stack/tape_roll/duct_tape) && (health < maxhealth)
+ . = istype(tool, /obj/item/stack/tape_roll/duct_tape) && (health < max_health)
/obj/structure/inflatable/handle_repair(mob/user, obj/item/tool)
var/obj/item/stack/tape_roll/duct_tape/T = tool
@@ -121,7 +121,7 @@
playsound(src, 'sound/effects/tape.ogg', 50, TRUE)
last_damage_message = null
to_chat(user, SPAN_NOTICE("You tape up some of the damage to \the [src]."))
- health = clamp(health + 3, 0, maxhealth)
+ health = clamp(health + 3, 0, max_health)
taped = TRUE
/obj/structure/inflatable/attackby(obj/item/W, mob/user)
diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm
index f472368a72d..92371cae966 100644
--- a/code/game/objects/structures/railing.dm
+++ b/code/game/objects/structures/railing.dm
@@ -12,7 +12,7 @@
obj_flags = OBJ_FLAG_ROTATABLE | OBJ_FLAG_MOVES_UNSUPPORTED
material = DEFAULT_FURNITURE_MATERIAL
material_alteration = MAT_FLAG_ALTERATION_ALL
- maxhealth = 100
+ max_health = 100
parts_amount = 2
parts_type = /obj/item/stack/material/strut
@@ -78,8 +78,8 @@
/obj/structure/railing/examine(mob/user)
. = ..()
- if(health < maxhealth)
- switch(health / maxhealth)
+ if(health < max_health)
+ switch(health / max_health)
if(0.0 to 0.5)
to_chat(user, "It looks severely damaged!")
if(0.25 to 0.5)
@@ -252,15 +252,15 @@
if(IS_WELDER(W))
var/obj/item/weldingtool/F = W
if(F.isOn())
- if(health >= maxhealth)
+ if(health >= max_health)
to_chat(user, "\The [src] does not need repairs.")
return
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 20, src))
- if(health >= maxhealth)
+ if(health >= max_health)
return
user.visible_message("\The [user] repairs some damage to \the [src].", "You repair some damage to \the [src].")
- health = min(health+(maxhealth/5), maxhealth)
+ health = min(health+(max_health/5), max_health)
return
// Install
@@ -300,7 +300,7 @@
. = ..()
if(.)
if(!anchored || material.is_brittle())
- take_damage(maxhealth) // Fatboy
+ take_damage(max_health) // Fatboy
user.jump_layer_shift()
addtimer(CALLBACK(user, /mob/living/proc/jump_layer_shift_end), 2)
diff --git a/code/game/objects/structures/rubble.dm b/code/game/objects/structures/rubble.dm
index 632fedb3ccf..8a1bf024a49 100644
--- a/code/game/objects/structures/rubble.dm
+++ b/code/game/objects/structures/rubble.dm
@@ -6,7 +6,7 @@
opacity = TRUE
density = TRUE
anchored = TRUE
- maxhealth = 50
+ max_health = 50
var/list/loot = list(
/obj/item/cell,
diff --git a/code/game/objects/structures/tables.dm b/code/game/objects/structures/tables.dm
index aa81ad48efd..f05c3903b52 100644
--- a/code/game/objects/structures/tables.dm
+++ b/code/game/objects/structures/tables.dm
@@ -15,7 +15,7 @@
// TODO: add 1px step-up?
mob_offset = 12
handle_generic_blending = TRUE
- maxhealth = 10
+ max_health = 10
tool_interaction_flags = TOOL_INTERACTION_DECONSTRUCT
material_alteration = MAT_FLAG_ALTERATION_NAME | MAT_FLAG_ALTERATION_DESC
parts_amount = 2
diff --git a/code/game/objects/structures/wall_frame.dm b/code/game/objects/structures/wall_frame.dm
index e919d9ce5af..271dc26a8ff 100644
--- a/code/game/objects/structures/wall_frame.dm
+++ b/code/game/objects/structures/wall_frame.dm
@@ -16,7 +16,7 @@
material = DEFAULT_WALL_MATERIAL
handle_generic_blending = TRUE
tool_interaction_flags = (TOOL_INTERACTION_ANCHOR | TOOL_INTERACTION_DECONSTRUCT)
- maxhealth = 40
+ max_health = 40
parts_amount = 2
parts_type = /obj/item/stack/material/strut
@@ -48,12 +48,13 @@
if(paint_color)
to_chat(user, SPAN_NOTICE("It has a smooth coat of paint applied."))
-/obj/structure/wall_frame/get_examined_damage_string(health_ratio)
- if(maxhealth == -1)
+/obj/structure/wall_frame/get_examined_damage_string()
+ if(!can_take_damage())
return
- if(health_ratio > 0.7)
+ var/health_percent = get_percent_health()
+ if(health_percent > 70)
return SPAN_NOTICE("It's got a few dents and scratches.")
- else if(health_ratio > 0.3)
+ else if(health_percent > 30)
return SPAN_WARNING("A few pieces of panelling have fallen off.")
else
return SPAN_DANGER("It's nearly falling to pieces.")
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 32c5c114abe..6d68cd9b32b 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -15,7 +15,7 @@
atmos_canpass = CANPASS_PROC
handle_generic_blending = TRUE
hitsound = 'sound/effects/Glasshit.ogg'
- maxhealth = 100
+ max_health = 100
var/damage_per_fire_tick = 2 // Amount of damage per fire tick. Regular windows are not fireproof so they might as well break quickly.
var/construction_state = 2
diff --git a/code/modules/blob/blob.dm b/code/modules/blob/blob.dm
index 1922422afa3..ff057c0d515 100644
--- a/code/modules/blob/blob.dm
+++ b/code/modules/blob/blob.dm
@@ -12,8 +12,8 @@
layer = BLOB_SHIELD_LAYER
- var/maxHealth = 30
- var/health
+ max_health = 30
+
var/regen_rate = 5
var/brute_resist = 4.3
var/fire_resist = 0.8
@@ -28,7 +28,6 @@
/obj/effect/blob/Initialize()
. = ..()
- health = maxHealth
update_icon()
START_PROCESSING(SSblob, src)
@@ -46,7 +45,7 @@
take_damage(rand(140 - (severity * 40), 140 - (severity * 20)) / brute_resist)
/obj/effect/blob/on_update_icon()
- if(health > maxHealth / 2)
+ if(health > max_health / 2)
icon_state = "blob"
else
icon_state = "blob_damaged"
@@ -66,7 +65,7 @@
update_icon()
/obj/effect/blob/proc/regen()
- health = min(health + regen_rate, maxHealth)
+ health = min(health + regen_rate, max_health)
update_icon()
/obj/effect/blob/proc/expand(var/turf/T)
@@ -196,7 +195,7 @@
name = "master nucleus"
desc = "A massive, fragile nucleus guarded by a shield of thick tendrils."
icon_state = "blob_core"
- maxHealth = 450
+ max_health = 450
damage_min = 30
damage_max = 40
expandType = /obj/effect/blob/shield
@@ -210,7 +209,7 @@
var/times_to_pulse = 0
/obj/effect/blob/core/proc/get_health_percent()
- return ((health / maxHealth) * 100)
+ return ((health / max_health) * 100)
/*
the master core becomes more vulnereable to damage as it weakens,
@@ -282,7 +281,7 @@ regen() will cover update_icon() for this proc
name = "auxiliary nucleus"
desc = "An interwoven mass of tendrils. A glowing nucleus pulses at its center."
icon_state = "blob_node"
- maxHealth = 125
+ max_health = 125
regen_rate = 1
damage_min = 15
damage_max = 20
@@ -294,13 +293,13 @@ regen() will cover update_icon() for this proc
return
/obj/effect/blob/core/secondary/on_update_icon()
- icon_state = (health / maxHealth >= 0.5) ? "blob_node" : "blob_factory"
+ icon_state = (health / max_health >= 0.5) ? "blob_node" : "blob_factory"
/obj/effect/blob/shield
name = "shielding mass"
desc = "A pulsating mass of interwoven tendrils. These seem particularly robust, but not quite as active."
icon_state = "blob_idle"
- maxHealth = 120
+ max_health = 120
damage_min = 13
damage_max = 25
attack_freq = 7
@@ -318,9 +317,9 @@ regen() will cover update_icon() for this proc
return ..()
/obj/effect/blob/shield/on_update_icon()
- if(health > maxHealth * 2 / 3)
+ if(health > max_health * 2 / 3)
icon_state = "blob_idle"
- else if(health > maxHealth / 3)
+ else if(health > max_health / 3)
icon_state = "blob"
else
icon_state = "blob_damaged"
@@ -331,7 +330,7 @@ regen() will cover update_icon() for this proc
/obj/effect/blob/ravaging
name = "ravaging mass"
desc = "A mass of interwoven tendrils. They thrash around haphazardly at anything in reach."
- maxHealth = 20
+ max_health = 20
damage_min = 27
damage_max = 36
attack_freq = 3
diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm
index 304dc2eca7c..2a86f4f951d 100644
--- a/code/modules/hydroponics/spreading/spreading.dm
+++ b/code/modules/hydroponics/spreading/spreading.dm
@@ -45,8 +45,8 @@
pass_flags = PASS_FLAG_TABLE
mouse_opacity = MOUSE_OPACITY_NORMAL
- var/health = 10
- var/max_health = 100
+ health = 10
+ max_health = 100
var/growth_threshold = 0
var/growth_type = 0
var/max_growth = 0
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 18c7287f270..cfdb1ea222a 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -185,7 +185,7 @@ default behaviour is:
/mob/living/verb/succumb()
set hidden = 1
- if ((src.health < src.maxHealth/2)) // Health below half of maxhealth.
+ if ((src.health < src.maxHealth/2)) // Health below half of max_health.
src.adjustBrainLoss(src.health + src.maxHealth * 2) // Deal 2x health in BrainLoss damage, as before but variable.
updatehealth()
to_chat(src, "You have given up life and succumbed to death.")
diff --git a/code/modules/mob/living/silicon/ai/ai_damage.dm b/code/modules/mob/living/silicon/ai/ai_damage.dm
index 087e8ecafcb..b8083eb7be2 100644
--- a/code/modules/mob/living/silicon/ai/ai_damage.dm
+++ b/code/modules/mob/living/silicon/ai/ai_damage.dm
@@ -48,10 +48,10 @@
..()
add_ai_verbs(src)
-// Returns percentage of AI's remaining backup capacitor charge (maxhealth - oxyloss).
+// Returns percentage of AI's remaining backup capacitor charge (max_health - oxyloss).
/mob/living/silicon/ai/proc/backup_capacitor()
return ((getOxyLoss() - maxHealth) / maxHealth) * (-100)
-// Returns percentage of AI's remaining hardware integrity (maxhealth - (bruteloss + fireloss))
+// Returns percentage of AI's remaining hardware integrity (max_health - (bruteloss + fireloss))
/mob/living/silicon/ai/proc/hardware_integrity()
return (health / maxHealth) * 100
\ No newline at end of file
diff --git a/code/modules/modular_computers/hardware/_hardware.dm b/code/modules/modular_computers/hardware/_hardware.dm
index c830be8b70e..de61e09ddfd 100644
--- a/code/modules/modular_computers/hardware/_hardware.dm
+++ b/code/modules/modular_computers/hardware/_hardware.dm
@@ -29,7 +29,7 @@
// Called on multitool click, prints diagnostic information to the user.
/obj/item/stock_parts/computer/proc/diagnostics()
- return list("Hardware Integrity Test... (Corruption: [get_percent_damage()]%)")
+ return list("Hardware Integrity Test... (Corruption: [get_percent_damages()]%)")
/obj/item/stock_parts/computer/Initialize()
. = ..()
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 7b8984696b4..47a89e778ee 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -10,9 +10,9 @@ var/global/list/rad_collectors = list()
anchored = FALSE
density = TRUE
initial_access = list(access_engine_equip)
+ max_health = 100
var/obj/item/tank/hydrogen/loaded_tank = null
- var/health = 100
var/max_safe_temp = 1000 + T0C
var/melted
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 992fa1ab3b3..2633d130893 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -12,7 +12,7 @@ var/global/list/solars_list = list()
density = TRUE
idle_power_usage = 0
active_power_usage = 0
- var/health = 10
+ max_health = 10
var/obscured = 0
var/sunfrac = 0
var/efficiency = 1
diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm
index d1d92264952..9385b2710e6 100644
--- a/code/modules/reagents/reagent_dispenser.dm
+++ b/code/modules/reagents/reagent_dispenser.dm
@@ -8,7 +8,7 @@
anchored = FALSE
material = /decl/material/solid/organic/plastic
matter = list(/decl/material/solid/metal/steel = MATTER_AMOUNT_SECONDARY)
- maxhealth = 100
+ max_health = 100
tool_interaction_flags = TOOL_INTERACTION_DECONSTRUCT
var/unwrenched = FALSE
var/tmp/volume = 1000
diff --git a/code/modules/recycling/disposalpipe.dm b/code/modules/recycling/disposalpipe.dm
index bb55f282676..1ef619ed011 100644
--- a/code/modules/recycling/disposalpipe.dm
+++ b/code/modules/recycling/disposalpipe.dm
@@ -6,7 +6,7 @@
desc = "An underfloor disposal pipe."
anchored = TRUE
density = FALSE
- maxhealth = 10
+ max_health = 10
level = LEVEL_BELOW_PLATING
dir = 0 // dir will contain dominant direction for junction pipes
alpha = 192 // Plane and alpha modified for mapping, reset to normal on spawn.
diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm
index 9aef90c8526..32b40b200be 100644
--- a/code/modules/shieldgen/emergency_shield.dm
+++ b/code/modules/shieldgen/emergency_shield.dm
@@ -6,15 +6,14 @@
density = TRUE
opacity = FALSE
anchored = TRUE
- var/const/max_health = 200
- var/health = max_health //The shield can only take so much beating (prevents perma-prisons)
+ max_health = 200
var/shield_generate_power = 7500 //how much power we use when regenerating
var/shield_idle_power = 1500 //how much power we use when just being sustained.
/obj/machinery/shield/malfai
name = "emergency forcefield"
desc = "A weak forcefield which seems to be projected by the emergency atmosphere containment field."
- health = max_health/2 // Half health, it's not suposed to resist much.
+ max_health = 100 // Half health, it's not suposed to resist much.
/obj/machinery/shield/malfai/Process()
health -= 0.5 // Slowly lose integrity over time
@@ -110,8 +109,7 @@
opacity = FALSE
anchored = FALSE
initial_access = list(access_engine)
- var/const/max_health = 100
- var/health = max_health
+ max_health = 100
var/active = 0
var/malfunction = 0 //Malfunction causes parts of the shield to slowly dissapate
var/list/deployed_shields = list()
@@ -276,7 +274,7 @@
else if(IS_COIL(W) && malfunction && is_open)
var/obj/item/stack/cable_coil/coil = W
to_chat(user, "You begin to replace the wires.")
- //if(do_after(user, min(60, round( ((maxhealth/health)*10)+(malfunction*10) ))) //Take longer to repair heavier damage
+ //if(do_after(user, min(60, round( ((max_health/health)*10)+(malfunction*10) ))) //Take longer to repair heavier damage
if(do_after(user, 30,src))
if (coil.use(1))
health = max_health
diff --git a/code/modules/vehicles/bike.dm b/code/modules/vehicles/bike.dm
index 21cdeff40c0..0f17bacd3e6 100644
--- a/code/modules/vehicles/bike.dm
+++ b/code/modules/vehicles/bike.dm
@@ -8,7 +8,7 @@
load_item_visible = 1
buckle_pixel_shift = list("x" = 0, "y" = 0, "z" = 5)
health = 100
- maxhealth = 100
+ max_health = 100
locked = 0
fire_dam_coeff = 0.6
diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm
index 5703c3ff0d0..804dea26ff9 100644
--- a/code/modules/vehicles/train.dm
+++ b/code/modules/vehicles/train.dm
@@ -5,7 +5,7 @@
move_delay = 1
health = 100
- maxhealth = 100
+ max_health = 100
fire_dam_coeff = 0.7
brute_dam_coeff = 0.5
diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm
index 5c7ee107bf2..2386d664bbb 100644
--- a/code/modules/vehicles/vehicle.dm
+++ b/code/modules/vehicles/vehicle.dm
@@ -19,8 +19,6 @@
var/attack_log = null
var/on = 0
- var/health = 0 //do not forget to set health for your vehicle!
- var/maxhealth = 0
var/fire_dam_coeff = 1.0
var/brute_dam_coeff = 1.0
var/open = 0 //Maint panel
@@ -86,9 +84,9 @@
else if(IS_WELDER(W))
var/obj/item/weldingtool/T = W
if(T.welding)
- if(health < maxhealth)
+ if(health < max_health)
if(open)
- health = min(maxhealth, health+10)
+ health = min(max_health, health+10)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.visible_message("\The [user] repairs \the [src]!","You repair \the [src]!")
else
diff --git a/maps/away/errant_pisces/errant_pisces.dm b/maps/away/errant_pisces/errant_pisces.dm
index 49a0ecdb69e..902981dab45 100644
--- a/maps/away/errant_pisces/errant_pisces.dm
+++ b/maps/away/errant_pisces/errant_pisces.dm
@@ -80,7 +80,7 @@
icon_state = "net_f"
anchored = TRUE
layer = CATWALK_LAYER//probably? Should cover cables, pipes and the rest of objects that are secured on the floor
- maxhealth = 100
+ max_health = 100
/obj/structure/net/Initialize(var/mapload)
. = ..()
@@ -93,16 +93,17 @@
continue
N.update_connections()
-/obj/structure/net/get_examined_damage_string(health_ratio)
- if(maxhealth == -1)
+/obj/structure/net/get_examined_damage_string()
+ if(!can_take_damage())
return
- if(health_ratio >= 1)
+ var/health_percent = get_percent_health()
+ if(health_percent >= 100)
return SPAN_NOTICE("It looks fully intact.")
- else if (health_ratio < 0.2)
+ else if (health_percent < 20)
return SPAN_DANGER("\The [src] is barely hanging on by the last few threads.")
- else if (health_ratio < 0.5)
+ else if (health_percent < 50)
return SPAN_WARNING("Large swathes of \the [src] have been cut.")
- else if (health_ratio < 0.9)
+ else
return SPAN_NOTICE("A few strands of \the [src] have been severed.")
/obj/structure/net/attackby(obj/item/W, mob/user)
diff --git a/mods/species/ascent/mobs/insectoid_egg.dm b/mods/species/ascent/mobs/insectoid_egg.dm
index dad0583a7fe..71fc85fb137 100644
--- a/mods/species/ascent/mobs/insectoid_egg.dm
+++ b/mods/species/ascent/mobs/insectoid_egg.dm
@@ -12,7 +12,7 @@ var/global/default_gyne
name = "alien egg"
desc = "A semi-translucent alien egg."
health = 100
- maxhealth = 100
+ max_health = 100
icon = 'mods/species/ascent/icons/egg.dmi'
icon_state = "egg"
@@ -27,7 +27,7 @@ var/global/default_gyne
var/hatched = FALSE // Whether or not this egg has already hatched.
material = /decl/material/solid/gemstone/crystal
-
+
/obj/structure/insectoid_egg/Initialize()
. = ..()
START_PROCESSING(SSprocessing, src)
@@ -76,11 +76,11 @@ var/global/default_gyne
last_tick = world.time
var/turf/T = get_turf(src)
-
+
// Too high of temp will damage eggs.
if(T.temperature > (max_temperature * 1.5))
health = max(0, health - 5)
-
+
if(T.temperature < min_temperature || T.temperature > max_temperature)
return
@@ -103,8 +103,8 @@ var/global/default_gyne
update_icon()
visible_message(SPAN_NOTICE("\icon[src] \The [src] trembles and cracks as it begins to hatch."))
addtimer(CALLBACK(src, .proc/finish_hatching), 2.5 SECONDS)
-
-
+
+
/obj/structure/insectoid_egg/proc/finish_hatching()
hatched = TRUE
hatching = FALSE
diff --git a/nebula.dme b/nebula.dme
index b6ee8a38be6..d55307e1d13 100644
--- a/nebula.dme
+++ b/nebula.dme
@@ -36,6 +36,7 @@
#include "code\__defines\colors.dm"
#include "code\__defines\computers.dm"
#include "code\__defines\culture.dm"
+#include "code\__defines\damage.dm"
#include "code\__defines\damage_organs.dm"
#include "code\__defines\definition_helpers.dm"
#include "code\__defines\deity.dm"
@@ -910,6 +911,7 @@
#include "code\game\objects\item_mob_overlay.dm"
#include "code\game\objects\munition.dm"
#include "code\game\objects\objs.dm"
+#include "code\game\objects\objs_damage.dm"
#include "code\game\objects\topic.dm"
#include "code\game\objects\auras\aura.dm"
#include "code\game\objects\auras\blueforge_aura.dm"