Merge pull request #4639 from RemieRichards/AtomPool

/tg/station Atom/Movable Pool + Pooling of Emitter beams and Say() Virtualspeakers
This commit is contained in:
Swag McYolosteinen
2014-09-19 20:03:24 +02:00
7 changed files with 113 additions and 11 deletions
+6 -2
View File
@@ -119,13 +119,17 @@
else
src.fire_delay = rand(20,100)
src.shot_number = 0
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
var/obj/item/projectile/beam/emitter/A = PoolOrNew(/obj/item/projectile/beam/emitter,src.loc)
A.dir = src.dir
playsound(src.loc, 'sound/weapons/emitter.ogg', 25, 1)
if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
A.dir = src.dir
switch(dir)
if(NORTH)
A.yo = 20
+7 -5
View File
@@ -50,10 +50,13 @@
var/forcedodge = 0
/obj/item/projectile/proc/delete()
// Garbage collect the projectiles
loc = null
/obj/item/projectile/proc/on_hit(var/atom/target, var/blocked = 0, var/hit_zone)
if(!isliving(target)) return 0
if(isanimal(target)) return 0
@@ -67,8 +70,8 @@
else
return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume
/obj/item/projectile/Bump(atom/A as mob|obj|turf|area)
/obj/item/projectile/Bump(atom/A as mob|obj|turf|area)
if(A == firer)
loc = A.loc
return 0 //cannot shoot yourself
@@ -120,8 +123,7 @@
permutated.Add(A)
return 0
density = 0
invisibility = 101
delete()
return 0
return 1
@@ -141,9 +143,9 @@
delete()
return
kill_count--
spawn while(src && src.loc)
spawn while(loc)
if((!( current ) || loc == current))
current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z)
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
delete()
return
@@ -54,6 +54,8 @@
icon_state = "emitter"
damage = 30
/obj/item/projectile/beam/emitter/delete() //what projectiles use to set loc = null
PlaceInPool(src)
/obj/item/projectile/lasertag
name = "laser tag beam"
@@ -301,10 +301,10 @@ datum/signal
if(!job)
job = "Unknown"
//SAY REWRITE RELATED CODE.
//This code is a little hacky, but it *should* work. Even though it'll result in a virtual speaker referencing another virtual speaker. vOv
var/atom/movable/virtualspeaker/virt = new(null)
var/atom/movable/virtualspeaker/virt = PoolOrNew(/atom/movable/virtualspeaker,null)
virt.name = source
virt.job = job
virt.faketrack = 1