[MIRROR] Overlay lighting component (#469)

* Overlay lighting component (#52413)

Sparks no longer lag, projectile beams move super smoothly, same with mobs and whatnot. This also allows for easy expansion into directional lights, field-of-view, wee-woo rotating lights or whatever.

It does have a downside: things right-clicked or checked through the alt+click tab will show the light overlay:


This is a BYOND limitation, very well worth it IMO.

🆑
add: Smooth movable lighting system implemented. Projectiles, sparks, thrown flashlights or moving mobs with lights should be much smoother and less laggy.
balance: Light sources no longer stack in range, though they still do in intensity.
/🆑

* Overlay lighting component

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
SkyratBot
2020-08-23 20:17:12 +02:00
committed by GitHub
parent 4a51355a9e
commit 0b65cc596b
85 changed files with 1082 additions and 395 deletions
@@ -21,13 +21,14 @@
sharpness = SHARP_EDGED
actions_types = list(/datum/action/item_action/toggle_light)
obj_flags = UNIQUE_RENAME
light_system = MOVABLE_LIGHT
light_range = 5
light_on = FALSE
var/list/trophies = list()
var/charged = TRUE
var/charge_time = 15
var/detonation_damage = 50
var/backstab_bonus = 30
var/brightness_on = 5
var/wielded = FALSE // track wielded status on item
/obj/item/kinetic_crusher/Initialize()
@@ -151,14 +152,8 @@
/obj/item/kinetic_crusher/ui_action_click(mob/user, actiontype)
set_light_on(!light_on)
playsound(user, 'sound/weapons/empty.ogg', 100, TRUE)
update_brightness(user)
update_icon()
/obj/item/kinetic_crusher/proc/update_brightness(mob/user = null)
if(light_on)
set_light(brightness_on)
else
set_light(0)
/obj/item/kinetic_crusher/update_icon_state()
inhand_icon_state = "crusher[wielded]" // this is not icon_state and not supported by 2hcomponent
@@ -287,7 +287,9 @@
desc = "Happy to light your way."
icon = 'icons/obj/lighting.dmi'
icon_state = "orb"
light_system = MOVABLE_LIGHT
light_range = 7
light_flags = LIGHT_ATTACHED
layer = ABOVE_ALL_MOB_LAYER
var/sight_flags = SEE_MOBS
var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
+6 -6
View File
@@ -35,6 +35,8 @@
healable = 0
loot = list(/obj/effect/decal/cleanable/robot_debris)
del_on_death = TRUE
light_system = MOVABLE_LIGHT
light_range = 6
light_on = FALSE
var/mode = MINEDRONE_COLLECT
var/obj/item/gun/energy/kinetic_accelerator/minebot/stored_gun
@@ -59,6 +61,7 @@
SetCollectBehavior()
/mob/living/simple_animal/hostile/mining_drone/Destroy()
for (var/datum/action/innate/minedrone/action in actions)
qdel(action)
@@ -234,16 +237,13 @@
name = "Toggle Light"
button_icon_state = "mech_lights_off"
/datum/action/innate/minedrone/toggle_light/Activate()
var/mob/living/simple_animal/hostile/mining_drone/user = owner
if(user.light_on)
user.set_light(0)
else
user.set_light(6)
user.light_on = !user.light_on
user.set_light_on(!user.light_on)
to_chat(user, "<span class='notice'>You toggle your light [user.light_on ? "on" : "off"].</span>")
/datum/action/innate/minedrone/toggle_mode
name = "Toggle Mode"
button_icon_state = "mech_cycle_equip_off"