From 765106986d15281a7b0e2505823dfa18282dfbb7 Mon Sep 17 00:00:00 2001 From: Anewbe Date: Tue, 18 Sep 2018 13:54:51 -0500 Subject: [PATCH] Fixes a couple of tool related oversight/runtimes --- code/game/machinery/doors/door.dm | 133 +++++++++++++------------ code/game/objects/structures/grille.dm | 4 +- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index a56ce2a880..55bcedfaca 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -205,80 +205,83 @@ /obj/machinery/door/attackby(obj/item/I as obj, mob/user as mob) src.add_fingerprint(user) - if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name()) - if(stat & BROKEN) - user << "It looks like \the [src] is pretty busted. It's going to need more than just patching up now." - return - if(health >= maxhealth) - user << "Nothing to fix!" - return - if(!density) - user << "\The [src] must be closed before you can repair it." - return + if(istype(I)) + if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name()) + if(stat & BROKEN) + user << "It looks like \the [src] is pretty busted. It's going to need more than just patching up now." + return + if(health >= maxhealth) + user << "Nothing to fix!" + return + if(!density) + user << "\The [src] must be closed before you can repair it." + return - //figure out how much metal we need - var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT - amount_needed = (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1 //Why does BYOND not have a ceiling proc? + //figure out how much metal we need + var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT + amount_needed = (round(amount_needed) == amount_needed)? amount_needed : round(amount_needed) + 1 //Why does BYOND not have a ceiling proc? - var/obj/item/stack/stack = I - var/transfer - if (repairing) - transfer = stack.transfer_to(repairing, amount_needed - repairing.amount) - if (!transfer) - user << "You must weld or remove \the [repairing] from \the [src] before you can add anything else." - else - repairing = stack.split(amount_needed) + var/obj/item/stack/stack = I + var/transfer if (repairing) - repairing.loc = src - transfer = repairing.amount + transfer = stack.transfer_to(repairing, amount_needed - repairing.amount) + if (!transfer) + user << "You must weld or remove \the [repairing] from \the [src] before you can add anything else." + else + repairing = stack.split(amount_needed) + if (repairing) + repairing.loc = src + transfer = repairing.amount - if (transfer) - user << "You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src]." + if (transfer) + user << "You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src]." - return - - if(repairing && istype(I, /obj/item/weapon/weldingtool)) - if(!density) - user << "\The [src] must be closed before you can repair it." return - var/obj/item/weapon/weldingtool/welder = I - if(welder.remove_fuel(0,user)) - user << "You start to fix dents and weld \the [repairing] into place." - playsound(src, welder.usesound, 50, 1) - if(do_after(user, (5 * repairing.amount) * welder.toolspeed) && welder && welder.isOn()) - user << "You finish repairing the damage to \the [src]." - health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth) - update_icon() - qdel(repairing) - repairing = null + if(repairing && istype(I, /obj/item/weapon/weldingtool)) + if(!density) + user << "\The [src] must be closed before you can repair it." + return + + var/obj/item/weapon/weldingtool/welder = I + if(welder.remove_fuel(0,user)) + user << "You start to fix dents and weld \the [repairing] into place." + playsound(src, welder.usesound, 50, 1) + if(do_after(user, (5 * repairing.amount) * welder.toolspeed) && welder && welder.isOn()) + user << "You finish repairing the damage to \the [src]." + health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth) + update_icon() + qdel(repairing) + repairing = null + return + + if(repairing && I.is_crowbar()) + user << "You remove \the [repairing]." + playsound(src, I.usesound, 100, 1) + repairing.loc = user.loc + repairing = null + return + + //psa to whoever coded this, there are plenty of objects that need to call attack() on doors without bludgeoning them. + if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card)) + var/obj/item/weapon/W = I + user.setClickCooldown(user.get_attack_speed(W)) + if(W.damtype == BRUTE || W.damtype == BURN) + user.do_attack_animation(src) + if(W.force < min_force) + user.visible_message("\The [user] hits \the [src] with \the [W] with no visible effect.") + else + user.visible_message("\The [user] forcefully strikes \the [src] with \the [W]!") + playsound(src.loc, hitsound, 100, 1) + take_damage(W.force) + return + + if(src.operating > 0 || isrobot(user)) + return //borgs can't attack doors open because it conflicts with their AI-like interaction with them. + + if(src.operating) return - if(repairing && I.is_crowbar()) - user << "You remove \the [repairing]." - playsound(src, I.usesound, 100, 1) - repairing.loc = user.loc - repairing = null - return - - //psa to whoever coded this, there are plenty of objects that need to call attack() on doors without bludgeoning them. - if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card)) - var/obj/item/weapon/W = I - user.setClickCooldown(user.get_attack_speed(W)) - if(W.damtype == BRUTE || W.damtype == BURN) - user.do_attack_animation(src) - if(W.force < min_force) - user.visible_message("\The [user] hits \the [src] with \the [W] with no visible effect.") - else - user.visible_message("\The [user] forcefully strikes \the [src] with \the [W]!") - playsound(src.loc, hitsound, 100, 1) - take_damage(W.force) - return - - if(src.operating > 0 || isrobot(user)) return //borgs can't attack doors open because it conflicts with their AI-like interaction with them. - - if(src.operating) return - if(src.allowed(user) && operable()) if(src.density) open() diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 8817dd64a2..2b01af77bc 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -93,7 +93,7 @@ src.health -= damage*0.2 spawn(0) healthcheck() //spawn to make sure we return properly if the grille is deleted -/obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob) +/obj/structure/grille/attackby(obj/item/W as obj, mob/user as mob) if(!istype(W)) return if(W.is_wirecutter()) @@ -109,7 +109,7 @@ "You have [anchored ? "fastened the grille to" : "unfastened the grille from"] the floor.") return -//window placing begin //TODO CONVERT PROPERLY TO MATERIAL DATUM + //window placing begin //TODO CONVERT PROPERLY TO MATERIAL DATUM else if(istype(W,/obj/item/stack/material)) var/obj/item/stack/material/ST = W if(!ST.material.created_window)