Skip to content

Commit

Permalink
Unifying adjust/get/set damage procs.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 authored and comma committed Mar 20, 2024
1 parent e26f62b commit 15dee6a
Show file tree
Hide file tree
Showing 146 changed files with 534 additions and 450 deletions.
1 change: 1 addition & 0 deletions code/__defines/damage_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define OXY "oxy"
#define CLONE "clone"
#define PAIN "pain"
#define BRAIN "brain"
#define ELECTROCUTE "electrocute"

#define CUT "cut"
Expand Down
10 changes: 5 additions & 5 deletions code/_helpers/medical_scans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
scan["blood_volume"] = H.vessel.total_volume
scan["blood_volume_max"] = H.vessel.maximum_volume
scan["temperature"] = H.bodytemperature
scan["trauma"] = H.getBruteLoss()
scan["burn"] = H.getFireLoss()
scan["toxin"] = H.getToxLoss()
scan["oxygen"] = H.getOxyLoss()
scan["trauma"] = H.get_damage(BRUTE)
scan["burn"] = H.get_damage(BURN)
scan["toxin"] = H.get_damage(TOX)
scan["oxygen"] = H.get_damage(OXY)
scan["radiation"] = H.radiation
scan["genetic"] = H.getCloneLoss()
scan["genetic"] = H.get_damage(CLONE)
scan["paralysis"] = GET_STATUS(H, STAT_PARA)
scan["immune_system"] = H.get_immunity()
scan["reagents"] = list()
Expand Down
8 changes: 4 additions & 4 deletions code/controllers/subsystems/statistics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ SUBSYSTEM_DEF(statistics)
death.gender = dead.gender
death.time_of_death = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
death.coords = "[dead.x], [dead.y], [dead.z]"
death.bruteloss = dead.getBruteLoss()
death.fireloss = dead.getFireLoss()
death.brainloss = dead.getBrainLoss()
death.oxyloss = dead.getOxyLoss()
death.bruteloss = dead.get_damage(BRUTE)
death.fireloss = dead.get_damage(BURN)
death.brainloss = dead.get_damage(BRAIN)
death.oxyloss = dead.get_damage(OXY)
death.using_map_name = global.using_map.full_name
var/obj/effect/overmap/visitable/cell = global.overmap_sectors[num2text(dead.z)]
death.overmap_location_name = cell?.name || "Unknown"
Expand Down
6 changes: 3 additions & 3 deletions code/datums/extensions/deity_be_near.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
return TRUE

/datum/extension/deity_be_near/champion/deal_damage(var/mob/living/victim,var/mult)
victim.adjustOxyLoss(3 * mult)
victim.take_damage(OXY, 3 * mult)

/datum/extension/deity_be_near/oracle/deal_damage(var/mob/living/victim, var/mult)
victim.adjustFireLoss(mult)
victim.take_damage(BURN, mult)

/datum/extension/deity_be_near/traitor/deal_damage(var/mob/living/victim, var/mult)
victim.adjustHalLoss(5 * mult)
victim.take_damage(PAIN, 5 * mult)
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
var/obj/item/organ/external/affecting = SAFEPICK(M.get_external_organs())
if(!affecting)
to_chat(M, SPAN_DANGER("You land heavily!"))
M.adjustBruteLoss(damage)
M.take_damage(BRUTE, damage)
else
to_chat(M, SPAN_DANGER("You land heavily on your [affecting.name]!"))
affecting.take_external_damage(damage, 0)
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
if(istype(organ))
organ.take_external_damage(0, burn_damage)
else
holder.adjustFireLoss(burn_damage)
holder.take_damage(BURN, burn_damage)
if(held_slot in holder.get_held_item_slots())
holder.drop_from_inventory(src)
else
Expand Down
22 changes: 11 additions & 11 deletions code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
if(!iscultist(target) && target.loc == get_turf(src)) // They hesitated, resisted, or can't join, and they are still on the rune - burn them
if(target.stat == CONSCIOUS)
target.take_overall_damage(0, 10)
switch(target.getFireLoss())
switch(target.get_damage(BURN))
if(0 to 25)
to_chat(target, "<span class='danger'>Your blood boils as you force yourself to resist the corruption invading every corner of your mind.</span>")
if(25 to 45)
Expand Down Expand Up @@ -180,17 +180,17 @@
var/warning = 0
while(user.loc == src)
user.take_organ_damage(0, 2)
if(user.getFireLoss() > 50)
if(user.get_damage(BURN) > 50)
to_chat(user, "<span class='danger'>Your body can't handle the heat anymore!</span>")
leaveRune(user)
return
if(warning == 0)
to_chat(user, "<span class='warning'>You feel the immerse heat of the realm of Nar-Sie...</span>")
++warning
if(warning == 1 && user.getFireLoss() > 15)
if(warning == 1 && user.get_damage(BURN) > 15)
to_chat(user, "<span class='warning'>Your burns are getting worse. You should return to your realm soon...</span>")
++warning
if(warning == 2 && user.getFireLoss() > 35)
if(warning == 2 && user.get_damage(BURN) > 35)
to_chat(user, "<span class='warning'>The heat! It burns!</span>")
++warning
sleep(10)
Expand Down Expand Up @@ -471,7 +471,7 @@
if(ishuman(victim))
var/mob/living/carbon/human/H = victim
if(H.is_asystole())
H.adjustBrainLoss(2 + casters.len)
H.take_damage(BRAIN, 2 + casters.len)
sleep(40)
if(victim && victim.loc == T && victim.stat == DEAD)
var/decl/special_role/cultist/cult = GET_DECL(/decl/special_role/cultist)
Expand Down Expand Up @@ -546,9 +546,9 @@
statuses += "you regain lost blood"
if(!charges)
return statuses
if(user.getBruteLoss() || user.getFireLoss())
var/healbrute = user.getBruteLoss()
var/healburn = user.getFireLoss()
if(user.get_damage(BRUTE) || user.get_damage(BURN))
var/healbrute = user.get_damage(BRUTE)
var/healburn = user.get_damage(BURN)
if(healbrute < healburn)
healbrute = min(healbrute, charges / 2)
charges -= healbrute
Expand All @@ -563,9 +563,9 @@
statuses += "your wounds mend"
if(!charges)
return statuses
if(user.getToxLoss())
use = min(user.getToxLoss(), charges)
user.adjustToxLoss(-use)
if(user.get_damage(TOX))
use = min(user.get_damage(TOX), charges)
user.heal_damage(TOX, use)
charges -= use
statuses += "your body stings less"
if(!charges)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/godmode/form_items/narsie_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if(!do_after(user,200, L))
return
user.visible_message("<span class='danger'>\The [user] plunges the knife down into \the [a]!</span>")
L.adjustBruteLoss(20)
L.take_damage(BRUTE, 20)
if(altar.linked_god)
altar.linked_god.adjust_power_min(2 * multiplier,0,"from a delicious sacrifice!")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@
if(H.should_have_organ(BP_HEART))
H.drip(5,get_turf(src))
else
H.adjustBruteLoss(5)
H.take_damage(BRUTE, 5)
linked_god.adjust_power_min(1,1)
return TRUE
4 changes: 2 additions & 2 deletions code/game/gamemodes/godmode/form_items/starlight_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@
/obj/item/knife/ritual/shadow/apply_hit_effect(var/mob/living/target, var/mob/living/user, var/hit_zone)
. = ..()
if(charge)
if(target.getBruteLoss() > 15)
if(target.get_damage(BRUTE) > 15)
var/datum/reagents/R = target.reagents
if(!R)
return
R.add_reagent(/decl/material/liquid/venom, 5)
new /obj/effect/temporary(get_turf(target),3, 'icons/effects/effects.dmi', "fire_goon")
charge--
else
user.adjustFireLoss(5)
user.take_damage(BURN, 5)
if(prob(5))
to_chat(user, "<span class='warning'>\The [src] appears to be out of power!</span>")
new /obj/effect/temporary(get_turf(user),3, 'icons/effects/effects.dmi', "fire_goon")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
if(followers.len)
for(var/m in followers)
var/mob/living/L = m
L.adjustFireLoss(-5)
L.heal_damage(BURN, 5)
if(prob(5))
to_chat(L, "<span class='notice'>You feel a pleasant warmth spread throughout your body...</span>")
for(var/s in L.mind.learned_spells)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/godmode/god_altar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
cycles_before_converted++
if(prob(50))
to_chat(M, "<span class='danger'>The mental strain is too much for you! You feel your body weakening!</span>")
M.adjustToxLoss(15, do_update_health = FALSE)
M.adjustHalLoss(30)
M.take_damage(TOX, 15, do_update_health = FALSE)
M.take_damage(PAIN, 30)
return TOPIC_REFRESH

/obj/structure/deity/altar/on_update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/wizard/servant_items/champion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
E?.take_external_damage(burn=2,used_weapon="stovetop")
else
var/mob/living/M = loc
M.adjustFireLoss(2)
M.take_damage(BURN, 2)
if(prob(2))
to_chat(loc,"<span class='danger'>\The [src] is burning you!</span>")
return 1
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/computer/arcade_orion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
if(ORION_TRAIL_CARP)
to_chat(usr, "<span class='danger'> Something bit you!</span>")
var/mob/living/M = usr
M.adjustBruteLoss(10)
M.take_damage(BRUTE, 10)
if(ORION_TRAIL_FLUX)
if(isliving(usr) && prob(75))
var/mob/living/M = usr
Expand Down Expand Up @@ -450,8 +450,8 @@
for(var/i=0;i<10;i++)
sleep(10)
SET_STATUS_MAX(M, STAT_STUN, 5)
M.adjustBruteLoss(10, do_update_health = FALSE)
M.adjustFireLoss(10)
M.take_damage(BRUTE, 10, do_update_health = FALSE)
M.take_damage(BURN, 10)
usr.gib() //So that people can't cheese it and inject a lot of kelo/bicard before losing


Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ About the new airlock wires panel:
var/mob/living/carbon/C = user
if(istype(C) && C.hallucination_power > 25)
to_chat(user, SPAN_DANGER("You feel a powerful shock course through your body!"))
user.adjustHalLoss(10)
user.take_damage(PAIN, 10)
SET_STATUS_MAX(user, STAT_STUN, 10)
return
..(user)
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/rechargestation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
return

// If we have repair capabilities, repair any damage.
if(weld_rate && occupant.getBruteLoss())
if(weld_rate && occupant.get_damage(BRUTE))
var/repair = weld_rate - use_power_oneoff(weld_power_use * weld_rate, LOCAL) / weld_power_use
occupant.adjustBruteLoss(-repair)
if(wire_rate && occupant.getFireLoss())
occupant.heal_damage(BRUTE, repair)
if(wire_rate && occupant.get_damage(BURN))
var/repair = wire_rate - use_power_oneoff(wire_power_use * wire_rate, LOCAL) / wire_power_use
occupant.adjustFireLoss(-repair)
occupant.heal_damage(BURN, repair)

var/obj/item/cell/target
if(isrobot(occupant))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/auras/blueforge_aura.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
layer = MOB_LAYER

/obj/aura/blueforge_aura/life_tick()
user.adjustToxLoss(-10)
user.heal_damage(TOX, 10)
return 0

/obj/aura/blueforge_aura/bullet_act(var/obj/item/projectile/P)
Expand Down
20 changes: 10 additions & 10 deletions code/game/objects/auras/regenerating_aura.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
var/tox_mult = 1

/obj/aura/regenerating/life_tick()
user.adjustBruteLoss(-brute_mult, do_update_health = FALSE)
user.adjustFireLoss(-fire_mult, do_update_health = FALSE)
user.adjustToxLoss(-tox_mult)
user.heal_damage(BRUTE, brute_mult, do_update_health = FALSE)
user.heal_damage(BURN, fire_mult, do_update_health = FALSE)
user.heal_damage(TOX, tox_mult)

/obj/aura/regenerating/human
var/nutrition_damage_mult = 1 //How much nutrition it takes to heal regular damage
Expand Down Expand Up @@ -37,25 +37,25 @@

var/update_health = FALSE
var/organ_regen = get_config_value(/decl/config/num/health_organ_regeneration_multiplier)
if(brute_mult && H.getBruteLoss())
if(brute_mult && H.get_damage(BRUTE))
update_health = TRUE
H.adjustBruteLoss(-brute_mult * organ_regen, do_update_health = FALSE)
H.heal_damage(BRUTE, brute_mult * organ_regen, do_update_health = FALSE)
H.adjust_nutrition(-nutrition_damage_mult)
if(fire_mult && H.getFireLoss())
if(fire_mult && H.get_damage(BURN))
update_health = TRUE
H.adjustFireLoss(-fire_mult * organ_regen, do_update_health = FALSE)
H.heal_damage(BURN, fire_mult * organ_regen, do_update_health = FALSE)
H.adjust_nutrition(-nutrition_damage_mult)
if(tox_mult && H.getToxLoss())
if(tox_mult && H.get_damage(TOX))
update_health = TRUE
H.adjustToxLoss(-tox_mult * organ_regen, do_update_health = FALSE)
H.heal_damage(TOX, tox_mult * organ_regen, do_update_health = FALSE)
H.adjust_nutrition(-nutrition_damage_mult)
if(update_health)
H.update_health()

if(!can_regenerate_organs())
return 1
if(organ_mult)
if(prob(10) && H.nutrition >= 150 && !H.getBruteLoss() && !H.getFireLoss())
if(prob(10) && H.nutrition >= 150 && !H.get_damage(BRUTE) && !H.get_damage(BURN))
var/obj/item/organ/external/D = GET_EXTERNAL_ORGAN(H, BP_HEAD)
if (D.status & ORGAN_DISFIGURED)
if (H.nutrition >= 20)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/auras/starlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
/obj/aura/starborn/bullet_act(var/obj/item/projectile/P, var/def_zone)
if(P.damage_type == BURN)
user.visible_message("<span class='warning'>\The [P] seems to only make \the [user] stronger.</span>")
user.adjustBruteLoss(-P.damage)
user.heal_damage(BRUTE, P.damage)
return AURA_FALSE
return 0

/obj/aura/starborn/attackby(var/obj/item/I, var/mob/i_user)
if(I.damtype == BURN)
to_chat(i_user, "<span class='warning'>\The [I] seems to only feed into \the [user]'s flames.</span>")
user.adjustBruteLoss(-I.force)
user.heal_damage(BRUTE, I.force)
return AURA_FALSE
return 0
2 changes: 1 addition & 1 deletion code/game/objects/effects/effect_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ steam.start() -- spawns the effect
if (!..())
return 0
M.drop_held_items()
M.adjustOxyLoss(1)
M.take_damage(OXY, 1)
M.cough()

/obj/effect/effect/smoke/bad/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/aicard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
flush = 1
to_chat(carded_ai, "Your core files are being wiped!")
while (carded_ai && carded_ai.stat != DEAD)
carded_ai.adjustOxyLoss(2)
carded_ai.take_damage(OXY, 2)
sleep(10)
flush = 0
if (href_list["radio"])
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/scanners/breath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

// Other general warnings.
if(skill_level >= SKILL_BASIC)
switch(C.getOxyLoss())
switch(C.get_damage(OXY))
if(0 to 25)
dat += "<span class='scan_green'>Subject oxygen levels nominal.</span>"
if(25 to 50)
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/devices/scanners/health.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@
if(skill_level >= SKILL_BASIC)
if(H.getOxyLossPercent() > 50)
dat += "<span class='scan_blue'>[b]Severe oxygen deprivation detected.[endb]</span>"
if(H.getToxLoss() > 50)
if(H.get_damage(TOX) > 50)
dat += "<span class='scan_green'>[b]Major systemic organ failure detected.[endb]</span>"
if(H.getFireLoss() > 50)
if(H.get_damage(BURN) > 50)
dat += "<span class='scan_orange'>[b]Severe burn damage detected.[endb]</span>"
if(H.getBruteLoss() > 50)
if(H.get_damage(BRUTE) > 50)
dat += "<span class='scan_red'>[b]Severe anatomical damage detected.[endb]</span>"

if(skill_level >= SKILL_BASIC)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/flashlights/_flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
to_chat(user, SPAN_WARNING("There's visible damage to [H]'s [vision.name]!"))
else if(HAS_STATUS(H, STAT_BLURRY))
to_chat(user, SPAN_NOTICE("\The [H]'s pupils react slower than normally."))
if(H.getBrainLoss() > 15)
if(H.get_damage(BRAIN) > 15)
to_chat(user, SPAN_NOTICE("There's visible lag between left and right pupils' reactions."))

var/static/list/pinpoint = list(
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/stacks/nanopaste.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
return 0
if (isrobot(M)) //Repairing cyborgs
var/mob/living/silicon/robot/R = M
if (R.getBruteLoss() || R.getFireLoss() )
if (R.get_damage(BRUTE) || R.get_damage(BURN) )
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
R.adjustBruteLoss(-15, do_update_health = FALSE)
R.adjustFireLoss(-15)
R.heal_damage(BRUTE, 15, do_update_health = FALSE)
R.heal_damage(BURN, 15)
use(1)
user.visible_message("<span class='notice'>\The [user] applied some [src] on [R]'s damaged areas.</span>",\
"<span class='notice'>You apply some [src] at [R]'s damaged areas.</span>")
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@
var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(H, BP_BRAIN)
if(!brain) return //no brain

var/brain_damage = clamp((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.getBrainLoss(), brain.max_damage)
H.setBrainLoss(brain_damage)
var/brain_damage = clamp((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.get_damage(BRAIN), brain.max_damage)
H.set_damage(BRAIN, brain_damage)

/obj/item/shockpaddles/proc/make_announcement(var/message, var/msg_class)
audible_message("<b>\The [src]</b> [message]", "\The [src] vibrates slightly.")
Expand Down
Loading

0 comments on commit 15dee6a

Please sign in to comment.