From 2bf69434929a7f236918ac250ae2b78d15bd5519 Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Mon, 26 Mar 2012 18:01:06 +0100 Subject: [PATCH] TG: Now all calls for bruteloss are handled via procs now. Extensibility++ r2803 --- code/WorkInProgress/virus2/base.dm | 2 +- .../mob/living/carbon/metroid/powers.dm | 27 +++++-------------- .../mob/living/carbon/monkey/monkey.dm | 25 +++++++++++------ code/modules/mob/living/living.dm | 12 ++++----- code/modules/mob/living/silicon/ai/ai.dm | 19 ++++++++++--- code/modules/mob/living/silicon/ai/life.dm | 5 ++-- code/modules/mob/living/silicon/pai/pai.dm | 4 +-- .../modules/mob/living/silicon/robot/robot.dm | 23 +++++++++++----- code/modules/mob/living/silicon/silicon.dm | 2 +- code/unused/hivebot/hivebot.dm | 7 +++-- code/unused/newcombatsystem.dm | 2 +- 11 files changed, 72 insertions(+), 56 deletions(-) diff --git a/code/WorkInProgress/virus2/base.dm b/code/WorkInProgress/virus2/base.dm index e66a8828f09..2c79fb26eef 100644 --- a/code/WorkInProgress/virus2/base.dm +++ b/code/WorkInProgress/virus2/base.dm @@ -446,7 +446,7 @@ proc/airborne_can_reach(turf/source, turf/target) mob.suiciding = 1 //instead of killing them instantly, just put them at -175 health and let 'em gasp for a while viewers(mob) << "\red [mob.name] is holding \his breath. It looks like \he's trying to commit suicide." - mob.oxyloss = max(175 - mob.toxloss - mob.fireloss - mob.bruteloss, mob.oxyloss) + mob.adjustOxyLoss(175 - mob.getToxLoss() - mob.getFireLoss() - mob.getBruteLoss() - mob.getOxyLoss()) mob.updatehealth() spawn(200) //in case they get revived by cryo chamber or something stupid like that, let them suicide again in 20 seconds mob.suiciding = 0 diff --git a/code/modules/mob/living/carbon/metroid/powers.dm b/code/modules/mob/living/carbon/metroid/powers.dm index a08b4df5edd..7c836158453 100644 --- a/code/modules/mob/living/carbon/metroid/powers.dm +++ b/code/modules/mob/living/carbon/metroid/powers.dm @@ -71,37 +71,22 @@ "A sharp, deep pain bathes every inch of your body!")]" if(istype(M, /mob/living/carbon)) - Victim.cloneloss += rand(1,10) + Victim.adjustCloneLoss(rand(1,10)) Victim.adjustToxLoss(rand(1,2)) if(Victim.health <= 0) Victim.adjustToxLoss(rand(2,4)) - if(getToxLoss() > 0) - adjustToxLoss(-10) - - if(getOxyLoss() > 0) - oxyloss = max(0, getOxyLoss()-10) - - if(getBruteLoss() > 0) - bruteloss = max(0, getBruteLoss()-10) - - if(getFireLoss() > 0) - adjustFireLoss(-10) - - if(getCloneLoss() > 0) - adjustCloneLoss(-10) + adjustToxLoss(-10) + adjustOxyLoss(-10) + adjustBruteLoss(-10) + adjustFireLoss(-10) + adjustCloneLoss(-10) if(Victim) for(var/mob/living/carbon/metroid/Metroid in view(1,M)) if(Metroid.Victim == M && Metroid != src) Metroid.Feedstop() - if(getToxLoss()<0) adjustToxLoss(0) - if(getOxyLoss()<0) adjustOxyLoss(0) - if(getBruteLoss()<0) adjustBruteLoss(0) - if(getFireLoss()<0) adjustFireLoss(0) - if(getCloneLoss()<0) adjustCloneLoss(0) - nutrition += rand(10,25) if(nutrition >= lastnut + 50) if(prob(80)) diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 6480701a8d0..00ae2c20c17 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -134,7 +134,7 @@ M.show_message(text("\red [] has been hit by []", src, O), 1) if (health > 0) var/shielded = 0 - bruteloss += 30 + adjustBruteLoss(30) if ((O.icon_state == "flaming" && !( shielded ))) adjustFireLoss(40) health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() @@ -149,7 +149,7 @@ O.show_message(text("\red [M.name] has bit []!", src), 1) var/damage = rand(1, 5) if (mutations & HULK) damage += 10 - bruteloss += damage + adjustBruteLoss(damage) updatehealth() for(var/datum/disease/D in M.viruses) @@ -172,7 +172,7 @@ for(var/mob/O in viewers(src, null)) O.show_message("\red [M.name] has bit [name]!", 1) var/damage = rand(1, 5) - bruteloss += damage + adjustBruteLoss(damage) health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() for(var/datum/disease/D in M.viruses) if(istype(D, /datum/disease/jungle_fever)) @@ -245,7 +245,7 @@ if ((O.client && !( O.blinded ))) O.show_message(text("\red [] has knocked out [name]!", M), 1) return - bruteloss += damage + adjustBruteLoss(damage) updatehealth() react_to_attack(M) else @@ -328,7 +328,7 @@ for(var/mob/O in viewers(src, null)) if ((O.client && !( O.blinded ))) O.show_message(text("\red [] has slashed [name]!", M), 1) - bruteloss += damage + adjustBruteLoss(damage) updatehealth() react_to_attack(M) else @@ -370,11 +370,20 @@ for(var/mob/O in viewers(src, null)) if ((O.client && !( O.blinded ))) O.show_message(text("\red [] has disarmed [name]!", M), 1) - bruteloss += damage + adjustBruteLoss(damage) react_to_attack(M) updatehealth() return +/mob/living/carbon/monkey/attack_animal(mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) + M.emote("[M.friendly] [src]") + else + for(var/mob/O in viewers(src, null)) + O.show_message("\red [M] [M.attacktext] [src]!", 1) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + adjustBruteLoss(damage) + updatehealth() /mob/living/carbon/monkey/attack_metroid(mob/living/carbon/metroid/M as mob) @@ -397,7 +406,7 @@ else damage = rand(5, 35) - bruteloss += damage + adjustBruteLoss(damage) if(M.powerlevel > 0) var/stunprob = 10 @@ -619,7 +628,7 @@ health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() if(2.0) if (stat != 2) - bruteloss += 60 + adjustBruteLoss(60) adjustFireLoss(60) health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() if(3.0) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index c3607a1637e..9f9ede58b22 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,14 +1,14 @@ /mob/living/verb/succumb() set hidden = 1 if ((src.health < 0 && src.health > -95.0)) - src.oxyloss += src.health + 200 + src.adjustOxyLoss(src.health + 200) src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() src << "\blue You have given up life and succumbed to death." /mob/living/proc/updatehealth() if(!src.nodamage) - src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.cloneloss - src.halloss + src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss() -src.halloss else src.health = 100 src.stat = 0 @@ -142,25 +142,25 @@ // heal ONE external organ, organ gets randomly selected from damaged ones. /mob/living/proc/heal_organ_damage(var/brute, var/burn) - bruteloss = max(0, getBruteLoss()-brute) + adjustBruteLoss(-brute) adjustFireLoss(-burn) src.updatehealth() // damage ONE external organ, organ gets randomly selected from damaged ones. /mob/living/proc/take_organ_damage(var/brute, var/burn) - bruteloss += brute + adjustBruteLoss(brute) adjustFireLoss(burn) src.updatehealth() // heal MANY external organs, in random order /mob/living/proc/heal_overall_damage(var/brute, var/burn) - bruteloss = max(0, getBruteLoss()-brute) + adjustBruteLoss(-brute) adjustFireLoss(-burn) src.updatehealth() // damage MANY external organs, in random order /mob/living/proc/take_overall_damage(var/brute, var/burn) - bruteloss += brute + adjustBruteLoss(brute) adjustFireLoss(burn) src.updatehealth() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 672558defa5..4eba5dad383 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -252,7 +252,7 @@ /mob/living/silicon/ai/blob_act() if (stat != 2) - bruteloss += 60 + adjustBruteLoss(60) updatehealth() return 1 return 0 @@ -328,7 +328,7 @@ M.show_message(text("\red [] has been hit by []", src, O), 1) //Foreach goto(19) if (health > 0) - bruteloss += 30 + adjustBruteLoss(30) if ((O.icon_state == "flaming")) adjustFireLoss(40) updatehealth() @@ -364,7 +364,7 @@ O.show_message(text("\red [] has slashed at []!", M, src), 1) if(prob(8)) flick("noise", flash) - bruteloss += damage + adjustBruteLoss(damage) updatehealth() else playsound(loc, 'slashmiss.ogg', 25, 1, -1) @@ -382,6 +382,19 @@ M << "\red ERROR: \black Remote access channel disabled." return + +/mob/living/silicon/ai/attack_animal(mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) + M.emote("[M.friendly] [src]") + else + for(var/mob/O in viewers(src, null)) + O.show_message("\red [M] [M.attacktext] [src]!", 1) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + adjustBruteLoss(damage) + updatehealth() + + + /mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C) usr:cameraFollow = null if (!C) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index c6e4462c7de..ffa15e78ac0 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -82,7 +82,7 @@ spawn(1) while (src.getOxyLoss()>0 && stat!=2) sleep(50) - src.oxyloss-=1 + src.adjustOxyLoss(-1) src.oxyloss = 0 return else if (src:aiRestorePowerRoutine==3) @@ -91,8 +91,7 @@ spawn(1) while (src.getOxyLoss()>0 && stat!=2) sleep(50) - src.oxyloss-=1 - src.oxyloss = 0 + src.adjustOxyLoss(-1) return else diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 0cf92458edc..6e0908137be 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -41,7 +41,7 @@ /mob/living/silicon/pai/blob_act() if (src.stat != 2) - src.bruteloss += 60 + src.adjustBruteLoss(60) src.updatehealth() return 1 return 0 @@ -138,7 +138,7 @@ O.show_message(text("\red [] has slashed at []!", M, src), 1) if(prob(8)) flick("noise", src.flash) - src.bruteloss += damage + src.adjustBruteLoss(damage) src.updatehealth() else playsound(src.loc, 'slashmiss.ogg', 25, 1, -1) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ea82813e7cd..cabe34ec5d6 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -175,7 +175,7 @@ /mob/living/silicon/robot/blob_act() if (stat != 2) - bruteloss += 60 + adjustBruteLoss(60) updatehealth() return 1 return 0 @@ -243,7 +243,7 @@ M.show_message(text("\red [src] has been hit by [O]"), 1) //Foreach goto(19) if (health > 0) - bruteloss += 30 + adjustBruteLoss(30) if ((O.icon_state == "flaming")) adjustFireLoss(40) updatehealth() @@ -354,7 +354,7 @@ user << "There are no dents to fix here!" return else if (W:remove_fuel(0)) - bruteloss -= 30 + adjustBruteLoss(-30) if(getBruteLoss() < 0) bruteloss = 0 updatehealth() add_fingerprint(user) @@ -539,7 +539,7 @@ O.show_message(text("\red [] has slashed at []!", M, src), 1) if(prob(8)) flick("noise", flash) - bruteloss += damage + adjustBruteLoss(damage) updatehealth() else playsound(loc, 'slashmiss.ogg', 25, 1, -1) @@ -587,7 +587,7 @@ damage = rand(5, 35) damage = round(damage / 2) // borgs recieve half damage - bruteloss += damage + adjustBruteLoss(damage) if(M.powerlevel > 0) @@ -617,13 +617,24 @@ s.start() if (prob(stunprob) && M.powerlevel >= 8) - bruteloss += M.powerlevel * rand(6,10) + adjustBruteLoss(M.powerlevel * rand(6,10)) updatehealth() return +/mob/living/silicon/robot/attack_animal(mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) + M.emote("[M.friendly] [src]") + else + for(var/mob/O in viewers(src, null)) + O.show_message("\red [M] [M.attacktext] [src]!", 1) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + adjustBruteLoss(damage) + updatehealth() + + /mob/living/silicon/robot/attack_hand(mob/user) add_fingerprint(user) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index c2d6c1141fc..204652cd1a4 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -27,7 +27,7 @@ return 1 /mob/living/silicon/bullet_act(var/obj/item/projectile/Proj) - if(!Proj.nodamage) bruteloss += Proj.damage + if(!Proj.nodamage) adjustBruteLoss(Proj.damage) Proj.on_hit(src,2) return 2 diff --git a/code/unused/hivebot/hivebot.dm b/code/unused/hivebot/hivebot.dm index a6c1b69f6c9..0c11474d467 100644 --- a/code/unused/hivebot/hivebot.dm +++ b/code/unused/hivebot/hivebot.dm @@ -34,7 +34,7 @@ /mob/living/silicon/hivebot/blob_act() if (src.stat != 2) - src.bruteloss += 60 + src.adjustBruteLoss(60) src.updatehealth() return 1 return 0 @@ -183,8 +183,7 @@ /mob/living/silicon/hivebot/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/weldingtool) && W:welding) if (W:remove_fuel(0)) - src.bruteloss -= 30 - if(src.getBruteLoss() < 0) src.bruteloss = 0 + src.adjustBruteLoss(-30) src.updatehealth() src.add_fingerprint(user) for(var/mob/O in viewers(user, null)) @@ -227,7 +226,7 @@ O.show_message(text("\red [] has slashed at []!", M, src), 1) if(prob(8)) flick("noise", src.flash) - src.bruteloss += damage + src.adjustBruteLoss(damage) src.updatehealth() else playsound(src.loc, 'slashmiss.ogg', 25, 1, -1) diff --git a/code/unused/newcombatsystem.dm b/code/unused/newcombatsystem.dm index 26a138726c6..274581a04e1 100644 --- a/code/unused/newcombatsystem.dm +++ b/code/unused/newcombatsystem.dm @@ -84,7 +84,7 @@ for(var/mob/O in viewers(src,7)) O << "\red \b [target.name] deftly parries the attack with [target.l_hand.name]!" return - target.bruteloss -= src.force + target.adjustBruteLoss(-src.force) var/modifier_knockdown = 1.0 var/modifier_knockout = 1.0