mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Backports several SSlighting improvements: overlay lighting (#17271)
* Backports SSlighting optimizations * Overlay lighting, first version compiles * Change conflicting defines * Sparks and beams dont count towards lumcount * Fix rendering * Various fixes * Fix errors * Fix PDA light 1 * a * Update game_options.txt * Fix plasmaman helmet * Fixes * Glowy changes Co-authored-by: Jamie D <993128+JamieD1@users.noreply.github.com>
This commit is contained in:
@@ -479,9 +479,7 @@
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return
|
||||
to_chat(user, span_notice("You click [S] into place on [src]."))
|
||||
if(S.on)
|
||||
set_light(0)
|
||||
gun_light = S
|
||||
set_gun_light(S)
|
||||
update_gunlight()
|
||||
alight = new(src)
|
||||
if(loc == user)
|
||||
@@ -569,12 +567,28 @@
|
||||
if(!gun_light)
|
||||
return
|
||||
var/obj/item/flashlight/seclite/removed_light = gun_light
|
||||
gun_light = null
|
||||
set_gun_light(null)
|
||||
update_gunlight()
|
||||
removed_light.update_brightness()
|
||||
QDEL_NULL(alight)
|
||||
return TRUE
|
||||
|
||||
///Called when gun_light value changes.
|
||||
/obj/item/gun/proc/set_gun_light(obj/item/flashlight/seclite/new_light)
|
||||
if(gun_light == new_light)
|
||||
return
|
||||
. = gun_light
|
||||
gun_light = new_light
|
||||
if(gun_light)
|
||||
gun_light.set_light_flags(gun_light.light_flags | LIGHT_ATTACHED)
|
||||
if(gun_light.loc != src)
|
||||
gun_light.forceMove(src)
|
||||
else if(.)
|
||||
var/obj/item/flashlight/seclite/old_gun_light = .
|
||||
old_gun_light.set_light_flags(old_gun_light.light_flags & ~LIGHT_ATTACHED)
|
||||
if(old_gun_light.loc == src)
|
||||
old_gun_light.forceMove(get_turf(src))
|
||||
|
||||
/obj/item/gun/ui_action_click(mob/user, actiontype)
|
||||
if(istype(actiontype, alight))
|
||||
toggle_gunlight()
|
||||
@@ -587,30 +601,14 @@
|
||||
|
||||
var/mob/living/carbon/human/user = usr
|
||||
gun_light.on = !gun_light.on
|
||||
gun_light.update_brightness()
|
||||
to_chat(user, span_notice("You toggle the gunlight [gun_light.on ? "on":"off"]."))
|
||||
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, TRUE)
|
||||
update_gunlight()
|
||||
|
||||
/obj/item/gun/proc/update_gunlight()
|
||||
if(gun_light)
|
||||
if(gun_light.on)
|
||||
set_light(gun_light.brightness_on)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlay(flashlight_overlay, TRUE)
|
||||
var/state = "flight[gun_light.on? "_on":""]" //Generic state.
|
||||
if(gun_light.icon_state in icon_states('icons/obj/guns/flashlights.dmi')) //Snowflake state?
|
||||
state = gun_light.icon_state
|
||||
flashlight_overlay = mutable_appearance('icons/obj/guns/flashlights.dmi', state)
|
||||
flashlight_overlay.pixel_x = flight_x_offset
|
||||
flashlight_overlay.pixel_y = flight_y_offset
|
||||
add_overlay(flashlight_overlay, TRUE)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlay(flashlight_overlay, TRUE)
|
||||
flashlight_overlay = null
|
||||
update_icon(TRUE)
|
||||
update_icon()
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
can_flashlight = FALSE // Can't attach or detach the flashlight, and override it's icon update
|
||||
|
||||
/obj/item/gun/energy/e_gun/mini/Initialize()
|
||||
gun_light = new /obj/item/flashlight/seclite(src)
|
||||
set_gun_light(new /obj/item/flashlight/seclite(src))
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/energy/e_gun/mini/update_icon()
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
damage = 20
|
||||
wound_bonus = -20
|
||||
bare_wound_bonus = 10
|
||||
light_range = 2
|
||||
damage_type = BURN
|
||||
hitsound = 'sound/weapons/sear.ogg'
|
||||
hitsound_wall = 'sound/weapons/effects/searwall.ogg'
|
||||
flag = LASER
|
||||
eyeblur = 2
|
||||
impact_effect_type = /obj/effect/temp_visual/impact_effect/red_laser
|
||||
light_system = MOVABLE_LIGHT
|
||||
light_range = 2
|
||||
light_color = LIGHT_COLOR_RED
|
||||
light_flags = LIGHT_NO_LUMCOUNT
|
||||
ricochets_max = 50 //Honk!
|
||||
ricochet_chance = 80
|
||||
reflectable = REFLECT_NORMAL
|
||||
|
||||
Reference in New Issue
Block a user