diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm
index 968582443ae..141308a0135 100644
--- a/code/_onclick/item_attack.dm
+++ b/code/_onclick/item_attack.dm
@@ -13,51 +13,17 @@
if(!(W.flags&NOBLUDGEON))
visible_message("[src] has been hit by [user] with [W].")
+/obj/attackby(obj/item/I, mob/living/user, params)
+ return I.attack_obj(src, user)
+
/mob/living/attackby(obj/item/I, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(attempt_harvest(I, user))
- return
- I.attack(src, user)
-
-/mob/living/proc/attacked_by(obj/item/I, mob/living/user, def_zone)
- apply_damage(I.force, I.damtype, def_zone)
- if(I.damtype == "brute")
- if(prob(33) && I.force)
- add_splatter_floor()
-
- var/showname = "."
- if(user)
- showname = " by [user]!"
- user.do_attack_animation(src)
- if(!(user in viewers(src, null)))
- showname = "."
-
- if(I.attack_verb && I.attack_verb.len)
- visible_message("[src] has been [pick(I.attack_verb)] with [I][showname]",
- "[src] has been [pick(I.attack_verb)] with [I][showname]")
- else if(I.force)
- visible_message("[src] has been attacked with [I][showname]",
- "[src] has been attacked with [I][showname]")
-
-/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user)
- if(!I.force)
- user.visible_message("[user] gently taps [src] with [I].",\
- "This weapon is ineffective, it does no damage.")
- else if(I.force >= force_threshold && I.damtype != STAMINA)
- ..()
- else
- visible_message("[I] bounces harmlessly off of [src].",\
- "[I] bounces harmlessly off of [src].")
-
-// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
-// Click parameters is the params string from byond Click() code, see that documentation.
-/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
- return
-
+ return 1
+ return I.attack(src, user)
/obj/item/proc/attack(mob/living/M, mob/living/user, def_zone)
-
- if(!istype(M)) // not sure if this is the right thing...
+ if(flags & (NOBLUDGEON))
return 0
if(can_operate(M)) //Checks if mob is lying down on table for surgery
@@ -85,29 +51,91 @@
else
return 1
- if(hitsound && force > 0) //If an item's hitsound is defined and the item's force is greater than zero...
- playsound(loc, hitsound, get_clamped_volume(), 1, -1) //...play the item's hitsound at get_clamped_volume() with varying frequency and -1 extra range.
- else if(force == 0)//Otherwise, if the item's force is zero...
- playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)//...play tap.ogg at get_clamped_volume()
- /////////////////////////
+ if(!force)
+ playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)
+ else if(hitsound)
+ playsound(loc, hitsound, get_clamped_volume(), 1, -1)
+
user.lastattacked = M
M.lastattacker = user
- add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
- /////////////////////////
-
+ if(user != M)
+ user.do_attack_animation(M)
M.attacked_by(src, user, def_zone)
+
+ add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
add_fingerprint(user)
- return 1
+
+
+//the equivalent of the standard version of attack() but for object targets.
+/obj/item/proc/attack_obj(obj/O, mob/living/user)
+ if(flags & (NOBLUDGEON))
+ return
+ user.changeNext_move(CLICK_CD_MELEE)
+ user.do_attack_animation(O)
+ O.attacked_by(src, user)
+
+/atom/movable/proc/attacked_by()
+ return
+
+/obj/attacked_by(obj/item/I, mob/living/user)
+ if(I.force)
+ user.visible_message("[user] has hit [src] with [I]!", "You hit [src] with [I]!")
+
+/mob/living/attacked_by(obj/item/I, mob/living/user, def_zone)
+ send_item_attack_message(I, user)
+ if(I.force)
+ apply_damage(I.force, I.damtype, def_zone)
+ if(I.damtype == BRUTE)
+ if(prob(33))
+ I.add_mob_blood(src)
+ var/turf/location = get_turf(src)
+ add_splatter_floor(location)
+ if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
+ user.add_mob_blood(src)
+ return TRUE //successful attack
+
+/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user)
+ if(!I.force)
+ user.visible_message("[user] gently taps [src] with [I].",\
+ "This weapon is ineffective, it does no damage!")
+ else if(I.force < force_threshold || I.damtype == STAMINA)
+ visible_message("[I] bounces harmlessly off of [src].",\
+ "[I] bounces harmlessly off of [src]!")
+ else
+ return ..()
+
+// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
+// Click parameters is the params string from byond Click() code, see that documentation.
+/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
+ return
/obj/item/proc/get_clamped_volume()
if(w_class)
if(force)
return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
else
- return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
\ No newline at end of file
+ return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
+
+/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
+ if(I.discrete)
+ return
+ var/message_verb = "attacked"
+ if(I.attack_verb && I.attack_verb.len)
+ message_verb = "[pick(I.attack_verb)]"
+ else if(!I.force)
+ return
+ var/message_hit_area = ""
+ if(hit_area)
+ message_hit_area = " in the [hit_area]"
+ var/attack_message = "[src] has been [message_verb][message_hit_area] with [I]."
+ if(user in viewers(src, null))
+ attack_message = "[src] has been [message_verb][message_hit_area] with [I] by [user]!"
+ visible_message("[attack_message]",
+ "[attack_message]")
+ return 1
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 63fc5a47168..3f05012586a 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -833,7 +833,7 @@
else
return attacked_by(W, user)
-/obj/mecha/proc/attacked_by(obj/item/I, mob/user)
+/obj/mecha/attacked_by(obj/item/I, mob/user)
log_message("Attacked by [I]. Attacker - [user]")
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index c04e2e94583..25dfb7f6961 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -234,7 +234,7 @@
W.update_icon()
return
-/obj/structure/grille/proc/attacked_by(obj/item/I, mob/living/user)
+/obj/structure/grille/attacked_by(obj/item/I, mob/living/user)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
if(!(I.flags&NOBLUDGEON))
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index 66680ecc8f5..f6a035158ec 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -141,7 +141,7 @@
else
attacked_by(W, user)
-/obj/structure/mineral_door/proc/attacked_by(obj/item/I, mob/user)
+/obj/structure/mineral_door/attacked_by(obj/item/I, mob/user)
if(I.damtype != STAMINA)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
diff --git a/code/modules/mob/living/carbon/carbon_defenses.dm b/code/modules/mob/living/carbon/carbon_defenses.dm
index 6878a0f28f7..eb6517e5f1d 100644
--- a/code/modules/mob/living/carbon/carbon_defenses.dm
+++ b/code/modules/mob/living/carbon/carbon_defenses.dm
@@ -24,7 +24,7 @@
for(var/datum/surgery/S in surgeries)
if(S.next_step(user, src))
return 1
- ..()
+ return ..()
/mob/living/carbon/attack_hand(mob/living/carbon/human/user)
if(!iscarbon(user))
diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm
index 28c81b026b9..3eb65f993f4 100644
--- a/code/modules/mob/living/carbon/human/human_attackhand.dm
+++ b/code/modules/mob/living/carbon/human/human_attackhand.dm
@@ -228,6 +228,3 @@
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
visible_message("[M] attempted to disarm [src]!")
return
-
-/mob/living/carbon/human/proc/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, inrange, params)
- return
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 3e73b1ca5c0..9170a0f74f9 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -215,15 +215,10 @@ emp_act
if(istype(I,/obj/item/weapon/card/emag))
emag_act(user, affecting)
- if(!I.discrete)
- if(I.attack_verb && I.attack_verb.len)
- visible_message("[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!",
- "[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!"))
- else if(I.force)
- visible_message("[src] has been attacked in the [hit_area] with [I] by [user]!",
- "[src] has been attacked in the [hit_area] with [I] by [user]!"))
- else
- return 0
+ send_item_attack_message(I, user, hit_area)
+
+ if(!I.force)
+ return 0 //item force is zero
var/armor = run_armor_check(affecting, "melee", "Your armour has protected your [hit_area].", "Your armour has softened hit to your [hit_area].", armour_penetration = I.armour_penetration)
var/weapon_sharp = is_sharp(I)
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index e3df2023664..4c1053995e0 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -567,10 +567,7 @@ var/list/robot_verbs_default = list(
return 2
-/mob/living/silicon/robot/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/weapon/restraints/handcuffs)) // fuck i don't even know why isrobot() in handcuff code isn't working so this will have to do
- return
-
+/mob/living/silicon/robot/attackby(obj/item/weapon/W, mob/user, params)
if(opened) // Are they trying to insert something?
for(var/V in components)
var/datum/robot_component/C = components[V]
@@ -610,6 +607,7 @@ var/list/robot_verbs_default = list(
else if(istype(W, /obj/item/stack/cable_coil) && user.a_intent == INTENT_HELP && (wiresexposed || istype(src,/mob/living/silicon/robot/drone)))
+ user.changeNext_move(CLICK_CD_MELEE)
if(!getFireLoss())
to_chat(user, "Nothing to fix!")
return
@@ -744,9 +742,13 @@ var/list/robot_verbs_default = list(
to_chat(user, "Upgrade error.")
else
- spark_system.start()
return ..()
+/mob/living/silicon/robot/attacked_by(obj/item/I, mob/living/user, def_zone)
+ if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt.
+ spark_system.start()
+ ..()
+
/mob/living/silicon/robot/emag_act(user as mob)
if(!ishuman(user) && !issilicon(user))
return
diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm
index d1fbd235efc..368a7df552c 100644
--- a/code/modules/mob/living/simple_animal/bot/medbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/medbot.dm
@@ -221,8 +221,9 @@
update_controls()
return
-/mob/living/simple_animal/bot/medbot/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
+/mob/living/simple_animal/bot/medbot/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/reagent_containers/glass))
+ . = 1 //no afterattack
if(locked)
to_chat(user, "You cannot insert a beaker because the panel is locked!")
return
@@ -236,7 +237,6 @@
reagent_glass = W
to_chat(user, "You insert [W].")
show_controls(user)
- return
else
var/current_health = health
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 0acbadbffa6..cf045091115 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -382,7 +382,7 @@
return
-/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/living/user as mob) //Marker -Agouri
+/mob/living/simple_animal/attackby(obj/item/O, mob/living/user)
if(can_collar && !collar && istype(O, /obj/item/clothing/accessory/petcollar))
var/obj/item/clothing/accessory/petcollar/C = O
user.drop_item()
@@ -396,34 +396,7 @@
real_name = C.tagname
return
else
- user.changeNext_move(CLICK_CD_MELEE)
- if(attempt_harvest(O, user))
- return
- user.do_attack_animation(src)
- if(istype(O) && istype(user) && !O.attack(src, user))
- var/damage = 0
- if(O.force)
- if(O.force >= force_threshold)
- damage = O.force
- if(O.damtype == STAMINA)
- damage = 0
- if(O.damtype == BRUTE)
- if(prob(33))
- O.add_mob_blood(src)
- var/turf/location = get_turf(src)
- add_splatter_floor(location)
- if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
- user.add_mob_blood(src)
- visible_message("[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] [src] with [O]!",\
- "[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] you with [O]!")
- else
- visible_message("[O] bounces harmlessly off of [src].",\
- "[O] bounces harmlessly off of [src].")
- playsound(loc, O.hitsound, 50, 1, -1)
- else
- user.visible_message("[user] gently taps [src] with [O].",\
- "This weapon is ineffective, it does no damage.")
- adjustBruteLoss(damage)
+ ..()
/mob/living/simple_animal/movement_delay()
. = ..()