Revert gun pool for now.

This commit is contained in:
ESwordTheCat
2014-05-08 00:46:48 -08:00
parent 25129b68a0
commit 7243a36f1e
10 changed files with 31 additions and 51 deletions

View File

@@ -114,7 +114,7 @@
A.fired() A.fired()
*/ */
proc/Emit() proc/Emit()
var/obj/item/projectile/beam/emitter/A = getFromPool(/obj/item/projectile/beam/emitter, loc) var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter(src.loc)
A.frequency = frequency A.frequency = frequency
A.damage = mega_energy * 500 A.damage = mega_energy * 500
playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1) playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1)

View File

@@ -92,7 +92,7 @@
src.fire_delay = rand(20,100) src.fire_delay = rand(20,100)
src.shot_number = 0 src.shot_number = 0
use_power(1000) use_power(1000)
var/obj/item/projectile/beam/emitter/A = getFromPool(/obj/item/projectile/beam/emitter, loc) var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter(src.loc)
playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1) playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1)
if(prob(35)) if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread

View File

@@ -292,7 +292,7 @@
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
var/turf/U = get_turf(A) var/turf/U = get_turf(A)
var/obj/item/projectile/beam/LE = getFromPool(/obj/item/projectile/beam, loc) var/obj/item/projectile/beam/LE = new /obj/item/projectile/beam(loc)
LE.icon = 'icons/effects/genetics.dmi' LE.icon = 'icons/effects/genetics.dmi'
LE.icon_state = "eyelasers" LE.icon_state = "eyelasers"
playsound(usr.loc, 'sound/weapons/taser2.ogg', 75, 1) playsound(usr.loc, 'sound/weapons/taser2.ogg', 75, 1)
@@ -333,7 +333,7 @@
"You hear the loud crackle of electricity!") "You hear the loud crackle of electricity!")
var/datum/powernet/PN = cable.get_powernet() var/datum/powernet/PN = cable.get_powernet()
var/available = 0 var/available = 0
var/obj/item/projectile/beam/lightning/L = getFromPool(/obj/item/projectile/beam/lightning, loc) var/obj/item/projectile/beam/lightning/L = new /obj/item/projectile/beam/lightning/(get_turf(src))
if(PN) if(PN)
available = PN.avail available = PN.avail
L.damage = PN.get_electrocute_damage() L.damage = PN.get_electrocute_damage()
@@ -359,8 +359,7 @@
s.set_up(5, 1, src) s.set_up(5, 1, src)
s.start() s.start()
if(L.damage <= 0) if(L.damage <= 0)
//del(L) del(L)
returnToPool(L)
if(L) if(L)
playsound(get_turf(src), 'sound/effects/eleczap.ogg', 75, 1) playsound(get_turf(src), 'sound/effects/eleczap.ogg', 75, 1)
L.tang = L.adjustAngle(get_angle(U,T)) L.tang = L.adjustAngle(get_angle(U,T))

View File

@@ -199,7 +199,7 @@ its easier to just keep the beam vertical.
//Maxdistance is the longest range the beam will persist before it gives up. //Maxdistance is the longest range the beam will persist before it gives up.
var/EndTime=world.time+time var/EndTime=world.time+time
var/broken = 0 var/broken = 0
var/obj/item/projectile/beam/lightning/light = getFromPool(/obj/item/projectile/beam/lightning) var/obj/item/projectile/beam/lightning/light = new
while(BeamTarget&&world.time<EndTime&&get_dist(src,BeamTarget)<maxdistance&&z==BeamTarget.z) while(BeamTarget&&world.time<EndTime&&get_dist(src,BeamTarget)<maxdistance&&z==BeamTarget.z)
//If the BeamTarget gets deleted, the time expires, or the BeamTarget gets out //If the BeamTarget gets deleted, the time expires, or the BeamTarget gets out

View File

@@ -1020,8 +1020,7 @@ Auto Patrol: []"},
if((src.lasercolor == "b") && (src.disabled == 0)) if((src.lasercolor == "b") && (src.disabled == 0))
if(istype(Proj, /obj/item/projectile/beam/lastertag/red)) if(istype(Proj, /obj/item/projectile/beam/lastertag/red))
src.disabled = 1 src.disabled = 1
//del (Proj) del (Proj)
returnToPool(Proj)
sleep(100) sleep(100)
src.disabled = 0 src.disabled = 0
else else
@@ -1029,8 +1028,7 @@ Auto Patrol: []"},
else if((src.lasercolor == "r") && (src.disabled == 0)) else if((src.lasercolor == "r") && (src.disabled == 0))
if(istype(Proj, /obj/item/projectile/beam/lastertag/blue)) if(istype(Proj, /obj/item/projectile/beam/lastertag/blue))
src.disabled = 1 src.disabled = 1
//del (Proj) del (Proj)
returnToPool(Proj)
sleep(100) sleep(100)
src.disabled = 0 src.disabled = 0
else else

View File

@@ -236,17 +236,17 @@
if (src.lasers) if (src.lasers)
switch(lasertype) switch(lasertype)
if(1) if(1)
A = getFromPool(/obj/item/projectile/beam, loc) A = new /obj/item/projectile/beam(loc)
if(2) if(2)
A = getFromPool(/obj/item/projectile/beam/heavylaser, loc) A = new /obj/item/projectile/beam/heavylaser(loc)
if(3) if(3)
A = getFromPool(/obj/item/projectile/beam/pulse, loc) A = new /obj/item/projectile/beam/pulse(loc)
if(4) if(4)
A = getFromPool(/obj/item/projectile/change, loc) A = new /obj/item/projectile/change(loc)
if(5) if(5)
A = getFromPool(/obj/item/projectile/beam/lastertag/blue, loc) A = new /obj/item/projectile/beam/lastertag/blue(loc)
if(6) if(6)
A = getFromPool(/obj/item/projectile/beam/lastertag/red, loc) A = new /obj/item/projectile/beam/lastertag/red(loc)
A.original = target A.original = target
use_power(500) use_power(500)
else else

View File

@@ -124,7 +124,7 @@
else else
src.fire_delay = rand(20,100) src.fire_delay = rand(20,100)
src.shot_number = 0 src.shot_number = 0
var/obj/item/projectile/beam/emitter/A = getFromPool(/obj/item/projectile/beam/emitter, loc) var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter(src.loc)
playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1) playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1)
if(prob(35)) if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread

View File

@@ -67,19 +67,18 @@
proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not. proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
if(!istype(target) || !istype(user)) if(!istype(target) || !istype(user))
return 0 return 0
var/obj/item/projectile/test/in_chamber = getFromPool(/obj/item/projectile/test, get_step_to(user, target)) //Making the test.... var/obj/item/projectile/test/in_chamber = new /obj/item/projectile/test(get_step_to(user,target)) //Making the test....
in_chamber.target = target in_chamber.target = target
in_chamber.flags = flags //Set the flags... in_chamber.flags = flags //Set the flags...
in_chamber.pass_flags = pass_flags //And the pass flags to that of the real projectile... in_chamber.pass_flags = pass_flags //And the pass flags to that of the real projectile...
in_chamber.firer = user in_chamber.firer = user
var/output = in_chamber.process() //Test it! var/output = in_chamber.process() //Test it!
//del(in_chamber) //No need for it anymore del(in_chamber) //No need for it anymore
returnToPool(in_chamber)
return output //Send it back to the gun! return output //Send it back to the gun!
Bump(atom/A as mob|obj|turf|area) Bump(atom/A as mob|obj|turf|area)
if(A == firer) if(A == firer)
//loc = A.loc loc = A.loc
return 0 //cannot shoot yourself return 0 //cannot shoot yourself
if(bumped) return 0 if(bumped) return 0
@@ -168,8 +167,7 @@
if(!istype(src, /obj/item/projectile/beam/lightning)) if(!istype(src, /obj/item/projectile/beam/lightning))
density = 0 density = 0
invisibility = 101 invisibility = 101
//del(src) del(src)
returnToPool(src)
return 1 return 1
@@ -184,16 +182,14 @@
process() process()
if(kill_count < 1) if(kill_count < 1)
//del(src) del(src)
returnToPool(src)
return return
kill_count-- kill_count--
spawn while(src) spawn while(src)
if((!( current ) || loc == current)) if((!( current ) || loc == current))
current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z) current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy)) if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
//del(src) del(src)
returnToPool(src)
return return
step_towards(src, current) step_towards(src, current)
sleep(1) sleep(1)
@@ -205,11 +201,9 @@
return return
proc/dumbfire(var/dir) // for spacepods, go snowflake go proc/dumbfire(var/dir) // for spacepods, go snowflake go
if(!dir) if(!dir)
//del(src) del(src)
returnToPool(src)
if(kill_count < 1) if(kill_count < 1)
//del(src) del(src)
returnToPool(src)
kill_count-- kill_count--
spawn while(src) spawn while(src)
var/turf/T = get_step(src, dir) var/turf/T = get_step(src, dir)

View File

@@ -163,8 +163,7 @@ var/list/beam_master = list()
if(src.loc != current) if(src.loc != current)
tang = adjustAngle(get_angle(src.loc,current)) tang = adjustAngle(get_angle(src.loc,current))
icon_state = "[tang]" icon_state = "[tang]"
//del(src) del(src)
returnToPool(src)
return return
/*cleanup(reference) //Waits .3 seconds then removes the overlay. /*cleanup(reference) //Waits .3 seconds then removes the overlay.
//world << "setting invisibility" //world << "setting invisibility"
@@ -195,17 +194,12 @@ var/list/beam_master = list()
if((!( current ) || loc == current)) //If we pass our target if((!( current ) || loc == current)) //If we pass our target
current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z) current = locate(min(max(x + xo, 1), world.maxx), min(max(y + yo, 1), world.maxy), z)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy)) if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
//del(src) //Delete if it passes the world edge del(src) //Delete if it passes the world edge
returnToPool(src)
return return
step_towards(src, current) //Move~ step_towards(src, current) //Move~
if (isnull(loc))
return
if(kill_count < 1) if(kill_count < 1)
//del(src) del(src)
returnToPool(src)
return return
kill_count-- kill_count--
@@ -245,19 +239,16 @@ var/list/beam_master = list()
var/reference = "\ref[src]" //So we do not have to recalculate it a ton var/reference = "\ref[src]" //So we do not have to recalculate it a ton
var/first = 1 //So we don't make the overlay in the same tile as the firer var/first = 1 //So we don't make the overlay in the same tile as the firer
if(!dir) if(!dir)
//del(src) del(src)
returnToPool(src)
spawn while(src) //Move until we hit something spawn while(src) //Move until we hit something
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy)) if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
//del(src) //Delete if it passes the world edge del(src) //Delete if it passes the world edge
returnToPool(src)
return return
var/turf/T = get_step(src, dir) var/turf/T = get_step(src, dir)
step_towards(src, T) //Move~ step_towards(src, T) //Move~
if(kill_count < 1) if(kill_count < 1)
//del(src) del(src)
returnToPool(src)
kill_count-- kill_count--
if(!bumped && !isturf(original)) if(!bumped && !isturf(original))

View File

@@ -192,12 +192,10 @@ obj/item/projectile/kinetic/New()
// Now we bump as a bullet, if the atom is a non-turf. // Now we bump as a bullet, if the atom is a non-turf.
if(!isturf(A)) if(!isturf(A))
..(A) ..(A)
//qdel(src) // Comment this out if you want to shoot through the asteroid, ERASER-style. qdel(src) // Comment this out if you want to shoot through the asteroid, ERASER-style.
returnToPool(src) // Comment this out if you want to shoot through the asteroid, ERASER-style.
return 1 return 1
else else
//qdel(src) qdel(src)
returnToPool(src)
return 0 return 0
/obj/item/effect/kinetic_blast /obj/item/effect/kinetic_blast