mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Merge pull request #998 from tigercat2000/LightShit
Baystation12's Lighting Overhaul
This commit is contained in:
@@ -208,8 +208,8 @@
|
||||
O.vars[variable]) as num|null
|
||||
if(new_value == null) return
|
||||
|
||||
if(variable=="luminosity")
|
||||
O.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
O.set_light(new_value)
|
||||
else
|
||||
O.vars[variable] = new_value
|
||||
|
||||
@@ -217,24 +217,24 @@
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in mob_list)
|
||||
if ( istype(M , O.type) )
|
||||
if(variable=="luminosity")
|
||||
M.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
M.set_light(new_value)
|
||||
else
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if ( istype(A , O.type) )
|
||||
if(variable=="luminosity")
|
||||
A.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
A.set_light(new_value)
|
||||
else
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if ( istype(A , O.type) )
|
||||
if(variable=="luminosity")
|
||||
A.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
A.set_light(new_value)
|
||||
else
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
@@ -242,24 +242,24 @@
|
||||
if(istype(O, /mob))
|
||||
for(var/mob/M in mob_list)
|
||||
if (M.type == O.type)
|
||||
if(variable=="luminosity")
|
||||
M.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
M.set_light(new_value)
|
||||
else
|
||||
M.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /obj))
|
||||
for(var/obj/A in world)
|
||||
if (A.type == O.type)
|
||||
if(variable=="luminosity")
|
||||
A.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
A.set_light(new_value)
|
||||
else
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
else if(istype(O, /turf))
|
||||
for(var/turf/A in world)
|
||||
if (A.type == O.type)
|
||||
if(variable=="luminosity")
|
||||
A.SetLuminosity(new_value)
|
||||
if(variable=="light_range")
|
||||
A.set_light(new_value)
|
||||
else
|
||||
A.vars[variable] = O.vars[variable]
|
||||
|
||||
|
||||
@@ -448,10 +448,10 @@ var/list/forbidden_varedit_object_types = list(
|
||||
O.vars[variable] = var_new
|
||||
|
||||
if("num")
|
||||
if(variable=="luminosity")
|
||||
if(variable=="light_range")
|
||||
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
|
||||
if(var_new == null) return
|
||||
O.SetLuminosity(var_new)
|
||||
O.set_light(var_new)
|
||||
else if(variable=="stat")
|
||||
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
|
||||
if(var_new == null) return
|
||||
|
||||
@@ -21,20 +21,8 @@
|
||||
icon_state = "hardhat[on]_[_color]"
|
||||
item_state = "hardhat[on]_[_color]"
|
||||
|
||||
if(on) user.SetLuminosity(user.luminosity + brightness_on)
|
||||
else user.SetLuminosity(user.luminosity - brightness_on)
|
||||
|
||||
pickup(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity + brightness_on)
|
||||
// user.UpdateLuminosity() //TODO: Carn
|
||||
SetLuminosity(0)
|
||||
|
||||
dropped(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity - brightness_on)
|
||||
// user.UpdateLuminosity()
|
||||
SetLuminosity(brightness_on)
|
||||
if(on) set_light(brightness_on)
|
||||
else set_light(0)
|
||||
|
||||
|
||||
/obj/item/clothing/head/hardhat/orange
|
||||
|
||||
@@ -57,22 +57,22 @@
|
||||
return
|
||||
on = !on
|
||||
icon_state = "[base_state][on]"
|
||||
if(on) user.SetLuminosity(user.luminosity + brightness_on)
|
||||
else user.SetLuminosity(user.luminosity - brightness_on)
|
||||
if(on) user.set_light(user.luminosity + brightness_on)
|
||||
else user.set_light(user.luminosity - brightness_on)
|
||||
user.update_inv_head()
|
||||
|
||||
|
||||
/obj/item/clothing/head/helmet/space/eva/plasmaman/pickup(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity + brightness_on)
|
||||
user.set_light(user.luminosity + brightness_on)
|
||||
// user.UpdateLuminosity()
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
/obj/item/clothing/head/helmet/space/eva/plasmaman/dropped(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity - brightness_on)
|
||||
user.set_light(user.luminosity - brightness_on)
|
||||
// user.UpdateLuminosity()
|
||||
SetLuminosity(brightness_on)
|
||||
set_light(brightness_on)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,25 +35,13 @@
|
||||
icon_state = "rig[on]-[_color]"
|
||||
// item_state = "rig[on]-[color]"
|
||||
|
||||
if(on) user.SetLuminosity(user.luminosity + brightness_on)
|
||||
else user.SetLuminosity(user.luminosity - brightness_on)
|
||||
if(on) set_light(brightness_on)
|
||||
else set_light(0)
|
||||
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
H.update_inv_head()
|
||||
|
||||
pickup(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity + brightness_on)
|
||||
// user.UpdateLuminosity()
|
||||
SetLuminosity(0)
|
||||
|
||||
dropped(mob/user)
|
||||
if(on)
|
||||
user.SetLuminosity(user.luminosity - brightness_on)
|
||||
// user.UpdateLuminosity()
|
||||
SetLuminosity(brightness_on)
|
||||
|
||||
/obj/item/clothing/suit/space/rig
|
||||
name = "hardsuit"
|
||||
desc = "A special space suit for environments that might pose hazards beyond just the vacuum of space. Provides more protection than a standard space suit."
|
||||
@@ -393,7 +381,7 @@
|
||||
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | STOPSPRESSUREDMAGE | THICKMATERIAL
|
||||
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
|
||||
cold_protection = HEAD
|
||||
user.AddLuminosity(brightness_on)
|
||||
set_light(brightness_on)
|
||||
else
|
||||
user << "<span class='notice'>You switch your helmet to combat mode.</span>"
|
||||
name = "blood-red hardsuit helmet (combat)"
|
||||
@@ -401,7 +389,7 @@
|
||||
flags = BLOCKHAIR
|
||||
flags_inv = HIDEEARS
|
||||
cold_protection = null
|
||||
user.AddLuminosity(-brightness_on)
|
||||
set_light(0)
|
||||
|
||||
update_icon()
|
||||
playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1)
|
||||
|
||||
@@ -75,15 +75,15 @@
|
||||
set name = "Reset Computer"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
|
||||
if(usr.stat || usr.restrained() || usr.lying || !istype(usr, /mob/living))
|
||||
usr << "\red You can't do that."
|
||||
return
|
||||
|
||||
|
||||
if(!Adjacent(usr))
|
||||
usr << "You can't reach it."
|
||||
return
|
||||
|
||||
|
||||
Reset()
|
||||
|
||||
New(var/L, var/built = 0)
|
||||
@@ -280,8 +280,8 @@
|
||||
chan = power_channel
|
||||
|
||||
var/area/A = get_area(loc)
|
||||
if(istype(A) && A.master && A.master.powered(chan))
|
||||
A.master.use_power(amount, chan)
|
||||
if(istype(A) && A.powered(chan))
|
||||
A.use_power(amount, chan)
|
||||
else if(battery && battery.charge > 0)
|
||||
battery.use(amount)
|
||||
|
||||
|
||||
@@ -143,10 +143,9 @@
|
||||
if(typekey == null)
|
||||
typekey = /obj/machinery
|
||||
var/list/machines = list()
|
||||
for(var/area/area in A.related)
|
||||
for(var/obj/O in area.contents)
|
||||
if(istype(O,typekey))
|
||||
machines |= O
|
||||
for(var/obj/O in A.contents)
|
||||
if(istype(O,typekey))
|
||||
machines |= O
|
||||
return machines
|
||||
verify_machine(var/obj/previous)
|
||||
if(!previous) return 0
|
||||
|
||||
@@ -63,11 +63,9 @@
|
||||
//world << " checking [areapath]"
|
||||
var/area/A = locate(areapath)
|
||||
//world << " A: [A], contents.len: [A.contents.len]"
|
||||
for(var/area/B in A.related)
|
||||
//world << " B: [B], contents.len: [B.contents.len]"
|
||||
for(var/turf/simulated/floor/F in B.contents)
|
||||
if(!F.contents.len)
|
||||
turfs += F
|
||||
for(var/turf/simulated/floor/F in A.contents)
|
||||
if(!F.contents.len)
|
||||
turfs += F
|
||||
|
||||
var/list/spawn_types = list()
|
||||
var/max_number
|
||||
|
||||
@@ -374,9 +374,6 @@
|
||||
..()
|
||||
if(!seed)
|
||||
return
|
||||
if(seed.get_trait(TRAIT_BIOLUM))
|
||||
user.SetLuminosity(user.luminosity + seed.get_trait(TRAIT_BIOLUM))
|
||||
SetLuminosity(0)
|
||||
if(seed.get_trait(TRAIT_STINGS))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(istype(H) && H.gloves)
|
||||
@@ -385,10 +382,4 @@
|
||||
return
|
||||
reagents.remove_any(rand(1,3)) //Todo, make it actually remove the reagents the seed uses.
|
||||
seed.do_thorns(H,src)
|
||||
seed.do_sting(H,src,pick("r_hand","l_hand"))
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/dropped(mob/user)
|
||||
..()
|
||||
if(seed && seed.get_trait(TRAIT_BIOLUM))
|
||||
user.SetLuminosity(user.luminosity - seed.get_trait(TRAIT_BIOLUM))
|
||||
SetLuminosity(seed.get_trait(TRAIT_BIOLUM))
|
||||
seed.do_sting(H,src,pick("r_hand","l_hand"))
|
||||
@@ -162,10 +162,11 @@
|
||||
var/obj/effect/plant/splat = new splat_type(T, src)
|
||||
if(!istype(splat)) // Plants handle their own stuff.
|
||||
splat.name = "[thrown.name] [pick("smear","smudge","splatter")]"
|
||||
var/clr
|
||||
if(get_trait(TRAIT_BIOLUM))
|
||||
if(get_trait(TRAIT_BIOLUM_COLOUR))
|
||||
splat.l_color = get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
splat.SetLuminosity(get_trait(TRAIT_BIOLUM))
|
||||
clr = get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
splat.set_light(get_trait(TRAIT_BIOLUM), l_color = clr)
|
||||
if(get_trait(TRAIT_PRODUCT_COLOUR))
|
||||
splat.color = get_trait(TRAIT_PRODUCT_COLOUR)
|
||||
|
||||
@@ -278,12 +279,12 @@
|
||||
|
||||
// Handle light requirements.
|
||||
if(!light_supplied)
|
||||
var/area/A = get_area(current_turf)
|
||||
if(A)
|
||||
if(A.lighting_use_dynamic)
|
||||
light_supplied = max(0,min(10,current_turf.lighting_lumcount)-5)
|
||||
else
|
||||
light_supplied = 5
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in current_turf
|
||||
if(L)
|
||||
light_supplied = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
|
||||
else
|
||||
light_supplied = 5
|
||||
|
||||
if(light_supplied)
|
||||
if(abs(light_supplied - get_trait(TRAIT_IDEAL_LIGHT)) > get_trait(TRAIT_LIGHT_TOLERANCE))
|
||||
health_change += rand(1,3) * HYDRO_SPEED_MULTIPLIER
|
||||
@@ -698,9 +699,10 @@
|
||||
product.desc += " On second thought, something about this one looks strange."
|
||||
|
||||
if(get_trait(TRAIT_BIOLUM))
|
||||
var/clr
|
||||
if(get_trait(TRAIT_BIOLUM_COLOUR))
|
||||
product.l_color = get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
product.SetLuminosity(get_trait(TRAIT_BIOLUM))
|
||||
clr = get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
product.set_light(get_trait(TRAIT_BIOLUM), l_color = clr)
|
||||
|
||||
//Handle spawning in living, mobile products (like dionaea).
|
||||
if(istype(product,/mob/living))
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
|
||||
for(var/areapath in typesof(/area/hallway))
|
||||
var/area/A = locate(areapath)
|
||||
for(var/area/B in A.related)
|
||||
for(var/turf/simulated/floor/F in B.contents)
|
||||
if(!F.contents.len)
|
||||
turfs += F
|
||||
for(var/turf/simulated/floor/F in A.contents)
|
||||
if(!F.contents.len)
|
||||
turfs += F
|
||||
|
||||
if(turfs.len) //Pick a turf to spawn at if we can
|
||||
var/turf/simulated/floor/T = pick(turfs)
|
||||
@@ -149,14 +148,13 @@
|
||||
color = icon_colour
|
||||
// Apply colour and light from seed datum.
|
||||
if(seed.get_trait(TRAIT_BIOLUM))
|
||||
SetLuminosity(1+round(seed.get_trait(TRAIT_POTENCY)/20))
|
||||
var/clr
|
||||
if(seed.get_trait(TRAIT_BIOLUM_COLOUR))
|
||||
l_color = seed.get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
else
|
||||
l_color = null
|
||||
clr = seed.get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
set_light(1+round(seed.get_trait(TRAIT_POTENCY)/20), l_color = clr)
|
||||
return
|
||||
else
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
/obj/effect/plant/proc/refresh_icon()
|
||||
var/growth = min(max_growth,round(health/growth_threshold))
|
||||
|
||||
@@ -348,6 +348,7 @@
|
||||
|
||||
seed = null
|
||||
dead = 0
|
||||
|
||||
sampled = 0
|
||||
age = 0
|
||||
yield_mod = 0
|
||||
@@ -487,7 +488,7 @@
|
||||
usr << "There is no label to remove."
|
||||
return
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/verb/set_light()
|
||||
/obj/machinery/portable_atmospherics/hydroponics/verb/setlight()
|
||||
set name = "Set Light"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
@@ -806,13 +807,12 @@
|
||||
if(closed_system && mechanical)
|
||||
light_string = "that the internal lights are set to [tray_light] lumens"
|
||||
else
|
||||
var/area/A = T.loc
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
var/light_available
|
||||
if(A)
|
||||
if(A.lighting_use_dynamic)
|
||||
light_available = max(0,min(10,T.lighting_lumcount)-5)
|
||||
else
|
||||
light_available = 5
|
||||
if(L)
|
||||
light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
|
||||
else
|
||||
light_available = 5
|
||||
light_string = "a light level of [light_available] lumens"
|
||||
|
||||
usr << "The tray's sensor suite is reporting [light_string] and a temperature of [environment.temperature]K."
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
..()
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid_verb
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/remove_label
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/set_light
|
||||
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/setlight
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/soil/CanPass()
|
||||
return 1
|
||||
|
||||
@@ -73,12 +73,11 @@
|
||||
// Update bioluminescence.
|
||||
if(seed)
|
||||
if(seed.get_trait(TRAIT_BIOLUM))
|
||||
SetLuminosity(round(seed.get_trait(TRAIT_POTENCY)/10))
|
||||
var/clr
|
||||
if(seed.get_trait(TRAIT_BIOLUM_COLOUR))
|
||||
l_color = seed.get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
else
|
||||
l_color = null
|
||||
clr = seed.get_trait(TRAIT_BIOLUM_COLOUR)
|
||||
set_light(round(seed.get_trait(TRAIT_POTENCY)/10), l_color = clr)
|
||||
return
|
||||
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
return
|
||||
@@ -44,7 +44,7 @@
|
||||
flick("[mineral]fwall_opening", src)
|
||||
sleep(15)
|
||||
src.density = 0
|
||||
SetOpacity(0)
|
||||
set_opacity(0)
|
||||
opening = 0
|
||||
else
|
||||
opening = 1
|
||||
@@ -55,5 +55,5 @@
|
||||
flick("[mineral]fwall_closing", src)
|
||||
density = 1
|
||||
sleep(15)
|
||||
SetOpacity(1)
|
||||
set_opacity(1)
|
||||
opening = 0
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
// if(AR.lighting_use_dynamic)
|
||||
// X.opacity = !X.opacity
|
||||
// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
|
||||
// X.sd_set_opacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
|
||||
|
||||
toupdate += X
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
BS12 object based lighting system
|
||||
*/
|
||||
|
||||
/*
|
||||
Changes from tg DAL:
|
||||
- Lighting is done using objects instead of subareas.
|
||||
- Animated transitions. (newer tg DAL has this)
|
||||
- Full colours with mixing.
|
||||
- Support for lights on shuttles.
|
||||
|
||||
- Code:
|
||||
- Instead of one flat luminosity var, light is represented by 3 atom vars:
|
||||
- light_range; range in tiles of the light, used for calculating falloff,
|
||||
- light_power; multiplier for the brightness of lights,
|
||||
- light_color; hex string representing the RGB colour of the light.
|
||||
- setLuminousity() is now set_light() and takes the three variables above.
|
||||
- Variables can be left as null to not update them.
|
||||
- set_opacity() is now set_opacity().
|
||||
- Areas have luminosity set to 1 permanently, no hard-lighting.
|
||||
- Objects inside other objects can have lights and they properly affect the turf. (flashlights)
|
||||
- area/master and area/list/related have been eviscerated since subareas aren't needed.
|
||||
*/
|
||||
|
||||
/*
|
||||
Relevant vars/procs:
|
||||
|
||||
atom: (lighting_atom.dm)
|
||||
- var/light_range; range in tiles of the light, used for calculating falloff
|
||||
- var/light_power; multiplier for the brightness of lights
|
||||
- var/light_color; hex string representing the RGB colour of the light
|
||||
|
||||
- var/datum/light_source/light; light source datum for this atom, only present if light_range && light_power
|
||||
- var/list/light_sources; light sources in contents that are shining through this object, including this object
|
||||
|
||||
- proc/set_light(l_range, l_power, l_color):
|
||||
- Sets light_range/power/color to non-null args and calls update_light()
|
||||
- proc/set_opacity(new_opacity):
|
||||
- Sets opacity to new_opacity.
|
||||
- If opacity has changed, call turf.reconsider_lights() to fix light occlusion
|
||||
- proc/update_light():
|
||||
- Updates the light var on this atom, deleting or creating as needed and calling .update()
|
||||
|
||||
|
||||
turf: (lighting_turf.dm)
|
||||
- var/list/affecting_lights; list of light sources that are shining onto this turf
|
||||
|
||||
- proc/reconsider_lights():
|
||||
- Force all light sources shining onto this turf to update
|
||||
|
||||
- proc/lighting_clear_overlays():
|
||||
- Delete (manual GC) all light overlays on this turf, used when changing turf to space
|
||||
- proc/lighting_build_overlays():
|
||||
- Create lighting overlays for this turf
|
||||
|
||||
|
||||
atom/movable/lighting_overlay: (lighting_overlay.dm)
|
||||
- var/lum_r, var/lum_g, var/lum_b; lumcounts of each colour
|
||||
- var/needs_update; set on update_lumcount, checked by lighting process
|
||||
|
||||
- var/xoffset, var/yoffset; (only present when using sub-tile overlays) fractional offset of this overlay in the tile
|
||||
|
||||
- proc/update_lumcount(delta_r, delta_g, delta_b):
|
||||
- Change the lumcount vars and queue the overlay for update
|
||||
- proc/update_overlay()
|
||||
- Called by the lighting process to update the color of the overlay
|
||||
*/
|
||||
@@ -0,0 +1,10 @@
|
||||
#define LIGHTING_INTERVAL 5 // frequency, in 1/10ths of a second, of the lighting process
|
||||
|
||||
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
|
||||
#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources
|
||||
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
|
||||
#define LIGHTING_TRANSITIONS 1 // smooth, animated transitions, similar to /tg/station
|
||||
|
||||
#define LIGHTING_RESOLUTION 1 // resolution of the lighting overlays, powers of 2 only, max of 32
|
||||
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
|
||||
#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects
|
||||
@@ -0,0 +1,169 @@
|
||||
/datum/light_source
|
||||
var/atom/top_atom
|
||||
var/atom/source_atom
|
||||
|
||||
var/turf/source_turf
|
||||
var/light_power
|
||||
var/light_range
|
||||
var/light_color // string, decomposed by parse_light_color()
|
||||
|
||||
var/lum_r
|
||||
var/lum_g
|
||||
var/lum_b
|
||||
|
||||
var/list/effect_r
|
||||
var/list/effect_g
|
||||
var/list/effect_b
|
||||
var/list/effect_turf
|
||||
|
||||
var/applied
|
||||
|
||||
var/needs_update
|
||||
var/destroyed
|
||||
var/force_update
|
||||
|
||||
/datum/light_source/New(atom/owner, atom/top)
|
||||
source_atom = owner
|
||||
if(!source_atom.light_sources) source_atom.light_sources = list()
|
||||
source_atom.light_sources += src
|
||||
top_atom = top
|
||||
if(top_atom != source_atom)
|
||||
if(!top.light_sources) top.light_sources = list()
|
||||
top_atom.light_sources += src
|
||||
|
||||
source_turf = top_atom
|
||||
light_power = source_atom.light_power
|
||||
light_range = source_atom.light_range
|
||||
light_color = source_atom.light_color
|
||||
|
||||
parse_light_color()
|
||||
|
||||
effect_r = list()
|
||||
effect_g = list()
|
||||
effect_b = list()
|
||||
effect_turf = list()
|
||||
|
||||
update()
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/light_source/proc/destroy()
|
||||
destroyed = 1
|
||||
force_update()
|
||||
if(source_atom) source_atom.light_sources -= src
|
||||
if(top_atom) top_atom.light_sources -= src
|
||||
|
||||
/datum/light_source/proc/update(atom/new_top_atom)
|
||||
if(new_top_atom && new_top_atom != top_atom)
|
||||
if(top_atom != source_atom) top_atom.light_sources -= src
|
||||
top_atom = new_top_atom
|
||||
if(top_atom != source_atom)
|
||||
if(!top_atom.light_sources) top_atom.light_sources = list()
|
||||
top_atom.light_sources += src
|
||||
lighting_update_lights += src
|
||||
needs_update = 1
|
||||
|
||||
/datum/light_source/proc/force_update()
|
||||
needs_update = 1
|
||||
force_update = 1
|
||||
lighting_update_lights += src
|
||||
|
||||
/datum/light_source/proc/check()
|
||||
if(!source_atom)
|
||||
destroy()
|
||||
return 1
|
||||
|
||||
if(!top_atom)
|
||||
top_atom = source_atom
|
||||
. = 1
|
||||
|
||||
if(istype(top_atom, /turf))
|
||||
if(source_turf != top_atom)
|
||||
source_turf = top_atom
|
||||
. = 1
|
||||
else if(top_atom.loc != source_turf)
|
||||
source_turf = top_atom.loc
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_power != light_power)
|
||||
light_power = source_atom.light_power
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_range != light_range)
|
||||
light_range = source_atom.light_range
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_color != light_color)
|
||||
light_color = source_atom.light_color
|
||||
parse_light_color()
|
||||
. = 1
|
||||
|
||||
if(light_range && light_power && !applied)
|
||||
. = 1
|
||||
|
||||
/datum/light_source/proc/parse_light_color()
|
||||
if(light_color)
|
||||
lum_r = GetRedPart(light_color) / 255
|
||||
lum_g = GetGreenPart(light_color) / 255
|
||||
lum_b = GetBluePart(light_color) / 255
|
||||
else
|
||||
lum_r = 1
|
||||
lum_g = 1
|
||||
lum_b = 1
|
||||
|
||||
/datum/light_source/proc/falloff(atom/movable/lighting_overlay/O)
|
||||
#if LIGHTING_FALLOFF == 1 // circular
|
||||
#if LIGHTING_RESOLUTION == 1
|
||||
. = (O.x - source_turf.x)**2 + (O.y - source_turf.y)**2 + LIGHTING_HEIGHT
|
||||
#else
|
||||
. = (O.x - source_turf.x + O.xoffset)**2 + (O.y - source_turf.y + O.yoffset)**2 + LIGHTING_HEIGHT
|
||||
#endif
|
||||
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
. = CLAMP01((1 - CLAMP01(sqrt(.) / light_range)) * (1 / (sqrt(. + 1))))
|
||||
#else
|
||||
. = 1 - CLAMP01(sqrt(.) / light_range)
|
||||
#endif
|
||||
|
||||
#elif LIGHTING_FALLOFF == 2 // square
|
||||
#if LIGHTING_RESOLUTION == 1
|
||||
. = abs(O.x - source_turf.x) + abs(O.y - source_turf.y) + LIGHTING_HEIGHT
|
||||
#else
|
||||
. = abs(O.x - source_turf.x + O.xoffset) + abs(O.y - source_turf.y + O.yoffset) + LIGHTING_HEIGHT
|
||||
#endif
|
||||
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
. = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
|
||||
#else
|
||||
. = 1 - CLAMP01(. / light_range)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/datum/light_source/proc/apply_lum()
|
||||
applied = 1
|
||||
if(istype(source_turf))
|
||||
for(var/atom/movable/lighting_overlay/O in view(light_range, source_turf))
|
||||
var/strength = light_power * falloff(O)
|
||||
|
||||
effect_r[O] = lum_r * strength
|
||||
effect_g[O] = lum_g * strength
|
||||
effect_b[O] = lum_b * strength
|
||||
|
||||
O.update_lumcount(lum_r * strength, lum_g * strength, lum_b * strength)
|
||||
for(var/turf/T in view(light_range, source_turf))
|
||||
if(!T.affecting_lights) T.affecting_lights = list()
|
||||
T.affecting_lights += src
|
||||
effect_turf += T
|
||||
|
||||
/datum/light_source/proc/remove_lum()
|
||||
applied = 0
|
||||
for(var/atom/movable/lighting_overlay/O in effect_r)
|
||||
O.update_lumcount(-effect_r[O], -effect_g[O], -effect_b[O])
|
||||
|
||||
for(var/turf/T in effect_turf)
|
||||
if(T.affecting_lights) T.affecting_lights -= src
|
||||
|
||||
effect_r.Cut()
|
||||
effect_g.Cut()
|
||||
effect_b.Cut()
|
||||
effect_turf.Cut()
|
||||
@@ -0,0 +1,81 @@
|
||||
/atom
|
||||
var/light_power = 1 // intensity of the light
|
||||
var/light_range = 0 // range in tiles of the light
|
||||
var/light_color // RGB string representing the colour of the light
|
||||
|
||||
var/datum/light_source/light
|
||||
var/list/light_sources
|
||||
|
||||
/atom/proc/set_light(l_range, l_power, l_color)
|
||||
if(l_power != null) light_power = l_power
|
||||
if(l_range != null) light_range = l_range
|
||||
if(l_color != null) light_color = l_color
|
||||
|
||||
update_light()
|
||||
|
||||
/atom/proc/update_light()
|
||||
if(!light_power || !light_range)
|
||||
if(light)
|
||||
light.destroy()
|
||||
light = null
|
||||
else
|
||||
if(!istype(loc, /atom/movable))
|
||||
. = src
|
||||
else
|
||||
. = loc
|
||||
|
||||
if(light)
|
||||
light.update(.)
|
||||
else
|
||||
light = new /datum/light_source(src, .)
|
||||
|
||||
/atom/New()
|
||||
. = ..()
|
||||
if(light_power && light_range)
|
||||
update_light()
|
||||
|
||||
/atom/Destroy()
|
||||
if(light)
|
||||
light.destroy()
|
||||
light = null
|
||||
return ..()
|
||||
|
||||
/atom/movable/Destroy()
|
||||
var/turf/T = loc
|
||||
if(opacity && istype(T))
|
||||
T.reconsider_lights()
|
||||
return ..()
|
||||
|
||||
/atom/movable/Move()
|
||||
var/turf/old_loc = loc
|
||||
. = ..()
|
||||
|
||||
if(loc != old_loc)
|
||||
for(var/datum/light_source/L in light_sources)
|
||||
L.source_atom.update_light()
|
||||
|
||||
var/turf/new_loc = loc
|
||||
if(istype(old_loc) && opacity)
|
||||
old_loc.reconsider_lights()
|
||||
|
||||
if(istype(new_loc) && opacity)
|
||||
new_loc.reconsider_lights()
|
||||
|
||||
/atom/proc/set_opacity(new_opacity)
|
||||
var/old_opacity = opacity
|
||||
opacity = new_opacity
|
||||
var/turf/T = loc
|
||||
if(old_opacity != new_opacity && istype(T))
|
||||
T.reconsider_lights()
|
||||
|
||||
/obj/item/equipped()
|
||||
. = ..()
|
||||
update_light()
|
||||
|
||||
/obj/item/pickup()
|
||||
. = ..()
|
||||
update_light()
|
||||
|
||||
/obj/item/dropped()
|
||||
. = ..()
|
||||
update_light()
|
||||
@@ -0,0 +1,48 @@
|
||||
/atom/movable/lighting_overlay
|
||||
name = ""
|
||||
mouse_opacity = 0
|
||||
simulated = 0
|
||||
anchored = 1
|
||||
|
||||
icon = LIGHTING_ICON
|
||||
layer = LIGHTING_LAYER
|
||||
invisibility = INVISIBILITY_LIGHTING
|
||||
blend_mode = BLEND_MULTIPLY
|
||||
color = "#000000"
|
||||
|
||||
var/lum_r
|
||||
var/lum_g
|
||||
var/lum_b
|
||||
|
||||
#if LIGHTING_RESOLUTION != 1
|
||||
var/xoffset
|
||||
var/yoffset
|
||||
#endif
|
||||
|
||||
var/needs_update
|
||||
|
||||
/atom/movable/lighting_overlay/New()
|
||||
. = ..()
|
||||
verbs.Cut()
|
||||
|
||||
/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b)
|
||||
lum_r += delta_r
|
||||
lum_g += delta_g
|
||||
lum_b += delta_b
|
||||
|
||||
needs_update = 1
|
||||
lighting_update_overlays += src
|
||||
|
||||
/atom/movable/lighting_overlay/proc/update_overlay()
|
||||
var/mx = max(lum_r, lum_g, lum_b)
|
||||
. = 1 // factor
|
||||
if(mx > 1)
|
||||
. = 1/mx
|
||||
#if LIGHTING_TRANSITIONS == 1
|
||||
animate(src,
|
||||
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .),
|
||||
LIGHTING_INTERVAL - 1
|
||||
)
|
||||
#else
|
||||
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
schedule_interval = LIGHTING_INTERVAL
|
||||
|
||||
create_lighting_overlays()
|
||||
|
||||
/datum/controller/process/lighting/doWork()
|
||||
for(var/datum/light_source/L in lighting_update_lights)
|
||||
if(L.needs_update)
|
||||
if(L.destroyed)
|
||||
L.remove_lum()
|
||||
else if(L.check() || L.force_update)
|
||||
L.remove_lum()
|
||||
L.apply_lum()
|
||||
L.force_update = 0
|
||||
L.needs_update = 0
|
||||
lighting_update_lights.Cut()
|
||||
|
||||
for(var/atom/movable/lighting_overlay/O in lighting_update_overlays)
|
||||
if(O.needs_update)
|
||||
O.update_overlay()
|
||||
O.needs_update = 0
|
||||
lighting_update_overlays.Cut()
|
||||
@@ -0,0 +1,47 @@
|
||||
/var/list/lighting_update_lights = list()
|
||||
/var/list/lighting_update_overlays = list()
|
||||
|
||||
/area/var/lighting_use_dynamic = 1
|
||||
|
||||
// duplicates lots of code, but this proc needs to be as fast as possible.
|
||||
/proc/create_lighting_overlays(zlevel = 0)
|
||||
var/state = "light[LIGHTING_RESOLUTION]"
|
||||
var/area/A
|
||||
if(zlevel == 0) // populate all zlevels
|
||||
for(var/turf/T in world)
|
||||
if(T.dynamic_lighting)
|
||||
A = T.loc
|
||||
if(A.lighting_use_dynamic)
|
||||
#if LIGHTING_RESOLUTION == 1
|
||||
var/atom/movable/lighting_overlay/O = new(T)
|
||||
O.icon_state = state
|
||||
#else
|
||||
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
|
||||
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
|
||||
var/atom/movable/lighting_overlay/O = new(T)
|
||||
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
|
||||
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
|
||||
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.icon_state = state
|
||||
#endif
|
||||
else
|
||||
for(var/x = 1; x <= world.maxx; x++)
|
||||
for(var/y = 1; y <= world.maxy; y++)
|
||||
var/turf/T = locate(x, y, zlevel)
|
||||
if(T.dynamic_lighting)
|
||||
A = T.loc
|
||||
if(A.lighting_use_dynamic)
|
||||
#if LIGHTING_RESOLUTION == 1
|
||||
var/atom/movable/lighting_overlay/O = new(T)
|
||||
O.icon_state = state
|
||||
#else
|
||||
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
|
||||
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
|
||||
var/atom/movable/lighting_overlay/O = new(T)
|
||||
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
|
||||
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
|
||||
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.icon_state = state
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/turf
|
||||
var/list/affecting_lights
|
||||
|
||||
/turf/proc/reconsider_lights()
|
||||
for(var/datum/light_source/L in affecting_lights)
|
||||
L.force_update()
|
||||
|
||||
/turf/proc/lighting_clear_overlays()
|
||||
for(var/atom/movable/lighting_overlay/L in src)
|
||||
L.loc = null
|
||||
|
||||
/turf/proc/lighting_build_overlays()
|
||||
if(!locate(/atom/movable/lighting_overlay) in src)
|
||||
var/state = "light[LIGHTING_RESOLUTION]"
|
||||
var/area/A = loc
|
||||
if(A.lighting_use_dynamic)
|
||||
#if LIGHTING_RESOLUTION == 1
|
||||
var/atom/movable/lighting_overlay/O = new(src)
|
||||
O.icon_state = state
|
||||
#else
|
||||
for(var/i = 0; i < LIGHTING_RESOLUTION; i++)
|
||||
for(var/j = 0; j < LIGHTING_RESOLUTION; j++)
|
||||
var/atom/movable/lighting_overlay/O = new(src)
|
||||
O.pixel_x = i * (32 / LIGHTING_RESOLUTION)
|
||||
O.pixel_y = j * (32 / LIGHTING_RESOLUTION)
|
||||
O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5)
|
||||
O.icon_state = state
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#undef LIGHTING_INTERVAL
|
||||
|
||||
#undef LIGHTING_FALLOFF
|
||||
#undef LIGHTING_LAMBERTIAN
|
||||
#undef LIGHTING_HEIGHT
|
||||
#undef LIGHTING_TRANSITIONS
|
||||
|
||||
#undef LIGHTING_RESOLUTION
|
||||
#undef LIGHTING_LAYER
|
||||
#undef LIGHTING_ICON
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
icon = 'icons/obj/machines/broadcast.dmi'
|
||||
icon_state = "broadcaster"
|
||||
l_color="#4285F4"
|
||||
light_color="#4285F4"
|
||||
use_power = 1
|
||||
idle_power_usage = 50
|
||||
active_power_usage = 1000
|
||||
@@ -110,10 +110,10 @@
|
||||
return
|
||||
if(on)
|
||||
overlays+="broadcaster on"
|
||||
SetLuminosity(3) // OH FUUUUCK
|
||||
set_light(3) // OH FUUUUCK
|
||||
use_power = 2
|
||||
else
|
||||
SetLuminosity(1) // Only the tile we're on.
|
||||
set_light(1) // Only the tile we're on.
|
||||
use_power = 1
|
||||
if(sources.len)
|
||||
overlays+="broadcaster linked"
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
icon_state = "furnace"
|
||||
density = 1
|
||||
anchored = 1
|
||||
luminosity = 3
|
||||
light_range = 3
|
||||
var/obj/machinery/mineral/input = null
|
||||
var/obj/machinery/mineral/output = null
|
||||
var/obj/machinery/mineral/console = null
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
name = "Light-emtter"
|
||||
anchored = 1
|
||||
unacidable = 1
|
||||
luminosity = 8
|
||||
light_range = 8
|
||||
|
||||
/**********************Miner Lockers**************************/
|
||||
|
||||
|
||||
@@ -741,10 +741,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
|
||||
|
||||
@@ -762,10 +763,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.
|
||||
@@ -1356,7 +1358,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.
|
||||
|
||||
@@ -437,10 +437,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
|
||||
@@ -668,4 +669,4 @@
|
||||
proc/handle_wetness()
|
||||
if(mob_master.current_cycle%20==2) //dry off a bit once every 20 ticks or so
|
||||
wetlevel = max(wetlevel - 1,0)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1325,11 +1325,10 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
|
||||
if( cell && cell.charge>=20)
|
||||
cell.use(20);
|
||||
spawn(0)
|
||||
for(var/area/A in area.related)
|
||||
for(var/obj/machinery/light/L in A)
|
||||
L.on = 1
|
||||
L.broken()
|
||||
sleep(1)
|
||||
for(var/obj/machinery/light/L in area)
|
||||
L.on = 1
|
||||
L.broken()
|
||||
sleep(1)
|
||||
|
||||
/obj/machinery/power/apc/Destroy()
|
||||
if(malfai && operating)
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
powernet.cut_cable(src) // update the powernets
|
||||
cable_list -= src
|
||||
/* if(istype(attached))
|
||||
attached.SetLuminosity(0)
|
||||
attached.set_light(0)
|
||||
attached.icon_state = "powersink0"
|
||||
attached.mode = 0
|
||||
processing_objects.Remove(attached)
|
||||
|
||||
@@ -141,7 +141,9 @@
|
||||
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
|
||||
var/on = 0 // 1 if on, 0 if off
|
||||
var/on_gs = 0
|
||||
var/brightness = 8 // luminosity when on, also used in power calculation
|
||||
var/brightness_range = 8 // luminosity when on, also used in power calculation
|
||||
var/brightness_power = 3
|
||||
var/brightness_color = null
|
||||
var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN
|
||||
var/flickering = 0
|
||||
var/light_type = /obj/item/weapon/light/tube // the type of light item
|
||||
@@ -157,7 +159,9 @@
|
||||
icon_state = "bulb1"
|
||||
base_state = "bulb"
|
||||
fitting = "bulb"
|
||||
brightness = 4
|
||||
brightness_range = 4
|
||||
brightness_power = 2
|
||||
brightness_color = "#a0a080"
|
||||
desc = "A small lighting fixture."
|
||||
light_type = /obj/item/weapon/light/bulb
|
||||
|
||||
@@ -178,7 +182,8 @@
|
||||
name = "spotlight"
|
||||
fitting = "large tube"
|
||||
light_type = /obj/item/weapon/light/tube/large
|
||||
brightness = 12
|
||||
brightness_range = 12
|
||||
brightness_power = 4
|
||||
|
||||
/obj/machinery/light/built/New()
|
||||
status = LIGHT_EMPTY
|
||||
@@ -195,13 +200,20 @@
|
||||
..()
|
||||
|
||||
spawn(2)
|
||||
var/area/A = get_area(src)
|
||||
if(A && !A.requires_power)
|
||||
on = 1
|
||||
|
||||
switch(fitting)
|
||||
if("tube")
|
||||
brightness = 8
|
||||
brightness_range = 8
|
||||
brightness_power = 3
|
||||
if(prob(2))
|
||||
broken(1)
|
||||
if("bulb")
|
||||
brightness = 4
|
||||
brightness_range = 4
|
||||
brightness_power = 2
|
||||
brightness_color = "#a0a080"
|
||||
if(prob(5))
|
||||
broken(1)
|
||||
spawn(1)
|
||||
@@ -235,7 +247,7 @@
|
||||
|
||||
update_icon()
|
||||
if(on)
|
||||
if(luminosity != brightness)
|
||||
if(light_range != brightness_range || light_power != brightness_power || light_color != brightness_color)
|
||||
switchcount++
|
||||
if(rigged)
|
||||
if(status == LIGHT_OK && trigger)
|
||||
@@ -249,15 +261,15 @@
|
||||
status = LIGHT_BURNED
|
||||
icon_state = "[base_state]-burned"
|
||||
on = 0
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
else
|
||||
use_power = 2
|
||||
SetLuminosity(brightness)
|
||||
set_light(brightness_range, brightness_power, brightness_color)
|
||||
else
|
||||
use_power = 1
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
|
||||
active_power_usage = (luminosity * 10)
|
||||
active_power_usage = ((light_range + light_power) * 10)
|
||||
if(on != on_gs)
|
||||
on_gs = on
|
||||
|
||||
@@ -309,8 +321,9 @@
|
||||
user << "You insert the [L.name]."
|
||||
switchcount = L.switchcount
|
||||
rigged = L.rigged
|
||||
brightness = L.brightness
|
||||
l_color = L.color
|
||||
brightness_range = L.brightness_range
|
||||
brightness_power = L.brightness_power
|
||||
brightness_color = L.brightness_color
|
||||
on = has_power()
|
||||
update()
|
||||
|
||||
@@ -387,7 +400,7 @@
|
||||
// true if area has power and lightswitch is on
|
||||
/obj/machinery/light/proc/has_power()
|
||||
var/area/A = src.loc.loc
|
||||
return A.master.lightswitch && A.master.power_light
|
||||
return A.lightswitch && A.power_light
|
||||
|
||||
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
|
||||
if(flickering) return
|
||||
@@ -474,8 +487,9 @@
|
||||
var/obj/item/weapon/light/L = new light_type()
|
||||
L.status = status
|
||||
L.rigged = rigged
|
||||
L.brightness = src.brightness
|
||||
L.color = l_color
|
||||
L.brightness_range = brightness_range
|
||||
L.brightness_power = brightness_power
|
||||
L.brightness_color = brightness_color
|
||||
|
||||
// light item inherits the switchcount, then zero it
|
||||
L.switchcount = switchcount
|
||||
@@ -501,8 +515,9 @@
|
||||
var/obj/item/weapon/light/L = new light_type()
|
||||
L.status = status
|
||||
L.rigged = rigged
|
||||
L.brightness = brightness
|
||||
L.color = l_color
|
||||
L.brightness_range = brightness_range
|
||||
L.brightness_power = brightness_power
|
||||
L.brightness_color = brightness_color
|
||||
|
||||
// light item inherits the switchcount, then zero it
|
||||
L.switchcount = switchcount
|
||||
@@ -533,7 +548,6 @@
|
||||
if(status == LIGHT_OK)
|
||||
return
|
||||
status = LIGHT_OK
|
||||
brightness = initial(brightness)
|
||||
on = 1
|
||||
update()
|
||||
|
||||
@@ -568,7 +582,7 @@
|
||||
/*
|
||||
/obj/machinery/light/process()//TODO: remove/add this from machines to save on processing as needed ~Carn PRIORITY
|
||||
if(on)
|
||||
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
|
||||
use_power(light_range * LIGHTING_POWER_FACTOR, LIGHT)
|
||||
*/
|
||||
|
||||
// called when area power state changes
|
||||
@@ -608,7 +622,9 @@
|
||||
var/switchcount = 0 // number of times switched
|
||||
m_amt = 60
|
||||
var/rigged = 0 // true if rigged to explode
|
||||
var/brightness = 2 //how much light it gives off
|
||||
var/brightness_range = 2 //how much light it gives off
|
||||
var/brightness_power = 1
|
||||
var/brightness_color = null
|
||||
|
||||
/obj/item/weapon/light/tube
|
||||
name = "light tube"
|
||||
@@ -617,12 +633,14 @@
|
||||
base_state = "ltube"
|
||||
item_state = "c_tube"
|
||||
g_amt = 100
|
||||
brightness = 8
|
||||
brightness_range = 8
|
||||
brightness_power = 3
|
||||
|
||||
/obj/item/weapon/light/tube/large
|
||||
w_class = 2
|
||||
name = "large light tube"
|
||||
brightness = 15
|
||||
brightness_range = 15
|
||||
brightness_power = 4
|
||||
|
||||
/obj/item/weapon/light/bulb
|
||||
name = "light bulb"
|
||||
@@ -631,7 +649,9 @@
|
||||
base_state = "lbulb"
|
||||
item_state = "contvapour"
|
||||
g_amt = 100
|
||||
brightness = 5
|
||||
brightness_range = 5
|
||||
brightness_power = 2
|
||||
brightness_color = "#a0a080"
|
||||
|
||||
/obj/item/weapon/light/throw_impact(atom/hit_atom)
|
||||
..()
|
||||
@@ -644,7 +664,8 @@
|
||||
base_state = "fbulb"
|
||||
item_state = "egg4"
|
||||
g_amt = 100
|
||||
brightness = 5
|
||||
brightness_range = 5
|
||||
brightness_power = 2
|
||||
|
||||
// update the icon state and description of the light
|
||||
|
||||
@@ -665,9 +686,9 @@
|
||||
..()
|
||||
switch(name)
|
||||
if("light tube")
|
||||
brightness = rand(6,9)
|
||||
brightness_range = rand(6,9)
|
||||
if("light bulb")
|
||||
brightness = rand(4,6)
|
||||
brightness_range = rand(4,6)
|
||||
update()
|
||||
|
||||
|
||||
|
||||
@@ -46,31 +46,20 @@
|
||||
return 1
|
||||
|
||||
var/area/A = src.loc.loc // make sure it's in an area
|
||||
if(!A || !isarea(A) || !A.master)
|
||||
if(!A || !isarea(A))
|
||||
return 0 // if not, then not powered
|
||||
if(chan == -1)
|
||||
chan = power_channel
|
||||
return A.master.powered(chan) // return power status of the area
|
||||
return A.powered(chan) // return power status of the area
|
||||
|
||||
// increment the power usage stats for an area
|
||||
|
||||
|
||||
/obj/machinery/proc/use_power(var/amount, var/chan = -1, var/autocalled = 0) // defaults to power_channel
|
||||
var/A = getArea()
|
||||
|
||||
/obj/machinery/proc/use_power(var/amount, var/chan = -1) // defaults to power_channel
|
||||
var/area/A = get_area(src) // make sure it's in an area
|
||||
if(!A || !isarea(A))
|
||||
return
|
||||
|
||||
var/area/B = A
|
||||
|
||||
if (!B.master)
|
||||
return
|
||||
|
||||
if (-1 == chan)
|
||||
if(chan == -1)
|
||||
chan = power_channel
|
||||
|
||||
|
||||
B.master.use_power(amount, chan)
|
||||
A.use_power(amount, chan)
|
||||
|
||||
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change
|
||||
// by default, check equipment channel & set flag
|
||||
@@ -445,9 +434,9 @@
|
||||
return null
|
||||
|
||||
/area/proc/get_apc()
|
||||
for(var/area/RA in src.related)
|
||||
if (RA.apc.len >= 1)
|
||||
return RA.apc[1]
|
||||
var/obj/machinery/power/apc/FINDME = locate() in src
|
||||
if (FINDME)
|
||||
return FINDME
|
||||
|
||||
|
||||
//Determines how strong could be shock, deals damage to mob, uses power.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
density = 0
|
||||
unacidable = 1
|
||||
use_power = 0
|
||||
luminosity = 4
|
||||
light_range = 4
|
||||
var/obj/machinery/field_generator/FG1 = null
|
||||
var/obj/machinery/field_generator/FG2 = null
|
||||
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
||||
|
||||
@@ -18,7 +18,7 @@ var/global/list/uneatable = list(
|
||||
anchored = 1
|
||||
density = 1
|
||||
layer = 6
|
||||
luminosity = 6
|
||||
light_range = 6
|
||||
unacidable = 1 //Don't comment this out.
|
||||
use_power = 0
|
||||
var/current_size = 1
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
user.drop_item()
|
||||
user << "<span class='notice'>You click [S] into place on [src].</span>"
|
||||
if(S.on)
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
F = S
|
||||
A.loc = src
|
||||
update_icon()
|
||||
@@ -359,32 +359,10 @@
|
||||
/obj/item/weapon/gun/proc/update_gunlight(var/mob/user = null)
|
||||
if(F)
|
||||
if(F.on)
|
||||
if(loc == user)
|
||||
user.AddLuminosity(F.brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(F.brightness_on)
|
||||
set_light(F.brightness_on)
|
||||
else
|
||||
if(loc == user)
|
||||
user.AddLuminosity(-F.brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
set_light(0)
|
||||
update_icon()
|
||||
else
|
||||
if(loc == user)
|
||||
user.AddLuminosity(-5)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/pickup(mob/user)
|
||||
if(F)
|
||||
if(F.on)
|
||||
user.AddLuminosity(F.brightness_on)
|
||||
SetLuminosity(0)
|
||||
|
||||
/obj/item/weapon/gun/dropped(mob/user)
|
||||
if(F)
|
||||
if(F.on)
|
||||
user.AddLuminosity(-F.brightness_on)
|
||||
SetLuminosity(F.brightness_on)
|
||||
|
||||
set_light(0)
|
||||
return
|
||||
@@ -185,16 +185,16 @@
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/Destroy()
|
||||
if(istype(loc,/mob))
|
||||
loc.SetLuminosity(round(loc.luminosity - potency/5,1))
|
||||
loc.set_light(round(loc.luminosity - potency/5,1))
|
||||
..()
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/pickup(mob/user)
|
||||
src.SetLuminosity(0)
|
||||
user.SetLuminosity(round(user.luminosity + (potency/5),1))
|
||||
src.set_light(0)
|
||||
user.set_light(round(user.luminosity + (potency/5),1))
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/dropped(mob/user)
|
||||
user.SetLuminosity(round(user.luminosity - (potency/5),1))
|
||||
src.SetLuminosity(round(potency/5,1))
|
||||
user.set_light(round(user.luminosity - (potency/5),1))
|
||||
src.set_light(round(potency/5,1))
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/cocoapod
|
||||
name = "cocoa pod"
|
||||
@@ -613,16 +613,16 @@
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/Destroy()
|
||||
if(istype(loc,/mob))
|
||||
loc.SetLuminosity(round(loc.luminosity - potency/10,1))
|
||||
loc.set_light(round(loc.luminosity - potency/10,1))
|
||||
..()
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user)
|
||||
SetLuminosity(0)
|
||||
user.SetLuminosity(round(user.luminosity + (potency/10),1))
|
||||
set_light(0)
|
||||
user.set_light(round(user.luminosity + (potency/10),1))
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user)
|
||||
user.SetLuminosity(round(user.luminosity - (potency/10),1))
|
||||
SetLuminosity(round(potency/10,1))
|
||||
user.set_light(round(user.luminosity - (potency/10),1))
|
||||
set_light(round(potency/10,1))
|
||||
|
||||
//Tobacco/varieties
|
||||
/obj/item/weapon/reagent_containers/food/snacks/grown/tobacco
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
icon_state = "darkmatter"
|
||||
density = 1
|
||||
anchored = 0
|
||||
luminosity = 4
|
||||
light_range = 4
|
||||
|
||||
var/gasefficency = 0.25
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
var/emergency_alert = "CRYSTAL DELAMINATION IMMINENT."
|
||||
var/explosion_point = 1000
|
||||
|
||||
l_color = "#8A8A00"
|
||||
light_color = "#8A8A00"
|
||||
var/warning_color = "#B8B800"
|
||||
var/emergency_color = "#D9D900"
|
||||
|
||||
@@ -102,10 +102,8 @@
|
||||
|
||||
//Changes color and luminosity of the light to these values if they were not already set
|
||||
/obj/machinery/power/supermatter/proc/shift_light(var/lum, var/clr)
|
||||
if(l_color != clr)
|
||||
l_color = clr
|
||||
if(luminosity != lum)
|
||||
SetLuminosity(lum)
|
||||
if(lum != light_range || clr != light_color)
|
||||
set_light(lum, l_color = clr)
|
||||
|
||||
/obj/machinery/power/supermatter/process()
|
||||
|
||||
@@ -151,7 +149,7 @@
|
||||
|
||||
explode()
|
||||
else
|
||||
shift_light(4,initial(l_color))
|
||||
shift_light(4,initial(light_color))
|
||||
if(grav_pulling)
|
||||
supermatter_pull()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
density = 1
|
||||
anchored = 1
|
||||
animate_movement=1
|
||||
luminosity = 3
|
||||
light_range = 3
|
||||
|
||||
var/attack_log = null
|
||||
var/on = 0
|
||||
@@ -179,13 +179,13 @@
|
||||
if(powered && cell.charge < charge_use)
|
||||
return 0
|
||||
on = 1
|
||||
luminosity = initial(luminosity)
|
||||
set_light(initial(light_range))
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/vehicle/proc/turn_off()
|
||||
on = 0
|
||||
luminosity = 0
|
||||
set_light(0)
|
||||
update_icon()
|
||||
|
||||
/obj/vehicle/proc/Emag(mob/user as mob)
|
||||
|
||||
@@ -482,7 +482,7 @@
|
||||
name = "Lantern Syndrome"
|
||||
stage = 3
|
||||
activate(var/mob/living/carbon/mob,var/multiplier)
|
||||
mob.SetLuminosity(5)
|
||||
mob.set_light(5)
|
||||
mob << "<span class = 'notice'>You are glowing brightly!</span>"
|
||||
|
||||
|
||||
@@ -866,7 +866,7 @@ var/list/compatible_mobs = list(/mob/living/carbon/human, /mob/living/carbon/mon
|
||||
name = "Lantern Syndrome"
|
||||
stage = 2
|
||||
activate(var/mob/living/carbon/mob,var/multiplier)
|
||||
mob.SetLuminosity(4)
|
||||
mob.set_light(4)
|
||||
mob << "<span class = 'notice'>You are glowing!</span>"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user