Items no longer need to check for tools in attackby

This commit is contained in:
Leo
2017-11-11 18:22:15 -02:00
committed by CitadelStationBot
parent 662c42b450
commit 73cb2ead88
11 changed files with 898 additions and 64 deletions
+17 -3
View File
@@ -1,12 +1,27 @@
/obj/item/proc/melee_attack_chain(mob/user, atom/target, params)
if(pre_attackby(target, user, params))
if(!tool_check(user, target) && pre_attackby(target, user, params))
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = target.attackby(src, user, params)
if(!resolved && target && !QDELETED(src))
afterattack(target, user, 1, params) // 1: clicking something Adjacent
//Checks if the item can work as a tool, calling the appropriate tool behavior on the target
/obj/item/proc/tool_check(mob/user, atom/target)
switch(tool_behaviour)
if(TOOL_NONE)
return FALSE
if(TOOL_CROWBAR)
return target.crowbar_act(user, src)
if(TOOL_SCREWDRIVER)
return target.screwdriver_act(user, src)
if(TOOL_WRENCH)
return target.wrench_act(user, src)
if(TOOL_WIRECUTTER)
return target.wirecutter_act(user, src)
// Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown.
/obj/item/proc/attack_self(mob/user)
SendSignal(COMSIG_ITEM_ATTACK_SELF, user)
@@ -118,5 +133,4 @@
attack_message = "[user] has [message_verb] [src][message_hit_area] with [I]!"
visible_message("<span class='danger'>[attack_message]</span>", \
"<span class='userdanger'>[attack_message]</span>", null, COMBAT_MESSAGE_RANGE)
return 1
return 1