mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Moar object pool.
This commit is contained in:
@@ -97,13 +97,14 @@
|
||||
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 = new /obj/item/projectile/test(get_step_to(user,target)) //Making the test....
|
||||
var/obj/item/projectile/test/in_chamber = getFromPool(/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
|
||||
//del(in_chamber) //No need for it anymore
|
||||
returnToPool(in_chamber)
|
||||
return output //Send it back to the gun!
|
||||
|
||||
Bump(atom/A as mob|obj|turf|area)
|
||||
@@ -197,7 +198,7 @@
|
||||
if(!istype(src, /obj/item/projectile/beam/lightning))
|
||||
density = 0
|
||||
invisibility = 101
|
||||
del(src)
|
||||
returnToPool(src)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -212,13 +213,15 @@
|
||||
|
||||
process()
|
||||
if(kill_count < 1)
|
||||
del(src)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
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)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
return
|
||||
step_towards(src, current)
|
||||
sleep(1)
|
||||
@@ -230,9 +233,11 @@
|
||||
return
|
||||
proc/dumbfire(var/dir) // for spacepods, go snowflake go
|
||||
if(!dir)
|
||||
del(src)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
if(kill_count < 1)
|
||||
del(src)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
kill_count--
|
||||
spawn while(src)
|
||||
var/turf/T = get_step(src, dir)
|
||||
@@ -252,6 +257,11 @@
|
||||
var/target = null
|
||||
var/result = 0 //To pass the message back to the gun.
|
||||
|
||||
resetVariables()
|
||||
target = initial(target)
|
||||
result = initial(result)
|
||||
return ..()
|
||||
|
||||
Bump(atom/A as mob|obj|turf|area)
|
||||
if(A == firer)
|
||||
loc = A.loc
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
*/
|
||||
var/list/beam_master = list()
|
||||
|
||||
//Special laser the captains gun uses
|
||||
/obj/item/projectile/beam/captain
|
||||
name = "captain laser"
|
||||
damage = 40
|
||||
|
||||
/obj/item/projectile/beam/lightning
|
||||
invisibility = 101
|
||||
name = "lightning"
|
||||
@@ -163,7 +158,8 @@ var/list/beam_master = list()
|
||||
if(src.loc != current)
|
||||
tang = adjustAngle(get_angle(src.loc,current))
|
||||
icon_state = "[tang]"
|
||||
del(src)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
return
|
||||
/*cleanup(reference) //Waits .3 seconds then removes the overlay.
|
||||
//world << "setting invisibility"
|
||||
@@ -191,6 +187,11 @@ var/list/beam_master = list()
|
||||
eyeblur = 4
|
||||
var/frequency = 1
|
||||
|
||||
// Special laser the captains gun uses
|
||||
captain
|
||||
name = "captain laser"
|
||||
damage = 40
|
||||
|
||||
process()
|
||||
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
|
||||
@@ -245,16 +246,19 @@ 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)
|
||||
//del(src)
|
||||
returnToPool(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
|
||||
//del(src) //Delete if it passes the world edge
|
||||
returnToPool(src)
|
||||
return
|
||||
var/turf/T = get_step(src, dir)
|
||||
step_towards(src, T) //Move~
|
||||
|
||||
if(kill_count < 1)
|
||||
del(src)
|
||||
//del(src)
|
||||
returnToPool(src)
|
||||
kill_count--
|
||||
|
||||
if(!bumped && !isturf(original))
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
resetVariables()
|
||||
embed = initial(embed)
|
||||
return ..()
|
||||
|
||||
/obj/item/projectile/bullet/weakbullet
|
||||
damage = 10
|
||||
stun = 5
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
flag = "energy"
|
||||
var/temperature = 300
|
||||
|
||||
resetVariables()
|
||||
temperature = initial(temperature)
|
||||
|
||||
on_hit(var/atom/target, var/blocked = 0)//These two could likely check temp protection on the mob
|
||||
if(istype(target, /mob/living))
|
||||
@@ -147,6 +149,9 @@
|
||||
flag = "energy"
|
||||
var/range = 2
|
||||
|
||||
resetVariables()
|
||||
range = initial(range)
|
||||
|
||||
obj/item/projectile/kinetic/New()
|
||||
var/turf/proj_turf = get_turf(src)
|
||||
if(!istype(proj_turf, /turf))
|
||||
@@ -193,10 +198,12 @@ 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.
|
||||
//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
|
||||
else
|
||||
qdel(src)
|
||||
//qdel(src)
|
||||
returnToPool(src)
|
||||
return 0
|
||||
|
||||
/obj/item/effect/kinetic_blast
|
||||
|
||||
Reference in New Issue
Block a user