mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Proted instabeams for energy projectiles.
Also buffed laser damage to pre-merge.
This commit is contained in:
@@ -1,14 +1,80 @@
|
||||
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
|
||||
|
||||
/obj/item/projectile/beam
|
||||
name = "laser"
|
||||
icon_state = "laser"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
damage = 20
|
||||
damage = 40
|
||||
damage_type = BURN
|
||||
flag = "laser"
|
||||
eyeblur = 2
|
||||
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
|
||||
|
||||
/obj/item/projectile/practice
|
||||
spawn(0)
|
||||
while(!bumped) //Move until we hit something
|
||||
step_towards(src, current) //Move~
|
||||
|
||||
for(var/mob/living/M in loc)
|
||||
Bump(M) //Bump anyone we touch
|
||||
|
||||
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
|
||||
return
|
||||
|
||||
if(!first) //Add the overlay as we pass over tiles
|
||||
var/target_dir = get_dir(src, current) //So we don't call this too much
|
||||
|
||||
//If the icon has not been added yet
|
||||
if( !("[icon_state][target_dir]" in beam_master) )
|
||||
var/image/I = image(icon,icon_state,10,target_dir) //Generate it.
|
||||
beam_master["[icon_state][target_dir]"] = I //And cache it!
|
||||
|
||||
//Finally add the overlay
|
||||
src.loc.overlays += beam_master["[icon_state][target_dir]"]
|
||||
|
||||
//Add the turf to a list in the beam master so they can be cleaned up easily.
|
||||
if(reference in beam_master)
|
||||
var/list/turf_master = beam_master[reference]
|
||||
if("[icon_state][target_dir]" in turf_master)
|
||||
var/list/turfs = turf_master["[icon_state][target_dir]"]
|
||||
turfs += loc
|
||||
else
|
||||
turf_master["[icon_state][target_dir]"] = list(loc)
|
||||
else
|
||||
var/list/turfs = list()
|
||||
turfs["[icon_state][target_dir]"] = list(loc)
|
||||
beam_master[reference] = turfs
|
||||
else
|
||||
first = 0
|
||||
|
||||
cleanup(reference)
|
||||
return
|
||||
|
||||
proc/cleanup(reference) //Waits .3 seconds then removes the overlay.
|
||||
src = null
|
||||
sleep(3)
|
||||
var/list/turf_master = beam_master[reference]
|
||||
for(var/laser_state in turf_master)
|
||||
var/list/turfs = turf_master[laser_state]
|
||||
for(var/turf/T in turfs)
|
||||
T.overlays -= beam_master[laser_state]
|
||||
return
|
||||
|
||||
/obj/item/projectile/beam/practice
|
||||
name = "laser"
|
||||
icon_state = "laser"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
@@ -45,7 +111,7 @@
|
||||
|
||||
|
||||
|
||||
/obj/item/projectile/bluetag
|
||||
/obj/item/projectile/beam/bluetag
|
||||
name = "lasertag beam"
|
||||
icon_state = "bluelaser"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
@@ -60,7 +126,7 @@
|
||||
M.Weaken(5)
|
||||
return 1
|
||||
|
||||
/obj/item/projectile/redtag
|
||||
/obj/item/projectile/beam/redtag
|
||||
name = "lasertag beam"
|
||||
icon_state = "laser"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
@@ -75,7 +141,7 @@
|
||||
M.Weaken(5)
|
||||
return 1
|
||||
|
||||
/obj/item/projectile/omnitag//A laser tag bolt that stuns EVERYONE
|
||||
/obj/item/projectile/beam/omnitag//A laser tag bolt that stuns EVERYONE
|
||||
name = "lasertag beam"
|
||||
icon_state = "omnilaser"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
|
||||
Reference in New Issue
Block a user