mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 16:10:02 +01:00
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:
@@ -137,10 +137,13 @@
|
||||
filling.color = COLOR_PINK
|
||||
AddOverlays(filling)
|
||||
|
||||
/obj/item/docility_serum/attack(mob/living/carbon/slime/M as mob, mob/user as mob)
|
||||
if(!istype(M, /mob/living/carbon/slime/))//If target is not a slime.
|
||||
/obj/item/docility_serum/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
var/mob/living/carbon/slime/M = target_mob
|
||||
|
||||
if(!istype(M))//If target is not a slime.
|
||||
to_chat(user, SPAN_WARNING("The docility serum only works on slimes!"))
|
||||
return ..()
|
||||
|
||||
if(M.stat)
|
||||
to_chat(user, SPAN_WARNING("The slime is dead!"))
|
||||
return ..()
|
||||
@@ -180,10 +183,13 @@
|
||||
filling.color = COLOR_PALE_PINK
|
||||
AddOverlays(filling)
|
||||
|
||||
/obj/item/advanced_docility_serum/attack(mob/living/carbon/slime/M as mob, mob/user as mob)
|
||||
if(!istype(M, /mob/living/carbon/slime/))//If target is not a slime.
|
||||
/obj/item/advanced_docility_serum/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
var/mob/living/carbon/slime/M = target_mob
|
||||
|
||||
if(!istype(M))//If target is not a slime.
|
||||
to_chat(user, SPAN_WARNING("The docility serum only works on slimes!"))
|
||||
return ..()
|
||||
|
||||
if(M.stat)
|
||||
to_chat(user, SPAN_WARNING("The slime is dead!"))
|
||||
return ..()
|
||||
@@ -230,10 +236,13 @@
|
||||
|
||||
return INITIALIZE_HINT_NORMAL
|
||||
|
||||
/obj/item/slimesteroid/attack(mob/living/carbon/slime/M as mob, mob/user as mob)
|
||||
if(!istype(M, /mob/living/carbon/slime)) //If target is not a slime.
|
||||
/obj/item/slimesteroid/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
var/mob/living/carbon/slime/M = target_mob
|
||||
|
||||
if(!istype(M)) //If target is not a slime.
|
||||
to_chat(user, SPAN_WARNING("The steroid only works on baby slimes!"))
|
||||
return ..()
|
||||
|
||||
if(M.is_adult) //Can't tame adults
|
||||
to_chat(user, SPAN_WARNING("Only baby slimes can use the steroid!"))
|
||||
return ..()
|
||||
|
||||
@@ -69,6 +69,6 @@
|
||||
sharp = FALSE
|
||||
edge = FALSE
|
||||
|
||||
/obj/item/crowbar/robotic/jawsoflife/attack(mob/living/carbon/M, mob/living/carbon/user)
|
||||
user.visible_message("\The [user] [pick("boops", "squeezes", "pokes", "prods", "strokes", "bonks")] \the [M] with \the [src]")
|
||||
/obj/item/crowbar/robotic/jawsoflife/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
user.visible_message("\The [user] [pick("boops", "squeezes", "pokes", "prods", "strokes", "bonks")] \the [target_mob] with \the [src]")
|
||||
return FALSE
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
origin_tech = list(TECH_MAGNET = 2, TECH_BIO = 1, TECH_ENGINEERING = 2)
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 500, MATERIAL_GLASS = 200)
|
||||
|
||||
/obj/item/device/robotanalyzer/attack(mob/living/M, mob/living/user)
|
||||
robotic_analyze_mob(M, user)
|
||||
/obj/item/device/robotanalyzer/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
robotic_analyze_mob(target_mob, user)
|
||||
add_fingerprint(user)
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
var/datum/matter_synth/wood
|
||||
var/datum/matter_synth/plastic
|
||||
|
||||
/obj/item/matter_decompiler/attack(mob/living/M, mob/living/user)
|
||||
/obj/item/matter_decompiler/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
return
|
||||
|
||||
/obj/item/matter_decompiler/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity, params)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
icon_state = "paper_bin1"
|
||||
item_state = "sheet-metal"
|
||||
|
||||
/obj/item/form_printer/attack(mob/living/carbon/M, mob/living/carbon/user)
|
||||
/obj/item/form_printer/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
return
|
||||
|
||||
/obj/item/form_printer/afterattack(atom/target, mob/living/user, flag, params)
|
||||
|
||||
@@ -147,20 +147,20 @@
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/gripper/attack(mob/M, mob/user)
|
||||
/obj/item/gripper/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
if(wrapped) //The force of the wrapped obj gets set to zero during the attack() and afterattack().
|
||||
force_holder = wrapped.force
|
||||
wrapped.force = 0
|
||||
var/resolved = wrapped.attack(M,user)
|
||||
var/resolved = wrapped.attack(target_mob, user)
|
||||
if(QDELETED(wrapped))
|
||||
drop(get_turf(src), user, FALSE)
|
||||
return resolved
|
||||
else // mob interactions
|
||||
switch(user.a_intent)
|
||||
if(I_HELP)
|
||||
user.visible_message("\The [user] [pick("boops", "squeezes", "pokes", "prods", "strokes", "bonks")] \the [M] with \the [src]")
|
||||
user.visible_message("\The [user] [pick("boops", "squeezes", "pokes", "prods", "strokes", "bonks")] \the [target_mob] with \the [src]")
|
||||
if(I_HURT)
|
||||
M.attack_generic(user, user.mob_size, "crushed")//about 16 dmg for a cyborg
|
||||
target_mob.attack_generic(user, user.mob_size, "crushed")//about 16 dmg for a cyborg
|
||||
//Attack generic does a visible message so we dont need one here
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN * 3)
|
||||
playsound(user, 'sound/effects/attackblob.ogg', 60, 1)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
return R.get_cell()
|
||||
return null
|
||||
|
||||
/obj/item/inductive_charger/attack(mob/living/M, mob/living/user, target_zone)
|
||||
/obj/item/inductive_charger/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
return
|
||||
|
||||
/obj/item/inductive_charger/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
|
||||
//////////////////////////////Capturing////////////////////////////////////////////////////////
|
||||
|
||||
/obj/item/device/soulstone/attack(mob/living/carbon/human/M as mob, mob/user as mob)
|
||||
/obj/item/device/soulstone/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
user.setClickCooldown(20)
|
||||
|
||||
var/mob/living/carbon/human/M = target_mob
|
||||
|
||||
if(!istype(M, /mob/living/carbon/human))//If target is not a human.
|
||||
return ..()
|
||||
if(istype(M, /mob/living/carbon/human/apparition))
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/item/grab/attack(mob/M, mob/living/user, var/target_zone)
|
||||
/obj/item/grab/attack(mob/living/target_mob, mob/living/user, target_zone)
|
||||
if(!affecting)
|
||||
return
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
last_action = world.time
|
||||
reset_kill_state() //using special grab moves will interrupt choking them
|
||||
|
||||
if(M == affecting) //clicking on the victim while grabbing them
|
||||
if(target_mob == affecting) //clicking on the victim while grabbing them
|
||||
if(ishuman(affecting))
|
||||
var/hit_zone = target_zone
|
||||
flick(hud.icon_state, hud)
|
||||
@@ -385,7 +385,7 @@
|
||||
hair_pull(affecting, assailant)
|
||||
|
||||
//clicking on yourself while grabbing them
|
||||
else if(M == assailant && assailant.a_intent == I_GRAB && state >= GRAB_AGGRESSIVE)
|
||||
else if(target_mob == assailant && assailant.a_intent == I_GRAB && state >= GRAB_AGGRESSIVE)
|
||||
devour(affecting, assailant)
|
||||
|
||||
/obj/item/grab/dropped()
|
||||
|
||||
Reference in New Issue
Block a user