Object pool for beam projectile, minor changes to object pool.

This commit is contained in:
ESwordTheCat
2014-04-29 05:21:50 -08:00
parent af95f1133a
commit e3f6270bb3
13 changed files with 105 additions and 42 deletions

View File

@@ -50,6 +50,35 @@
var/drowsy = 0
var/agony = 0
resetVariables()
bumped = initial(bumped)
def_zone = initial(def_zone)
firer = initial(firer)
silenced = initial(silenced)
yo = initial(yo)
xo = initial(xo)
current = initial(current)
shot_from = initial(shot_from)
original = initial(original)
starting = initial(starting)
permutated = initial(permutated)
p_x = initial(p_x)
p_y = initial(p_y)
damage = initial(damage)
damage_type = initial(damage_type)
nodamage = initial(nodamage)
flag = initial(flag)
projectile_type = initial(projectile_type)
kill_count = initial(kill_count)
stun = initial(stun)
weaken = initial(weaken)
paralyze = initial(paralyze)
irradiate = initial(irradiate)
stutter = initial(stutter)
eyeblur = initial(eyeblur)
drowsy = initial(drowsy)
agony = initial(agony)
return ..()
proc/on_hit(var/atom/target, var/blocked = 0)
if(blocked >= 2) return 0//Full block

View File

@@ -1,17 +1,20 @@
/*
* Use: Caches beam state images and holds turfs that had these images overlaid.
* Structure:
* beam_master
* icon_states/dirs of beams
* image for that beam
* references for fired beams
* icon_states/dirs for each placed beam image
* turfs that have that icon_state/dir
*/
var/list/beam_master = list()
//Use: Caches beam state images and holds turfs that had these images overlaid.
//Structure:
//beam_master
// icon_states/dirs of beams
// image for that beam
// references for fired beams
// icon_states/dirs for each placed beam image
// turfs that have that icon_state/dir
//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"
@@ -26,6 +29,7 @@ var/list/beam_master = list()
layer = 3
var/turf/last = null
kill_count = 6
proc/adjustAngle(angle)
angle = round(angle) + 45
if(angle > 180)
@@ -172,6 +176,11 @@ var/list/beam_master = list()
M.playsound_local(src, "explosion", 50, 1)
..()
resetVariables()
tang = initial(tang)
last = initial(last)
return ..()
/obj/item/projectile/beam
name = "laser"
icon_state = "laser"
@@ -181,6 +190,7 @@ var/list/beam_master = list()
flag = "laser"
eyeblur = 4
var/frequency = 1
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
@@ -189,12 +199,14 @@ 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
//del(src) //Delete if it passes the world edge
returnToPool(src)
return
step_towards(src, current) //Move~
if(kill_count < 1)
del(src)
//del(src)
returnToPool(src)
kill_count--
if(!bumped && !isturf(original))
@@ -293,6 +305,10 @@ var/list/beam_master = list()
T.overlays -= beam_master[laser_state]
return
resetVariables()
frequency = initial(frequency)
return ..()
/obj/item/projectile/beam/practice
name = "laser"
icon_state = "laser"