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
+8 -8
View File
@@ -125,11 +125,11 @@
user.visible_message("<b>[user]</b> finishes wiping [A].")
A.on_rag_wipe(src)
/obj/item/reagent_containers/glass/rag/attack(atom/target as obj|turf|area, mob/user as mob , flag)
if(isliving(target))
var/mob/living/M = target
/obj/item/reagent_containers/glass/rag/attack(mob/living/target_mob, mob/living/user, target_zone)
if(isliving(target_mob))
var/mob/living/M = target_mob
if(on_fire)
user.visible_message(SPAN_DANGER("\The [user] hits \the [target] with \the [src]!"))
user.visible_message(SPAN_DANGER("\The [user] hits \the [target_mob] with \the [src]!"))
user.do_attack_animation(src)
M.IgniteMob()
else if(ishuman(M))
@@ -164,18 +164,18 @@
if(user.zone_sel.selecting == BP_MOUTH && !(M.wear_mask && M.wear_mask.item_flags & ITEM_FLAG_AIRTIGHT))
user.do_attack_animation(src)
user.visible_message(
SPAN_DANGER("\The [user] smothers [target] with [src]!"),
SPAN_WARNING("You smother [target] with [src]!"),
SPAN_DANGER("\The [user] smothers [target_mob] with [src]!"),
SPAN_WARNING("You smother [target_mob] with [src]!"),
"You hear some struggling and muffled cries of surprise."
)
//it's inhaled, so... maybe CHEM_BLOOD doesn't make a whole lot of sense but it's the best we can do for now
//^HA HA HA
reagents.trans_to_mob(target, amount_per_transfer_from_this, CHEM_BREATHE)
reagents.trans_to_mob(target_mob, amount_per_transfer_from_this, CHEM_BREATHE)
update_name()
update_icon()
else
wipe_down(target, user)
wipe_down(target_mob, user)
return
return ..()
@@ -45,7 +45,7 @@
to_chat(user, SPAN_NOTICE("You overlay \the [src] and \the [initial(supplied.name)], combining the print records."))
return 1
/obj/item/sample/attackby(obj/item/attacking_item, var/mob/user)
/obj/item/sample/attackby(obj/item/attacking_item, mob/user, params)
if(attacking_item.type == src.type)
user.unEquip(attacking_item)
if(merge_evidence(attacking_item, user))
@@ -110,15 +110,15 @@
name = "[initial(name)] (\the [H])"
icon_state = "fingerprint1"
/obj/item/sample/print/attack(var/mob/living/M, var/mob/user, var/target_zone)
/obj/item/sample/print/attack(mob/living/target_mob, mob/living/user, target_zone)
if(!ishuman(M))
var/mob/living/carbon/human/H = target_mob
if(!istype(H))
return ..()
if(LAZYLEN(evidence))
return 0
var/mob/living/carbon/human/H = M
if(H.gloves)
to_chat(user, SPAN_WARNING("\The [H] is wearing gloves."))
+3 -3
View File
@@ -18,15 +18,15 @@
/obj/item/forensics/swab/proc/is_used()
return used
/obj/item/forensics/swab/attack(var/mob/living/M, var/mob/user, var/target_zone)
/obj/item/forensics/swab/attack(mob/living/target_mob, mob/living/user, target_zone)
if(!ishuman(M))
var/mob/living/carbon/human/H = target_mob
if(!istype(H))
return ..()
if(is_used())
return
var/mob/living/carbon/human/H = M
var/sample_type
if(!H.dna || !H.dna.unique_enzymes)