mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Merge pull request #998 from tigercat2000/LightShit
Baystation12's Lighting Overhaul
This commit is contained in:
@@ -272,7 +272,7 @@
|
||||
name = "glowing resin"
|
||||
desc = "Blue bioluminescence shines from beneath the surface."
|
||||
icon_state = "weednode"
|
||||
luminosity = 1
|
||||
light_range = 1
|
||||
var/node_range = NODERANGE
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
var/obj/item/device/assembly/signaler/anomaly/aSignal = null
|
||||
|
||||
/obj/effect/anomaly/New()
|
||||
SetLuminosity(initial(luminosity))
|
||||
set_light(initial(luminosity))
|
||||
aSignal = new(src)
|
||||
aSignal.code = rand(1,100)
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
density = 0
|
||||
anchored = 1
|
||||
layer = 2
|
||||
luminosity = 1
|
||||
light_range = 1
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "greenglow"
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
processing_objects += src
|
||||
|
||||
|
||||
SetLuminosity(round(potency/10))
|
||||
set_light(round(potency/10))
|
||||
lastTick = world.timeofday
|
||||
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
msg_admin_attack("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[epicenter.x];Y=[epicenter.y];Z=[epicenter.z]'>JMP</a>)")
|
||||
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
|
||||
|
||||
var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit
|
||||
lighting_controller.processing = 0
|
||||
//var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit
|
||||
//lighting_controller.processing = 0
|
||||
var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 1
|
||||
@@ -72,7 +72,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
var/z0 = epicenter.z
|
||||
|
||||
for(var/turf/T in trange(max_range, epicenter))
|
||||
var/dist = cheap_pythag(T.x - x0,T.y - y0)
|
||||
var/dist = sqrt((T.x - x0)**2 + (T.y - y0)**2)
|
||||
|
||||
if(config.reactionary_explosions)
|
||||
var/turf/Trajectory = T
|
||||
@@ -95,7 +95,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
if(T)
|
||||
for(var/atom_movable in T.contents) //bypass type checking since only atom/movable can be contained by turfs anyway
|
||||
var/atom/movable/AM = atom_movable
|
||||
if(AM) AM.ex_act(dist)
|
||||
if(AM && AM.simulated) AM.ex_act(dist)
|
||||
// if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density)
|
||||
// PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience!
|
||||
if(dist > 0)
|
||||
@@ -124,7 +124,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
|
||||
sleep(8)
|
||||
|
||||
if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
|
||||
//if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
|
||||
if(!powernet_rebuild_was_deferred_already)
|
||||
if(defer_powernet_rebuild != 2)
|
||||
defer_powernet_rebuild = 0
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
/obj/item/areaeditor/proc/get_area()
|
||||
var/turf/T = get_turf(usr)
|
||||
var/area/A = T.loc
|
||||
A = A.master
|
||||
return A
|
||||
|
||||
|
||||
@@ -150,7 +149,6 @@
|
||||
return
|
||||
var/area/A = new
|
||||
A.name = str
|
||||
A.tagbase="[A.type]_[md5(str)]" // without this dynamic light system ruin everithing
|
||||
//var/ma
|
||||
//ma = A.master ? "[A.master]" : "(null)"
|
||||
//world << "DEBUG: create_area: <br>A.name=[A.name]<br>A.tag=[A.tag]<br>A.master=[ma]"
|
||||
@@ -159,7 +157,6 @@
|
||||
A.power_environ = 0
|
||||
A.always_unpowered = 0
|
||||
move_turfs_to_area(turfs, A)
|
||||
A.SetDynamicLighting()
|
||||
|
||||
interact()
|
||||
return
|
||||
@@ -179,8 +176,7 @@
|
||||
usr << "<span class='warning'>The given name is too long. The area's name is unchanged.</span>"
|
||||
return
|
||||
set_area_machinery_title(A,str,prevname)
|
||||
for(var/area/RA in A.related)
|
||||
RA.name = str
|
||||
A.name = str
|
||||
usr << "<span class='notice'>You rename the '[prevname]' to '[str]'.</span>"
|
||||
interact()
|
||||
return
|
||||
@@ -189,20 +185,18 @@
|
||||
/obj/item/areaeditor/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle)
|
||||
if (!oldtitle) // or replacetext goes to infinite loop
|
||||
return
|
||||
for(var/area/RA in A.related)
|
||||
for(var/obj/machinery/alarm/M in RA)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/power/apc/M in RA)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in RA)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/M in RA)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/door/M in RA)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/alarm/M in A)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/power/apc/M in A)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in A)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/M in A)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
for(var/obj/machinery/door/M in A)
|
||||
M.name = replacetext(M.name,oldtitle,title)
|
||||
//TODO: much much more. Unnamed airlocks, cameras, etc.
|
||||
|
||||
|
||||
/obj/item/areaeditor/proc/check_tile_is_border(var/turf/T2,var/dir)
|
||||
if (istype(T2, /turf/space))
|
||||
return BORDER_SPACE //omg hull breach we all going to die here
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
//src.damtype = "fire"
|
||||
for(var/mob/O in viewers(usr, null))
|
||||
O.show_message(flavor_text, 1)
|
||||
SetLuminosity(CANDLE_LUM)
|
||||
set_light(CANDLE_LUM)
|
||||
processing_objects.Add(src)
|
||||
|
||||
|
||||
@@ -72,17 +72,4 @@
|
||||
if(lit)
|
||||
lit = 0
|
||||
update_icon()
|
||||
SetLuminosity(0)
|
||||
user.SetLuminosity(user.luminosity - CANDLE_LUM)
|
||||
|
||||
|
||||
pickup(mob/user)
|
||||
if(lit)
|
||||
SetLuminosity(0)
|
||||
user.SetLuminosity(user.luminosity + CANDLE_LUM)
|
||||
|
||||
|
||||
dropped(mob/user)
|
||||
if(lit)
|
||||
user.SetLuminosity(user.luminosity - CANDLE_LUM)
|
||||
SetLuminosity(CANDLE_LUM)
|
||||
set_light(0)
|
||||
@@ -327,16 +327,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
/*
|
||||
* The Actual PDA
|
||||
*/
|
||||
/obj/item/device/pda/pickup(mob/user)
|
||||
if(fon)
|
||||
SetLuminosity(0)
|
||||
user.SetLuminosity(user.luminosity + f_lum)
|
||||
|
||||
/obj/item/device/pda/dropped(mob/user)
|
||||
if(fon)
|
||||
user.SetLuminosity(user.luminosity - f_lum)
|
||||
SetLuminosity(f_lum)
|
||||
|
||||
/obj/item/device/pda/New()
|
||||
..()
|
||||
PDAs += src
|
||||
@@ -623,12 +613,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
if("Light")
|
||||
if(fon)
|
||||
fon = 0
|
||||
if(src in U.contents) U.SetLuminosity(U.luminosity - f_lum)
|
||||
else SetLuminosity(0)
|
||||
set_light(0)
|
||||
else
|
||||
fon = 1
|
||||
if(src in U.contents) U.SetLuminosity(U.luminosity + f_lum)
|
||||
else SetLuminosity(f_lum)
|
||||
set_light(f_lum)
|
||||
if("Medical Scan")
|
||||
if(scanmode == 1)
|
||||
scanmode = 0
|
||||
|
||||
@@ -17,24 +17,18 @@
|
||||
..()
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
SetLuminosity(brightness_on)
|
||||
set_light(brightness_on)
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
/obj/item/device/flashlight/proc/update_brightness(var/mob/user = null)
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
if(loc == user)
|
||||
user.SetLuminosity(user.luminosity + brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(brightness_on)
|
||||
set_light(brightness_on)
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
if(loc == user)
|
||||
user.SetLuminosity(user.luminosity - brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
/obj/item/device/flashlight/attack_self(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
@@ -87,19 +81,6 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/flashlight/pickup(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity + brightness_on)
|
||||
SetLuminosity(0)
|
||||
|
||||
|
||||
/obj/item/device/flashlight/dropped(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity - brightness_on)
|
||||
SetLuminosity(brightness_on)
|
||||
|
||||
|
||||
/obj/item/device/flashlight/pen
|
||||
name = "penlight"
|
||||
desc = "A pen-sized light, used by medical staff."
|
||||
@@ -197,7 +178,7 @@
|
||||
on = 1 //Bio-luminesence has one setting, on.
|
||||
|
||||
/obj/item/device/flashlight/slime/New()
|
||||
SetLuminosity(brightness_on)
|
||||
set_light(brightness_on)
|
||||
spawn(1) //Might be sloppy, but seems to be necessary to prevent further runtimes and make these work as intended... don't judge me!
|
||||
update_brightness()
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
/obj/item/device/lightreplacer/emag_act(user as mob)
|
||||
if(!emagged)
|
||||
Emag()
|
||||
|
||||
|
||||
/obj/item/device/lightreplacer/attack_self(mob/user)
|
||||
/* // This would probably be a bit OP. If you want it though, uncomment the code.
|
||||
if(isrobot(user))
|
||||
@@ -147,7 +147,9 @@
|
||||
var/obj/item/weapon/light/L1 = new target.light_type(target.loc)
|
||||
L1.status = target.status
|
||||
L1.rigged = target.rigged
|
||||
L1.brightness = target.brightness
|
||||
L1.brightness_range = target.brightness_range
|
||||
L1.brightness_power = target.brightness_power
|
||||
L1.brightness_color = target.brightness_color
|
||||
L1.switchcount = target.switchcount
|
||||
target.switchcount = 0
|
||||
L1.update()
|
||||
@@ -160,7 +162,9 @@
|
||||
target.status = L2.status
|
||||
target.switchcount = L2.switchcount
|
||||
target.rigged = emagged
|
||||
target.brightness = L2.brightness
|
||||
target.brightness_range = L2.brightness_range
|
||||
target.brightness_power = L2.brightness_power
|
||||
target.brightness_color = L2.brightness_color
|
||||
target.on = target.has_power()
|
||||
target.update()
|
||||
del(L2)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
for(var/mob/M in viewers(user))
|
||||
if(M == user) continue
|
||||
M << "[user] detaches the power sink from the cable."
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
icon_state = "powersink0"
|
||||
|
||||
return
|
||||
@@ -61,7 +61,7 @@
|
||||
..()
|
||||
|
||||
Destroy()
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
processing_objects.Remove(src)
|
||||
// attached.attached = null
|
||||
attached = null
|
||||
@@ -93,7 +93,7 @@
|
||||
if(M == user) continue
|
||||
M << "[user] deactivates the power sink!"
|
||||
mode = 1
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
icon_state = "powersink0"
|
||||
processing_objects.Remove(src)
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
if(attached)
|
||||
var/datum/powernet/PN = attached.get_powernet()
|
||||
if(PN)
|
||||
SetLuminosity(12)
|
||||
set_light(12)
|
||||
|
||||
// found a powernet, so drain up to max power from it
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
user.adjustFireLoss(5)
|
||||
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src], they however burn their finger in the process.</span>")
|
||||
|
||||
user.SetLuminosity(user.luminosity + 2)
|
||||
set_light(2)
|
||||
processing_objects.Add(src)
|
||||
else
|
||||
lit = 0
|
||||
@@ -455,7 +455,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
else
|
||||
user.visible_message("<span class='notice'>[user] quietly shuts off the [src].")
|
||||
|
||||
user.SetLuminosity(user.luminosity - 2)
|
||||
set_light(0)
|
||||
processing_objects.Remove(src)
|
||||
else
|
||||
return ..()
|
||||
@@ -488,19 +488,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/lighter/pickup(mob/user)
|
||||
if(lit)
|
||||
SetLuminosity(0)
|
||||
user.SetLuminosity(user.luminosity+2)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/lighter/dropped(mob/user)
|
||||
if(lit)
|
||||
user.SetLuminosity(user.luminosity-2)
|
||||
SetLuminosity(2)
|
||||
return
|
||||
|
||||
///////////
|
||||
//ROLLING//
|
||||
///////////
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
do_the_flick()
|
||||
sleep(4)
|
||||
density = 0
|
||||
SetOpacity(0)
|
||||
set_opacity(0)
|
||||
update_icon(0)
|
||||
else
|
||||
var/srcturf = get_turf(src)
|
||||
@@ -75,7 +75,7 @@
|
||||
do_the_flick()
|
||||
density = 1
|
||||
sleep(4)
|
||||
SetOpacity(1)
|
||||
set_opacity(1)
|
||||
update_icon()
|
||||
opening = 0
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
/obj/structure/mineral_door/uranium
|
||||
mineralType = "uranium"
|
||||
hardness = 3
|
||||
luminosity = 2
|
||||
light_range = 2
|
||||
|
||||
/obj/structure/mineral_door/sandstone
|
||||
mineralType = "sandstone"
|
||||
|
||||
@@ -62,13 +62,11 @@
|
||||
//lighting check
|
||||
var/light_amount = 0
|
||||
var/turf/T = get_turf(src)
|
||||
var/area/A = T.loc
|
||||
|
||||
if(A)
|
||||
if(A.lighting_use_dynamic)
|
||||
light_amount = T.lighting_lumcount
|
||||
else
|
||||
light_amount = 10
|
||||
var/atom/movable/lighting_overlay/LO = locate(/atom/movable/lighting_overlay) in T
|
||||
if(LO)
|
||||
light_amount = max(0,min(10,LO.lum_r + LO.lum_g + LO.lum_b)-5)
|
||||
else
|
||||
light_amount = 5
|
||||
|
||||
if(light_amount > 2)
|
||||
M << "<span class='warning'>It's too bright here to use [src.name]!</span>"
|
||||
|
||||
@@ -467,4 +467,54 @@ var/global/wcColored
|
||||
desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window."
|
||||
icon_state = "fwindow"
|
||||
basestate = "fwindow"
|
||||
health = 30
|
||||
health = 30
|
||||
|
||||
/obj/structure/window/reinforced/polarized
|
||||
name = "electrochromic window"
|
||||
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
|
||||
var/id
|
||||
|
||||
/obj/structure/window/reinforced/polarized/proc/toggle()
|
||||
if(opacity)
|
||||
animate(src, color="#FFFFFF", time=5)
|
||||
set_opacity(0)
|
||||
else
|
||||
animate(src, color="#222222", time=5)
|
||||
set_opacity(1)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/button/windowtint
|
||||
name = "window tint control"
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "light0"
|
||||
desc = "A remote control switch for polarized windows."
|
||||
var/range = 7
|
||||
var/id = 0
|
||||
var/active = 0
|
||||
|
||||
/obj/machinery/button/windowtint/attack_hand(mob/user as mob)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
toggle_tint()
|
||||
|
||||
/obj/machinery/button/windowtint/proc/toggle_tint()
|
||||
use_power(5)
|
||||
|
||||
active = !active
|
||||
update_icon()
|
||||
|
||||
for(var/obj/structure/window/reinforced/polarized/W in range(src,range))
|
||||
if (W.id == src.id || !W.id)
|
||||
spawn(0)
|
||||
W.toggle()
|
||||
return
|
||||
|
||||
/obj/machinery/button/windowtint/power_change()
|
||||
..()
|
||||
if(active && !powered(power_channel))
|
||||
toggle_tint()
|
||||
|
||||
/obj/machinery/button/windowtint/update_icon()
|
||||
icon_state = "light[active]"
|
||||
Reference in New Issue
Block a user