Refactored the attack proc (#19908)

Refactored the attack proc signature.
Added signals and components for the attack proc.
Added signals and components for the attackby proc.
Adjusted some leftover attackby procs signatures.
Added grep test to ensure people don't keep adding attack/attackby procs
with the wrong signature.
This commit is contained in:
Fluffy
2024-10-06 21:30:00 +00:00
committed by GitHub
parent b79b7c5177
commit 9636363e60
121 changed files with 878 additions and 663 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
var/mode = 0 //off or on.
matter = list(DEFAULT_WALL_MATERIAL = 120, MATERIAL_GLASS = 80)
/obj/item/device/hand_labeler/attack()
/obj/item/device/hand_labeler/attack(mob/living/target_mob, mob/living/user, target_zone)
return
/obj/item/device/hand_labeler/afterattack(atom/A, mob/user as mob, proximity)
+5 -1
View File
@@ -234,7 +234,11 @@
/obj/item/paper/attack_ai(var/mob/living/silicon/ai/user)
show_content(user)
/obj/item/paper/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob, var/target_zone)
/obj/item/paper/attack(mob/living/target_mob, mob/living/user, target_zone)
var/mob/living/carbon/M = target_mob
if(!istype(M))
return ..()
if(target_zone == BP_EYES)
user.visible_message(SPAN_NOTICE("You show \the [src] to [M]."), \
SPAN_NOTICE("[user] holds up \the [src] and shows it to [M]."))
+11 -11
View File
@@ -176,21 +176,21 @@
. = ..()
create_reagents(30)
/obj/item/pen/reagent/attack(mob/living/M, mob/user)
/obj/item/pen/reagent/attack(mob/living/target_mob, mob/living/user, target_zone)
. = ..()
if(!ismob(M))
if(!ismob(target_mob))
return
if(M.can_inject(user, 1))
if(target_mob.can_inject(user, 1))
if(reagents.total_volume)
if(M.reagents)
if(target_mob.reagents)
var/contained_reagents = reagents.get_reagents()
var/trans = reagents.trans_to_mob(M, 30, CHEM_BLOOD)
to_chat(user, SPAN_ALERT("You stab \the [M] with \the [src], injecting all of its contents.")) // To the stabber.
to_chat(M, SPAN_WARNING("You feel a small <b>pinch</b>!")) // To the stabbed.
M.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been stabbed with [name] by [user.name] ([user.ckey])</font>"
user.attack_log += "\[[time_stamp()]\] <span class='warning'>Used the [name] to stab [M.name] ([M.ckey])</span>"
msg_admin_attack("[user.name] ([user.ckey]) Used the [name] to stab [M.name] ([M.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(user),ckey_target=key_name(M))
admin_inject_log(user, M, src, contained_reagents, reagents.get_temperature(), trans) // Admin log.
var/trans = reagents.trans_to_mob(target_mob, 30, CHEM_BLOOD)
to_chat(user, SPAN_ALERT("You stab \the [target_mob] with \the [src], injecting all of its contents.")) // To the stabber.
to_chat(target_mob, SPAN_WARNING("You feel a small <b>pinch</b>!")) // To the stabbed.
target_mob.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been stabbed with [name] by [user.name] ([user.ckey])</font>"
user.attack_log += "\[[time_stamp()]\] <span class='warning'>Used the [name] to stab [target_mob.name] ([target_mob.ckey])</span>"
msg_admin_attack("[user.name] ([user.ckey]) Used the [name] to stab [target_mob.name] ([target_mob.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(user),ckey_target=key_name(target_mob))
admin_inject_log(user, target_mob, src, contained_reagents, reagents.get_temperature(), trans) // Admin log.
/*
* Sleepy Pens
+1 -1
View File
@@ -169,7 +169,7 @@ var/global/photo_count = 0
size = nsize
to_chat(usr, SPAN_NOTICE("Camera will now take [size]x[size] photos."))
/obj/item/device/camera/attack(mob/living/carbon/human/M as mob, mob/user as mob)
/obj/item/device/camera/attack(mob/living/target_mob, mob/living/user, target_zone)
return
/obj/item/device/camera/attack_self(mob/user as mob)
+7 -1
View File
@@ -100,8 +100,14 @@
to_chat(user, SPAN_ALERT("\The [src] already has a paper in it."))
. = ..()
/obj/item/portable_typewriter/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
/obj/item/portable_typewriter/attack(mob/living/target_mob, mob/living/user, target_zone)
..()
var/mob/living/carbon/M = target_mob
if(!istype(M))
return
user.visible_message(SPAN_ALERT("\The [src] shatters into metal pieces!"))
M.Weaken(2)
playsound(loc, 'sound/effects/metalhit.ogg', 50, 1)