mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Adds new helper: use_tool, shakes things up in tool code (#35095)
* small changes * Adds a use_tool helper and changes some tools to use it * Ports most tool operations to use_tool * Converts more tool operations to use_tool and tool_act * Changes some things to default_unfasten_wrench * Improves tool_behavior support in mech construction * Code review memes * Fixes all instant use_tool calls failing * Code improvements * merge fixes
This commit is contained in:
@@ -136,20 +136,29 @@
|
||||
if(cell)
|
||||
to_chat(user, "<span class='notice'>[src] is [round(cell.percent())]% charged.</span>")
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/attackby(obj/item/A, mob/user)
|
||||
if(istype(A, /obj/item/stack/sheet/mineral/plasma))
|
||||
var/obj/item/stack/sheet/S = A
|
||||
S.use(1)
|
||||
/obj/item/gun/energy/plasmacutter/attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/stack/sheet/mineral/plasma))
|
||||
I.use(1)
|
||||
cell.give(1000)
|
||||
to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>")
|
||||
else if(istype(A, /obj/item/stack/ore/plasma))
|
||||
var/obj/item/stack/ore/S = A
|
||||
S.use(1)
|
||||
to_chat(user, "<span class='notice'>You insert [I] in [src], recharging it.</span>")
|
||||
else if(istype(I, /obj/item/stack/ore/plasma))
|
||||
I.use(1)
|
||||
cell.give(500)
|
||||
to_chat(user, "<span class='notice'>You insert [A] in [src], recharging it.</span>")
|
||||
to_chat(user, "<span class='notice'>You insert [I] in [src], recharging it.</span>")
|
||||
else
|
||||
..()
|
||||
|
||||
// Tool procs, in case plasma cutter is used as welder
|
||||
/obj/item/gun/energy/plasmacutter/tool_use_check(mob/living/user, amount)
|
||||
if(cell.charge >= amount * 100)
|
||||
return TRUE
|
||||
|
||||
to_chat(user, "<span class='warning'>You need more charge to complete this task!</span>")
|
||||
return FALSE
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/use(amount)
|
||||
return cell.use(amount * 100)
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/update_icon()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user