mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Merge pull request #5577 from Anewbe/grilles
Fixes a couple of tool related oversight/runtimes
This commit is contained in:
@@ -205,80 +205,83 @@
|
|||||||
/obj/machinery/door/attackby(obj/item/I as obj, mob/user as mob)
|
/obj/machinery/door/attackby(obj/item/I as obj, mob/user as mob)
|
||||||
src.add_fingerprint(user)
|
src.add_fingerprint(user)
|
||||||
|
|
||||||
if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name())
|
if(istype(I))
|
||||||
if(stat & BROKEN)
|
if(istype(I, /obj/item/stack/material) && I.get_material_name() == src.get_material_name())
|
||||||
user << "<span class='notice'>It looks like \the [src] is pretty busted. It's going to need more than just patching up now.</span>"
|
if(stat & BROKEN)
|
||||||
return
|
user << "<span class='notice'>It looks like \the [src] is pretty busted. It's going to need more than just patching up now.</span>"
|
||||||
if(health >= maxhealth)
|
return
|
||||||
user << "<span class='notice'>Nothing to fix!</span>"
|
if(health >= maxhealth)
|
||||||
return
|
user << "<span class='notice'>Nothing to fix!</span>"
|
||||||
if(!density)
|
return
|
||||||
user << "<span class='warning'>\The [src] must be closed before you can repair it.</span>"
|
if(!density)
|
||||||
return
|
user << "<span class='warning'>\The [src] must be closed before you can repair it.</span>"
|
||||||
|
return
|
||||||
|
|
||||||
//figure out how much metal we need
|
//figure out how much metal we need
|
||||||
var/amount_needed = (maxhealth - health) / DOOR_REPAIR_AMOUNT
|
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?
|
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/obj/item/stack/stack = I
|
||||||
var/transfer
|
var/transfer
|
||||||
if (repairing)
|
|
||||||
transfer = stack.transfer_to(repairing, amount_needed - repairing.amount)
|
|
||||||
if (!transfer)
|
|
||||||
user << "<span class='warning'>You must weld or remove \the [repairing] from \the [src] before you can add anything else.</span>"
|
|
||||||
else
|
|
||||||
repairing = stack.split(amount_needed)
|
|
||||||
if (repairing)
|
if (repairing)
|
||||||
repairing.loc = src
|
transfer = stack.transfer_to(repairing, amount_needed - repairing.amount)
|
||||||
transfer = repairing.amount
|
if (!transfer)
|
||||||
|
user << "<span class='warning'>You must weld or remove \the [repairing] from \the [src] before you can add anything else.</span>"
|
||||||
|
else
|
||||||
|
repairing = stack.split(amount_needed)
|
||||||
|
if (repairing)
|
||||||
|
repairing.loc = src
|
||||||
|
transfer = repairing.amount
|
||||||
|
|
||||||
if (transfer)
|
if (transfer)
|
||||||
user << "<span class='notice'>You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src].</span>"
|
user << "<span class='notice'>You fit [transfer] [stack.singular_name]\s to damaged and broken parts on \the [src].</span>"
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
if(repairing && istype(I, /obj/item/weapon/weldingtool))
|
|
||||||
if(!density)
|
|
||||||
user << "<span class='warning'>\The [src] must be closed before you can repair it.</span>"
|
|
||||||
return
|
return
|
||||||
|
|
||||||
var/obj/item/weapon/weldingtool/welder = I
|
if(repairing && istype(I, /obj/item/weapon/weldingtool))
|
||||||
if(welder.remove_fuel(0,user))
|
if(!density)
|
||||||
user << "<span class='notice'>You start to fix dents and weld \the [repairing] into place.</span>"
|
user << "<span class='warning'>\The [src] must be closed before you can repair it.</span>"
|
||||||
playsound(src, welder.usesound, 50, 1)
|
return
|
||||||
if(do_after(user, (5 * repairing.amount) * welder.toolspeed) && welder && welder.isOn())
|
|
||||||
user << "<span class='notice'>You finish repairing the damage to \the [src].</span>"
|
var/obj/item/weapon/weldingtool/welder = I
|
||||||
health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
|
if(welder.remove_fuel(0,user))
|
||||||
update_icon()
|
user << "<span class='notice'>You start to fix dents and weld \the [repairing] into place.</span>"
|
||||||
qdel(repairing)
|
playsound(src, welder.usesound, 50, 1)
|
||||||
repairing = null
|
if(do_after(user, (5 * repairing.amount) * welder.toolspeed) && welder && welder.isOn())
|
||||||
|
user << "<span class='notice'>You finish repairing the damage to \the [src].</span>"
|
||||||
|
health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
|
||||||
|
update_icon()
|
||||||
|
qdel(repairing)
|
||||||
|
repairing = null
|
||||||
|
return
|
||||||
|
|
||||||
|
if(repairing && I.is_crowbar())
|
||||||
|
user << "<span class='notice'>You remove \the [repairing].</span>"
|
||||||
|
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("<span class='danger'>\The [user] hits \the [src] with \the [W] with no visible effect.</span>")
|
||||||
|
else
|
||||||
|
user.visible_message("<span class='danger'>\The [user] forcefully strikes \the [src] with \the [W]!</span>")
|
||||||
|
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
|
return
|
||||||
|
|
||||||
if(repairing && I.is_crowbar())
|
|
||||||
user << "<span class='notice'>You remove \the [repairing].</span>"
|
|
||||||
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("<span class='danger'>\The [user] hits \the [src] with \the [W] with no visible effect.</span>")
|
|
||||||
else
|
|
||||||
user.visible_message("<span class='danger'>\The [user] forcefully strikes \the [src] with \the [W]!</span>")
|
|
||||||
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.allowed(user) && operable())
|
||||||
if(src.density)
|
if(src.density)
|
||||||
open()
|
open()
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
src.health -= damage*0.2
|
src.health -= damage*0.2
|
||||||
spawn(0) healthcheck() //spawn to make sure we return properly if the grille is deleted
|
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))
|
if(!istype(W))
|
||||||
return
|
return
|
||||||
if(W.is_wirecutter())
|
if(W.is_wirecutter())
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
"<span class='notice'>You have [anchored ? "fastened the grille to" : "unfastened the grille from"] the floor.</span>")
|
"<span class='notice'>You have [anchored ? "fastened the grille to" : "unfastened the grille from"] the floor.</span>")
|
||||||
return
|
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))
|
else if(istype(W,/obj/item/stack/material))
|
||||||
var/obj/item/stack/material/ST = W
|
var/obj/item/stack/material/ST = W
|
||||||
if(!ST.material.created_window)
|
if(!ST.material.created_window)
|
||||||
|
|||||||
Reference in New Issue
Block a user