From 5d1c4548fa51b5981e5d5009f1e34ea7f01b6e5c Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sun, 1 Sep 2013 00:16:11 +0100 Subject: [PATCH] Cell.use checks instead of just minuses. Yay for code! --- code/game/gamemodes/events/ninja_abilities.dm | 8 ++++---- code/game/gamemodes/events/ninja_equipment.dm | 5 ++++- code/game/machinery/floodlight.dm | 5 +++-- code/modules/mob/living/carbon/alien/humanoid/humanoid.dm | 2 +- code/modules/mob/living/carbon/alien/larva/larva.dm | 2 +- code/modules/mob/living/carbon/human/human_attackhand.dm | 2 +- code/modules/mob/living/carbon/metroid/metroid.dm | 2 +- code/modules/mob/living/carbon/monkey/monkey.dm | 2 +- code/modules/projectiles/guns/projectile/bow.dm | 4 ++-- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/code/game/gamemodes/events/ninja_abilities.dm b/code/game/gamemodes/events/ninja_abilities.dm index 16dfae52493..9245c740e07 100644 --- a/code/game/gamemodes/events/ninja_abilities.dm +++ b/code/game/gamemodes/events/ninja_abilities.dm @@ -109,7 +109,7 @@ Not sure why this would be useful (it's not) but whatever. Ninjas need their smo playsound(U.loc, 'sound/effects/EMPulse.ogg', 60, 2) empulse(U, 2, 3) //Procs sure are nice. Slightly weaker than wizard's disable tch. s_coold = 2 - cell.charge-=(C*10) + cell.use(C*10) return //=======//ENERGY BLADE//=======// @@ -129,7 +129,7 @@ Not sure why this would be useful (it's not) but whatever. Ninjas need their smo spark_system.start() playsound(U.loc, "sparks", 50, 1) U.put_in_hands(W) - cell.charge-=(C*10) + cell.use(C*10) else U << "\red You can only summon one blade. Try dropping an item first." else//Else you can run around with TWO energy blades. I don't know why you'd want to but cool factor remains. @@ -173,7 +173,7 @@ This could be a lot better but I'm too tired atm.*/ A.current = curloc A.yo = targloc.y - curloc.y A.xo = targloc.x - curloc.x - cell.charge-=(C*100)// Ninja stars now cost 100 energy, stil la fair chunk to avoid spamming, will run out of power quickly if used 3 or more times + cell.use(C*100)// Ninja stars now cost 100 energy, stil la fair chunk to avoid spamming, will run out of power quickly if used 3 or more times A.process() else U << "\red There are no targets in view." @@ -210,7 +210,7 @@ Must right click on a mob to activate.*/ E.master = U spawn(0)//Parallel processing. E.process(M) - cell.charge-=(C*100) // Nets now cost what should be most of a standard battery, since your taking someone out of the round + cell.use(C*100) // Nets now cost what should be most of a standard battery, since your taking someone out of the round else U << "They are already trapped inside an energy net." else diff --git a/code/game/gamemodes/events/ninja_equipment.dm b/code/game/gamemodes/events/ninja_equipment.dm index 647933ca3d9..d25dabe21bb 100644 --- a/code/game/gamemodes/events/ninja_equipment.dm +++ b/code/game/gamemodes/events/ninja_equipment.dm @@ -520,7 +520,10 @@ ________________________________________________________________________________ if(damage>1)//So they don't spam it when energy is a factor. spark_system.start()//SPARKS THERE SHALL BE SPARKS U.electrocute_act(damage, src,0.1,1)//The last argument is a safety for the human proc that checks for gloves. - cell.charge -= damage + if(cell.charge < damage) + cell.use(cell.charge) + else + cell.use(damage) else A << "\red ERROR: \black Not enough energy remaining." diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index 57f1bc4be6e..bfb8c458518 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -21,8 +21,9 @@ /obj/machinery/floodlight/process() if(on) - cell.charge -= use - if(cell.charge <= 0) + if(cell.charge >= use) + cell.use(use) + else on = 0 updateicon() SetLuminosity(0) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 3917671d963..6188f88827b 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -268,7 +268,7 @@ if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. if(G.cell.charge >= 2500) - G.cell.charge -= 2500 + G.cell.use(2500) Weaken(5) if (stuttering < 5) diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 3086886b318..2a4886206f6 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -248,7 +248,7 @@ if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. if(G.cell.charge >= 2500) - G.cell.charge -= 2500 + G.cell.use(2500) Weaken(5) if (stuttering < 5) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 76dce7e45e5..3c279e5cf72 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -22,7 +22,7 @@ if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. if(G.cell.charge >= 2500) - G.cell.charge -= 2500 + G.cell.use(2500) visible_message("\red [src] has been touched with the stun gloves by [M]!") M.attack_log += text("\[[time_stamp()]\] Stungloved [src.name] ([src.ckey])") src.attack_log += text("\[[time_stamp()]\] Has been stungloved by [M.name] ([M.ckey])") diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 24ef8092531..693fd1bd6a7 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -440,7 +440,7 @@ if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. if(G.cell.charge >= 2500) - G.cell.charge -= 2500 + G.cell.use(2500) for(var/mob/O in viewers(src, null)) if ((O.client && !( O.blinded ))) O.show_message("\red [src] has been touched with the stun gloves by [M]!", 1, "\red You hear someone fall.", 2) diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 7f109dd7d7a..29c0b4defbc 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -229,7 +229,7 @@ if(G.cell) if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. if(G.cell.charge >= 2500) - G.cell.charge -= 2500 + G.cell.use(2500) Weaken(5) if (stuttering < 5) stuttering = 5 diff --git a/code/modules/projectiles/guns/projectile/bow.dm b/code/modules/projectiles/guns/projectile/bow.dm index e2bc1c1088d..5a627ae6ef2 100644 --- a/code/modules/projectiles/guns/projectile/bow.dm +++ b/code/modules/projectiles/guns/projectile/bow.dm @@ -77,7 +77,7 @@ user << "[arrow] plinks and crackles as it begins to glow red-hot." arrow.throwforce = 15 arrow.icon_state = "metal-rod-superheated" - cell.charge -= 500 + cell.use(500) return if(istype(W, /obj/item/weapon/cell)) @@ -91,7 +91,7 @@ user << "[arrow] plinks and crackles as it begins to glow red-hot." arrow.throwforce = 15 arrow.icon_state = "metal-rod-superheated" - cell.charge -= 500 + cell.use(500) else user << "[src] already has a cell installed."