Gun Code Overhaul Phase 1: (Now with 50% less wasted code!)

- Gun code condensed to make future modifications easier. Functionality should (mostly) remain the same.
- Taser guns shoot ONE WHOLE SHOT more then they do now. Yippy!
- Energy Crossbow has a slightly higher shot capacity (still automatically recharges).
- Guns that shoot projectiles (such as revolvers) now eject the ammo casings when they fire (this will be adjusted somewhat in phase 2).
- Revolvers can either be loaded one shell at a time or all at once with an ammo box.
- All guns now have a badmin var. Have fun (think shotguns).
- A few admin-only guns have been removed (for now). They'll get re-added in a future update.
- Shotguns no longer need to be pumped before firing (will change back in phase 2).
- All gunshots fired by players are now logged in both the firer's and the target's attack_log. So if someone gets shot and it doesn't show up, it's because a turret or something shot them.

Hopefully I didn't miss anything.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1659 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
morikou@gmail.com
2011-06-04 03:39:20 +00:00
parent 02c951575d
commit 8188eb5e17
41 changed files with 817 additions and 2034 deletions
-136
View File
@@ -940,142 +940,6 @@
src.part3.release()
return
/obj/bullet/Bump(atom/A as mob|obj|turf|area)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_BULLET, src, def_zone)
if(istype(A,/turf))
for(var/obj/O in A)
O.bullet_act(PROJECTILE_BULLET, src, def_zone)
del(src)
return
/obj/bullet/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover, /obj/bullet))
return prob(95)
else
return 1
/obj/bullet/weakbullet/Bump(atom/A as mob|obj|turf|area)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_WEAKBULLET, src)
if(istype(A,/turf))
for(var/obj/O in A)
O.bullet_act(PROJECTILE_WEAKBULLET, src, def_zone)
del(src)
return
/obj/bullet/electrode/Bump(atom/A as mob|obj|turf|area)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_TASER)
if(istype(A,/turf))
for(var/obj/O in A)
O.bullet_act(PROJECTILE_TASER, src, def_zone)
del(src)
return
/obj/bullet/cbbolt/Bump(atom/A as mob|obj|turf|area)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_BOLT)
if(istype(A,/turf))
for(var/obj/O in A)
O.bullet_act(PROJECTILE_BOLT, src, def_zone)
del(src)
return
/obj/bullet/neurodart/Bump(atom/A as mob|obj|turf|area)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_DART)
if(istype(A,/turf))
for(var/obj/O in A)
O.bullet_act(PROJECTILE_DART, src, def_zone)
del(src)
return
/obj/bullet/teleshot/Bump(atom/A as mob|obj|turf|area)
if (src.target == null)
var/list/turfs = list( )
for(var/turf/T in orange(10, src))
if(T.x>world.maxx-4 || T.x<4) continue //putting them at the edge is dumb
if(T.y>world.maxy-4 || T.y<4) continue
turfs += T
if(turfs)
src.target = pick(turfs)
if (!src.target)
del(src)
return
spawn(0)
if(A)
var/turf/T = get_turf(A)
for(var/atom/movable/M in T)
if(istype(M, /obj/effects)) //sparks don't teleport
continue
if (M.anchored)
continue
if (istype(M, /atom/movable))
var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread
s.set_up(5, 1, M)
s.start()
if(prob(src.failchance)) //oh dear a problem, put em in deep space
do_teleport(M, locate(rand(5, world.maxx - 5), rand(5, world.maxy -5), 3), 0)
else
do_teleport(M, src.target, 2)
del(src)
return
/obj/bullet/proc/process()
spawn while(src)
if ((!( src.current ) || src.loc == src.current))
src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z)
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
//SN src = null
del(src)
return
step_towards(src, src.current)
sleep( 1 )
return
/obj/beam/a_laser/Bump(atom/A as mob|obj|turf)
spawn(0)
if(A)
A.bullet_act(PROJECTILE_LASER, src, def_zone)
del(src)
/obj/beam/a_laser/proc/process()
spawn while(src)
//world << text("laser at [] []:[], target is [] []:[]", src.loc, src.x, src.y, src:current, src.current:x, src.current:y)
if ((!( src.current ) || src.loc == src.current))
src.current = locate(min(max(src.x + src.xo, 1), world.maxx), min(max(src.y + src.yo, 1), world.maxy), src.z)
//world << text("current changed: target is now []. location was [],[], added [],[]", src.current, src.x, src.y, src.xo, src.yo)
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
//world << text("off-world, deleting")
//SN src = null
del(src)
return
step_towards(src, src.current)
// make it able to hit lying-down folk
var/list/dudes = list()
for(var/mob/living/M in src.loc)
dudes += M
if(dudes.len)
src.Bump(pick(dudes))
//world << text("laser stepped, now [] []:[], target is [] []:[]", src.loc, src.x, src.y, src.current, src.current:x, src.current:y)
src.life--
if (src.life <= 0)
//SN src = null
del(src)
return
sleep(1)
return
/obj/beam/i_beam/proc/hit()
//world << "beam \ref[src]: hit"
if (src.master)