Skip to content

Commit

Permalink
Revert gun pool for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ESwordTheCat authored and ESwordTheCat committed May 8, 2014
1 parent 25129b6 commit 7243a36
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 51 deletions.
2 changes: 1 addition & 1 deletion code/WorkInProgress/Cael_Aislinn/Rust/gyrotron.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
A.fired()
*/
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.damage = mega_energy * 500
playsound(get_turf(src), 'sound/weapons/emitter.ogg', 25, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
src.fire_delay = rand(20,100)
src.shot_number = 0
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)
if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
Expand Down
7 changes: 3 additions & 4 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
var/turf/T = get_turf(src)
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_state = "eyelasers"
playsound(usr.loc, 'sound/weapons/taser2.ogg', 75, 1)
Expand Down Expand Up @@ -333,7 +333,7 @@
"You hear the loud crackle of electricity!")
var/datum/powernet/PN = cable.get_powernet()
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)
available = PN.avail
L.damage = PN.get_electrocute_damage()
Expand All @@ -359,8 +359,7 @@
s.set_up(5, 1, src)
s.start()
if(L.damage <= 0)
//del(L)
returnToPool(L)
del(L)
if(L)
playsound(get_turf(src), 'sound/effects/eleczap.ogg', 75, 1)
L.tang = L.adjustAngle(get_angle(U,T))
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
var/EndTime=world.time+time
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)

//If the BeamTarget gets deleted, the time expires, or the BeamTarget gets out
Expand Down
6 changes: 2 additions & 4 deletions code/game/machinery/bots/ed209bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1020,17 +1020,15 @@ Auto Patrol: []"},
if((src.lasercolor == "b") && (src.disabled == 0))
if(istype(Proj, /obj/item/projectile/beam/lastertag/red))
src.disabled = 1
//del (Proj)
returnToPool(Proj)
del (Proj)
sleep(100)
src.disabled = 0
else
..()
else if((src.lasercolor == "r") && (src.disabled == 0))
if(istype(Proj, /obj/item/projectile/beam/lastertag/blue))
src.disabled = 1
//del (Proj)
returnToPool(Proj)
del (Proj)
sleep(100)
src.disabled = 0
else
Expand Down
12 changes: 6 additions & 6 deletions code/game/machinery/turrets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,17 @@
if (src.lasers)
switch(lasertype)
if(1)
A = getFromPool(/obj/item/projectile/beam, loc)
A = new /obj/item/projectile/beam(loc)
if(2)
A = getFromPool(/obj/item/projectile/beam/heavylaser, loc)
A = new /obj/item/projectile/beam/heavylaser(loc)
if(3)
A = getFromPool(/obj/item/projectile/beam/pulse, loc)
A = new /obj/item/projectile/beam/pulse(loc)
if(4)
A = getFromPool(/obj/item/projectile/change, loc)
A = new /obj/item/projectile/change(loc)
if(5)
A = getFromPool(/obj/item/projectile/beam/lastertag/blue, loc)
A = new /obj/item/projectile/beam/lastertag/blue(loc)
if(6)
A = getFromPool(/obj/item/projectile/beam/lastertag/red, loc)
A = new /obj/item/projectile/beam/lastertag/red(loc)
A.original = target
use_power(500)
else
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/singularity/emitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
else
src.fire_delay = rand(20,100)
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)
if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
Expand Down
22 changes: 8 additions & 14 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
if(!istype(target) || !istype(user))
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.flags = flags //Set the flags...
in_chamber.pass_flags = pass_flags //And the pass flags to that of the real projectile...
in_chamber.firer = user
var/output = in_chamber.process() //Test it!
//del(in_chamber) //No need for it anymore
returnToPool(in_chamber)
del(in_chamber) //No need for it anymore
return output //Send it back to the gun!

Bump(atom/A as mob|obj|turf|area)
if(A == firer)
//loc = A.loc
loc = A.loc
return 0 //cannot shoot yourself

if(bumped) return 0
Expand Down Expand Up @@ -168,8 +167,7 @@
if(!istype(src, /obj/item/projectile/beam/lightning))
density = 0
invisibility = 101
//del(src)
returnToPool(src)
del(src)
return 1


Expand All @@ -184,16 +182,14 @@

process()
if(kill_count < 1)
//del(src)
returnToPool(src)
del(src)
return
kill_count--
spawn while(src)
if((!( current ) || loc == current))
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))
//del(src)
returnToPool(src)
del(src)
return
step_towards(src, current)
sleep(1)
Expand All @@ -205,11 +201,9 @@
return
proc/dumbfire(var/dir) // for spacepods, go snowflake go
if(!dir)
//del(src)
returnToPool(src)
del(src)
if(kill_count < 1)
//del(src)
returnToPool(src)
del(src)
kill_count--
spawn while(src)
var/turf/T = get_step(src, dir)
Expand Down
21 changes: 6 additions & 15 deletions code/modules/projectiles/projectile/beams.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ var/list/beam_master = list()
if(src.loc != current)
tang = adjustAngle(get_angle(src.loc,current))
icon_state = "[tang]"
//del(src)
returnToPool(src)
del(src)
return
/*cleanup(reference) //Waits .3 seconds then removes the overlay.
//world << "setting invisibility"
Expand Down Expand Up @@ -195,17 +194,12 @@ var/list/beam_master = list()
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)
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
//del(src) //Delete if it passes the world edge
returnToPool(src)
del(src) //Delete if it passes the world edge
return
step_towards(src, current) //Move~

if (isnull(loc))
return

if(kill_count < 1)
//del(src)
returnToPool(src)
del(src)
return
kill_count--

Expand Down Expand Up @@ -245,19 +239,16 @@ var/list/beam_master = list()
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
if(!dir)
//del(src)
returnToPool(src)
del(src)
spawn while(src) //Move until we hit something
if((x == 1 || x == world.maxx || y == 1 || y == world.maxy))
//del(src) //Delete if it passes the world edge
returnToPool(src)
del(src) //Delete if it passes the world edge
return
var/turf/T = get_step(src, dir)
step_towards(src, T) //Move~

if(kill_count < 1)
//del(src)
returnToPool(src)
del(src)
kill_count--

if(!bumped && !isturf(original))
Expand Down
6 changes: 2 additions & 4 deletions code/modules/projectiles/projectile/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,10 @@ obj/item/projectile/kinetic/New()
// Now we bump as a bullet, if the atom is a non-turf.
if(!isturf(A))
..(A)
//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.
qdel(src) // Comment this out if you want to shoot through the asteroid, ERASER-style.
return 1
else
//qdel(src)
returnToPool(src)
qdel(src)
return 0

/obj/item/effect/kinetic_blast
Expand Down

0 comments on commit 7243a36

Please sign in to comment.