add an argument that toggles spammability of use_tool() (#30962)

* add an argument that toggles spammability of use_tool()

* make argument more specific
This commit is contained in:
Toastical
2025-12-03 18:12:10 +02:00
committed by GitHub
parent 79a891fd6d
commit 4506011bbf
2 changed files with 7 additions and 3 deletions
@@ -2,7 +2,7 @@
* Called when a mob tries to use the item as a tool.
* Handles most checks.
*/
/obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks)
/obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks, do_after_once = FALSE)
// No delay means there is no start message, and no reason to call tool_start_check before use_tool.
// Run the start check here so we wouldn't have to call it manually.
target.add_fingerprint(user)
@@ -21,9 +21,13 @@
if(!do_mob(user, target, delay, extra_checks = list(tool_check)))
return
else
else if(!do_after_once)
if(!do_after(user, delay, target=target, extra_checks = list(tool_check)))
return
else
if(!do_after_once(user, delay, target=target, extra_checks = list(tool_check)))
return
else
// Invoke the extra checks once, just in case.
if(extra_checks && !extra_checks.Invoke())
+1 -1
View File
@@ -187,7 +187,7 @@
cig.light(user, target)
return TRUE
/obj/item/weldingtool/use_tool(atom/target, user, delay, amount, volume, datum/callback/extra_checks)
/obj/item/weldingtool/use_tool(atom/target, user, delay, amount, volume, datum/callback/extra_checks, do_after_once)
target.add_overlay(GLOB.welding_sparks)
var/did_thing = ..()
if(did_thing)