Dart and Syringegun

This commit is contained in:
Fox-McCloud
2015-02-21 09:54:02 -05:00
parent 2a1028324c
commit edde2d10c6
8 changed files with 98 additions and 157 deletions
@@ -125,6 +125,11 @@
/obj/item/ammo_casing/shotgun/dart/attackby()
return
/obj/item/ammo_casing/syringegun
name = "syringe gun spring"
desc = "A high-power spring that throws syringes."
projectile_type = null
/obj/item/ammo_casing/shotgun/fakebeanbag
name = "beanbag shell"
desc = "A weak beanbag shell."
+10 -4
View File
@@ -24,18 +24,24 @@
return
/obj/item/weapon/gun/projectile/process_chambered()
/obj/item/weapon/gun/projectile/process_chambered(var/eject_casing = 1, var/empty_chamber = 1)
// if(in_chamber)
// return 1
var/obj/item/ammo_casing/AC = chambered //Find chambered round
if(isnull(AC) || !istype(AC))
return 0
AC.loc = get_turf(src) //Eject casing onto ground.
AC.SpinAnimation(10, 1) //next gen special effects
chambered = null
if(eject_casing)
AC.loc = get_turf(src) //Eject casing onto ground.
AC.SpinAnimation(10, 1) //next gen special effects
if(empty_chamber)
chambered = null
chamber_round()
if(AC.BB)
if(AC.reagents && AC.BB.reagents)
var/datum/reagents/casting_reagents = AC.reagents
casting_reagents.trans_to(AC.BB, casting_reagents.total_volume) //For chemical darts/bullets
casting_reagents.delete()
in_chamber = AC.BB //Load projectile into chamber.
AC.BB.loc = src //Set projectile loc to gun.
AC.update_icon()
@@ -12,18 +12,7 @@
return
/obj/item/weapon/gun/projectile/revolver/process_chambered()
var/obj/item/ammo_casing/AC = chambered //Find chambered round
if(isnull(AC) || !istype(AC))
return 0
chambered = null
chamber_round()
if(AC.BB)
in_chamber = AC.BB //Load projectile into chamber.
AC.BB.loc = src //Set projectile loc to gun.
AC.BB = null
AC.update_icon()
return 1
return 0
return ..(0, 1)
/obj/item/weapon/gun/projectile/revolver/attackby(var/obj/item/A as obj, mob/user as mob)
var/num_loaded = 0
@@ -36,21 +36,10 @@
/obj/item/weapon/gun/projectile/shotgun/process_chambered()
var/obj/item/ammo_casing/AC = chambered //Find chambered round
if(isnull(AC) || !istype(AC))
return 0
if(AC.BB)
if(AC.reagents && AC.BB.reagents)
var/datum/reagents/casting_reagents = AC.reagents
casting_reagents.trans_to(AC.BB, casting_reagents.total_volume) //For chemical darts
casting_reagents.delete()
in_chamber = AC.BB //Load projectile into chamber.
AC.BB.loc = src //Set projectile loc to gun.
AC.BB = null
AC.update_icon()
return 1
return 0
return ..(0, 0)
/obj/item/weapon/gun/projectile/shotgun/chamber_round()
return
/obj/item/weapon/gun/projectile/shotgun/attack_self(mob/living/user as mob)
if(recentpump) return
+12 -6
View File
@@ -75,7 +75,7 @@
proj_hit = 1
qdel(src)
proc/on_hit(var/atom/target, var/blocked = 0)
proc/on_hit(var/atom/target, var/blocked = 0, var/hit_zone)
if(!isliving(target)) return 0
if(isanimal(target)) return 0
var/mob/living/L = target
@@ -107,6 +107,12 @@
loc = A.loc
return 0// nope.avi
var/reagent_note
if(reagents && reagents.reagent_list)
reagent_note = " REAGENTS:"
for(var/datum/reagent/R in reagents.reagent_list)
reagent_note += R.id + " ("
reagent_note += num2text(R.volume) + ") "
//Lower accurancy/longer range tradeoff. Distance matters a lot here, so at
// close distance, actually RAISE the chance to hit.
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
@@ -124,18 +130,18 @@
playsound(loc, hitsound, 20, 1, -1)
visible_message("\red [A.name] is hit by the [src.name] in the [parse_zone(def_zone)]!")//X has fired Y is now given by the guns so you cant tell who shot you if you could not see the shooter
if(istype(firer, /mob))
M.attack_log += "\[[time_stamp()]\] <b>[firer]/[firer.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>[src.type]</b>"
firer.attack_log += "\[[time_stamp()]\] <b>[firer]/[firer.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>[src.type]</b>"
M.attack_log += "\[[time_stamp()]\] <b>[firer]/[firer.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>[src.type]</b>[reagent_note]"
firer.attack_log += "\[[time_stamp()]\] <b>[firer]/[firer.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>[src.type]</b>[reagent_note]"
if(M.ckey && chatlog_attacks)
msg_admin_attack("[firer] ([firer.ckey]) shot [M] ([M.ckey]) with a [src] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[firer.x];Y=[firer.y];Z=[firer.z]'>JMP</a>)") //BS12 EDIT ALG
msg_admin_attack("[firer] ([firer.ckey]) shot [M] ([M.ckey]) with a [src][reagent_note] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[firer.x];Y=[firer.y];Z=[firer.z]'>JMP</a>)") //BS12 EDIT ALG
if(!iscarbon(firer))
M.LAssailant = null
else
M.LAssailant = firer
else
M.attack_log += "\[[time_stamp()]\] <b>UNKNOWN SUBJECT (No longer exists)</b> shot <b>[M]/[M.ckey]</b> with a <b>[src]</b>"
M.attack_log += "\[[time_stamp()]\] <b>UNKNOWN SUBJECT (No longer exists)</b> shot <b>[M]/[M.ckey]</b> with a <b>[src]</b>[reagent_note]"
if(M.ckey && chatlog_attacks)
msg_admin_attack("UNKNOWN shot [M] ([M.ckey]) with a [src] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[firer.x];Y=[firer.y];Z=[firer.z]'>JMP</a>)") //BS12 EDIT ALG
msg_admin_attack("UNKNOWN shot [M] ([M.ckey]) with a [src][reagent_note] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[firer.x];Y=[firer.y];Z=[firer.z]'>JMP</a>)") //BS12 EDIT ALG
spawn(0)
if(A)
@@ -144,6 +144,8 @@
name = "dart"
icon_state = "cbbolt"
damage = 6
embed = 0
sharp = 0
New()
..()
+14 -1
View File
@@ -297,4 +297,17 @@
starting_chems = list("kelotane","bicaridine","anti_toxin")
/obj/item/weapon/gun/dartgun/vox/raider
starting_chems = list("space_drugs","stoxin","impedrezene")
starting_chems = list("space_drugs","stoxin","impedrezene")
/obj/effect/syringe_gun_dummy //moved this shitty thing here
name = ""
desc = ""
icon = 'icons/obj/chemical.dmi'
icon_state = "null"
anchored = 1
density = 0
New()
var/datum/reagents/R = new/datum/reagents(15)
reagents = R
R.my_atom = src
+51 -120
View File
@@ -1,136 +1,67 @@
/obj/item/weapon/gun/syringe
name = "syringe gun"
desc = "A spring loaded rifle designed to fit syringes, designed to incapacitate unruly patients from a distance."
icon = 'icons/obj/gun.dmi'
desc = "A spring loaded rifle designed to fit syringes, used to incapacitate unruly patients from a distance."
icon_state = "syringegun"
item_state = "syringegun"
w_class = 3.0
w_class = 3
throw_speed = 2
throw_range = 10
force = 4.0
var/list/syringes = new/list()
var/max_syringes = 1
force = 4
m_amt = 2000
clumsy_check = 0
fire_sound = 'sound/items/syringeproj.ogg'
var/list/syringes = list()
var/max_syringes = 1
/obj/item/weapon/gun/syringe/process_chambered()
if(!syringes.len) return 0
var/obj/item/weapon/reagent_containers/syringe/S = syringes[1]
if(!S) return 0
in_chamber = new /obj/item/projectile/bullet/dart/syringe(src)
S.reagents.trans_to(in_chamber, S.reagents.total_volume)
in_chamber.name = S.name
syringes.Remove(S)
del(S)
return 1
/obj/item/weapon/gun/syringe/examine()
set src in view()
..()
if (!(usr in view(2)) && usr!=src.loc) return
usr << "\blue [syringes.len] / [max_syringes] syringes."
usr << "Can hold [max_syringes] syringe\s. Has [syringes.len] syringe\s remaining."
return
/obj/item/weapon/gun/syringe/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/weapon/reagent_containers/syringe))
var/obj/item/weapon/reagent_containers/syringe/S = I
if(S.mode != 2)//SYRINGE_BROKEN in syringes.dm
if(syringes.len < max_syringes)
user.drop_item()
I.loc = src
syringes += I
user << "\blue You put the syringe in [src]."
user << "\blue [syringes.len] / [max_syringes] syringes."
else
usr << "\red [src] cannot hold more syringes."
/obj/item/weapon/gun/syringe/attack_self(mob/living/user as mob)
if(!syringes.len)
user << "<span class='notice'>[src] is empty.</span>"
return 0
var/obj/item/weapon/reagent_containers/syringe/S = syringes[syringes.len]
if(!S) return 0
S.loc = user.loc
syringes.Remove(S)
user << "<span class = 'notice'>You unload [S] from \the [src]!</span>"
return 1
/obj/item/weapon/gun/syringe/attackby(var/obj/item/A as obj, mob/user as mob, var/show_msg = 1)
if(istype(A, /obj/item/weapon/reagent_containers/syringe))
if(syringes.len < max_syringes)
user.drop_item()
user << "<span class='notice'>You load [A] into \the [src]!</span>"
syringes.Add(A)
A.loc = src
return 1
else
usr << "\red This syringe is broken!"
/obj/item/weapon/gun/syringe/afterattack(obj/target, mob/user , flag)
if(!isturf(target.loc) || target == user) return
..()
/obj/item/weapon/gun/syringe/can_fire()
return syringes.len
/obj/item/weapon/gun/syringe/can_hit(var/mob/living/target as mob, var/mob/living/user as mob)
return 1 //SHOOT AND LET THE GOD GUIDE IT (probably will hit a wall anyway)
/obj/item/weapon/gun/syringe/Fire(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, params, reflex = 0)
if(syringes.len)
spawn(0) fire_syringe(target,user)
else
usr << "\red [src] is empty."
/obj/item/weapon/gun/syringe/proc/fire_syringe(atom/target, mob/user)
if (locate (/obj/structure/table, src.loc))
return
else
var/turf/trg = get_turf(target)
var/obj/effect/syringe_gun_dummy/D = new/obj/effect/syringe_gun_dummy(get_turf(src))
var/obj/item/weapon/reagent_containers/syringe/S = syringes[1]
if((!S) || (!S.reagents)) //ho boy! wot runtimes!
return
S.reagents.trans_to(D, S.reagents.total_volume)
syringes -= S
del(S)
D.icon_state = "syringeproj"
D.name = "syringe"
playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
for(var/i=0, i<6, i++)
if(!D) break
if(D.loc == trg) break
step_towards(D,trg)
if(D)
for(var/mob/living/carbon/M in D.loc)
if(!istype(M,/mob/living/carbon)) continue
if(M == user) continue
//Syringe gun attack logging by Yvarov
var/R
if(D.reagents)
for(var/datum/reagent/A in D.reagents.reagent_list)
R += A.id + " ("
R += num2text(A.volume) + "),"
if (istype(M, /mob))
M.attack_log += "\[[time_stamp()]\] <b>[user]/[user.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>syringegun</b> ([R])"
user.attack_log += "\[[time_stamp()]\] <b>[user]/[user.ckey]</b> shot <b>[M]/[M.ckey]</b> with a <b>syringegun</b> ([R])"
if(M.ckey)
msg_admin_attack("[user] ([user.ckey]) shot [M] ([M.ckey]) with a syringegun ([R]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
else
M.attack_log += "\[[time_stamp()]\] <b>UNKNOWN SUBJECT (No longer exists)</b> shot <b>[M]/[M.ckey]</b> with a <b>syringegun</b> ([R])"
msg_admin_attack("UNKNOWN shot [M] ([M.ckey]) with a <b>syringegun</b> ([R]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
if(D.reagents)
D.reagents.trans_to(M, 15)
M.visible_message("<span class='danger'>[M] is hit by the syringe!</span>")
del(D)
break
if(D)
for(var/atom/A in D.loc)
if(A == user) continue
if(A.density) del(D)
sleep(1)
if (D) spawn(10) del(D)
return
usr << "<span class='notice'>[src] cannot hold more syringes.</span>"
return 0
/obj/item/weapon/gun/syringe/rapidsyringe
name = "rapid syringe gun"
desc = "A modification of the syringe gun design, using a rotating cylinder to store up to four syringes."
desc = "A modification of the syringe gun design, using a rotating cylinder to store up to six syringes."
icon_state = "rapidsyringegun"
max_syringes = 4
/obj/effect/syringe_gun_dummy
name = ""
desc = ""
icon = 'icons/obj/chemical.dmi'
icon_state = "null"
anchored = 1
density = 0
New()
var/datum/reagents/R = new/datum/reagents(15)
reagents = R
R.my_atom = src
max_syringes = 6