Lasers, energy projectiles, and muzzle flashes now produce light.

It's a bit wonky due to lighting only updating once every half-second,
but it's very much functional, at least on my desktop.
This commit is contained in:
MagmaRam
2016-09-17 23:14:41 -05:00
parent 2af3fd537f
commit 22adc0411a
6 changed files with 142 additions and 7 deletions

View File

@@ -11,7 +11,8 @@
if(istype(M))
transform = M
/obj/effect/projectile/proc/activate(var/kill_delay = 3)
/obj/effect/projectile/proc/activate(var/kill_delay = 5)
update_light()
spawn(kill_delay)
qdel(src) //see effect_system.dm - sets loc to null and lets GC handle removing these effects
@@ -22,117 +23,207 @@
//----------------------------
/obj/effect/projectile/laser/tracer
icon_state = "beam"
light_range = 2
light_power = 0.5
light_color = "#FF0D00"
/obj/effect/projectile/laser/muzzle
icon_state = "muzzle_laser"
light_range = 2
light_power = 0.5
light_color = "#FF0D00"
/obj/effect/projectile/laser/impact
icon_state = "impact_laser"
light_range = 2
light_power = 0.5
light_color = "#FF0D00"
//----------------------------
// Blue laser beam
//----------------------------
/obj/effect/projectile/laser_blue/tracer
icon_state = "beam_blue"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
/obj/effect/projectile/laser_blue/muzzle
icon_state = "muzzle_blue"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
/obj/effect/projectile/laser_blue/impact
icon_state = "impact_blue"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
//----------------------------
// Omni laser beam
//----------------------------
/obj/effect/projectile/laser_omni/tracer
icon_state = "beam_omni"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"
/obj/effect/projectile/laser_omni/muzzle
icon_state = "muzzle_omni"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"
/obj/effect/projectile/laser_omni/impact
icon_state = "impact_omni"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"
//----------------------------
// Xray laser beam
//----------------------------
/obj/effect/projectile/xray/tracer
icon_state = "xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
/obj/effect/projectile/xray/muzzle
icon_state = "muzzle_xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
/obj/effect/projectile/xray/impact
icon_state = "impact_xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
//----------------------------
// Heavy laser beam
//----------------------------
/obj/effect/projectile/laser_heavy/tracer
icon_state = "beam_heavy"
light_range = 3
light_power = 1
light_color = "#FF0D00"
/obj/effect/projectile/laser_heavy/muzzle
icon_state = "muzzle_beam_heavy"
light_range = 3
light_power = 1
light_color = "#FF0D00"
/obj/effect/projectile/laser_heavy/impact
icon_state = "impact_beam_heavy"
light_range = 3
light_power = 1
light_color = "#FF0D00"
//----------------------------
// Pulse laser beam
//----------------------------
/obj/effect/projectile/laser_pulse/tracer
icon_state = "u_laser"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
/obj/effect/projectile/laser_pulse/muzzle
icon_state = "muzzle_u_laser"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
/obj/effect/projectile/laser_pulse/impact
icon_state = "impact_u_laser"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
//----------------------------
// Pulse muzzle effect only
//----------------------------
/obj/effect/projectile/pulse/muzzle
icon_state = "muzzle_pulse"
light_range = 2
light_power = 0.5
light_color = "#0066FF"
//----------------------------
// Emitter beam
//----------------------------
/obj/effect/projectile/emitter/tracer
icon_state = "emitter"
icon_state = "impact_xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
/obj/effect/projectile/emitter/muzzle
icon_state = "muzzle_emitter"
icon_state = "impact_xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
/obj/effect/projectile/emitter/impact
icon_state = "impact_emitter"
icon_state = "impact_xray"
light_range = 2
light_power = 0.5
light_color = "#00CC33"
//----------------------------
// Stun beam
//----------------------------
/obj/effect/projectile/stun/tracer
icon_state = "stun"
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
/obj/effect/projectile/stun/muzzle
icon_state = "muzzle_stun"
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
/obj/effect/projectile/stun/impact
icon_state = "impact_stun"
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
//----------------------------
// Bullet
//----------------------------
/obj/effect/projectile/bullet/muzzle
icon_state = "muzzle_bullet"
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
//----------------------------
// Lightning beam
//----------------------------
/obj/effect/projectile/lightning/tracer
icon_state = "lightning"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"
/obj/effect/projectile/lightning/muzzle
icon_state = "muzzle_lightning"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"
/obj/effect/projectile/lightning/impact
icon_state = "impact_lightning"
icon_state = "impact_lightning"
light_range = 2
light_power = 0.5
light_color = "#00C6FF"

View File

@@ -293,6 +293,7 @@
trajectory.increment() // increment the current location
location = trajectory.return_location(location) // update the locally stored location data
update_light() //energy projectiles will look glowy and fun
if(!location)
qdel(src) // if it's left the world... kill it
@@ -354,6 +355,7 @@
M.set_transform(T)
M.pixel_x = location.pixel_x
M.pixel_y = location.pixel_y
M.update_light()
M.activate()
/obj/item/projectile/proc/tracer_effect(var/matrix/M)
@@ -364,6 +366,7 @@
P.set_transform(M)
P.pixel_x = location.pixel_x
P.pixel_y = location.pixel_y
P.update_light()
if(!hitscan)
P.activate(step_delay) //if not a hitscan projectile, remove after a single delay
else
@@ -377,6 +380,7 @@
P.set_transform(M)
P.pixel_x = location.pixel_x
P.pixel_y = location.pixel_y
P.update_light()
P.activate()
//"Tracing" projectile

View File

@@ -5,6 +5,9 @@
damage_type = BURN
nodamage = 1
check_armour = "energy"
light_range = 2
light_power = 0.5
light_color = "#55AAFF"
/obj/item/projectile/animate/Bump(var/atom/change)
if((istype(change, /obj/item) || istype(change, /obj/structure)) && !is_type_in_list(change, protected_objects))

View File

@@ -9,6 +9,9 @@
var/frequency = 1
hitscan = 1
invisibility = 101 //beam projectiles are invisible as they are rendered by the effect engine
light_range = 2
light_power = 0.5
light_color = "#FF0D00"
muzzle_type = /obj/effect/projectile/laser/muzzle
tracer_type = /obj/effect/projectile/laser/tracer
@@ -32,6 +35,7 @@
damage = 30
armor_penetration = 10
/obj/item/projectile/beam/midlaser
damage = 40
armor_penetration = 10
@@ -39,22 +43,27 @@
/obj/item/projectile/beam/heavylaser
name = "heavy laser"
icon_state = "heavylaser"
damage = 60
armor_penetration = 30
damage = 80
armor_penetration = 50
light_range = 3
light_power = 1
light_color = "#FF0D00"
muzzle_type = /obj/effect/projectile/laser_heavy/muzzle
tracer_type = /obj/effect/projectile/laser_heavy/tracer
impact_type = /obj/effect/projectile/laser_heavy/impact
/obj/item/projectile/beam/heavylaser/cannon
damage = 80
armor_penetration = 50
damage = 90
armor_penetration = 100
light_color = "#FF0D00"
/obj/item/projectile/beam/xray
name = "xray beam"
icon_state = "xray"
damage = 25
armor_penetration = 50
light_color = "#00CC33"
muzzle_type = /obj/effect/projectile/xray/muzzle
tracer_type = /obj/effect/projectile/xray/tracer
@@ -65,6 +74,7 @@
icon_state = "u_laser"
damage = 50
armor_penetration = 30
light_color = "#0066FF"
muzzle_type = /obj/effect/projectile/laser_pulse/muzzle
tracer_type = /obj/effect/projectile/laser_pulse/tracer
@@ -79,6 +89,7 @@
name = "emitter beam"
icon_state = "emitter"
damage = 0 // The actual damage is computed in /code/modules/power/singularity/emitter.dm
light_color = "#00CC33"
muzzle_type = /obj/effect/projectile/emitter/muzzle
tracer_type = /obj/effect/projectile/emitter/tracer
@@ -92,6 +103,7 @@
no_attack_log = 1
damage_type = BURN
check_armour = "laser"
light_color = "#0066FF"
muzzle_type = /obj/effect/projectile/laser_blue/muzzle
tracer_type = /obj/effect/projectile/laser_blue/tracer
@@ -112,6 +124,7 @@
no_attack_log = 1
damage_type = BURN
check_armour = "laser"
light_color = "#FF0D00"
/obj/item/projectile/beam/lastertag/red/on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
@@ -127,6 +140,7 @@
damage = 0
damage_type = BURN
check_armour = "laser"
light_color = "#00C6FF"
muzzle_type = /obj/effect/projectile/laser_omni/muzzle
tracer_type = /obj/effect/projectile/laser_omni/tracer
@@ -144,6 +158,7 @@
icon_state = "xray"
damage = 50
armor_penetration = 10
light_color = "#00CC33"
muzzle_type = /obj/effect/projectile/xray/muzzle
tracer_type = /obj/effect/projectile/xray/tracer
@@ -156,6 +171,7 @@
taser_effect = 1
agony = 40
damage_type = HALLOSS
light_color = "#FFFFFF"
muzzle_type = /obj/effect/projectile/stun/muzzle
tracer_type = /obj/effect/projectile/stun/tracer

View File

@@ -25,7 +25,6 @@
for (var/mob/living/carbon/M in viewers(T, flash_range))
if(M.eyecheck() < 1)
M.flash_eyes()
if(ishuman(M))
var/mob/living/carbon/human/H = M
flash_strength *= H.species.flash_mod
@@ -69,6 +68,9 @@
taser_effect = 1
agony = 40
damage_type = HALLOSS
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
//Damage will be handled on the MOB side, to prevent window shattering.
/obj/item/projectile/energy/electrode/strong
@@ -86,6 +88,9 @@
nodamage = 1
damage_type = CLONE
irradiate = 40
light_range = 2
light_power = 0.5
light_color = "#33CC00"
/obj/item/projectile/energy/dart
@@ -125,3 +130,6 @@
damage = 20
damage_type = TOX
irradiate = 20
light_range = 2
light_power = 0.5
light_color = "#33CC00"

View File

@@ -5,6 +5,9 @@
damage_type = BURN
nodamage = 1
check_armour = "energy"
light_range = 2
light_power = 0.5
light_color = "#55AAFF"
on_hit(var/atom/target, var/blocked = 0)
@@ -32,6 +35,9 @@
nodamage = 1
check_armour = "energy"
var/temperature = 300
light_range = 2
light_power = 0.5
light_color = "#55AAFF"
on_hit(var/atom/target, var/blocked = 0)//These two could likely check temp protection on the mob
@@ -77,6 +83,9 @@
damage_type = TOX
nodamage = 1
check_armour = "energy"
light_range = 2
light_power = 0.5
light_color = "#33CC00"
on_hit(var/atom/target, var/blocked = 0)
var/mob/living/M = target
@@ -116,6 +125,9 @@
damage_type = TOX
nodamage = 1
check_armour = "energy"
light_range = 2
light_power = 0.5
light_color = "#FFFFFF"
on_hit(var/atom/target, var/blocked = 0)
var/mob/M = target
@@ -136,6 +148,7 @@
if(ishuman(target))
var/mob/living/carbon/human/M = target
M.confused += rand(5,8)
/obj/item/projectile/chameleon
name = "bullet"
icon_state = "bullet"