diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm
index 75557e73553..91aededa4d9 100644
--- a/code/game/objects/items/toys.dm
+++ b/code/game/objects/items/toys.dm
@@ -339,89 +339,88 @@
attack_verb = list("attacked", "struck", "hit")
var/bullets = 5
- examine(mob/user)
- if(..(user, 2) && bullets)
- to_chat(user, "It is loaded with [bullets] foam darts!")
+/obj/item/toy/crossbow/examine(mob/user)
+ if(..(user, 2) && bullets)
+ to_chat(user, "It is loaded with [bullets] foam darts!")
- attackby(obj/item/I as obj, mob/user as mob)
- if(istype(I, /obj/item/toy/ammo/crossbow))
- if(bullets <= 4)
- user.drop_from_inventory(I,src)
- qdel(I)
- bullets++
- to_chat(user, "You load the foam dart into the crossbow.")
- else
- to_chat(usr, "It's already fully loaded.")
+/obj/item/toy/crossbow/attackby(obj/item/I as obj, mob/user as mob)
+ if(istype(I, /obj/item/toy/ammo/crossbow))
+ if(bullets <= 4)
+ user.drop_from_inventory(I,src)
+ qdel(I)
+ bullets++
+ to_chat(user, "You load the foam dart into the crossbow.")
+ else
+ to_chat(usr, "It's already fully loaded.")
- afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
- if(!isturf(target.loc) || target == user) return
- if(flag) return
+/obj/item/toy/crossbow/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
+ if(!isturf(target.loc) || target == user) return
+ if(flag) return
- if (locate (/obj/structure/table, src.loc))
- return
- else if (bullets)
- var/turf/trg = get_turf(target)
- var/obj/effect/foam_dart_dummy/D = new/obj/effect/foam_dart_dummy(get_turf(src))
- bullets--
- D.icon_state = "foamdart"
- D.name = "foam dart"
- playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
+ if (locate (/obj/structure/table, src.loc))
+ return
+ else if (bullets)
+ var/turf/trg = get_turf(target)
+ var/obj/effect/foam_dart_dummy/D = new/obj/effect/foam_dart_dummy(get_turf(src))
+ bullets--
+ D.icon_state = "foamdart"
+ D.name = "foam dart"
+ playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
- for(var/i=0, i<6, i++)
- if (D)
- if(D.loc == trg) break
- step_towards(D,trg)
+ for(var/i=0, i<6, i++)
+ if (D)
+ if(D.loc == trg) break
+ step_towards(D,trg)
- for(var/mob/living/M in D.loc)
- if(!istype(M,/mob/living)) continue
- if(M == user) continue
- for(var/mob/O in viewers(world.view, D))
- O.show_message(text("\The [] was hit by the foam dart!", M), 1)
- new /obj/item/toy/ammo/crossbow(M.loc)
- qdel(D)
- return
-
- for(var/atom/A in D.loc)
- if(A == user) continue
- if(A.density)
- new /obj/item/toy/ammo/crossbow(A.loc)
- qdel(D)
-
- sleep(1)
-
- spawn(10)
- if(D)
- new /obj/item/toy/ammo/crossbow(D.loc)
+ for(var/mob/living/M in D.loc)
+ if(!istype(M,/mob/living)) continue
+ if(M == user) continue
+ for(var/mob/O in viewers(world.view, D))
+ O.show_message(text("\The [] was hit by the foam dart!", M), 1)
+ new /obj/item/toy/ammo/crossbow(M.loc)
qdel(D)
+ return
- return
- else if (bullets == 0)
- user.Weaken(5)
- for(var/mob/O in viewers(world.view, user))
- O.show_message(text("\The [] realized they were out of ammo and starting scrounging for some!", user), 1)
+ for(var/atom/A in D.loc)
+ if(A == user) continue
+ if(A.density)
+ new /obj/item/toy/ammo/crossbow(A.loc)
+ qdel(D)
+
+ sleep(1)
+
+ spawn(10)
+ if(D)
+ new /obj/item/toy/ammo/crossbow(D.loc)
+ qdel(D)
+
+ return
+ else if (bullets == 0)
+ user.Weaken(5)
+ for(var/mob/O in viewers(world.view, user))
+ O.show_message(text("\The [] realized they were out of ammo and starting scrounging for some!", user), 1)
- attack(mob/M as mob, mob/user as mob)
- src.add_fingerprint(user)
+/obj/item/toy/crossbow/attack(mob/M as mob, mob/user as mob)
+ src.add_fingerprint(user)
// ******* Check
- if (src.bullets > 0 && M.lying)
+ if (src.bullets > 0 && M.lying)
+ for(var/mob/O in viewers(M, null))
+ if(O.client)
+ O.show_message(text("\The [] casually lines up a shot with []'s head and pulls the trigger!", user, M), 1, "You hear the sound of foam against skull", 2)
+ O.show_message(text("\The [] was hit in the head by the foam dart!", M), 1)
- for(var/mob/O in viewers(M, null))
- if(O.client)
- O.show_message(text("\The [] casually lines up a shot with []'s head and pulls the trigger!", user, M), 1, "You hear the sound of foam against skull", 2)
- O.show_message(text("\The [] was hit in the head by the foam dart!", M), 1)
-
- playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
- new /obj/item/toy/ammo/crossbow(M.loc)
- src.bullets--
- else if (M.lying && src.bullets == 0)
- for(var/mob/O in viewers(M, null))
- if (O.client) O.show_message(text("\The [] casually lines up a shot with []'s head, pulls the trigger, then realizes they are out of ammo and drops to the floor in search of some!", user, M), 1, "You hear someone fall", 2)
- user.Weaken(5)
- return
+ playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
+ new /obj/item/toy/ammo/crossbow(M.loc)
+ src.bullets--
+ else if (M.lying && src.bullets == 0)
+ for(var/mob/O in viewers(M, null))
+ if (O.client) O.show_message(text("\The [] casually lines up a shot with []'s head, pulls the trigger, then realizes they are out of ammo and drops to the floor in search of some!", user, M), 1, "You hear someone fall", 2)
+ user.Weaken(5)
+ return
/obj/item/toy/ammo/crossbow
name = "foam dart"