mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Adds Absolute Pathing to the Foam Crossbow (#13610)
This commit is contained in:
@@ -339,89 +339,88 @@
|
||||
attack_verb = list("attacked", "struck", "hit")
|
||||
var/bullets = 5
|
||||
|
||||
examine(mob/user)
|
||||
if(..(user, 2) && bullets)
|
||||
to_chat(user, "<span class='notice'>It is loaded with [bullets] foam darts!</span>")
|
||||
/obj/item/toy/crossbow/examine(mob/user)
|
||||
if(..(user, 2) && bullets)
|
||||
to_chat(user, "<span class='notice'>It is loaded with [bullets] foam darts!</span>")
|
||||
|
||||
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, "<span class='notice'>You load the foam dart into the crossbow.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>It's already fully loaded.</span>")
|
||||
/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, "<span class='notice'>You load the foam dart into the crossbow.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>It's already fully loaded.</span>")
|
||||
|
||||
|
||||
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("<span class='warning'>\The [] was hit by the foam dart!</span>", 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("<span class='warning'>\The [] was hit by the foam dart!</span>", 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("<span class='warning'>\The [] realized they were out of ammo and starting scrounging for some!</span>", 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("<span class='warning'>\The [] realized they were out of ammo and starting scrounging for some!</span>", 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("<span class='danger'>\The [] casually lines up a shot with []'s head and pulls the trigger!</span>", user, M), 1, "<span class='warning'>You hear the sound of foam against skull</span>", 2)
|
||||
O.show_message(text("<span class='warning'>\The [] was hit in the head by the foam dart!</span>", M), 1)
|
||||
|
||||
for(var/mob/O in viewers(M, null))
|
||||
if(O.client)
|
||||
O.show_message(text("<span class='danger'>\The [] casually lines up a shot with []'s head and pulls the trigger!</span>", user, M), 1, "<span class='warning'>You hear the sound of foam against skull</span>", 2)
|
||||
O.show_message(text("<span class='warning'>\The [] was hit in the head by the foam dart!</span>", 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("<span class='danger'>\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!</span>", user, M), 1, "<span class='warning'>You hear someone fall</span>", 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("<span class='danger'>\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!</span>", user, M), 1, "<span class='warning'>You hear someone fall</span>", 2)
|
||||
user.Weaken(5)
|
||||
return
|
||||
|
||||
/obj/item/toy/ammo/crossbow
|
||||
name = "foam dart"
|
||||
|
||||
Reference in New Issue
Block a user