mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Lighting overhaul.
This commit overhauls the lighting system to Bay12 standards. It is better in pretty much every way.
This commit is contained in:
@@ -734,10 +734,11 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
|
||||
if(isturf(loc)) //else, there's considered to be no light
|
||||
var/turf/T = loc
|
||||
var/area/A = T.loc
|
||||
if(A)
|
||||
if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else light_amount = 5
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 5
|
||||
nutrition += light_amount
|
||||
traumatic_shock -= light_amount
|
||||
|
||||
@@ -755,10 +756,11 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
var/light_amount = 0
|
||||
if(isturf(loc))
|
||||
var/turf/T = loc
|
||||
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/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = L.lum_r + L.lum_g + L.lum_b //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 10
|
||||
if(light_amount > species.light_dam) //if there's enough light, start dying
|
||||
if(species.light_effect_amp)
|
||||
adjustFireLoss(5) //This gets doubled by Shadowling's innate fire weakness, so it ends up being 10.
|
||||
@@ -1349,7 +1351,8 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
//0.1% chance of playing a scary sound to someone who's in complete darkness
|
||||
if(isturf(loc) && rand(1,1000) == 1)
|
||||
var/turf/currentTurf = loc
|
||||
if(!currentTurf.lighting_lumcount)
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in currentTurf
|
||||
if(L && L.lum_r + L.lum_g + L.lum_b == 0)
|
||||
playsound_local(src,pick(scarySounds),50, 1, -1)
|
||||
|
||||
// Separate proc so we can jump out of it when we've succeeded in spreading disease.
|
||||
|
||||
@@ -434,10 +434,11 @@
|
||||
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
|
||||
if(isturf(loc)) //else, there's considered to be no light
|
||||
var/turf/T = loc
|
||||
var/area/A = T.loc
|
||||
if(A)
|
||||
if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else light_amount = 5
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 5
|
||||
|
||||
nutrition += light_amount
|
||||
traumatic_shock -= light_amount
|
||||
|
||||
@@ -203,14 +203,14 @@
|
||||
/mob/living/proc/IgniteMob()
|
||||
if(fire_stacks > 0 && !on_fire)
|
||||
on_fire = 1
|
||||
src.AddLuminosity(3)
|
||||
set_light(light_range + 3,l_color = "#ED9200")
|
||||
update_fire()
|
||||
|
||||
/mob/living/proc/ExtinguishMob()
|
||||
if(on_fire)
|
||||
on_fire = 0
|
||||
fire_stacks = 0
|
||||
src.AddLuminosity(-3)
|
||||
set_light(max(0,light_range - 3))
|
||||
update_fire()
|
||||
|
||||
/mob/living/proc/update_fire()
|
||||
|
||||
@@ -654,13 +654,13 @@ var/list/ai_verbs_default = list(
|
||||
|
||||
/mob/living/silicon/ai/reset_view(atom/A)
|
||||
if(current)
|
||||
current.SetLuminosity(0)
|
||||
current.set_light(0)
|
||||
if(istype(A,/obj/machinery/camera))
|
||||
current = A
|
||||
..()
|
||||
if(istype(A,/obj/machinery/camera))
|
||||
if(camera_light_on) A.SetLuminosity(AI_CAMERA_LUMINOSITY)
|
||||
else A.SetLuminosity(0)
|
||||
if(camera_light_on) A.set_light(AI_CAMERA_LUMINOSITY)
|
||||
else A.set_light(0)
|
||||
|
||||
/mob/living/silicon/ai/proc/botcall()
|
||||
set category = "AI Commands"
|
||||
@@ -941,7 +941,7 @@ var/list/ai_verbs_default = list(
|
||||
src << "Camera lights [camera_light_on ? "activated" : "deactivated"]."
|
||||
if(!camera_light_on)
|
||||
if(current)
|
||||
current.SetLuminosity(0)
|
||||
current.set_light(0)
|
||||
current = null
|
||||
else
|
||||
lightNearbyCamera()
|
||||
@@ -970,20 +970,20 @@ var/list/ai_verbs_default = list(
|
||||
if(src.current)
|
||||
var/obj/machinery/camera/camera = near_range_camera(src.eyeobj)
|
||||
if(camera && src.current != camera)
|
||||
src.current.SetLuminosity(0)
|
||||
src.current.set_light(0)
|
||||
if(!camera.light_disabled)
|
||||
src.current = camera
|
||||
src.current.SetLuminosity(AI_CAMERA_LUMINOSITY)
|
||||
src.current.set_light(AI_CAMERA_LUMINOSITY)
|
||||
else
|
||||
src.current = null
|
||||
else if(isnull(camera))
|
||||
src.current.SetLuminosity(0)
|
||||
src.current.set_light(0)
|
||||
src.current = null
|
||||
else
|
||||
var/obj/machinery/camera/camera = near_range_camera(src.eyeobj)
|
||||
if(camera && !camera.light_disabled)
|
||||
src.current = camera
|
||||
src.current.SetLuminosity(AI_CAMERA_LUMINOSITY)
|
||||
src.current.set_light(AI_CAMERA_LUMINOSITY)
|
||||
camera_light_on = world.timeofday + 1 * 20 // Update the light every 2 seconds.
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
if(src.can_use())
|
||||
cameranet.addCamera(src)
|
||||
else
|
||||
src.SetLuminosity(0)
|
||||
src.set_light(0)
|
||||
cameranet.removeCamera(src)
|
||||
|
||||
/obj/machinery/camera/New()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
src.cameraFollow = null
|
||||
src.reset_view(null)
|
||||
src.unset_machine()
|
||||
|
||||
|
||||
src.updatehealth()
|
||||
|
||||
if (src.malfhack)
|
||||
@@ -48,7 +48,7 @@
|
||||
loc = T.loc
|
||||
if (istype(loc, /area))
|
||||
//stage = 4
|
||||
if (!loc.master.power_equip && !istype(src.loc,/obj/item))
|
||||
if (!loc.power_equip && !istype(src.loc,/obj/item))
|
||||
//stage = 5
|
||||
blind = 1
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
else
|
||||
|
||||
//stage = 6
|
||||
|
||||
var/area/current_area = get_area(src)
|
||||
|
||||
src.blind.screen_loc = "1,1 to 15,15"
|
||||
if (src.blind.layer!=18)
|
||||
src.blind.layer = 18
|
||||
@@ -98,7 +101,7 @@
|
||||
src.see_in_dark = 0
|
||||
src.see_invisible = SEE_INVISIBLE_LIVING
|
||||
|
||||
if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item))
|
||||
if (((!loc.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item))
|
||||
if (src:aiRestorePowerRoutine==0)
|
||||
src:aiRestorePowerRoutine = 1
|
||||
|
||||
@@ -112,7 +115,7 @@
|
||||
spawn(20)
|
||||
src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection."
|
||||
sleep(50)
|
||||
if (loc.master.power_equip)
|
||||
if (loc.power_equip)
|
||||
if (!istype(T, /turf/space))
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
@@ -136,21 +139,20 @@
|
||||
theAPC = something
|
||||
break
|
||||
*/
|
||||
var/PRP //like ERP with the code, at least this stuff is no more 4x sametext
|
||||
var/PRP
|
||||
for (PRP=1, PRP<=4, PRP++)
|
||||
var/area/AIarea = get_area(src)
|
||||
for(var/area/A in AIarea.master.related)
|
||||
for (var/obj/machinery/power/apc/APC in A)
|
||||
if (!(APC.stat & BROKEN))
|
||||
theAPC = APC
|
||||
break
|
||||
for (var/obj/machinery/power/apc/APC in current_area)
|
||||
if (!(APC.stat & BROKEN))
|
||||
theAPC = APC
|
||||
break
|
||||
|
||||
if (!theAPC)
|
||||
switch(PRP)
|
||||
if (1) src << "Unable to locate APC!"
|
||||
else src << "Lost connection with the APC!"
|
||||
src:aiRestorePowerRoutine = 2
|
||||
return
|
||||
if (loc.master.power_equip)
|
||||
if (loc.power_equip)
|
||||
if (!istype(T, /turf/space))
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
set category = "Drone"
|
||||
|
||||
if(luminosity)
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
return
|
||||
SetLuminosity(2)
|
||||
set_light(2)
|
||||
|
||||
//Actual picking-up event.
|
||||
/mob/living/silicon/robot/drone/attack_hand(mob/living/carbon/human/M as mob)
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
emote_hear = list("barks", "woofs", "yaps","pants")
|
||||
emote_see = list("shakes its head", "shivers")
|
||||
desc = "It's a corgi."
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
inventory_head.loc = src.loc
|
||||
inventory_head = null
|
||||
regenerate_icons()
|
||||
@@ -295,7 +295,7 @@
|
||||
emote_hear = list("barks christmas songs", "yaps merrily")
|
||||
emote_see = list("looks for presents", "checks his list")
|
||||
desc = "He's very fond of milk and cookies."
|
||||
SetLuminosity(6)
|
||||
set_light(6)
|
||||
if(/obj/item/clothing/head/soft)
|
||||
name = "Corgi Tech [real_name]"
|
||||
desc = "The reason your yellow gloves have chew-marks."
|
||||
@@ -303,7 +303,7 @@
|
||||
name = "[real_name] the red-nosed Corgi"
|
||||
emote_hear = list("lights the way", "illuminates", "yaps")
|
||||
desc = "He has a very shiny nose."
|
||||
SetLuminosity(1)
|
||||
set_light(1)
|
||||
|
||||
|
||||
//IAN! SQUEEEEEEEEE~
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
emote_hear = list("clicks")
|
||||
emote_see = list("clacks")
|
||||
desc = "Free crabs!"
|
||||
src.sd_SetLuminosity(0)
|
||||
src.sd_set_light(0)
|
||||
inventory_head.loc = src.loc
|
||||
inventory_head = null
|
||||
else
|
||||
|
||||
@@ -112,11 +112,23 @@
|
||||
/mob/living/simple_animal/hostile/statue/proc/can_be_seen(var/turf/destination)
|
||||
// Check for darkness
|
||||
var/turf/T = get_turf(loc)
|
||||
var/light_amount
|
||||
var/DLlight_amount
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 5
|
||||
var/atom/movable/lighting_overlay/DL = locate(/atom/movable/lighting_overlay) in destination
|
||||
if(DL)
|
||||
DLlight_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
DLlight_amount = 5
|
||||
if(T && destination)
|
||||
// Don't check it twice if our destination is the tile we are on or we can't even get to our destination
|
||||
if(T == destination)
|
||||
destination = null
|
||||
else if(!T.lighting_lumcount && !destination.lighting_lumcount) // No one can see us in the darkness, right?
|
||||
else if(light_amount <= 1 && DLlight_amount <= 1) // No one can see us in the darkness, right?
|
||||
return null
|
||||
|
||||
// We aren't in darkness, loop for viewers.
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
var/player_logged = 0
|
||||
|
||||
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
||||
var/list/shouldnt_see = list() //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes
|
||||
var/list/shouldnt_see = list(/atom/movable/lighting_overlay) //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes
|
||||
|
||||
var/kills=0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user