From 3bc5d862634d3cc2aabcb0dedb6da2132cedb77c Mon Sep 17 00:00:00 2001
From: PJB3005
Date: Tue, 21 Jul 2015 12:54:42 +0200
Subject: [PATCH] LIGHTING IS BACK.
AND A SHITLOAD FASTER.
SANIC.
---
code/ATMOSPHERICS/hvac/chiller.dm | 2 +-
code/ATMOSPHERICS/hvac/spaceheater.dm | 6 +-
.../Cael_Aislinn/Rust/core_control.dm | 2 +-
.../Cael_Aislinn/Rust/core_gen.dm | 8 +-
.../Cael_Aislinn/Rust/core_monitor.dm | 2 +-
.../Cael_Aislinn/Rust/gyrotron_controller.dm | 2 +-
code/WorkInProgress/Mini/atmos_control.dm | 2 +-
code/WorkInProgress/buildmode.dm | 2 +-
code/ZAS/Fire.dm | 14 +-
code/__HELPERS/_macros.dm | 2 +
code/__HELPERS/game.dm | 4 +-
code/__HELPERS/maths.dm | 2 +
code/__HELPERS/unsorted.dm | 26 +-
code/_onclick/observer.dm | 9 +-
code/controllers/Processes/lighting (OLD).dm | 26 ++
code/controllers/Processes/lighting.dm | 40 ++-
code/controllers/failsafe.dm | 17 --
code/controllers/shuttle_controller.dm | 6 +-
code/controllers/verbs.dm | 9 +-
code/game/area/Space Station 13 areas.dm | 32 +-
code/game/area/areas.dm | 184 +++++------
code/game/atoms.dm | 3 -
code/game/atoms_movable.dm | 5 -
code/game/dna/dna_modifier.dm | 24 +-
code/game/gamemodes/cult/cult_structures.dm | 16 +-
code/game/gamemodes/cult/hell_universe.dm | 9 +-
code/game/gamemodes/cult/narsie.dm | 4 +-
code/game/gamemodes/endgame/endgame.dm | 3 +-
.../endgame/supermatter_cascade/blob.dm | 17 +-
.../endgame/supermatter_cascade/portal.dm | 2 +-
.../endgame/supermatter_cascade/universe.dm | 11 +-
code/game/gamemodes/events/biomass.dm | 7 +-
code/game/gamemodes/events/spacevines.dm | 7 +-
code/game/gamemodes/vampire/vampire.dm | 5 +-
code/game/gamemodes/vampire/vampire_powers.dm | 24 +-
code/game/machinery/Sleeper.dm | 21 +-
code/game/machinery/adv_med.dm | 15 +-
code/game/machinery/alarm.dm | 18 +-
code/game/machinery/atmo_control.dm | 2 +-
.../atmoalter/area_atmos_computer.dm | 15 +-
code/game/machinery/atmoalter/gas_mine.dm | 16 +-
code/game/machinery/autolathe.dm | 2 +-
code/game/machinery/biogenerator.dm | 12 +-
code/game/machinery/bioprinter.dm | 12 +-
code/game/machinery/bots/bots.dm | 4 +-
code/game/machinery/bots/secbot.dm | 6 +-
code/game/machinery/camera/camera.dm | 2 +-
.../machinery/computer/HolodeckControl.dm | 2 +-
code/game/machinery/computer/Operating.dm | 2 +-
code/game/machinery/computer/aifixer.dm | 2 +-
code/game/machinery/computer/arcade.dm | 2 +-
code/game/machinery/computer/atmos_alert.dm | 2 +-
code/game/machinery/computer/camera.dm | 12 +-
code/game/machinery/computer/card.dm | 2 +-
.../game/machinery/computer/communications.dm | 2 +-
code/game/machinery/computer/computer.dm | 14 +-
code/game/machinery/computer/law.dm | 4 +-
code/game/machinery/computer/medical.dm | 4 +-
code/game/machinery/computer/message.dm | 2 +-
code/game/machinery/computer/pda_terminal.dm | 2 +-
code/game/machinery/computer/pod.dm | 4 +-
code/game/machinery/computer/prisoner.dm | 2 +-
code/game/machinery/computer/prisonshuttle.dm | 4 +-
code/game/machinery/computer/robot.dm | 2 +-
code/game/machinery/computer/salvage_ship.dm | 2 +-
code/game/machinery/computer/security.dm | 4 +-
code/game/machinery/computer/shuttle.dm | 2 +-
.../machinery/computer/specops_shuttle.dm | 4 +-
code/game/machinery/computer/station_alert.dm | 2 +-
code/game/machinery/computer/store.dm | 2 +-
.../machinery/computer/syndicate_shuttle.dm | 2 +-
.../computer/syndicate_specops_shuttle.dm | 4 +-
code/game/machinery/computer/taxi_shuttle.dm | 2 +-
code/game/machinery/computer/vox_shuttle.dm | 2 +-
code/game/machinery/cryo.dm | 12 +-
code/game/machinery/doors/alarmlock.dm | 2 -
code/game/machinery/doors/door.dm | 6 +-
code/game/machinery/doors/poddoor.dm | 6 +-
code/game/machinery/doors/shutters.dm | 6 +-
code/game/machinery/floodlight.dm | 8 +-
code/game/machinery/hologram.dm | 8 +-
code/game/machinery/kitchen/smartfridge.dm | 8 +-
.../game/machinery/kitchen/snackbarmachine.dm | 6 +-
code/game/machinery/lightswitch.dm | 11 +-
code/game/machinery/machinery.dm | 5 +
code/game/machinery/requests_console.dm | 4 +-
code/game/machinery/telecomms/logbrowser.dm | 2 +-
code/game/machinery/telecomms/telemonitor.dm | 2 +-
.../machinery/telecomms/traffic_control.dm | 2 +-
code/game/machinery/teleporter.dm | 2 +-
code/game/machinery/turrets.dm | 18 +-
code/game/machinery/vending.dm | 8 +-
code/game/mecha/equipment/tools/tools.dm | 6 +-
code/game/mecha/mech_bay.dm | 2 +-
code/game/mecha/mecha.dm | 4 +-
code/game/mecha/mecha_control_console.dm | 2 +-
code/game/objects/effects/decals/slag.dm | 10 +-
code/game/objects/effects/glowshroom.dm | 2 +-
code/game/objects/items/blueprints.dm | 9 +-
code/game/objects/items/candle.dm | 17 +-
code/game/objects/items/devices/PDA/PDA.dm | 15 +-
code/game/objects/items/devices/PDA/apps.dm | 2 +-
code/game/objects/items/devices/flashlight.dm | 81 +----
.../objects/items/devices/lightreplacer.dm | 8 +-
code/game/objects/items/devices/powersink.dm | 8 +-
code/game/objects/items/stacks/cable.dm | 2 +-
.../objects/items/weapons/cigs_lighters.dm | 72 +----
code/game/objects/items/weapons/glowstick.dm | 14 +-
.../items/weapons/grenades/flashbang.dm | 2 +-
code/game/objects/objs.dm | 4 -
code/game/objects/structures/false_walls.dm | 8 +-
.../objects/structures/vehicles/adminbus.dm | 52 ++--
.../structures/vehicles/adminbus_powers.dm | 28 +-
code/game/supplyshuttle.dm | 16 +-
code/game/turfs/simulated.dm | 1 +
code/game/turfs/simulated/floor.dm | 26 +-
code/game/turfs/space/space.dm | 2 +-
code/game/turfs/turf.dm | 45 +--
code/modules/admin/admin_verbs.dm | 3 +-
code/modules/admin/verbs/adminjump.dm | 9 +-
code/modules/admin/verbs/massmodvar.dm | 138 +++++----
code/modules/admin/verbs/modifyvariables.dm | 21 +-
code/modules/awaymissions/maploader/writer.dm | 1 +
code/modules/bomberman/bomberman.dm | 4 +-
code/modules/clothing/head/hardhat.dm | 31 +-
code/modules/clothing/head/misc_special.dm | 23 +-
code/modules/clothing/spacesuits/plasmamen.dm | 21 +-
code/modules/clothing/spacesuits/rig.dm | 33 +-
code/modules/detectivework/detective_work.dm | 2 +-
code/modules/events/bluespaceanomaly.dm | 1 +
code/modules/events/infestation.dm | 7 +-
code/modules/html_interface/map/crew/crew.dm | 3 +-
code/modules/hydroponics/hydro_tray.dm | 34 +--
code/modules/hydroponics/seed_datums.dm | 4 +-
code/modules/hydroponics/vines.dm | 23 +-
code/modules/lighting/__lighting_docs.dm | 74 +++++
code/modules/lighting/light_source.dm | 286 ++++++++++++++++++
code/modules/lighting/lighting_atom.dm | 77 +++++
code/modules/lighting/lighting_overlay.dm | 115 +++++++
code/modules/lighting/lighting_system.dm | 29 ++
code/modules/lighting/lighting_turf.dm | 3 +-
.../media/broadcast/transmitters/broadcast.dm | 6 +-
code/modules/media/jukebox.dm | 6 +-
code/modules/medical/cloning.dm | 13 +-
code/modules/medical/computer/cloning.dm | 2 +-
code/modules/mining/machine_processing.dm | 10 +-
code/modules/mining/machine_stacking.dm | 2 +-
code/modules/mining/mine_items.dm | 6 +-
code/modules/mining/mine_structures.dm | 20 +-
code/modules/mining/ores_coins.dm | 2 +-
code/modules/mining/surprise.dm | 2 +
code/modules/mob/living/carbon/human/life.dm | 19 +-
code/modules/mob/living/carbon/monkey/life.dm | 9 +-
code/modules/mob/living/living_defense.dm | 4 +-
code/modules/mob/living/silicon/ai/ai.dm | 6 +-
.../silicon/ai/freelook/update_triggers.dm | 2 +-
code/modules/mob/living/silicon/ai/life.dm | 17 +-
.../mob/living/silicon/mommi/inventory.dm | 6 +-
.../mob/living/silicon/mommi/update_icons.dm | 6 +-
.../mob/living/silicon/robot/inventory.dm | 8 +-
.../modules/mob/living/silicon/robot/robot.dm | 2 +-
.../mob/living/simple_animal/constructs.dm | 2 +-
.../living/simple_animal/friendly/corgi.dm | 2 +-
code/modules/mob/mob.dm | 4 +-
code/modules/power/apc.dm | 9 +-
code/modules/power/cable.dm | 12 +-
code/modules/power/cable_heavyduty.dm | 2 +-
code/modules/power/gravitygenerator.dm | 6 +-
code/modules/power/lighting.dm | 54 ++--
code/modules/power/monitor.dm | 5 +
code/modules/power/power.dm | 11 +-
.../particle_accelerator/particle_control.dm | 2 +-
code/modules/power/solars/control.dm | 7 +-
code/modules/power/turbine.dm | 2 +-
code/modules/projectiles/projectile/flare.dm | 4 +-
code/modules/reagents/Chemistry-Machinery.dm | 7 +-
.../reagent_containers/food/drinks.dm | 16 +-
.../food/drinks/drinkingglass.dm | 6 +-
.../reagent_containers/food/snacks/grown.dm | 31 +-
code/modules/recycling/disposal.dm | 22 +-
code/modules/research/protolathe.dm | 6 +-
code/modules/research/rdconsole.dm | 14 +-
code/modules/research/research_shuttle.dm | 2 +-
code/modules/research/server.dm | 2 +-
.../spells/aoe_turf/conjure/construct.dm | 2 +-
code/modules/supermatter/supermatter.dm | 6 +-
code/modules/telesci/telesci_computer.dm | 2 +-
code/modules/virus2/centrifuge.dm | 4 +-
code/modules/virus2/diseasesplicer.dm | 2 +-
code/modules/virus2/effect.dm | 2 +-
icons/effects/lighting_overlay.dmi | Bin 0 -> 260 bytes
vgstation13.dme | 8 +-
192 files changed, 1502 insertions(+), 1145 deletions(-)
create mode 100644 code/controllers/Processes/lighting (OLD).dm
create mode 100644 code/modules/lighting/__lighting_docs.dm
create mode 100644 code/modules/lighting/light_source.dm
create mode 100644 code/modules/lighting/lighting_atom.dm
create mode 100644 code/modules/lighting/lighting_overlay.dm
create mode 100644 code/modules/lighting/lighting_system.dm
create mode 100644 icons/effects/lighting_overlay.dmi
diff --git a/code/ATMOSPHERICS/hvac/chiller.dm b/code/ATMOSPHERICS/hvac/chiller.dm
index 204c00d1e66..18fdf5ad0de 100644
--- a/code/ATMOSPHERICS/hvac/chiller.dm
+++ b/code/ATMOSPHERICS/hvac/chiller.dm
@@ -10,7 +10,7 @@
var/cooling_power = 40000
base_state = "aircond"
- l_color = LIGHT_COLOR_CYAN
+ light_color = LIGHT_COLOR_CYAN
flags = FPRINT
diff --git a/code/ATMOSPHERICS/hvac/spaceheater.dm b/code/ATMOSPHERICS/hvac/spaceheater.dm
index 481f0d03dab..cb0c89cf3c4 100644
--- a/code/ATMOSPHERICS/hvac/spaceheater.dm
+++ b/code/ATMOSPHERICS/hvac/spaceheater.dm
@@ -11,7 +11,9 @@
var/heating_power = 40000
var/base_state = "sheater"
- l_color = LIGHT_COLOR_ORANGE
+ light_power_on = 0.75
+ light_range_on = 2
+ light_color = LIGHT_COLOR_ORANGE
ghost_read = 0
ghost_write = 0
@@ -31,7 +33,7 @@
/obj/machinery/space_heater/update_icon()
overlays.len = 0
icon_state = "[base_state][on]"
- SetLuminosity(on ? 1 : 0)
+ set_light(on ? light_range_on : 0, light_power_on)
if(panel_open)
overlays += "[base_state]-open"
return
diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm
index 9042dd167fc..198e54d8393 100644
--- a/code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm
@@ -3,7 +3,7 @@
name = "R-UST Mk. 7 Core Control"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core_control"
- l_color = LIGHT_COLOR_ORANGE
+ light_color = LIGHT_COLOR_ORANGE
var/list/connected_devices = list()
var/scan_range = 25
diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_gen.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_gen.dm
index c1789d28c3c..1112bdc4c5b 100644
--- a/code/WorkInProgress/Cael_Aislinn/Rust/core_gen.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_gen.dm
@@ -52,7 +52,9 @@ max volume of plasma storeable by the field = the total volume of a number of ti
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core0"
density = 1
- l_color = LIGHT_COLOR_BLUE
+ light_power_on = 2
+ light_range_on = 3
+ light_color = LIGHT_COLOR_BLUE
var/obj/effect/rust_em_field/owned_field
var/field_strength = 1//0.01
@@ -117,7 +119,7 @@ max volume of plasma storeable by the field = the total volume of a number of ti
owned_field = new(loc, src)
owned_field.ChangeFieldStrength(field_strength)
owned_field.ChangeFieldFrequency(field_frequency)
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
icon_state = "core1"
use_power = 2
. = 1
@@ -129,7 +131,7 @@ max volume of plasma storeable by the field = the total volume of a number of ti
icon_state = "core0"
qdel(owned_field)
use_power = 1
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/power/rust_core/proc/AddParticles(var/name, var/quantity = 1)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/power/rust_core/proc/AddParticles() called tick#: [world.time]")
diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_monitor.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_monitor.dm
index b2f154bdf5e..f101ce02827 100644
--- a/code/WorkInProgress/Cael_Aislinn/Rust/core_monitor.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_monitor.dm
@@ -1,7 +1,7 @@
/obj/machinery/computer/rust_core_monitor
name = "R-UST Mk. 7 Tokamak Core Monitoring Computer"
icon_state = "power"
- l_color = LIGHT_COLOR_YELLOW
+ light_color = LIGHT_COLOR_YELLOW
circuit = /obj/item/weapon/circuitboard/rust_core_monitor
var/obj/machinery/power/rust_core/linked_core
diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/gyrotron_controller.dm b/code/WorkInProgress/Cael_Aislinn/Rust/gyrotron_controller.dm
index 82368bd2445..11a9cf69fe9 100644
--- a/code/WorkInProgress/Cael_Aislinn/Rust/gyrotron_controller.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Rust/gyrotron_controller.dm
@@ -4,7 +4,7 @@
name = "Gyrotron Remote Controller"
icon_state = "engine"
circuit = /obj/item/weapon/circuitboard/rust_gyrotron_control
- l_color = LIGHT_COLOR_BLUE
+ light_color = LIGHT_COLOR_BLUE
var/list/linked_gyrotrons[0] //List of linked gyrotrons.
diff --git a/code/WorkInProgress/Mini/atmos_control.dm b/code/WorkInProgress/Mini/atmos_control.dm
index c2e807b3c26..4e6dafea9e4 100644
--- a/code/WorkInProgress/Mini/atmos_control.dm
+++ b/code/WorkInProgress/Mini/atmos_control.dm
@@ -25,7 +25,7 @@ var/global/list/atmos_controllers = list()
var/overridden = 0 //not set yet, can't think of a good way to do it
req_one_access = list(access_ce)
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/atmoscontrol/New()
..()
diff --git a/code/WorkInProgress/buildmode.dm b/code/WorkInProgress/buildmode.dm
index 7ec6275d8d0..3119fbff927 100644
--- a/code/WorkInProgress/buildmode.dm
+++ b/code/WorkInProgress/buildmode.dm
@@ -421,7 +421,7 @@ obj/effect/bmode/buildholder/New()
A.maptext = holder.buildmode.copycat.maptext
A.maptext_height = holder.buildmode.copycat.maptext_height
A.maptext_width = holder.buildmode.copycat.maptext_width
- A.l_color = holder.buildmode.copycat.l_color
+ A.light_color = holder.buildmode.copycat.light_color
A.luminosity = holder.buildmode.copycat.luminosity
A.molten = holder.buildmode.copycat.molten
A.pixel_x = holder.buildmode.copycat.pixel_x
diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm
index ed94da2a0ea..bfe589a07cb 100644
--- a/code/ZAS/Fire.dm
+++ b/code/ZAS/Fire.dm
@@ -130,13 +130,13 @@ Attach to transfer valve and open. BOOM.
anchored = 1
mouse_opacity = 0
- //luminosity = 3
+ blend_mode = BLEND_ADD
icon = 'icons/effects/fire.dmi'
icon_state = "1"
layer = TURF_LAYER
- l_color = "#ED9200"
+ light_color = LIGHT_COLOR_FIRE
/obj/fire/proc/Extinguish()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/fire/proc/Extinguish() called tick#: [world.time]")
@@ -191,13 +191,13 @@ Attach to transfer valve and open. BOOM.
if(firelevel > 6)
icon_state = "3"
- SetLuminosity(7)
+ set_light(7, 3)
else if(firelevel > 2.5)
icon_state = "2"
- SetLuminosity(5)
+ set_light(5, 2)
else
icon_state = "1"
- SetLuminosity(3)
+ set_light(3, 1)
//im not sure how to implement a version that works for every creature so for now monkeys are firesafe
for(var/mob/living/carbon/human/M in loc)
@@ -253,13 +253,13 @@ Attach to transfer valve and open. BOOM.
/obj/fire/New()
. = ..()
dir = pick(cardinal)
- SetLuminosity(3)
+ set_light(3)
air_master.active_hotspots.Add(src)
/obj/fire/Destroy()
air_master.active_hotspots.Remove(src)
- SetLuminosity(0)
+ set_light(0)
..()
turf/simulated/var/fire_protection = 0 //Protects newly extinguished tiles from being overrun again.
diff --git a/code/__HELPERS/_macros.dm b/code/__HELPERS/_macros.dm
index 76475c6d7bc..db2cfec4eae 100644
--- a/code/__HELPERS/_macros.dm
+++ b/code/__HELPERS/_macros.dm
@@ -93,6 +93,8 @@
#define iscamera(A) istype(A, /obj/machinery/camera)
+#define islightingoverlay(A) (istype(A, /atom/movable/lighting_overlay))
+
//Macros for antags
#define isvampire(H) ((H.mind in ticker.mode.vampires) || H.mind.vampire)
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index a0abfeed006..01f06e10cc8 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -28,8 +28,8 @@
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/get_area_master() called tick#: [world.time]")
var/area/A = get_area(O)
- if (isarea(A))
- return A.master
+ if(isarea(A))
+ return A
/proc/get_area_name(N) //get area by its name
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/get_area_name() called tick#: [world.time]")
diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm
index 0391912c694..7f64246e62b 100644
--- a/code/__HELPERS/maths.dm
+++ b/code/__HELPERS/maths.dm
@@ -5,11 +5,13 @@
var/const/E = 2.71828183
var/const/Sqrt2 = 1.41421356
+/* //All point fingers and laugh at this joke of a list, I even heard using sqrt() is faster than this list lookup, honk.
// List of square roots for the numbers 1-100.
var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10)
+*/
/proc/Atan2(x, y)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/Atan2() called tick#: [world.time]")
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 002e6ec3d9b..55e260fbba2 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -800,14 +800,10 @@ proc/GaussRandRound(var/sigma,var/roundto)
/proc/SortAreas()
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/SortAreas() called tick#: [world.time]")
for(var/area/A in areas)
- if(A.lighting_subarea)
- continue
sortedAreas.Add(A)
sortTim(sortedAreas, /proc/cmp_name_asc)
-
-
/area/proc/addSorted()
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/area/proc/addSorted() called tick#: [world.time]")
sortedAreas.Add(src)
@@ -1450,6 +1446,28 @@ proc/find_holder_of_type(var/atom/reference,var/typepath) //Returns the first ob
return locate(dest_x,dest_y,dest_z)
+//Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant).
+/proc/dview(var/range = world.view, var/center, var/invis_flags = 0)
+ //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/dview() called tick#: [world.time]")
+ if(!center)
+ return
+
+ var/global/mob/dview/DV
+ if(!DV)
+ DV = new
+
+ DV.loc = center
+
+ DV.see_in_dark = range
+ DV.see_invisible = invis_flags
+
+ . = view(range, DV)
+ DV.loc = null
+
+/mob/dview
+ invisibility = 101
+ density = 0
+
//Gets the Z level datum for this atom's Z level
/proc/get_z_level(var/atom/A)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/get_z_level() called tick#: [world.time]")
diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm
index 0119a3ebd30..52dc1c89b1a 100644
--- a/code/_onclick/observer.dm
+++ b/code/_onclick/observer.dm
@@ -19,11 +19,10 @@
if(!targetarea)
return
var/list/turfs = list()
- for(var/area/Ar in targetarea.related)
- for(var/turf/T in Ar)
- if(T.density)
- continue
- turfs.Add(T)
+ for(var/turf/T in targetarea)
+ if(T.density)
+ continue
+ turfs.Add(T)
targetloc = pick_n_take(turfs)
if(!targetloc)
diff --git a/code/controllers/Processes/lighting (OLD).dm b/code/controllers/Processes/lighting (OLD).dm
new file mode 100644
index 00000000000..bbf9ecd2f99
--- /dev/null
+++ b/code/controllers/Processes/lighting (OLD).dm
@@ -0,0 +1,26 @@
+/datum/controller/process/lighting/setup()
+ name = "lighting"
+ schedule_interval = 5 // every .5 second
+ lighting_controller.Initialize()
+
+/datum/controller/process/lighting/doWork()
+ lighting_controller.lights_workload_max = \
+ max(lighting_controller.lights_workload_max, lighting_controller.lights.len)
+
+ for(var/datum/light_source/L in lighting_controller.lights)
+ if(L && L.check())
+ lighting_controller.lights.Remove(L)
+
+ scheck()
+
+ lighting_controller.changed_turfs_workload_max = \
+ max(lighting_controller.changed_turfs_workload_max, lighting_controller.changed_turfs.len)
+
+ for(var/turf/T in lighting_controller.changed_turfs)
+ if(T && T.lighting_changed)
+ T.shift_to_subarea()
+
+ scheck()
+
+ if(lighting_controller.changed_turfs && lighting_controller.changed_turfs.len)
+ lighting_controller.changed_turfs.len = 0 // reset the changed list
diff --git a/code/controllers/Processes/lighting.dm b/code/controllers/Processes/lighting.dm
index 285e2b26a85..acaa0da427d 100644
--- a/code/controllers/Processes/lighting.dm
+++ b/code/controllers/Processes/lighting.dm
@@ -1,28 +1,38 @@
/datum/controller/process/lighting
- schedule_interval = LIGHTING_INTERVAL // every .5 second
+ schedule_interval = LIGHTING_INTERVAL
/datum/controller/process/lighting/setup()
name = "lighting"
- lighting_controller.Initialize()
+
+ create_lighting_overlays()
/datum/controller/process/lighting/doWork()
- lighting_controller.lights_workload_max = \
- max(lighting_controller.lights_workload_max, lighting_controller.lights.len)
+ var/list/lighting_update_lights_old = lighting_update_lights //We use a different list so any additions to the update lists during a delay from scheck() don't cause things to be cut from the list without being updated.
+ lighting_update_lights = null //Nulling it first because of http://www.byond.com/forum/?post=1854520
+ lighting_update_lights = list()
- for(var/datum/light_source/L in lighting_controller.lights)
- if(L && L.check())
- lighting_controller.lights.Remove(L)
+ for(var/datum/light_source/L in lighting_update_lights_old)
+ . = L.check()
+ if(L.destroyed || . || L.force_update)
+ L.remove_lum()
+ if(!L.destroyed)
+ L.apply_lum()
+
+ else if(L.vis_update) //We smartly update only tiles that became (in) visible to use.
+ L.smart_vis_update()
+
+ L.vis_update = 0
+ L.force_update = 0
+ L.needs_update = 0
scheck()
- lighting_controller.changed_turfs_workload_max = \
- max(lighting_controller.changed_turfs_workload_max, lighting_controller.changed_turfs.len)
+ var/list/lighting_update_overlays_old = lighting_update_overlays //Same as above.
+ lighting_update_overlays = null //Same as above
+ lighting_update_overlays = list()
- for(var/turf/T in lighting_controller.changed_turfs)
- if(T && T.lighting_changed)
- T.shift_to_subarea()
+ for(var/atom/movable/lighting_overlay/O in lighting_update_overlays_old)
+ O.update_overlay()
+ O.needs_update = 0
scheck()
-
- if(lighting_controller.changed_turfs && lighting_controller.changed_turfs.len)
- lighting_controller.changed_turfs.len = 0 // reset the changed list
diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm
index 954bd005072..1b8288d32c9 100644
--- a/code/controllers/failsafe.dm
+++ b/code/controllers/failsafe.dm
@@ -59,21 +59,4 @@ var/global/datum/controller/failsafe/failsafe
masterControllerAlertLevel = 0
masterControllerIteration = master_controller.iteration
- if(lighting_controller.processing)
- if(lightingControllerIteration == lighting_controller.iteration) // Lighting controller hasn't finished processing in the defined interval.
- switch(lightingControllerAlertLevel)
- if(0 to 3)
- lightingControllerAlertLevel++
- if(4)
- admins << "Warning. The lighting_controller controller has not fired in the last [lightingControllerAlertLevel * processing_interval] ticks. Automatic restart in [processing_interval] ticks."
- lightingControllerAlertLevel = 5
- if(5)
- admins << "Warning. The lighting_controller controller has still not fired within the last [lightingControllerAlertLevel * processing_interval] ticks. Killing and restarting..."
- new /datum/controller/lighting() // Replace the old lighting_controller (hence killing the old one's process).
- lighting_controller.process() // Start it rolling again.
- lightingControllerAlertLevel = 0
- else
- lightingControllerAlertLevel = 0
- lightingControllerIteration = lighting_controller.iteration
-
sleep(processing_interval)
diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm
index 0e35bc5b47f..6e62104f3d3 100644
--- a/code/controllers/shuttle_controller.dm
+++ b/code/controllers/shuttle_controller.dm
@@ -50,7 +50,7 @@ datum/shuttle_controller/proc/incall(coeff = 1)
//turning on the red lights in hallways
if(alert == 0)
for(var/area/A in areas)
- if(istype(A, /area/hallway) && !A.lighting_subarea)
+ if(istype(A, /area/hallway))
A.readyalert()
datum/shuttle_controller/proc/shuttlealert(var/X)
@@ -80,7 +80,7 @@ datum/shuttle_controller/proc/recall()
setdirection(-1)
online = 1
for(var/area/A in areas)
- if(istype(A, /area/hallway) && !A.lighting_subarea)
+ if(istype(A, /area/hallway))
A.readyreset()
return
else //makes it possible to send shuttle back.
@@ -242,6 +242,8 @@ datum/shuttle_controller/emergency_shuttle/process()
var/turf/D = locate(T.x, throwy - 1, 1)
//var/turf/E = get_step(D, SOUTH)
for(var/atom/A as mob|obj in T)
+ if(istype(A, /atom/movable/lighting_overlay)) //This'd be a whole nother level of dumb
+ continue
if(ismob(A))
var/mob/M=A
M.gib()
diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm
index f5f6e0ae23b..24bfae82e26 100644
--- a/code/controllers/verbs.dm
+++ b/code/controllers/verbs.dm
@@ -18,10 +18,6 @@
if("Failsafe")
new /datum/controller/failsafe()
feedback_add_details("admin_verb","RFailsafe")
- if("Lighting")
- new /datum/controller/lighting()
- lighting_controller.process()
- feedback_add_details("admin_verb","RLighting")
if("Supply Shuttle")
supply_shuttle.process()
feedback_add_details("admin_verb","RSupply")
@@ -35,7 +31,7 @@
return
-/client/proc/debug_controller(controller in list("Air", "Cameras", "Configuration", "Emergency Shuttle", "failsafe", "Garbage", "Jobs", "lighting", "master", "pAI", "Radio", "Scheduler", "Sun", "Supply Shuttle", "Ticker"))
+/client/proc/debug_controller(controller in list("Air", "Cameras", "Configuration", "Emergency Shuttle", "failsafe", "Garbage", "Jobs", "master", "pAI", "Radio", "Scheduler", "Sun", "Supply Shuttle", "Ticker"))
set category = "Debug"
set name = "debug controller"
set desc = "debug the various periodic loop controllers for the game (be careful!)."
@@ -54,9 +50,6 @@
if("Ticker")
debug_variables(ticker)
feedback_add_details("admin_verb","DTicker")
- if ("lighting")
- debug_variables(lighting_controller)
- feedback_add_details("admin_verb", "dlighting")
if("Air")
debug_variables(air_master)
feedback_add_details("admin_verb","DAir")
diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm
index cd2cf7ae3bd..b02569bd3f4 100755
--- a/code/game/area/Space Station 13 areas.dm
+++ b/code/game/area/Space Station 13 areas.dm
@@ -28,7 +28,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
icon_state = "unknown"
layer = 10
mouse_opacity = 0
- invisibility = INVISIBILITY_LIGHTING
+ luminosity = 0
var/lightswitch = 1
var/eject = null
@@ -50,9 +50,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/has_gravity = 1
var/no_air = null
- var/area/master // master area used for power calcluations
- // (original area before splitting due to sd_DAL)
- var/list/related // the other areas of the same type as this
// var/list/lights // list of all lights on this area
var/list/all_doors = list() //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area
@@ -146,10 +143,9 @@ proc/process_adminbus_teleport_locs()
//place to another. Look at escape shuttle for example.
//All shuttles show now be under shuttle since we have smooth-wall code.
-/area/shuttle //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
+/area/shuttle
requires_power = 0
- luminosity = 1
- lighting_use_dynamic = 0
+ lighting_use_dynamic = 0 //Lighting STILL disabled, even with the new bay engine, because lighting doesn't play nice with our shuttles, might just be our shuttle code, or the small changes in the lighting engine we have from bay.
/area/shuttle/arrival
name = "\improper Arrival Shuttle"
@@ -250,15 +246,11 @@ proc/process_adminbus_teleport_locs()
icon_state = "shuttle"
name = "\improper Alien Shuttle Base"
requires_power = 1
- luminosity = 0
- lighting_use_dynamic = 1
/area/shuttle/alien/mine
icon_state = "shuttle"
name = "\improper Alien Shuttle Mine"
requires_power = 1
- luminosity = 0
- lighting_use_dynamic = 1
/area/shuttle/prison/
name = "\improper Prison Shuttle"
@@ -337,8 +329,6 @@ proc/process_adminbus_teleport_locs()
name = "\improper Vox Skipjack"
icon_state = "yellow"
requires_power = 0
- lighting_use_dynamic = 0
- luminosity=1
/area/shuttle/salvage
name = "\improper Salvage Ship"
@@ -459,7 +449,6 @@ proc/process_adminbus_teleport_locs()
name = "start area"
icon_state = "start"
requires_power = 0
- luminosity = 1
lighting_use_dynamic = 0
has_gravity = 1
@@ -476,6 +465,7 @@ proc/process_adminbus_teleport_locs()
name = "\improper Centcom"
icon_state = "centcom"
requires_power = 0
+ lighting_use_dynamic = 0
/area/centcom/control
name = "\improper Centcom Control"
@@ -513,6 +503,7 @@ proc/process_adminbus_teleport_locs()
name = "\improper Syndicate Mothership"
icon_state = "syndie-ship"
requires_power = 0
+ lighting_use_dynamic = 0
/area/syndicate_mothership/control
name = "\improper Syndicate Control Room"
@@ -1053,7 +1044,6 @@ proc/process_adminbus_teleport_locs()
/area/holodeck
name = "\improper Holodeck"
icon_state = "Holodeck"
- luminosity = 1
lighting_use_dynamic = 0
/area/holodeck/alphadeck
@@ -1187,7 +1177,6 @@ proc/process_adminbus_teleport_locs()
/area/solar
requires_power = 0
- luminosity = 1
lighting_use_dynamic = 0
/area/solar/fport
@@ -1888,25 +1877,21 @@ proc/process_adminbus_teleport_locs()
/area/turret_protected/AIsatextFP
name = "\improper AI Sat Ext"
icon_state = "storage"
- luminosity = 1
lighting_use_dynamic = 0
/area/turret_protected/AIsatextFS
name = "\improper AI Sat Ext"
icon_state = "storage"
- luminosity = 1
lighting_use_dynamic = 0
/area/turret_protected/AIsatextAS
name = "\improper AI Sat Ext"
icon_state = "storage"
- luminosity = 1
lighting_use_dynamic = 0
/area/turret_protected/AIsatextAP
name = "\improper AI Sat Ext"
icon_state = "storage"
- luminosity = 1
lighting_use_dynamic = 0
/area/turret_protected/NewAIMain
@@ -2061,31 +2046,26 @@ proc/process_adminbus_teleport_locs()
/area/awaymission/wwmines
name = "\improper Wild West Mines"
icon_state = "away1"
- luminosity = 1
requires_power = 0
/area/awaymission/wwgov
name = "\improper Wild West Mansion"
icon_state = "away2"
- luminosity = 1
requires_power = 0
/area/awaymission/wwrefine
name = "\improper Wild West Refinery"
icon_state = "away3"
- luminosity = 1
requires_power = 0
/area/awaymission/wwvault
name = "\improper Wild West Vault"
icon_state = "away3"
- luminosity = 0
/area/awaymission/wwvaultdoors
name = "\improper Wild West Vault Doors" // this is to keep the vault area being entirely lit because of requires_power
icon_state = "away2"
requires_power = 0
- luminosity = 0
/area/awaymission/desert
name = "Mars"
@@ -2143,7 +2123,6 @@ proc/process_adminbus_teleport_locs()
/area/awaymission/beach
name = "Beach"
icon_state = "null"
- luminosity = 1
lighting_use_dynamic = 0
requires_power = 0
var/sound/mysound = null
@@ -2269,7 +2248,6 @@ var/list/the_station_areas = list (
/area/beach/
name = "The metaclub's private beach"
icon_state = "null"
- luminosity = 1
lighting_use_dynamic = 0
requires_power = 0
var/sound/mysound = null
diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 9930ac3c231..d0de787f203 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -10,9 +10,7 @@
/area/New()
icon_state = ""
layer = 10
- master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references loc.loc.master ~Carn
uid = ++global_uid
- related = list(src)
areas |= src
if(type == /area) // override defaults for space. TODO: make space areas of type /area/space rather than /area
@@ -25,25 +23,18 @@
// lighting_state = 4
//has_gravity = 0 // Space has gravity. Because.. because.
- if(requires_power)
- luminosity = 0
- else
+ if(!requires_power)
power_light = 0 //rastaf0
power_equip = 0 //rastaf0
power_environ = 0 //rastaf0
- luminosity = 1
- lighting_use_dynamic = 0
..()
// spawn(15)
power_change() // all machines set to current power level, also updates lighting icon
- InitializeLighting()
/area/Destroy()
..()
- for(var/area/A in src.related)
- A.related -= src
areaapc = null
/*
@@ -54,18 +45,14 @@
* If you want to find machines, mobs, etc, in the same logical area,
* you will need to check all the related areas.
* This returns a master contents list to assist in that.
+ * NOTE: Due to a new lighting engine this is now deprecated, but we're keeping this because I can't be bothered to relace everything that references this.
*/
/proc/area_contents(const/area/A)
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/area_contents() called tick#: [world.time]")
if (!isarea(A))
return
- var/list/contents = list()
-
- for(var/area/LSA in A.related)
- contents |= LSA.contents
-
- return contents
+ return A.contents
/area/proc/poweralert(var/state, var/obj/source as obj)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/poweralert() called tick#: [world.time]")
@@ -74,13 +61,12 @@
poweralm = state
if(istype(source)) //Only report power alarms on the z-level where the source is located.
var/list/cameras = list()
- for (var/area/RA in related)
- for (var/obj/machinery/camera/C in RA)
- cameras += C
- if(state == 1)
- C.network.Remove("Power Alarms")
- else
- C.network.Add("Power Alarms")
+ for(var/obj/machinery/camera/C in src)
+ cameras += C
+ if(state == 1)
+ C.network.Remove("Power Alarms")
+ else
+ C.network.Add("Power Alarms")
for (var/mob/living/silicon/aiPlayer in player_list)
if(aiPlayer.z == source.z)
if (state == 1)
@@ -88,7 +74,7 @@
else
aiPlayer.triggerAlarm("Power", src, cameras, source)
for(var/obj/machinery/computer/station_alert/a in machines)
- if(master in (a.covered_areas))
+ if(src in (a.covered_areas))
if(state == 1)
a.cancelAlarm("Power", src, source)
else
@@ -109,16 +95,15 @@
var/danger_level = 0
// Determine what the highest DL reported by air alarms is
- for (var/area/RA in related)
- for(var/obj/machinery/alarm/AA in RA)
- if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
- continue
- var/reported_danger_level=AA.local_danger_level
- if(AA.alarmActivated)
- reported_danger_level=2
- if(reported_danger_level>danger_level)
- danger_level=reported_danger_level
- //testing("Danger level at [AA.name]: [AA.local_danger_level] (reported [reported_danger_level])")
+ for(var/obj/machinery/alarm/AA in src)
+ if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
+ continue
+ var/reported_danger_level=AA.local_danger_level
+ if(AA.alarmActivated)
+ reported_danger_level=2
+ if(reported_danger_level>danger_level)
+ danger_level=reported_danger_level
+ //testing("Danger level at [AA.name]: [AA.local_danger_level] (reported [reported_danger_level])")
//testing("Danger level decided upon in [name]: [danger_level] (from [atmosalm])")
@@ -127,27 +112,25 @@
// Going to danger level 2 from something else
if (danger_level == 2)
var/list/cameras = list()
- for(var/area/RA in related)
- //updateicon()
- for(var/obj/machinery/camera/C in RA)
- cameras += C
- C.network.Add("Atmosphere Alarms")
+ //updateicon()
+ for(var/obj/machinery/camera/C in src)
+ cameras += C
+ C.network.Add("Atmosphere Alarms")
for(var/mob/living/silicon/aiPlayer in player_list)
aiPlayer.triggerAlarm("Atmosphere", src, cameras, src)
for(var/obj/machinery/computer/station_alert/a in machines)
- if(master in (a.covered_areas))
+ if(src in (a.covered_areas))
a.triggerAlarm("Atmosphere", src, cameras, src)
door_alerts |= DOORALERT_ATMOS
UpdateFirelocks()
// Dropping from danger level 2.
else if (atmosalm == 2)
- for(var/area/RA in related)
- for(var/obj/machinery/camera/C in RA)
- C.network.Remove("Atmosphere Alarms")
+ for(var/obj/machinery/camera/C in src)
+ C.network.Remove("Atmosphere Alarms")
for(var/mob/living/silicon/aiPlayer in player_list)
aiPlayer.cancelAlarm("Atmosphere", src, src)
for(var/obj/machinery/computer/station_alert/a in machines)
- if(master in (a.covered_areas))
+ if(src in (a.covered_areas))
a.cancelAlarm("Atmosphere", src, src)
door_alerts &= ~DOORALERT_ATMOS
UpdateFirelocks()
@@ -163,15 +146,14 @@
var/danger_level = 0
// Determine what the highest DL reported by air alarms is
- for (var/area/RA in related)
- for(var/obj/machinery/alarm/AA in RA)
- if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
- continue
- var/reported_danger_level=AA.local_danger_level
- if(AA.alarmActivated)
- reported_danger_level=2
- if(reported_danger_level>danger_level)
- danger_level=reported_danger_level
+ for(var/obj/machinery/alarm/AA in src)
+ if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
+ continue
+ var/reported_danger_level=AA.local_danger_level
+ if(AA.alarmActivated)
+ reported_danger_level=2
+ if(reported_danger_level>danger_level)
+ danger_level=reported_danger_level
if (danger_level == 2)
a.triggerAlarm("Atmosphere", src, null, src)
@@ -223,14 +205,13 @@
door_alerts |= DOORALERT_FIRE
UpdateFirelocks()
var/list/cameras = list()
- for(var/area/RA in related)
- for (var/obj/machinery/camera/C in RA)
- cameras.Add(C)
- C.network.Add("Fire Alarms")
+ for (var/obj/machinery/camera/C in src)
+ cameras.Add(C)
+ C.network.Add("Fire Alarms")
for (var/mob/living/silicon/ai/aiPlayer in player_list)
aiPlayer.triggerAlarm("Fire", src, cameras, src)
for (var/obj/machinery/computer/station_alert/a in machines)
- if(master in (a.covered_areas))
+ if(src in (a.covered_areas))
a.triggerAlarm("Fire", src, cameras, src)
/area/proc/send_firealert(var/obj/machinery/computer/station_alert/a)//sending alerts to newly built Station Alert Computers.
@@ -244,13 +225,12 @@
fire = 0
mouse_opacity = 0
updateicon()
- for(var/area/RA in related)
- for (var/obj/machinery/camera/C in RA)
- C.network.Remove("Fire Alarms")
+ for (var/obj/machinery/camera/C in src)
+ C.network.Remove("Fire Alarms")
for (var/mob/living/silicon/ai/aiPlayer in player_list)
aiPlayer.cancelAlarm("Fire", src, src)
for (var/obj/machinery/computer/station_alert/a in machines)
- if(master in (a.covered_areas))
+ if(src in (a.covered_areas))
a.cancelAlarm("Fire", src, src)
door_alerts &= ~DOORALERT_FIRE
UpdateFirelocks()
@@ -327,12 +307,6 @@
// new lighting behaviour with obj lights
icon_state = null
- // We're master, Update children.
- for(var/area/A in related)
- if(A && A!=src)
- // Propogate
- A.icon_state=icon_state
-
/*
#define EQUIP 1
@@ -344,17 +318,17 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/powered() called tick#: [world.time]")
- if(!master.requires_power)
+ if(!requires_power)
return 1
- if(master.always_unpowered)
+ if(always_unpowered)
return 0
switch(chan)
if(EQUIP)
- return master.power_equip
+ return power_equip
if(LIGHT)
- return master.power_light
+ return power_light
if(ENVIRON)
- return master.power_environ
+ return power_environ
return 0
@@ -363,29 +337,28 @@
*/
/area/proc/power_change()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/power_change() called tick#: [world.time]")
- for(var/area/RA in related)
- for(var/obj/machinery/M in RA) // for each machine in the area
- M.power_change() // reverify power status (to update icons etc.)
- if (fire || eject || party)
- RA.updateicon()
+ for(var/obj/machinery/M in src) // for each machine in the area
+ M.power_change() // reverify power status (to update icons etc.)
+ if (fire || eject || party)
+ updateicon()
/area/proc/usage(const/chan)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/usage() called tick#: [world.time]")
switch (chan)
if (LIGHT)
- return master.used_light
+ return used_light
if (EQUIP)
- return master.used_equip
+ return used_equip
if (ENVIRON)
- return master.used_environ
+ return used_environ
if (TOTAL)
- return master.used_light + master.used_equip + master.used_environ
+ return used_light + used_equip + used_environ
if(STATIC_EQUIP)
- return master.static_equip
+ return static_equip
if(STATIC_LIGHT)
- return master.static_light
+ return static_light
if(STATIC_ENVIRON)
- return master.static_environ
+ return static_environ
return 0
/area/proc/addStaticPower(value, powerchannel)
@@ -399,36 +372,36 @@
static_environ += value
/area/proc/clear_usage()
- master.used_equip = 0
- master.used_light = 0
- master.used_environ = 0
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/clear_usage() called tick#: [world.time]")
+ used_equip = 0
+ used_light = 0
+ used_environ = 0
/area/proc/use_power(const/amount, const/chan)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/use_power() called tick#: [world.time]")
switch (chan)
if(EQUIP)
- master.used_equip += amount
+ used_equip += amount
if(LIGHT)
- master.used_light += amount
+ used_light += amount
if(ENVIRON)
- master.used_environ += amount
+ used_environ += amount
/area/Entered(atom/movable/Obj, atom/OldLoc)
- var/area/oldAreaMaster = Obj.areaMaster
- Obj.areaMaster = master
-
+ var/area/oldArea = Obj.areaMaster
+ Obj.areaMaster = src
if (!ismob(Obj))
return
var/mob/M = Obj
// /vg/ - EVENTS!
- CallHook("MobAreaChange", list("mob" = M, "new" = Obj.areaMaster, "old" = oldAreaMaster))
+ CallHook("MobAreaChange", list("mob" = M, "new" = Obj.areaMaster, "old" = oldArea))
// Being ready when you change areas gives you a chance to avoid falling all together.
- if(!oldAreaMaster || !M.areaMaster)
+ if(!oldArea || !M.areaMaster)
thunk(M)
- else if (!oldAreaMaster.has_gravity && M.areaMaster.has_gravity && M.m_intent == "run")
+ else if (!oldArea.has_gravity && M.areaMaster.has_gravity && M.m_intent == "run")
thunk(M)
if (isnull(M.client))
@@ -478,12 +451,11 @@
A.has_gravity = gravitystate
- for(var/area/SubA in A.related)
- SubA.has_gravity = gravitystate
+ A.has_gravity = gravitystate
- if(gravitystate)
- for(var/mob/living/carbon/human/M in SubA)
- thunk(M)
+ if(gravitystate)
+ for(var/mob/living/carbon/human/M in A)
+ thunk(M)
/area/proc/thunk(mob)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/thunk() called tick#: [world.time]")
@@ -506,11 +478,9 @@
/area/proc/set_apc(var/obj/machinery/power/apc/apctoset)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/set_apc() called tick#: [world.time]")
- for(var/area/A in src.related)
- A.areaapc = apctoset
+ areaapc = apctoset
/area/proc/remove_apc(var/obj/machinery/power/apc/apctoremove)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/area/proc/remove_apc() called tick#: [world.time]")
- for(var/area/A in src.related)
- if(A.areaapc == apctoremove)
- A.areaapc = null
+ if(areaapc == apctoremove)
+ areaapc = null
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index f30035d2c78..4e50ae7f6f9 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -20,7 +20,6 @@ var/global/list/ghdel_profiling = list()
var/throwpass = 0
var/germ_level = 0 // The higher the germ level, the more germ on the atom.
var/pressure_resistance = ONE_ATMOSPHERE
- var/simulated = 1 //filter for actions - used by lighting overlays
///Chemistry.
var/datum/reagents/reagents = null
@@ -118,8 +117,6 @@ var/global/list/ghdel_profiling = list()
..()
/atom/Destroy()
- SetOpacity(0)
-
if(reagents)
reagents.Destroy()
reagents = null
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index aad4c0a0cc6..8a66df49b6a 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -32,11 +32,6 @@
getFromPool(/mob/virtualhearer, src)
/atom/movable/Destroy()
- if(opacity)
- if(isturf(loc))
- if(loc:lighting_lumcount > 1)
- UpdateAffectingLights()
-
if(flags & HEAR && !ismob(src))
for(var/mob/virtualhearer/VH in virtualhearers)
if(VH.attached == src)
diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm
index dc06f089b92..1b5ea9ad6a5 100644
--- a/code/game/dna/dna_modifier.dm
+++ b/code/game/dna/dna_modifier.dm
@@ -51,13 +51,10 @@
var/obj/item/weapon/reagent_containers/glass/beaker = null
machine_flags = SCREWTOGGLE | CROWDESTROY
- l_color = "#7BF9FF"
- power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)) && src.occupant)
- SetLuminosity(2)
- else
- SetLuminosity(0)
+ light_color = LIGHT_COLOR_CYAN
+ use_auto_lights = 1
+ light_range_on = 3
+ light_power_on = 2
/obj/machinery/dna_scannernew/New()
. = ..()
@@ -351,7 +348,7 @@
// Fix for #274 (Mash create block injector without answering dialog to make unlimited injectors) - N3X.
var/waiting_for_user_input = 0
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/scan_consolenew/attackby(obj/O as obj, mob/user as mob)
..()
@@ -383,17 +380,6 @@
if(prob(75))
qdel(src)
-/obj/machinery/computer/scan_consolenew/power_change()
- if(stat & BROKEN)
- icon_state = "broken"
- else if(powered())
- icon_state = initial(icon_state)
- stat &= ~NOPOWER
- else
- spawn(rand(0, 15))
- src.icon_state = "c_unpowered"
- stat |= NOPOWER
-
/obj/machinery/computer/scan_consolenew/New()
..()
for(var/i=0;i<3;i++)
diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm
index 45e7f9eed53..74992ef10c4 100644
--- a/code/game/gamemodes/cult/cult_structures.dm
+++ b/code/game/gamemodes/cult/cult_structures.dm
@@ -22,8 +22,8 @@
desc = "A floating crystal that hums with an unearthly energy"
icon_state = "pylon"
var/isbroken = 0
- luminosity = 5
- l_color = "#3e0000"
+ light_range = 5
+ light_color = LIGHT_COLOR_RED
var/obj/item/wepon = null
/obj/structure/cult/pylon/attack_hand(mob/M as mob)
@@ -48,7 +48,7 @@
isbroken = 1
density = 0
icon_state = "pylon-broken"
- SetLuminosity(0)
+ set_light(0)
else
user << "You hit the pylon!"
playsound(get_turf(src), 'sound/effects/Glasshit.ogg', 75, 1)
@@ -68,14 +68,14 @@
isbroken = 0
density = 1
icon_state = "pylon"
- SetLuminosity(5)
+ set_light(5)
/obj/structure/cult/tome
name = "Desk"
desc = "A desk covered in arcane manuscripts and tomes in unknown languages. Looking at the text makes your skin crawl"
icon_state = "tomealtar"
- luminosity = 2
- l_color = "#3e0000"
+ light_range = 2
+ light_color = LIGHT_COLOR_RED
/obj/structure/cult/tome/attackby(obj/item/weapon/W as obj, mob/user as mob)
user.drop_item(W, src.loc)
@@ -113,7 +113,7 @@
/obj/effect/gateway/active
luminosity=5
- l_color="#ff0000"
+ light_color = LIGHT_COLOR_RED
spawnable=list(
/mob/living/simple_animal/hostile/scarybat,
/mob/living/simple_animal/hostile/creature,
@@ -122,7 +122,7 @@
/obj/effect/gateway/active/cult
luminosity=5
- l_color="#ff0000"
+ light_color = LIGHT_COLOR_RED
spawnable=list(
/mob/living/simple_animal/hostile/scarybat/cult,
/mob/living/simple_animal/hostile/creature/cult,
diff --git a/code/game/gamemodes/cult/hell_universe.dm b/code/game/gamemodes/cult/hell_universe.dm
index 7b6790943a7..6173ee8cc82 100644
--- a/code/game/gamemodes/cult/hell_universe.dm
+++ b/code/game/gamemodes/cult/hell_universe.dm
@@ -71,8 +71,7 @@ In short:
/datum/universal_state/hell/proc/AreaSet()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/hell/proc/AreaSet() called tick#: [world.time]")
- for(var/area/ca in areas)
- var/area/A=get_area_master(ca)
+ for(var/area/A in areas)
if(!istype(A,/area) || A.name=="Space")
continue
@@ -110,8 +109,12 @@ In short:
T.overlays += "hell01"
else
T.underlays += "hell01"
- T.update_lumcount(1, 255, 0, 0, 0)
tcheck(85,1)
+
+ for(var/atom/movable/lighting_overlay/L in all_lighting_overlays)
+ L.update_lumcount(0.5, 0, 0)
+ tcheck(80,1)
+
/datum/universal_state/hell/proc/MiscSet()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/hell/proc/MiscSet() called tick#: [world.time]")
for(var/turf/simulated/floor/T in turfs)
diff --git a/code/game/gamemodes/cult/narsie.dm b/code/game/gamemodes/cult/narsie.dm
index 74c5b324a9a..05bb8b6f2cc 100644
--- a/code/game/gamemodes/cult/narsie.dm
+++ b/code/game/gamemodes/cult/narsie.dm
@@ -32,8 +32,8 @@ var/global/list/narsie_list = list()
// Pixel stuff centers Narsie.
pixel_x = -236
pixel_y = -256
- luminosity = 1
- l_color = "#3e0000"
+ light_range = 1
+ light_color = LIGHT_COLOR_RED
current_size = 12
consume_range = 12 // How many tiles out do we eat.
diff --git a/code/game/gamemodes/endgame/endgame.dm b/code/game/gamemodes/endgame/endgame.dm
index e2ac58a635f..e9082aa3e03 100644
--- a/code/game/gamemodes/endgame/endgame.dm
+++ b/code/game/gamemodes/endgame/endgame.dm
@@ -24,6 +24,7 @@
// Simulates stuff getting broken due to molecular bonds decaying.
var/decay_rate = 0
+
// Actually decay the turf.
/datum/universal_state/proc/DecayTurf(var/turf/T)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/proc/DecayTurf() called tick#: [world.time]")
@@ -45,7 +46,7 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/proc/OnShuttleCall() called tick#: [world.time]")
return 1
-// Processed per tick
+// This gets called by lighting overlay updates, lighting_overlays.dm line #62.
/datum/universal_state/proc/OnTurfTick(var/turf/T)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/proc/OnTurfTick() called tick#: [world.time]")
if(decay_rate && prob(decay_rate))
diff --git a/code/game/gamemodes/endgame/supermatter_cascade/blob.dm b/code/game/gamemodes/endgame/supermatter_cascade/blob.dm
index b5f04501235..c2a2d6ca224 100644
--- a/code/game/gamemodes/endgame/supermatter_cascade/blob.dm
+++ b/code/game/gamemodes/endgame/supermatter_cascade/blob.dm
@@ -7,21 +7,22 @@
icon_state = "bluespace"
//luminosity = 5
- //l_color="#0066FF"
- layer = LIGHTING_LAYER+1
+ //light_color="#0066FF"
+ layer = LIGHTING_LAYER + 1
var/spawned=0 // DIR mask
var/next_check=0
var/list/avail_dirs = list(NORTH,SOUTH,EAST,WEST)
+ dynamic_lighting = 0
+
/turf/unsimulated/wall/supermatter/New()
- ..()
- processing_objects.Add(src)
- next_check = world.time+5 SECONDS
+ processing_objects |= src
+ return ..()
/turf/unsimulated/wall/supermatter/Destroy()
- processing_objects.Remove(src)
- ..()
+ processing_objects -= src
+ return ..()
/turf/unsimulated/wall/supermatter/process()
// Only check infrequently.
@@ -116,4 +117,4 @@
if(istype(user,/mob/dead/observer))
return
- del(user)
+ qdel(user)
diff --git a/code/game/gamemodes/endgame/supermatter_cascade/portal.dm b/code/game/gamemodes/endgame/supermatter_cascade/portal.dm
index 7cc2bb8fd22..f716e5c7ab7 100644
--- a/code/game/gamemodes/endgame/supermatter_cascade/portal.dm
+++ b/code/game/gamemodes/endgame/supermatter_cascade/portal.dm
@@ -10,7 +10,7 @@
announce=0
narnar=0
- layer=LIGHTING_LAYER+2 // ITS SO BRIGHT
+ layer = LIGHTING_LAYER + 2 // ITS SO BRIGHT
consume_range = 6
diff --git a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm
index da7a6674918..1a6244384df 100644
--- a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm
+++ b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm
@@ -3,7 +3,7 @@
name = "Supermatter Cascade"
desc = "Unknown harmonance affecting universal substructure, converting nearby matter to supermatter."
- decay_rate = 5 // 5% chance of a turf decaying on lighting update/airflow (there's no actual tick for turfs)
+ decay_rate = 5 // 5% chance of a turf decaying on lighting update (there's no actual tick for turfs). Code that triggers this is lighting_overlays.dm, line #62.
/datum/universal_state/supermatter_cascade/OnShuttleCall(var/mob/user)
if(user)
@@ -16,8 +16,6 @@
T.underlays -= "end01"
else
T.overlays -= "end01"
- if(!T.color_lighting_lumcount)
- T.update_lumcount(1, 160, 255, 0, 0)
/datum/universal_state/supermatter_cascade/DecayTurf(var/turf/T)
if(istype(T,/turf/simulated/wall))
@@ -151,8 +149,13 @@ The access requirements on the Asteroid Shuttles' consoles have now been revoked
else
if(T.z != map.zCentcomm)
T.underlays += "end01"
- T.update_lumcount(1, 160, 255, 0, 0)
tcheck(80,1)
+
+ for(var/atom/movable/lighting_overlay/L in all_lighting_overlays)
+ if(L.z != map.zCentcomm)
+ L.update_lumcount(0.15, 0.5, 0)
+ tcheck(80,1)
+
/datum/universal_state/supermatter_cascade/proc/MiscSet()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/universal_state/supermatter_cascade/proc/MiscSet() called tick#: [world.time]")
for (var/obj/machinery/firealarm/alm in machines)
diff --git a/code/game/gamemodes/events/biomass.dm b/code/game/gamemodes/events/biomass.dm
index 7b410ee5b94..36a22c86dc0 100644
--- a/code/game/gamemodes/events/biomass.dm
+++ b/code/game/gamemodes/events/biomass.dm
@@ -201,10 +201,9 @@
for(var/type in typesof(/area/hallway))
var/area/Hallway = locate(type)
- for(var/area/Related in Hallway.related)
- for(var/turf/simulated/floor/Floor in Related.contents)
- if(Floor.contents.len <= 0)
- Floors += Floor
+ for(var/turf/simulated/floor/Floor in Hallway.contents)
+ if(Floor.contents.len <= 0)
+ Floors += Floor
if(Floors.len) // pick a floor to spawn at
var/turf/simulated/floor/Floor = pick(Floors)
diff --git a/code/game/gamemodes/events/spacevines.dm b/code/game/gamemodes/events/spacevines.dm
index 7442f55b815..7c5ce0d8d88 100644
--- a/code/game/gamemodes/events/spacevines.dm
+++ b/code/game/gamemodes/events/spacevines.dm
@@ -7,10 +7,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)
diff --git a/code/game/gamemodes/vampire/vampire.dm b/code/game/gamemodes/vampire/vampire.dm
index 2b280949d5e..11d043dac36 100644
--- a/code/game/gamemodes/vampire/vampire.dm
+++ b/code/game/gamemodes/vampire/vampire.dm
@@ -638,9 +638,10 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha
if(VAMP_MATURE in mind.vampire.powers)
smitetemp -= 1
if(VAMP_SHADOW in mind.vampire.powers)
- var/turf/simulated/T = get_turf(src)
- if(T.lighting_lumcount < 2)
+ var/turf/T = get_turf(src)
+ if((T.get_lumcount() * 10) < 2)
smitetemp -= 1
+
if(VAMP_UNDYING in mind.vampire.powers)
smitetemp -= 1
diff --git a/code/game/gamemodes/vampire/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers.dm
index da4dc9f1d1a..4f834f66ad8 100644
--- a/code/game/gamemodes/vampire/vampire_powers.dm
+++ b/code/game/gamemodes/vampire/vampire_powers.dm
@@ -36,8 +36,8 @@
src << "Your powers are useless on this holy ground."
return 0
if(check_holy(src) && !fullpower)
- var/turf/simulated/T = get_turf(src)
- if(T.lighting_lumcount > 2)
+ var/turf/T = get_turf(src)
+ if((T.get_lumcount() * 10) > 2)
src << "This ground has been blessed and illuminated, suppressing your abilities."
return 0
return 1
@@ -349,16 +349,15 @@
alpha = 255
color = "#FFFFFF"
return
- var/turf/simulated/T = get_turf(src)
- if(!istype(T))
- return 0
+ var/turf/T = get_turf(src)
if(!mind.vampire.iscloaking)
alpha = 255
color = "#FFFFFF"
return 0
- if(T.lighting_lumcount <= 2)
+
+ if((T.get_lumcount() * 10) <= 2)
alpha = round((255 * 0.15))
if(VAMP_SHADOW in mind.vampire.powers)
color = "#000000"
@@ -494,9 +493,7 @@
if(T.density) continue
if(T.x>world.maxx-outer_tele_radius || T.xworld.maxy-outer_tele_radius || T.y max_lum) continue
+ if((T.get_lumcount() * 10) > max_lum) continue
turfs += T
if(!turfs.len)
@@ -543,15 +540,14 @@
if(!mind || !mind.vampire || !ishuman(src))
mind.vampire.ismenacing = 0
return
- var/turf/simulated/T = get_turf(src)
-
- if(!istype(T))
- return 0
if(!mind.vampire.ismenacing)
mind.vampire.ismenacing = 0
return 0
- if(T.lighting_lumcount > 2)
+
+ var/turf/T = get_turf(src)
+
+ if(T.get_lumcount() > 2)
mind.vampire.ismenacing = 0
return 0
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index 7725ffbe8b4..2028ce65115 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -160,13 +160,15 @@
/obj/item/weapon/stock_parts/manipulator,
/obj/item/weapon/stock_parts/manipulator
)
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
+ light_range_on = 3
+ light_power_on = 2
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)) && occupant)
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
else
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/sleeper/New()
..()
@@ -278,7 +280,7 @@
if(user.pulling == L)
user.stop_pulling()
if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
sedativeblock = 1
sleep(SLEEPER_SOPORIFIC_DELAY)
sedativeblock = 0
@@ -327,7 +329,7 @@
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.blob_act()
- del(src)
+ qdel(src)
return
/obj/machinery/sleeper/crowbarDestroy(mob/user)
@@ -385,7 +387,7 @@
src.add_fingerprint(user)
qdel(G)
if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
sedativeblock = 1
spawn(SLEEPER_SOPORIFIC_DELAY)
sedativeblock = 0
@@ -504,6 +506,7 @@
return
src.go_out()
add_fingerprint(usr)
+ set_light(0)
return
@@ -540,9 +543,11 @@
update_icon()
for(var/obj/O in src)
- del(O)
+ qdel(O)
src.add_fingerprint(usr)
+ if(!(stat & (BROKEN|NOPOWER)))
+ set_light(light_range_on, light_power_on)
return
return
-#undef SLEEPER_SOPORIFIC_DELAY
+#undef SLEEPER_SOPORIFIC_DELAY
diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm
index d63fbde3b3d..55f5555fcaa 100644
--- a/code/game/machinery/adv_med.dm
+++ b/code/game/machinery/adv_med.dm
@@ -22,7 +22,9 @@
var/mob/living/carbon/occupant
var/locked
- l_color = "#00FF00"
+ light_color = LIGHT_COLOR_GREEN
+ light_range_on = 3
+ light_power_on = 2
/obj/machinery/bodyscanner/New()
..()
@@ -81,9 +83,9 @@
/obj/machinery/bodyscanner/power_change()
..()
if(!(stat & (BROKEN|NOPOWER)) && src.occupant)
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
else
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/bodyscanner/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
if(!ismob(O)) //humans only
@@ -131,6 +133,8 @@
OO.loc = src.loc
//Foreach goto(154)
src.add_fingerprint(user)
+ if(!(stat & (BROKEN|NOPOWER)))
+ set_light(light_range_on, light_power_on)
return
/obj/machinery/bodyscanner/MouseDrop(over_object, src_location, var/turf/over_location, src_control, over_control, params)
@@ -203,6 +207,8 @@
for(var/obj/O in src)
qdel(O)
src.add_fingerprint(usr)
+ if(!(stat & (BROKEN|NOPOWER)))
+ set_light(light_range_on, light_power_on)
return
/obj/machinery/bodyscanner/proc/go_out(var/exit = loc)
@@ -216,6 +222,7 @@
src.occupant.reset_view()
src.occupant = null
update_icon()
+ set_light(0)
return
/obj/machinery/bodyscanner/crowbarDestroy(mob/user)
@@ -266,6 +273,8 @@
O.loc = src.loc
src.add_fingerprint(user)
qdel(G)
+ if(!(stat & (BROKEN|NOPOWER)))
+ set_light(light_range_on, light_power_on)
return
/obj/machinery/bodyscanner/ex_act(severity)
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index 702827f21da..3e017d37427 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -94,11 +94,10 @@
/obj/machinery/alarm/proc/apply_preset(var/no_cycle_after=0)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/alarm/proc/apply_preset() called tick#: [world.time]")
// Propogate settings.
- for (var/area/A in areaMaster.related)
- for (var/obj/machinery/alarm/AA in A)
- if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.preset != src.preset)
- AA.preset=preset
- apply_preset(1) // Only this air alarm should send a cycle.
+ for (var/obj/machinery/alarm/AA in areaMaster)
+ if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.preset != src.preset)
+ AA.preset=preset
+ apply_preset(1) // Only this air alarm should send a cycle.
TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
TLV["nitrogen"] = list(-1, -1, -1, -1) // Partial pressure, kpa
@@ -300,11 +299,10 @@
/obj/machinery/alarm/proc/elect_master()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/alarm/proc/elect_master() called tick#: [world.time]")
- for (var/area/A in areaMaster.related)
- for (var/obj/machinery/alarm/AA in A)
- if (!(AA.stat & (NOPOWER|BROKEN)))
- areaMaster.master_air_alarm = AA
- return 1
+ for (var/obj/machinery/alarm/AA in areaMaster)
+ if (!(AA.stat & (NOPOWER|BROKEN)))
+ areaMaster.master_air_alarm = AA
+ return 1
return 0
/obj/machinery/alarm/proc/get_danger_level(const/current_value, const/list/danger_levels)
diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm
index 18ad4e19072..090b7d4c75e 100644
--- a/code/game/machinery/atmo_control.dm
+++ b/code/game/machinery/atmo_control.dm
@@ -122,7 +122,7 @@
var/list/sensor_information = list()
var/datum/radio_frequency/radio_connection
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/general_air_control/attack_hand(mob/user)
if(..(user))
diff --git a/code/game/machinery/atmoalter/area_atmos_computer.dm b/code/game/machinery/atmoalter/area_atmos_computer.dm
index f5125ef2822..a2dbcffc856 100644
--- a/code/game/machinery/atmoalter/area_atmos_computer.dm
+++ b/code/game/machinery/atmoalter/area_atmos_computer.dm
@@ -9,13 +9,8 @@
var/range = 25
- l_color = "#7BF9FF"
- power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
- else
- SetLuminosity(0)
+ light_color = LIGHT_COLOR_CYAN
+ light_range_on = 2
//Simple variable to prevent me from doing attack_hand in both this and the child computer
var/zone = "This computer is working on a wireless range, the range is currently limited to 25 meters."
@@ -153,14 +148,10 @@
var/turf/T_src = get_turf(src)
if(!T_src.loc) return 0
var/area/A_src = T_src.loc
- if (A_src.master)
- A_src = A_src.master
var/turf/T_scrub = get_turf(scrubber)
if(!T_scrub.loc) return 0
var/area/A_scrub = T_scrub.loc
- if (A_scrub.master)
- A_scrub = A_scrub.master
if(A_scrub != A_src)
return 0
@@ -179,7 +170,7 @@
var/turf/T2 = get_turf(scrubber)
if(T2 && T2.loc)
var/area/A2 = T2.loc
- if(istype(A2) && A2.master && A2.master == A )
+ if(istype(A2) && A2 == A )
connectedscrubbers += scrubber
found = 1
diff --git a/code/game/machinery/atmoalter/gas_mine.dm b/code/game/machinery/atmoalter/gas_mine.dm
index c61f9ae8a5d..6db6d271b08 100644
--- a/code/game/machinery/atmoalter/gas_mine.dm
+++ b/code/game/machinery/atmoalter/gas_mine.dm
@@ -16,7 +16,7 @@
var/max_external_pressure=10000 // 10,000kPa ought to do it.
var/internal_pressure=4500 // Bottleneck
- var/light_color = "#FFFFFF"
+ var/overlay_color = "#FFFFFF"
machine_flags = WRENCHMOVE | FIXED2WORK
@@ -72,7 +72,7 @@
return
if(on)
var/new_icon_state="on"
- var/new_color = light_color
+ var/new_color = overlay_color
if(stat & BROKEN)
new_icon_state="broken"
new_color="#FF0000"
@@ -118,7 +118,7 @@
/obj/machinery/atmospherics/miner/sleeping_agent
name = "\improper N2O Gas Miner"
- light_color = "#FFCCCC"
+ overlay_color = "#FFCCCC"
AddAir()
var/datum/gas/sleeping_agent/trace_gas = new
@@ -127,28 +127,28 @@
/obj/machinery/atmospherics/miner/nitrogen
name = "\improper N2 Gas Miner"
- light_color = "#CCFFCC"
+ overlay_color = "#CCFFCC"
AddAir()
air_contents.nitrogen = internal_pressure*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/miner/oxygen
name = "\improper O2 Gas Miner"
- light_color = "#007FFF"
+ overlay_color = "#007FFF"
AddAir()
air_contents.oxygen = internal_pressure*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/miner/toxins
name = "\improper Plasma Gas Miner"
- light_color = "#FF0000"
+ overlay_color = "#FF0000"
AddAir()
air_contents.toxins = internal_pressure*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
/obj/machinery/atmospherics/miner/carbon_dioxide
name = "\improper CO2 Gas Miner"
- light_color = "#CDCDCD"
+ overlay_color = "#CDCDCD"
AddAir()
air_contents.carbon_dioxide = internal_pressure*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
@@ -157,7 +157,7 @@
/obj/machinery/atmospherics/miner/air
name = "\improper Air Miner"
desc = "You fucking cheater."
- light_color = "#70DBDB"
+ overlay_color = "#70DBDB"
on = 0
diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm
index 17c82b349c5..70801bb3b08 100644
--- a/code/game/machinery/autolathe.dm
+++ b/code/game/machinery/autolathe.dm
@@ -29,7 +29,7 @@
research_flags = NANOTOUCH | TAKESMATIN | HASOUTPUT | IGNORE_CHEMS | HASMAT_OVER
- l_color = LIGHT_COLOR_CYAN
+ light_color = LIGHT_COLOR_CYAN
part_sets = list(
"Tools"=list(
diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm
index f2ee8b36bea..e791dac05bd 100644
--- a/code/game/machinery/biogenerator.dm
+++ b/code/game/machinery/biogenerator.dm
@@ -221,14 +221,10 @@
machine_flags = SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK
- l_color = "#7BF9FF"
-
-/obj/machinery/biogenerator/power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
- else
- SetLuminosity(0)
+ light_color = LIGHT_COLOR_CYAN
+ light_range_on = 3
+ light_power_on = 2
+ use_auto_lights = 1
/obj/machinery/biogenerator/on_reagent_change() //When the reagents change, change the icon as well.
update_icon()
diff --git a/code/game/machinery/bioprinter.dm b/code/game/machinery/bioprinter.dm
index 2dfcf8e06f5..a96b86b240a 100644
--- a/code/game/machinery/bioprinter.dm
+++ b/code/game/machinery/bioprinter.dm
@@ -12,14 +12,10 @@
use_power = 1
idle_power_usage = 50
- l_color = "#7BF9FF"
-
- power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
- else
- SetLuminosity(0)
+ light_color = LIGHT_COLOR_CYAN
+ light_range_on = 3
+ light_power_on = 2
+ use_auto_lights = 1
var/prints_prosthetics
var/stored_matter = 200
diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm
index 30f04bb0d22..9df4bae045c 100644
--- a/code/game/machinery/bots/bots.dm
+++ b/code/game/machinery/bots/bots.dm
@@ -32,13 +32,13 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/bot/proc/turn_on() called tick#: [world.time]")
if(stat) return 0
on = 1
- SetLuminosity(initial(luminosity))
+ set_light(initial(luminosity))
return 1
/obj/machinery/bot/proc/turn_off()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/bot/proc/turn_off() called tick#: [world.time]")
on = 0
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/bot/proc/explode()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/bot/proc/explode() called tick#: [world.time]")
diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm
index df60770ceb9..c442981f0a1 100644
--- a/code/game/machinery/bots/secbot.dm
+++ b/code/game/machinery/bots/secbot.dm
@@ -58,13 +58,13 @@
/obj/item/weapon/gun/energy/laser/bluetag,\
/obj/item/weapon/gun/energy/laser/redtag,\
/obj/item/weapon/gun/energy/laser/practice)
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
power_change()
..()
if(src.on)
- SetLuminosity(2)
+ set_light(2)
else
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/bot/secbot/beepsky
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index 5d6bf8cd054..722c812caa3 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -99,7 +99,7 @@ var/list/camera_names=list()
network = list()
cameranet.removeCamera(src)
stat |= EMPED
- SetLuminosity(0)
+ set_light(0)
triggerCameraAlarm()
update_icon()
spawn(900)
diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm
index 2d8f63d40dc..882a7e986da 100644
--- a/code/game/machinery/computer/HolodeckControl.dm
+++ b/code/game/machinery/computer/HolodeckControl.dm
@@ -9,7 +9,7 @@
var/damaged = 0
var/last_change = 0
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/HolodeckControl/attack_ai(var/mob/user as mob)
add_hiddenprint(user)
diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm
index 6c4f0f8ae9b..6c97b49626d 100644
--- a/code/game/machinery/computer/Operating.dm
+++ b/code/game/machinery/computer/Operating.dm
@@ -9,7 +9,7 @@
var/mob/living/carbon/human/victim = null
var/obj/machinery/optable/optable = null
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/operating/New()
..()
diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm
index b1ef127eaf1..b4786953553 100644
--- a/code/game/machinery/computer/aifixer.dm
+++ b/code/game/machinery/computer/aifixer.dm
@@ -6,7 +6,7 @@
var/mob/living/silicon/ai/occupant = null
var/active = 0
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/aifixer/New()
..()
diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm
index 3df91ec655f..a068ec00fd4 100644
--- a/code/game/machinery/computer/arcade.dm
+++ b/code/game/machinery/computer/arcade.dm
@@ -16,7 +16,7 @@
machine_flags = EMAGGABLE | SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK
emag_cost = 0 // because fun
- l_color = "#00FF00"
+ light_color = LIGHT_COLOR_GREEN
var/list/prizes = list( /obj/item/weapon/storage/box/snappops = 2,
/obj/item/toy/cards = 2,
diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm
index 458959d0b90..75b073d894d 100644
--- a/code/game/machinery/computer/atmos_alert.dm
+++ b/code/game/machinery/computer/atmos_alert.dm
@@ -11,7 +11,7 @@
var/receive_frequency = 1437
var/datum/radio_frequency/radio_connection
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/atmos_alert/initialize()
diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm
index a01d1029ef9..1f65d367c4e 100644
--- a/code/game/machinery/computer/camera.dm
+++ b/code/game/machinery/computer/camera.dm
@@ -11,7 +11,7 @@
var/list/network = list("SS13")
var/mapping = 0//For the overview file, interesting bit of code.
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/security/attack_ai(var/mob/user as mob)
src.add_hiddenprint(user)
@@ -93,7 +93,7 @@
density = 0
circuit = null
- l_color = "#000000"
+ light_color = null
/obj/machinery/computer/security/telescreen/update_icon()
icon_state = initial(icon_state)
@@ -110,14 +110,14 @@
density = 0
circuit = null
- l_color = "#000000"
+ light_color = null
/obj/machinery/computer/security/wooden_tv
name = "Security Cameras"
desc = "An old TV hooked into the stations camera network."
icon_state = "security_det"
- l_color = "#000000"
+ light_color = null
/obj/machinery/computer/security/mining
name = "Outpost Cameras"
@@ -126,7 +126,7 @@
network = list("MINE")
circuit = "/obj/item/weapon/circuitboard/mining"
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/security/engineering
name = "Engineering Cameras"
@@ -134,3 +134,5 @@
icon_state = "engineeringcameras"
network = list("Power Alarms","Atmosphere Alarms","Fire Alarms")
circuit = "/obj/item/weapon/circuitboard/security/engineering"
+
+ light_color = LIGHT_COLOR_YELLOW
diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm
index b5b734db937..7f617f1338f 100644
--- a/code/game/machinery/computer/card.dm
+++ b/code/game/machinery/computer/card.dm
@@ -43,7 +43,7 @@
"ERT_medical",
)
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
proc/is_centcom()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/is_centcom() called tick#: [world.time]")
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index c5061a880a0..dc489241964 100644
--- a/code/game/machinery/computer/communications.dm
+++ b/code/game/machinery/computer/communications.dm
@@ -57,7 +57,7 @@ var/shuttle_call/shuttle_calls[0]
var/stat_msg2
var/display_type="blank"
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/communications/Topic(href, href_list)
if(..(href, href_list))
diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm
index f460a178042..f3aa5104f53 100644
--- a/code/game/machinery/computer/computer.dm
+++ b/code/game/machinery/computer/computer.dm
@@ -10,6 +10,10 @@
var/processing = 0
machine_flags = EMAGGABLE | SCREWTOGGLE | WRENCHMOVE | FIXED2WORK | MULTITOOL_MENU
+ use_auto_lights = 1
+ light_power_on = 2
+ light_range_on = 3
+
/obj/machinery/computer/cultify()
new /obj/structure/cult/tome(loc)
..()
@@ -59,7 +63,6 @@
set_broken()
..()
-
/obj/machinery/computer/blob_act()
if (prob(75))
for(var/x in verbs)
@@ -78,16 +81,9 @@
else if(stat & NOPOWER)
icon_state = "[initial(icon_state)]0"
-
-
/obj/machinery/computer/power_change()
- ..()
+ . = ..()
update_icon()
- if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
- else
- SetLuminosity(0)
-
/obj/machinery/computer/proc/set_broken()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/computer/proc/set_broken() called tick#: [world.time]")
diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm
index 321d8769530..5aee57977a5 100644
--- a/code/game/machinery/computer/law.dm
+++ b/code/game/machinery/computer/law.dm
@@ -8,7 +8,7 @@
var/mob/living/silicon/ai/current = null
var/opened = 0
- l_color = "#FFFFFF"
+ light_color = "#555555"
verb/AccessInternals()
@@ -140,7 +140,7 @@
circuit = "/obj/item/weapon/circuitboard/borgupload"
var/mob/living/silicon/robot/current = null
- l_color = "#FFFFFF"
+ light_color = "#555555"
proc/announce_law_changes()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/announce_law_changes() called tick#: [world.time]")
diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm
index 2b7f80f55fd..7806d3d9d7d 100644
--- a/code/game/machinery/computer/medical.dm
+++ b/code/game/machinery/computer/medical.dm
@@ -16,7 +16,7 @@
var/temp = null
var/printing = null
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/med_data/attack_ai(user as mob)
src.add_hiddenprint(user)
@@ -524,6 +524,6 @@
anchored = 0
density = 0
- l_color = "#00FF00"
+ light_color = LIGHT_COLOR_GREEN
diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm
index 573bf23faec..fcd91bbd932 100644
--- a/code/game/machinery/computer/message.dm
+++ b/code/game/machinery/computer/message.dm
@@ -32,7 +32,7 @@
var/customjob = "Admin"
var/custommessage = "This is a test, please ignore."
- l_color = "#50AB00"
+ light_color = LIGHT_COLOR_GREEN
/obj/machinery/computer/message_monitor/attackby(obj/item/weapon/O as obj, mob/living/user as mob)
diff --git a/code/game/machinery/computer/pda_terminal.dm b/code/game/machinery/computer/pda_terminal.dm
index e5ab483ce3c..f3da0ed8d5d 100644
--- a/code/game/machinery/computer/pda_terminal.dm
+++ b/code/game/machinery/computer/pda_terminal.dm
@@ -3,7 +3,7 @@
desc = "It can be used to download Apps on your PDA."
icon_state = "pdaterm"
circuit = "/obj/item/weapon/circuitboard/pda_terminal"
- l_color = "#993300"
+ light_color = LIGHT_COLOR_ORANGE
var/obj/item/device/pda/pda_device = null
diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm
index 728724c1788..7dedd2be339 100644
--- a/code/game/machinery/computer/pod.dm
+++ b/code/game/machinery/computer/pod.dm
@@ -17,7 +17,7 @@
var/default_loop = 0
var/default_timings = 0
- l_color = "#555555"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/pod/New()
..()
@@ -290,7 +290,7 @@
desc = "The Syndicate operate on a tight budget. Operates external airlocks."
req_access = list(access_syndicate)
circuit = /obj/item/weapon/circuitboard/syndicatedoor
- l_color = "#000000"
+ light_color = null
/obj/machinery/computer/pod/old/syndicate/attack_hand(var/mob/user as mob)
if(!allowed(user))
diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm
index 225a4b0d3fd..a8a541768b6 100644
--- a/code/game/machinery/computer/prisoner.dm
+++ b/code/game/machinery/computer/prisoner.dm
@@ -13,7 +13,7 @@
var/stop = 0.0
var/screen = 0 // 0 - No Access Denied, 1 - Access allowed
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
attack_ai(var/mob/user as mob)
src.add_hiddenprint(user)
diff --git a/code/game/machinery/computer/prisonshuttle.dm b/code/game/machinery/computer/prisonshuttle.dm
index 5634bf5c7a1..2b3a944ffff 100644
--- a/code/game/machinery/computer/prisonshuttle.dm
+++ b/code/game/machinery/computer/prisonshuttle.dm
@@ -19,7 +19,7 @@ var/prison_shuttle_timeleft = 0
var/temp = null
var/allowedtocall = 0
var/prison_break = 0
-
+ light_color = LIGHT_COLOR_CYAN
attackby(I as obj, user as mob)
if(!..())
@@ -67,7 +67,7 @@ var/prison_shuttle_timeleft = 0
if(..())
return 1
- else
+ else
usr.set_machine(src)
if (href_list["sendtodock"])
diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm
index 71fd0a8fac3..e39ea1a7c30 100644
--- a/code/game/machinery/computer/robot.dm
+++ b/code/game/machinery/computer/robot.dm
@@ -16,7 +16,7 @@
var/stop = 0.0
var/screen = 0 // 0 - Main Menu, 1 - Cyborg Status, 2 - Kill 'em All! -- In text
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/robotics/attack_ai(var/mob/user as mob)
diff --git a/code/game/machinery/computer/salvage_ship.dm b/code/game/machinery/computer/salvage_ship.dm
index 4e7b98e3cd8..bcc29714a7a 100644
--- a/code/game/machinery/computer/salvage_ship.dm
+++ b/code/game/machinery/computer/salvage_ship.dm
@@ -10,7 +10,7 @@
var/moving = 0
var/lastMove = 0
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/salvage_ship/New()
curr_location= locate(/area/shuttle/salvage/start)
diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm
index 92c772a1655..5eef61250af 100644
--- a/code/game/machinery/computer/security.dm
+++ b/code/game/machinery/computer/security.dm
@@ -22,7 +22,7 @@
var/sortBy = "name"
var/order = 1 // -1 = Descending - 1 = Ascending
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/secure_data/attackby(obj/item/O as obj, user as mob)
if(istype(O, /obj/item/weapon/card/id) && !scan)
@@ -603,4 +603,4 @@ What a mess.*/
icon = 'icons/obj/computer.dmi'
icon_state = "messyfiles"
- l_color = "#000000"
+ light_color = null
diff --git a/code/game/machinery/computer/shuttle.dm b/code/game/machinery/computer/shuttle.dm
index 34a6626099a..b8b4752d0d0 100644
--- a/code/game/machinery/computer/shuttle.dm
+++ b/code/game/machinery/computer/shuttle.dm
@@ -5,7 +5,7 @@
var/auth_need = 3.0
var/list/authorized = list( )
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob)
if(stat & (BROKEN|NOPOWER)) return
diff --git a/code/game/machinery/computer/specops_shuttle.dm b/code/game/machinery/computer/specops_shuttle.dm
index 27b8df45d7d..7e3260ed1ec 100644
--- a/code/game/machinery/computer/specops_shuttle.dm
+++ b/code/game/machinery/computer/specops_shuttle.dm
@@ -21,7 +21,7 @@ var/specops_shuttle_timeleft = 0
var/allowedtocall = 0
var/specops_shuttle_timereset = 0
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/proc/specops_return()
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/specops_return() called tick#: [world.time]")
@@ -320,8 +320,6 @@ var/specops_shuttle_timeleft = 0
var/area/centcom/specops/special_ops = locate()
if(special_ops)
- if(special_ops.master)
- special_ops=special_ops.master
special_ops.readyalert()//Trigger alarm for the spec ops area.
specops_shuttle_moving_to_station = 1
diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm
index c1838424fbd..0c5b9a36e13 100644
--- a/code/game/machinery/computer/station_alert.dm
+++ b/code/game/machinery/computer/station_alert.dm
@@ -4,7 +4,7 @@
desc = "Used to access the station's automated alert system."
icon_state = "alert:0"
circuit = "/obj/item/weapon/circuitboard/stationalert"
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
var/alarms = list("Fire"=list(), "Atmosphere"=list(), "Power"=list())
diff --git a/code/game/machinery/computer/store.dm b/code/game/machinery/computer/store.dm
index 57777f0031b..f1a708f2ee6 100644
--- a/code/game/machinery/computer/store.dm
+++ b/code/game/machinery/computer/store.dm
@@ -4,7 +4,7 @@
icon_state = "store"
circuit = "/obj/item/weapon/circuitboard/merch"
- l_color = "#993300"
+ light_color = LIGHT_COLOR_ORANGE
/obj/item/weapon/circuitboard/merch
name = "\improper Merchandise Computer Circuitboard"
diff --git a/code/game/machinery/computer/syndicate_shuttle.dm b/code/game/machinery/computer/syndicate_shuttle.dm
index af3313d9a5b..bdd8b45c057 100644
--- a/code/game/machinery/computer/syndicate_shuttle.dm
+++ b/code/game/machinery/computer/syndicate_shuttle.dm
@@ -10,7 +10,7 @@
var/moving = 0
var/lastMove = 0
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/syndicate_station/New()
curr_location= locate(/area/syndicate_station/start)
diff --git a/code/game/machinery/computer/syndicate_specops_shuttle.dm b/code/game/machinery/computer/syndicate_specops_shuttle.dm
index cd931ce22a3..d57ca3b0fe3 100644
--- a/code/game/machinery/computer/syndicate_specops_shuttle.dm
+++ b/code/game/machinery/computer/syndicate_specops_shuttle.dm
@@ -19,7 +19,7 @@ var/syndicate_elite_shuttle_timeleft = 0
var/hacked = 0
var/allowedtocall = 0
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/proc/syndicate_elite_process()
//writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/syndicate_elite_process() called tick#: [world.time]")
@@ -240,8 +240,6 @@ var/syndicate_elite_shuttle_timeleft = 0
var/area/syndicate_mothership/elite_squad/elite_squad = locate()
if(elite_squad)
- if(elite_squad.master)
- elite_squad=elite_squad.master
elite_squad.readyalert()//Trigger alarm for the spec ops area.
syndicate_elite_shuttle_moving_to_station = 1
diff --git a/code/game/machinery/computer/taxi_shuttle.dm b/code/game/machinery/computer/taxi_shuttle.dm
index ee118a84f54..6035822d4f2 100644
--- a/code/game/machinery/computer/taxi_shuttle.dm
+++ b/code/game/machinery/computer/taxi_shuttle.dm
@@ -20,7 +20,7 @@ var/global/list/taxi_computers = list()
var/letter = ""
var/list/connected_buttons = list()
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/taxi_shuttle/New()
..()
diff --git a/code/game/machinery/computer/vox_shuttle.dm b/code/game/machinery/computer/vox_shuttle.dm
index c38c7af95de..bb4bf69b5c1 100644
--- a/code/game/machinery/computer/vox_shuttle.dm
+++ b/code/game/machinery/computer/vox_shuttle.dm
@@ -12,7 +12,7 @@ var/global/vox_shuttle_location
var/moving = FALSE
var/lastMove = 0
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
/obj/machinery/computer/vox_station/proc/vox_move_to(var/destination)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/computer/vox_station/proc/vox_move_to() called tick#: [world.time]")
diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm
index 070fd07da51..bcb93bbbd43 100644
--- a/code/game/machinery/cryo.dm
+++ b/code/game/machinery/cryo.dm
@@ -22,14 +22,10 @@ var/global/list/cryo_health_indicator = list( "full" = image("icon" = 'icons/obj
machine_flags = SCREWTOGGLE | CROWDESTROY
- l_color = "#00FF00"
-
-/obj/machinery/atmospherics/unary/cryo_cell/power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)) && on)
- SetLuminosity(2)
- else
- SetLuminosity(0)
+ light_color = LIGHT_COLOR_GREEN
+ light_range_on = 1
+ light_power_on = 2
+ use_auto_lights = 1
/obj/machinery/atmospherics/unary/cryo_cell/New()
. = ..()
diff --git a/code/game/machinery/doors/alarmlock.dm b/code/game/machinery/doors/alarmlock.dm
index 67e5c83dc30..46c6f6f8572 100644
--- a/code/game/machinery/doors/alarmlock.dm
+++ b/code/game/machinery/doors/alarmlock.dm
@@ -29,8 +29,6 @@
var/alert = signal.data["alert"]
var/area/our_area = get_area(src)
- if (our_area.master)
- our_area = our_area.master
if(alarm_area == our_area.name)
switch(alert)
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index 4686d0bdea9..be82545d735 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -253,13 +253,13 @@ var/list/all_doors = list()
if(!operating) operating = 1
door_animate("opening")
- src.SetOpacity(0)
+ src.set_opacity(0)
sleep(10)
src.layer = base_layer
src.density = 0
explosion_resistance = 0
update_icon()
- SetOpacity(0)
+ set_opacity(0)
update_nearby_tiles()
//update_freelook_sight()
@@ -289,7 +289,7 @@ var/list/all_doors = list()
update_icon()
if (!glass)
- src.SetOpacity(1)
+ src.set_opacity(1)
// Copypasta!!!
var/obj/effect/beam/B = locate() in loc
if(B)
diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm
index 1a6bdfc0530..b7539c3d764 100644
--- a/code/game/machinery/doors/poddoor.dm
+++ b/code/game/machinery/doors/poddoor.dm
@@ -48,7 +48,7 @@ var/list/poddoors = list()
src.operating = 1
flick("pdoorc0", src)
src.icon_state = "pdoor0"
- src.SetOpacity(0)
+ src.set_opacity(0)
sleep(15)
src.density = 0
src.operating = 0
@@ -64,7 +64,7 @@ var/list/poddoors = list()
src.operating = 1
flick("pdoorc0", src)
src.icon_state = "pdoor0"
- src.SetOpacity(0)
+ src.set_opacity(0)
sleep(10)
layer = initial(layer)
src.density = 0
@@ -85,7 +85,7 @@ var/list/poddoors = list()
flick("pdoorc1", src)
src.icon_state = "pdoor1"
src.density = 1
- src.SetOpacity(initial(opacity))
+ src.set_opacity(initial(opacity))
update_nearby_tiles()
sleep(10)
diff --git a/code/game/machinery/doors/shutters.dm b/code/game/machinery/doors/shutters.dm
index 6db8786a278..278264bf785 100644
--- a/code/game/machinery/doors/shutters.dm
+++ b/code/game/machinery/doors/shutters.dm
@@ -24,7 +24,7 @@
icon_state = "shutter0"
sleep(15)
density = 0
- SetOpacity(0)
+ set_opacity(0)
operating = 0
return
return
@@ -41,7 +41,7 @@
icon_state = "shutter0"
sleep(10)
density = 0
- SetOpacity(0)
+ set_opacity(0)
update_nearby_tiles()
if(operating == 1) //emag again
@@ -60,7 +60,7 @@
icon_state = "shutter1"
density = 1
if(visible)
- SetOpacity(1)
+ set_opacity(1)
update_nearby_tiles()
sleep(10)
diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm
index f9f1343f6e2..74cb3bb7d71 100644
--- a/code/game/machinery/floodlight.dm
+++ b/code/game/machinery/floodlight.dm
@@ -26,14 +26,14 @@
if(cell.charge < powercost)
on = 0
update_icon()
- SetLuminosity(0)
+ set_light(0)
visible_message("\The [src] shuts down!")
return
else
on = 0
update_icon()
- SetLuminosity(0)
+ set_light(0)
visible_message("\The [src] shuts down!")
return
@@ -58,12 +58,12 @@
if(on)
on = 0
- SetLuminosity(0)
+ set_light(0)
else
if(!cell || !cell.charge > powercost)
return
on = 1
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
user.visible_message("[user] turns \the [src] [on ? "on":"off"]", \
"You turn \the [src] [on ? "on":"off"]")
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 6d108f1adc4..c4c7579202b 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -98,8 +98,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them.
hologram.anchored = 1//So space wind cannot drag it.
hologram.name = "[A.name] (Hologram)"//If someone decides to right click.
- hologram.SetLuminosity(2) //hologram lighting
- SetLuminosity(2) //pad lighting
+ hologram.set_light(2) //hologram lighting
+ set_light(2) //pad lighting
icon_state = "holopad1"
A.current = src
master = A//AI is the master.
@@ -113,7 +113,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
if(master.current == src)
master.current = null
master = null//Null the master, since no-one is using it now.
- SetLuminosity(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
+ set_light(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
icon_state = "holopad0"
use_power = 1//Passive power usage.
return 1
@@ -130,7 +130,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
var/area/holo_area = get_area(src)
var/area/eye_area = get_area(master.eyeobj)
- if(eye_area in holo_area.master.related)
+ if(eye_area == holo_area)
return 1
clear_holo()//If not, we want to get rid of the hologram.
diff --git a/code/game/machinery/kitchen/smartfridge.dm b/code/game/machinery/kitchen/smartfridge.dm
index 0f6e9944042..07b3e98093c 100644
--- a/code/game/machinery/kitchen/smartfridge.dm
+++ b/code/game/machinery/kitchen/smartfridge.dm
@@ -26,13 +26,13 @@
machine_flags = SCREWTOGGLE | CROWDESTROY | EJECTNOTDEL
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
+ set_light(2)
else
- SetLuminosity(0)
+ set_light(0)
/********************************************************************
@@ -72,7 +72,7 @@
accepted_types = list(/obj/item/seeds)
- l_color = "#000000"
+ light_color = null
/obj/machinery/smartfridge/seeds/New()
. = ..()
diff --git a/code/game/machinery/kitchen/snackbarmachine.dm b/code/game/machinery/kitchen/snackbarmachine.dm
index 8568bbcc487..2def2f8f2e1 100644
--- a/code/game/machinery/kitchen/snackbarmachine.dm
+++ b/code/game/machinery/kitchen/snackbarmachine.dm
@@ -13,13 +13,13 @@
machine_flags = SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
+ set_light(2)
else
- SetLuminosity(0)
+ set_light(0)
/********************************************************************
** Adding Stock Parts to VV so preconstructed shit has its candy **
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index 89f1917a005..2c9991256dd 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -99,13 +99,12 @@
if(buildstage != 2) return
on = !on
- for(var/area/A in areaMaster.related)
- A.lightswitch = on
- A.updateicon()
+ areaMaster.lightswitch = on
+ areaMaster.updateicon()
- for(var/obj/machinery/light_switch/L in A)
- L.on = on
- L.updateicon()
+ for(var/obj/machinery/light_switch/L in areaMaster)
+ L.on = on
+ L.updateicon()
areaMaster.power_change()
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 6aaf953ed2d..713204dd718 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -133,6 +133,11 @@ Class Procs:
var/panel_open = 0
var/state = 0 //0 is unanchored, 1 is anchored and unwelded, 2 is anchored and welded for most things
+ //These are some values to automatically set the light power/range on machines if they have power
+ var/light_range_on = 0
+ var/light_power_on = 0
+ var/use_auto_lights = 0//Incase you want to use it, set this to 0, defaulting to 1 so machinery with no lights doesn't call set_light()
+
/**
* Machine construction/destruction/emag flags.
*/
diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm
index 31b246de741..ab404705fc6 100644
--- a/code/game/machinery/requests_console.dm
+++ b/code/game/machinery/requests_console.dm
@@ -185,7 +185,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
if (Console.department == department)
Console.newmessagepriority = 0
Console.icon_state = "req_comp0"
- Console.SetLuminosity(1)
+ Console.set_light(1)
newmessagepriority = 0
icon_state = "req_comp0"
for(var/msg in messages)
@@ -332,7 +332,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
Console.messages += "Message from [department]
[message]"
screen = 6
- Console.SetLuminosity(2)
+ Console.set_light(2)
messages += "Message sent to [dpt]
[message]"
else
say(text("\icon[src] *The Requests Console beeps: 'NOTICE: No server detected!'"))
diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm
index f1e3013bc8a..d07b7427e7c 100644
--- a/code/game/machinery/telecomms/logbrowser.dm
+++ b/code/game/machinery/telecomms/logbrowser.dm
@@ -1,7 +1,7 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/computer/telecomms
- l_color = "#50AB00"
+ light_color = LIGHT_COLOR_GREEN
/obj/machinery/computer/telecomms/server
name = "Telecommunications Server Monitor"
diff --git a/code/game/machinery/telecomms/telemonitor.dm b/code/game/machinery/telecomms/telemonitor.dm
index dee746f5012..e555cd86e5c 100644
--- a/code/game/machinery/telecomms/telemonitor.dm
+++ b/code/game/machinery/telecomms/telemonitor.dm
@@ -20,7 +20,7 @@
var/temp = "" // temporary feedback messages
- l_color = "#50AB00"
+ light_color = LIGHT_COLOR_GREEN
/obj/machinery/computer/telecomms/monitor/attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
diff --git a/code/game/machinery/telecomms/traffic_control.dm b/code/game/machinery/telecomms/traffic_control.dm
index 647cd0b1231..fe69354e175 100644
--- a/code/game/machinery/telecomms/traffic_control.dm
+++ b/code/game/machinery/telecomms/traffic_control.dm
@@ -18,7 +18,7 @@
var/list/access_log = list()
var/process = 0
- l_color = "#50AB00"
+ light_color = LIGHT_COLOR_GREEN
req_access = list(access_tcomsat)
diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm
index 4d043cb386f..1daccc3c82b 100644
--- a/code/game/machinery/teleporter.dm
+++ b/code/game/machinery/teleporter.dm
@@ -9,7 +9,7 @@
//Setting this to 1 will set src.locked to null after a player enters the portal and will not allow hand-teles to open portals to that location.
ghost_write=0
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/teleporter/New()
. = ..()
diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm
index fcc5adc754b..fe5bf82833f 100644
--- a/code/game/machinery/turrets.dm
+++ b/code/game/machinery/turrets.dm
@@ -14,8 +14,6 @@
/area/turret_protected/Entered(O)
..()
- if( master && master != src )
- return master.Entered(O)
if( iscarbon(O) )
turretTargets |= O
@@ -31,9 +29,6 @@
return 1
/area/turret_protected/Exited(O)
- if( master && master != src )
- return master.Exited(O)
-
if( ismob(O) && !issilicon(O) )
turretTargets -= O
// /vg/ vehicles
@@ -129,8 +124,6 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/turret/proc/get_protected_area() called tick#: [world.time]")
var/area/turret_protected/TP = get_area(src)
if(istype(TP))
- if(TP.master && TP.master != TP)
- TP = TP.master
return TP
return
@@ -353,7 +346,7 @@
var/enabled = 1
var/lethal = 0
var/locked = 1
- var/control_area //can be area name, path or nothing.
+ var/area/turret_protected/control_area //can be area name, path or nothing.
var/ailock = 0 // AI cannot use this
req_access = list(access_ai_upload)
@@ -364,11 +357,7 @@
/obj/machinery/turretid/New()
..()
if(!control_area)
- var/area/CA = get_area(src)
- if(CA.master && CA.master != CA)
- control_area = CA.master
- else
- control_area = CA
+ control_area = get_area(src)
else if(istext(control_area))
for(var/area/A in areas)
if(A.name && A.name==control_area)
@@ -497,7 +486,8 @@
/obj/machinery/turretid/proc/updateTurrets()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/turretid/proc/updateTurrets() called tick#: [world.time]")
if(control_area)
- for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
+ //ASSERT(istype(control_area))
+ for(var/obj/machinery/turret/aTurret in control_area.contents)
aTurret.setState(enabled, lethal)
src.update_icons()
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 7e2f0cea17f..27d93625d25 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -1876,7 +1876,7 @@
src.build_inventory(contraband, 1)
emagged = 1
overlays = 0
- var/image/dangerlay = image(icon,"[icon_state]-dangermode",LIGHTING_LAYER+1)
+ var/image/dangerlay = image(icon,"[icon_state]-dangermode", LIGHTING_LAYER + 1)
overlays_vending[2] = dangerlay
update_icon()
return 1
@@ -1906,7 +1906,7 @@
..()
emagged = 1
overlays = 0
- var/image/dangerlay = image(icon,"[icon_state]-dangermode",LIGHTING_LAYER+1)
+ var/image/dangerlay = image(icon,"[icon_state]-dangermode", LIGHTING_LAYER + 1)
overlays_vending[2] = dangerlay
update_icon()
@@ -1949,7 +1949,7 @@
src.build_inventory(contraband, 1)
emagged = 1
overlays = 0
- var/image/dangerlay = image(icon,"[icon_state]-dangermode",LIGHTING_LAYER+1)
+ var/image/dangerlay = image(icon,"[icon_state]-dangermode", LIGHTING_LAYER + 1)
overlays_vending[2] = dangerlay
update_icon()
return 1
@@ -1982,7 +1982,7 @@
..()
emagged = 1
overlays = 0
- var/image/dangerlay = image(icon,"[icon_state]-dangermode",LIGHTING_LAYER+1)
+ var/image/dangerlay = image(icon,"[icon_state]-dangermode", LIGHTING_LAYER + 1)
overlays_vending[2] = dangerlay
update_icon()
diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm
index e648330d81d..d49a4c8e789 100644
--- a/code/game/mecha/equipment/tools/tools.dm
+++ b/code/game/mecha/equipment/tools/tools.dm
@@ -926,7 +926,7 @@
var/pow_chan
if(A)
for(var/c in use_channels)
- if(A.master && A.master.powered(c))
+ if(A.powered(c))
pow_chan = c
break
return pow_chan
@@ -971,13 +971,13 @@
if(A)
var/pow_chan
for(var/c in list(EQUIP,ENVIRON,LIGHT))
- if(A.master.powered(c))
+ if(A.powered(c))
pow_chan = c
break
if(pow_chan)
var/delta = min(12, ER.chassis.cell.maxcharge-cur_charge)
ER.chassis.give_power(delta)
- A.master.use_power(delta*ER.coeff, pow_chan)
+ A.use_power(delta*ER.coeff, pow_chan)
return
diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm
index b190227e023..d6059ecd41b 100644
--- a/code/game/mecha/mech_bay.dm
+++ b/code/game/mecha/mech_bay.dm
@@ -160,7 +160,7 @@
var/obj/machinery/mech_bay_recharge_floor/recharge_floor
var/obj/machinery/mech_bay_recharge_port/recharge_port
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/mech_bay_power_console/proc/mecha_in(var/obj/mecha/mecha)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/computer/mech_bay_power_console/proc/mecha_in() called tick#: [world.time]")
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 732f77216e1..0458b5b4886 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -1050,8 +1050,8 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/mecha/verb/toggle_lights() called tick#: [world.time]")
if(usr!=occupant) return
lights = !lights
- if(lights) SetLuminosity(luminosity + lights_power)
- else SetLuminosity(luminosity - lights_power)
+ if(lights) set_light(luminosity + lights_power)
+ else set_light(luminosity - lights_power)
src.occupant_message("Toggled lights [lights?"on":"off"].")
log_message("Toggled lights [lights?"on":"off"].")
return
diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm
index fb4bb3990cb..b5a3277179f 100644
--- a/code/game/mecha/mecha_control_console.dm
+++ b/code/game/mecha/mecha_control_console.dm
@@ -8,7 +8,7 @@
var/screen = 0
var/stored_data
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/mecha/attack_ai(var/mob/user as mob)
src.add_hiddenprint(user)
diff --git a/code/game/objects/effects/decals/slag.dm b/code/game/objects/effects/decals/slag.dm
index e8e56972ebe..fd9c0a041aa 100644
--- a/code/game/objects/effects/decals/slag.dm
+++ b/code/game/objects/effects/decals/slag.dm
@@ -6,7 +6,7 @@
icon_state = "slagcold"
anchored = 1
melt_temperature=0
- l_color="#FFA500"
+ light_color = LIGHT_COLOR_ORANGE
starting_materials = list()
@@ -25,10 +25,10 @@
molten=1
icon_state="slaghot"
processing_objects.Add(src)
- SetLuminosity(2)
+ set_light(2)
/obj/effect/decal/slag/Destroy()
- SetLuminosity(0)
+ set_light(0)
processing_objects.Remove(src)
..()
@@ -63,11 +63,11 @@
/obj/effect/decal/slag/solidify()
icon_state="slagcold"
- SetLuminosity(0)
+ set_light(0)
/obj/effect/decal/slag/melt()
icon_state="slaghot"
- SetLuminosity(2)
+ set_light(2)
/obj/effect/decal/slag/Crossed(M as mob)
..()
diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm
index 0fbbcf187de..8874a7f0121 100644
--- a/code/game/objects/effects/glowshroom.dm
+++ b/code/game/objects/effects/glowshroom.dm
@@ -40,7 +40,7 @@
icon_state = "glowshroomf"
spawn(delay)
- SetLuminosity(round(potency/10))
+ set_light(round(potency/10))
// Spread() - Methinks this is broken - N3X
/obj/effect/glowshroom/proc/Spread()
diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm
index b68cb66ca7e..c5df0f6c495 100644
--- a/code/game/objects/items/blueprints.dm
+++ b/code/game/objects/items/blueprints.dm
@@ -29,7 +29,9 @@
/obj/item/blueprints/Topic(href, href_list)
. = ..()
- if(.) return 1
+ if(.)
+ return
+
switch(href_list["action"])
if ("create_area")
if (get_area_type()!=AREA_SPACE)
@@ -79,7 +81,7 @@ move an amendment to the drawing.
/obj/item/blueprints/proc/get_area_type(var/area/A = get_area())
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/item/blueprints/proc/get_area_type() called tick#: [world.time]")
- if (A.name == "Space" && A.tag)
+ if (A.name == "Space")
return AREA_SPACE
var/list/SPECIALS = list(
/area/shuttle,
@@ -124,8 +126,6 @@ move an amendment to the drawing.
var/area/oldarea = get_area(usr)
newarea.name = str
newarea.tag = "[newarea.type]/[md5(str)]"
- newarea.tagbase = "[newarea.type]_[md5(str)]" // without this dynamic light system ruin everithing
- newarea.master = newarea
newarea.power_equip = 0
newarea.power_light = 0
newarea.power_environ = 0
@@ -137,7 +137,6 @@ move an amendment to the drawing.
for(var/atom/allthings in T.contents)
allthings.change_area(oldarea,newarea)
newarea.addSorted()
- newarea.SetDynamicLighting()
sleep(5)
interact()
diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm
index 680d99f9a4e..26e8eda1b61 100644
--- a/code/game/objects/items/candle.dm
+++ b/code/game/objects/items/candle.dm
@@ -6,7 +6,7 @@
item_state = "candle1"
w_class = 1
heat_production = 1000
- l_color = LIGHT_COLOR_FIRE
+ light_color = LIGHT_COLOR_FIRE
var/wax = 200
var/lit = 0
@@ -31,7 +31,7 @@
if(!src.lit)
src.lit = 1
visible_message(flavor_text)
- SetLuminosity(CANDLE_LUM)
+ set_light(CANDLE_LUM)
processing_objects.Add(src)
/obj/item/candle/process()
@@ -52,18 +52,7 @@
if(lit)
lit = 0
update_icon()
- SetLuminosity(0)
- user.SetLuminosity(user.luminosity - CANDLE_LUM)
-
-/obj/item/candle/pickup(mob/user)
- if(lit)
- SetLuminosity(0)
- user.SetLuminosity(user.luminosity + CANDLE_LUM)
-
-/obj/item/candle/dropped(mob/user)
- if(lit && !luminosity)
- user.SetLuminosity(user.luminosity - CANDLE_LUM)
- SetLuminosity(CANDLE_LUM)
+ set_light(0)
/obj/item/candle/is_hot()
if(lit)
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index a407bfab9e9..c28825192ab 100755
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -553,15 +553,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 && !luminosity)
- user.SetLuminosity(user.luminosity - f_lum)
- SetLuminosity(f_lum)
/obj/item/device/pda/New()
..()
@@ -1626,12 +1617,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
diff --git a/code/game/objects/items/devices/PDA/apps.dm b/code/game/objects/items/devices/PDA/apps.dm
index 2752b1d2bca..5bef7b71a90 100644
--- a/code/game/objects/items/devices/PDA/apps.dm
+++ b/code/game/objects/items/devices/PDA/apps.dm
@@ -45,7 +45,7 @@ var/global/list/pda_app_menus = list(
..()
pda_device.f_lum = 3
if(pda_device.fon)
- pda_device.SetLuminosity(pda_device.f_lum)
+ pda_device.set_light(pda_device.f_lum)
/datum/pda_app/spam_filter
name = "Spam Filter"
diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm
index 468c4f7bee3..88a78cbbdcc 100644
--- a/code/game/objects/items/devices/flashlight.dm
+++ b/code/game/objects/items/devices/flashlight.dm
@@ -19,25 +19,19 @@
..()
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)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/item/device/flashlight/proc/update_brightness() called tick#: [world.time]")
if(on)
icon_state = "[initial(icon_state)]-on"
- if(user && loc == user)
- user.SetLuminosity(user.luminosity + brightness_on)
- else
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
else
icon_state = initial(icon_state)
- if(user && loc == user)
- user.SetLuminosity(user.luminosity - brightness_on)
- else
- SetLuminosity(0)
+ set_light(0)
/obj/item/device/flashlight/attack_self(mob/user)
if(!isturf(user.loc))
@@ -92,19 +86,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 && !luminosity)
- 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."
@@ -156,6 +137,7 @@
desc = "A red Nanotrasen issued flare. There are instructions on the side, it reads 'pull cord, make light'."
w_class = 2.0
brightness_on = 4 // Pretty bright.
+ light_power = 2.5
icon_state = "flare"
item_state = "flare"
action_button_name = null //just pull it manually, neckbeard.
@@ -164,7 +146,7 @@
var/produce_heat = 1500
var/H_color = ""
- l_color = "#AA0033"
+ light_color = LIGHT_COLOR_FLARE
/obj/item/device/flashlight/flare/New()
fuel = rand(300, 500) // Sorry for changing this so much but I keep under-estimating how long X number of ticks last in seconds.
@@ -215,21 +197,14 @@
src.damtype = "fire"
processing_objects += src
if(user)
- user.l_color = l_color
update_brightness(user)
else
update_brightness()
-/obj/item/device/flashlight/flare/pickup(mob/user)
- ..()
- if(on)
- user.l_color = l_color
-
-
-/obj/item/device/flashlight/flare/dropped(mob/user)
- ..()
- user.l_color = initial(user.l_color)
-
+/obj/item/device/flashlight/flare/ever_bright/New()
+ . = ..()
+ fuel = INFINITY
+ Light()
// SLIME LAMP
/obj/item/device/flashlight/lamp/slime
@@ -237,7 +212,7 @@
desc = "A lamp powered by a slime core. You can adjust its brightness by touching it."
icon_state = "slimelamp"
item_state = ""
- l_color = "#333300"
+ light_color = LIGHT_COLOR_SLIME_LAMP
on = 0
luminosity = 2
var/brightness_max = 6
@@ -247,25 +222,19 @@
..()
if(on)
icon_state = "[initial(icon_state)]-on"
- SetLuminosity(brightness_max)
+ set_light(brightness_max)
else
icon_state = initial(icon_state)
- SetLuminosity(brightness_min)
+ set_light(brightness_min)
/obj/item/device/flashlight/lamp/slime/proc/slime_brightness(var/mob/user = null)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/item/device/flashlight/lamp/slime/proc/slime_brightness() called tick#: [world.time]")
if(on)
icon_state = "[initial(icon_state)]-on"
- if(user && loc == user)
- user.SetLuminosity(user.luminosity + brightness_max - brightness_min)
- else if(isturf(loc))
- SetLuminosity(brightness_max)
+ set_light(brightness_max)
else
icon_state = initial(icon_state)
- if(user && loc == user)
- user.SetLuminosity(user.luminosity - brightness_max + brightness_min)
- else if(isturf(loc))
- SetLuminosity(brightness_min)
+ set_light(brightness_min)
/obj/item/device/flashlight/lamp/slime/attack_self(mob/user)
if(!isturf(user.loc))
@@ -274,23 +243,3 @@
on = !on
slime_brightness(user)
return 1
-
-/obj/item/device/flashlight/lamp/slime/pickup(mob/user)
- user.l_color = l_color
- if(on)
- user.SetLuminosity(user.luminosity + brightness_max)
- SetLuminosity(0)
- else
- user.SetLuminosity(user.luminosity + brightness_min)
- SetLuminosity(0)
-
-
-/obj/item/device/flashlight/lamp/slime/dropped(mob/user)
- user.l_color = initial(user.l_color)
- if(on && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_max)
- SetLuminosity(brightness_max)
- else
- if(!luminosity)
- user.SetLuminosity(user.luminosity - brightness_min)
- SetLuminosity(brightness_min)
diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm
index 9cdabfa2a41..0da9207d5d5 100644
--- a/code/game/objects/items/devices/lightreplacer.dm
+++ b/code/game/objects/items/devices/lightreplacer.dm
@@ -154,7 +154,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()
@@ -167,7 +169,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)
diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm
index 7bcf31a7141..f68ef5bb2e3 100644
--- a/code/game/objects/items/devices/powersink.dm
+++ b/code/game/objects/items/devices/powersink.dm
@@ -55,7 +55,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
@@ -63,7 +63,7 @@
..()
Destroy()
- SetLuminosity(0)
+ set_light(0)
processing_objects.Remove(src)
attached.attached = null
attached = null
@@ -96,7 +96,7 @@
if(M == user) continue
M << "[user] deactivates the power sink!"
mode = 1
- SetLuminosity(0)
+ set_light(0)
icon_state = "powersink0"
playsound(get_turf(src), 'sound/effects/teleport.ogg', 50, 1)
processing_objects.Remove(src)
@@ -105,7 +105,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
diff --git a/code/game/objects/items/stacks/cable.dm b/code/game/objects/items/stacks/cable.dm
index 76cedf1fea4..cbd5bcc5b67 100644
--- a/code/game/objects/items/stacks/cable.dm
+++ b/code/game/objects/items/stacks/cable.dm
@@ -253,7 +253,7 @@ var/global/list/datum/stack_recipe/cable_recipes = list ( \
if(C.shock(user, 50))
if(prob(50)) //fail
- getFromPool(/obj/item/stack/cable_coil, C.loc, 1, C.l_color)
+ getFromPool(/obj/item/stack/cable_coil, C.loc, 1, C.light_color)
returnToPool(C)
return
diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm
index b5b73b94330..7e07d9b63b5 100644
--- a/code/game/objects/items/weapons/cigs_lighters.dm
+++ b/code/game/objects/items/weapons/cigs_lighters.dm
@@ -30,7 +30,7 @@ MATCHBOXES ARE ALSO IN FANCY.DM
w_class = 1.0
origin_tech = "materials=1"
attack_verb = list("burnt", "singed")
- l_color = LIGHT_COLOR_FIRE
+ light_color = LIGHT_COLOR_FIRE
/obj/item/weapon/match/New()
@@ -74,18 +74,10 @@ MATCHBOXES ARE ALSO IN FANCY.DM
if(lit == 1) //I wish I didn't need the == 1 part, but Dreamkamer is a dumb puppy
processing_objects.Add(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity + brightness_on)
- else if(isturf(loc))
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
else
processing_objects.Remove(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity - brightness_on)
- else if(isturf(loc))
- SetLuminosity(0)
+ set_light(0)
update_icon()
/obj/item/weapon/match/process()
@@ -99,16 +91,6 @@ MATCHBOXES ARE ALSO IN FANCY.DM
location.hotspot_expose(heat_production, 5, surfaces = istype(loc, /turf))
return
-/obj/item/weapon/match/pickup(mob/user)
- if(lit == 1)
- user.SetLuminosity(user.luminosity + brightness_on)
- SetLuminosity(0)
-
-/obj/item/weapon/match/dropped(mob/user)
- if(lit == 1)
- user.SetLuminosity(user.luminosity - brightness_on)
- SetLuminosity(brightness_on)
-
/obj/item/weapon/match/is_hot()
if(lit == 1)
return heat_production
@@ -169,7 +151,7 @@ MATCHBOXES ARE ALSO IN FANCY.DM
body_parts_covered = null
attack_verb = list("burnt", "singed")
heat_production = 1000
- l_color = LIGHT_COLOR_FIRE
+ light_color = LIGHT_COLOR_FIRE
var/lit = 0
var/overlay_on = "ciglit" //Apparently not used
var/type_butt = /obj/item/weapon/cigbutt
@@ -210,30 +192,12 @@ MATCHBOXES ARE ALSO IN FANCY.DM
if(lit)
processing_objects.Add(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity + brightness_on)
- else if(isturf(loc))
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
else
processing_objects.Remove(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity - brightness_on)
- else if(isturf(loc))
- SetLuminosity(0)
+ set_light(0)
update_icon()
-/obj/item/clothing/mask/cigarette/pickup(mob/user)
- if(lit)
- user.SetLuminosity(user.luminosity + brightness_on)
- SetLuminosity(0)
-
-/obj/item/clothing/mask/cigarette/dropped(mob/user)
- if(lit)
- user.SetLuminosity(user.luminosity - brightness_on)
- SetLuminosity(brightness_on)
-
/obj/item/clothing/mask/cigarette/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(lit)
return
@@ -618,7 +582,7 @@ MATCHBOXES ARE ALSO IN FANCY.DM
heat_production = 1500
slot_flags = SLOT_BELT
attack_verb = list("burnt", "singed")
- l_color = LIGHT_COLOR_FIRE
+ light_color = LIGHT_COLOR_FIRE
var/lit = 0
/obj/item/weapon/lighter/zippo
@@ -662,30 +626,12 @@ MATCHBOXES ARE ALSO IN FANCY.DM
if(lit)
processing_objects.Add(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity + brightness_on)
- else if(isturf(loc))
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
else
processing_objects.Remove(src)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity - brightness_on)
- else if(isturf(loc))
- SetLuminosity(0)
+ set_light(0)
update_icon()
-/obj/item/weapon/lighter/pickup(mob/user)
- if(lit)
- user.SetLuminosity(user.luminosity + brightness_on)
- SetLuminosity(0)
-
-/obj/item/weapon/lighter/dropped(mob/user)
- if(lit)
- user.SetLuminosity(user.luminosity - brightness_on)
- SetLuminosity(brightness_on)
-
/obj/item/weapon/lighter/afterattack(obj/O, mob/user, proximity)
if(!proximity)
return 0
diff --git a/code/game/objects/items/weapons/glowstick.dm b/code/game/objects/items/weapons/glowstick.dm
index b6e4028a2fd..6856c031839 100644
--- a/code/game/objects/items/weapons/glowstick.dm
+++ b/code/game/objects/items/weapons/glowstick.dm
@@ -9,9 +9,9 @@
icon = 'icons/obj/weapons.dmi'
icon_state = "glowstick"
- l_color = GLOW_GREEN
+ light_color = GLOW_GREEN
w_class = 2
-
+
suicide_act(mob/user)
viewers(user) << "[user] is breaking open the [src.name] and eating the liquid inside! It looks like \he's trying to commit suicide!"
return (TOXLOSS)
@@ -19,31 +19,31 @@
/obj/item/weapon/glowstick/New()
. = ..()
- SetLuminosity(2)
+ set_light(2, l_color = light_color)
/obj/item/weapon/glowstick/red
desc = "A plastic stick filled with luminescent liquid, this one is red."
color = GLOW_RED
- l_color = GLOW_RED
+ light_color = GLOW_RED
/obj/item/weapon/glowstick/blue
desc = "A plastic stick filled with luminescent liquid, this one is blue."
color = GLOW_BLUE
- l_color = GLOW_BLUE
+ light_color = GLOW_BLUE
/obj/item/weapon/glowstick/yellow
desc = "A plastic stick filled with luminescent liquid, this one is yellow."
color = "#FFFF00"
- l_color = "#FFFF00"
+ light_color = "#FFFF00"
/obj/item/weapon/glowstick/magenta
desc = "A plastic stick filled with luminescent liquid, this one is magenta."
color = "#FF00FF"
- l_color = "#FF00FF"
+ light_color = "#FF00FF"
#undef GLOW_GREEN
#undef GLOW_RED
diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm
index 2acd919bbd1..eb5dc28a423 100644
--- a/code/game/objects/items/weapons/grenades/flashbang.dm
+++ b/code/game/objects/items/weapons/grenades/flashbang.dm
@@ -105,7 +105,7 @@
/obj/effect/effect/smoke/flashbang/New()
..()
- SetLuminosity(15)
+ set_light(15)
/obj/item/weapon/grenade/flashbang/clusterbang//Created by Polymorph, fixed by Sieve
desc = "Use of this weapon may constiute a war crime in your area, consult your local captain."
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index f35952c3cc7..2dfc63060d3 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -155,16 +155,12 @@ var/global/list/reagents_to_log = list("fuel" = "welder fuel", "plasma"= "pla
return
/obj/singularity_act()
- if(!simulated)
- return 0
ex_act(1)
if(src)
qdel(src)
return 2
/obj/singularity_pull(S, current_size)
- if(!simulated)
- return 0
if(anchored)
if(current_size >= STAGE_FIVE)
anchored = 0
diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm
index ceff68134d8..a0976d0023b 100644
--- a/code/game/objects/structures/false_walls.dm
+++ b/code/game/objects/structures/false_walls.dm
@@ -128,7 +128,7 @@
flick("[mineral]fwall_opening", src)
sleep(15)
src.density = 0
- SetOpacity(0)
+ set_opacity(0)
opening = 0
else
opening = 1
@@ -136,7 +136,7 @@
icon_state = "[mineral]0"
density = 1
sleep(15)
- SetOpacity(1)
+ set_opacity(1)
src.relativewall()
opening = 0
@@ -241,7 +241,7 @@
flick("frwall_opening", src)
sleep(15)
density = 0
- SetOpacity(0)
+ set_opacity(0)
opening = 0
else
opening = 1
@@ -249,7 +249,7 @@
flick("frwall_closing", src)
density = 1
sleep(15)
- SetOpacity(1)
+ set_opacity(1)
relativewall()
opening = 0
diff --git a/code/game/objects/structures/vehicles/adminbus.dm b/code/game/objects/structures/vehicles/adminbus.dm
index 0daec81bda1..ca82d9cc47d 100644
--- a/code/game/objects/structures/vehicles/adminbus.dm
+++ b/code/game/objects/structures/vehicles/adminbus.dm
@@ -149,9 +149,9 @@
update_lightsource()
handle_mob_bumping()
if(warp)
- warp.loc = src.loc
+ warp.forceMove(loc)
if(busjuke)
- busjuke.loc = src.loc
+ busjuke.forceMove(loc)
busjuke.dir = dir
if(busjuke.icon_state)
busjuke.repack()
@@ -161,10 +161,10 @@
var/atom/A = passengers[i]
if(isliving(A))
var/mob/living/M = A
- M.loc = src.loc
+ M.forceMove(loc)
else if(isbot(A))
var/obj/machinery/bot/B = A
- B.loc = src.loc
+ B.forceMove(loc)
for(var/obj/structure/hookshot/H in hookshot)
H.forceMove(get_step(H,src.dir))
@@ -172,40 +172,40 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/structure/stool/bed/chair/vehicle/adminbus/proc/update_lightsource() called tick#: [world.time]")
var/turf/T = get_step(src,src.dir)
if(T.opacity)
- lightsource.loc = T
+ lightsource.forceMove(T)
switch(roadlights) //if the bus is right against a wall, only the wall's tile is lit
if(0)
- if(lightsource.luminosity != 0)
- lightsource.SetLuminosity(0)
+ if(lightsource.light_range != 0)
+ lightsource.set_light(0)
if(1,2)
- if(lightsource.luminosity != 1)
- lightsource.SetLuminosity(1)
+ if(lightsource.light_range != 1)
+ lightsource.set_light(1)
else
T = get_step(T,src.dir) //if there is a wall two tiles in front of the bus, the lightsource is right in front of the bus, though weaker
if(T.opacity)
- lightsource.loc = get_step(src,src.dir)
+ lightsource.forceMove(get_step(src,src.dir))
switch(roadlights)
if(0)
- if(lightsource.luminosity != 0)
- lightsource.SetLuminosity(0)
+ if(lightsource.light_range != 0)
+ lightsource.set_light(0)
if(1)
- if(lightsource.luminosity != 1)
- lightsource.SetLuminosity(1)
+ if(lightsource.light_range != 1)
+ lightsource.set_light(1)
if(2)
- if(lightsource.luminosity != 2)
- lightsource.SetLuminosity(2)
+ if(lightsource.light_range != 2)
+ lightsource.set_light(2)
else
- lightsource.loc = T
- switch(roadlights) //otherwise, the lightsource position itself two tiles in front of the bus and with regular luminosity
+ lightsource.forceMove(T)
+ switch(roadlights) //otherwise, the lightsource position itself two tiles in front of the bus and with regular light_range
if(0)
- if(lightsource.luminosity != 0)
- lightsource.SetLuminosity(0)
+ if(lightsource.light_range != 0)
+ lightsource.set_light(0)
if(1)
- if(lightsource.luminosity != 2)
- lightsource.SetLuminosity(2)
+ if(lightsource.light_range != 2)
+ lightsource.set_light(2)
if(2)
- if(lightsource.luminosity != 3)
- lightsource.SetLuminosity(3)
+ if(lightsource.light_range != 3)
+ lightsource.set_light(3)
/obj/structure/stool/bed/chair/vehicle/adminbus/proc/handle_mob_bumping()
@@ -508,7 +508,7 @@
forceMove(get_step_towards(src,abus))
max_distance++
if(max_distance >= 7)
- del(src)
+ qdel(src)
return
sleep(2)
.()
@@ -527,7 +527,7 @@
if(abus.buckled_mob)
abus.buckled_mob.gui_icons.adminbus_hook.icon_state = "icon_hook"
abus.hook = 1
- del(src)
+ qdel(src)
return
sleep(2)
.()
diff --git a/code/game/objects/structures/vehicles/adminbus_powers.dm b/code/game/objects/structures/vehicles/adminbus_powers.dm
index 489cb6d9f06..0ff5c5d0f7d 100644
--- a/code/game/objects/structures/vehicles/adminbus_powers.dm
+++ b/code/game/objects/structures/vehicles/adminbus_powers.dm
@@ -18,7 +18,7 @@
freed(L)
else if(isbot(A))
var/obj/machinery/bot/B = A
- B.loc = get_step(src,turn(src.dir,-90))
+ B.forceMove(get_step(src,turn(src.dir,-90)))
B.turn_on()
B.flags &= ~INVULNERABLE
B.anchored = 0
@@ -165,18 +165,18 @@
bususer.gui_icons.adminbus_hook.icon_state = "icon_hook-push"
var/obj/structure/singulo_chain/anchor/A = locate(/obj/structure/singulo_chain/anchor) in chain
if(A)
- del(A)//so we don't drag the singulo back to us along with the rest of the chain.
+ qdel(A)//so we don't drag the singulo back to us along with the rest of the chain.
singulo.on_release()
singulo = null
while(chain_base)
var/obj/structure/singulo_chain/C = chain_base
C.move_child(get_turf(src))
chain_base = C.child
- del(C)
+ qdel(C)
sleep(2)
for(var/obj/structure/singulo_chain/N in chain)//Just in case some bits of the chain were detached from the bus for whatever reason
- del(N)
+ qdel(N)
chain.len = 0
if(!singulo)
@@ -226,25 +226,25 @@
bususer.gui_icons.adminbus_roadlights_0.icon_state = "icon_lights_0-on"
bususer.gui_icons.adminbus_roadlights_1.icon_state = "icon_lights_1-off"
bususer.gui_icons.adminbus_roadlights_2.icon_state = "icon_lights_2-off"
- lightsource.SetLuminosity(0)
+ lightsource.set_light(0)
if(roadlights == 1 || roadlights == 2)
- overlays -= image(icon,"roadlights",LIGHTING_LAYER+1)
+ overlays -= image(icon,"roadlights", LIGHTING_LAYER + 1)
roadlights = 0
if(1)
bususer.gui_icons.adminbus_roadlights_0.icon_state = "icon_lights_0-off"
bususer.gui_icons.adminbus_roadlights_1.icon_state = "icon_lights_1-on"
bususer.gui_icons.adminbus_roadlights_2.icon_state = "icon_lights_2-off"
- lightsource.SetLuminosity(2)
+ lightsource.set_light(2)
if(roadlights == 0)
- overlays += image(icon,"roadlights",LIGHTING_LAYER+1)
+ overlays += image(icon,"roadlights", LIGHTING_LAYER + 1)
roadlights = 1
if(2)
bususer.gui_icons.adminbus_roadlights_0.icon_state = "icon_lights_0-off"
bususer.gui_icons.adminbus_roadlights_1.icon_state = "icon_lights_1-off"
bususer.gui_icons.adminbus_roadlights_2.icon_state = "icon_lights_2-on"
- lightsource.SetLuminosity(3)
+ lightsource.set_light(3)
if(roadlights == 0)
- overlays += image(icon,"roadlights",LIGHTING_LAYER+1)
+ overlays += image(icon,"roadlights", LIGHTING_LAYER + 1)
roadlights = 2
update_lightsource()
@@ -605,17 +605,17 @@
*/
- M.loc = pick(tdomeobserve)
+ M.forceMove(pick(tdomeobserve))
M << "You have been sent to the Thunderdome. Thank you for riding with us and enjoy your games."
else if(isbot(A))
var/obj/machinery/bot/B = A
- B.loc = get_step(src,turn(src.dir,-90))
+ B.forceMove(get_step(src,turn(src.dir,-90)))
B.turn_on()
B.flags &= ~INVULNERABLE
B.anchored = 0
passengers -= B
- B.loc = pick(tdomeobserve)
+ B.forceMove(pick(tdomeobserve))
var/turf/TD = get_turf(A)
if(TD)
@@ -826,7 +826,7 @@
else if(isbot(A))
var/obj/machinery/bot/B = A
- B.loc = get_step(src,turn(src.dir,-90))
+ B.forceMove(get_step(src,turn(src.dir,-90)))
B.turn_on()
B.flags &= ~INVULNERABLE
B.anchored = 0
diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm
index 004aceadca9..e90e601f673 100644
--- a/code/game/supplyshuttle.dm
+++ b/code/game/supplyshuttle.dm
@@ -19,20 +19,16 @@ var/list/mechtoys = list(
/obj/item/toy/prize/odysseus,
/obj/item/toy/prize/phazon
)
-
-/area/supply/station //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
+//Lighting STILL disabled, even with the new bay engine, because lighting doesn't play nice with our shuttles, might just be our shuttle code, or the small changes in the lighting engine we have from bay.
+/area/supply/station
name = "supply shuttle"
icon_state = "shuttle3"
- luminosity = 1
- lighting_use_dynamic = 0
requires_power = 0
-/area/supply/dock //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
+/area/supply/dock
name = "supply shuttle"
icon_state = "shuttle3"
- luminosity = 1
- lighting_use_dynamic = 0
requires_power = 0
//SUPPLY PACKS MOVED TO /code/defines/obj/supplypacks.dm
@@ -126,7 +122,7 @@ var/list/mechtoys = list(
var/last_viewed_group = "categories"
var/datum/money_account/current_acct
- l_color = "#87421F"
+ light_color = LIGHT_COLOR_BROWN
/obj/machinery/computer/ordercomp
name = "Supply ordering console"
@@ -138,7 +134,7 @@ var/list/mechtoys = list(
var/last_viewed_group = "categories"
var/datum/money_account/current_acct
- l_color = "#87421F"
+ light_color = LIGHT_COLOR_BROWN
/*
/obj/effect/marker/supplymarker
@@ -339,7 +335,7 @@ var/list/mechtoys = list(
if(T.density) continue
var/contcount
for(var/atom/A in T.contents)
- if(!A.simulated)
+ if(islightingoverlay(A))
continue
contcount++
if(contcount)
diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm
index b0f09046847..ae22d53b78c 100644
--- a/code/game/turfs/simulated.dm
+++ b/code/game/turfs/simulated.dm
@@ -11,6 +11,7 @@
var/drying = 0 // tracking if something is currently drying
/turf/simulated/New()
..()
+
if(istype(loc, /area/chapel))
holy = 1
levelupdate()
diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm
index 3b1511d3582..a8dce0be46e 100644
--- a/code/game/turfs/simulated/floor.dm
+++ b/code/game/turfs/simulated/floor.dm
@@ -109,30 +109,30 @@ turf/simulated/floor/proc/update_icon()
switch(T.state)
if(LIGHTFLOOR_ON)
icon_state = "light_on"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_WHITE)
icon_state = "light_on-w"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_RED)
icon_state = "light_on-r"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_GREEN)
icon_state = "light_on-g"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_YELLOW)
icon_state = "light_on-y"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_BLUE)
icon_state = "light_on-b"
- SetLuminosity(5)
+ set_light(5)
if(LIGHTFLOOR_PURPLE)
icon_state = "light_on-p"
- SetLuminosity(5)
+ set_light(5)
else
icon_state = "light_off"
- SetLuminosity(0)
+ set_light(0)
else
- SetLuminosity(0)
+ set_light(0)
icon_state = "light_off"
else if(is_grass_floor())
if(!broken && !burnt)
@@ -355,7 +355,7 @@ turf/simulated/floor/proc/update_icon()
//qdel(floor_tile)
returnToPool(floor_tile)
icon_plating = "plating"
- SetLuminosity(0)
+ set_light(0)
floor_tile = null
intact = 0
broken = 0
@@ -373,7 +373,7 @@ turf/simulated/floor/proc/update_icon()
broken = 0
burnt = 0
intact = 1
- SetLuminosity(0)
+ set_light(0)
if(floor_tile) returnToPool(floor_tile)
floor_tile = null
if(T)
@@ -597,13 +597,13 @@ turf/simulated/floor/proc/update_icon()
if("uranium")
if(!spam_flag)
spam_flag = 1
- SetLuminosity(2)
+ set_light(3)
icon_state = "uranium_inactive"
for(var/mob/living/L in range(2,src)) //Weak radiation
L.apply_effect(3,IRRADIATE,0)
flick("uranium_active",src)
spawn(20)
- SetLuminosity(0)
+ set_light(0)
spawn(200)
spam_flag = 0
update_icon()
diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm
index 474689045a2..50039b351e9 100644
--- a/code/game/turfs/space/space.dm
+++ b/code/game/turfs/space/space.dm
@@ -7,7 +7,7 @@
temperature = TCMB
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
heat_capacity = 700000
- intact = 0 //No seriously, that's not a joke. Allows cable to be laid PROPERLY on catwalks
+ intact = 0 //No seriously, that's not a joke. Allows cable to be laid properLY on catwalks
dynamic_lighting = 0
/turf/space/New()
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 0365bb5b1d4..157b4baf5fa 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -2,20 +2,22 @@
icon = 'icons/turf/floors.dmi'
level = 1.0
+ luminosity = 1
+
//for floors, use is_plating(), is_plasteel_floor() and is_light_floor()
var/intact = 1
- //Properties for open tiles (/floor)
+ //properties for open tiles (/floor)
var/oxygen = 0
var/carbon_dioxide = 0
var/nitrogen = 0
var/toxins = 0
- //Properties for airtight tiles (/wall)
+ //properties for airtight tiles (/wall)
var/thermal_conductivity = 0.05
var/heat_capacity = 1
- //Properties for both
+ //properties for both
var/temperature = T20C
var/blocks_air = 0
@@ -275,7 +277,6 @@
if (!N)
return
- var/initialOpacity = opacity
#ifdef ENABLE_TRI_LEVEL
// Fuck this, for now - N3X
///// Z-Level Stuff ///// This makes sure that turfs are not changed to space when one side is part of a zone
@@ -297,9 +298,13 @@
///// Z-Level Stuff
#endif
- var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/datum/gas_mixture/env
+ var/old_opacity = opacity
+ var/old_dynamic_lighting = dynamic_lighting
+ var/list/old_affecting_lights = affecting_lights
+ var/old_lighting_overlay = lighting_overlay
+
//world << "Replacing [src.type] with [N]"
if(connections) connections.erase_all()
@@ -329,11 +334,6 @@
if(env)
W.air = env //Copy the old environment data over if both turfs were simulated
- W.lighting_lumcount += old_lumcount
- if((old_lumcount != W.lighting_lumcount) || (loc.name != "Space" && force_lighting_update))
- W.lighting_changed = 1
- lighting_controller.changed_turfs += W
-
if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
@@ -345,10 +345,7 @@
W.levelupdate()
- if((opacity != initialOpacity) && W.lighting_lumcount)
- UpdateAffectingLights()
-
- return W
+ . = W
else
//if(zone)
@@ -357,10 +354,6 @@
// zone.SetStatus(ZONE_ACTIVE)
var/turf/W = new N( locate(src.x, src.y, src.z) )
- W.lighting_lumcount += old_lumcount
- if((old_lumcount != W.lighting_lumcount) || (loc.name != "Space" && force_lighting_update))
- W.lighting_changed = 1
- lighting_controller.changed_turfs += W
if(tell_universe)
universe.OnTurfChange(W)
@@ -370,10 +363,17 @@
W.levelupdate()
- if((opacity != initialOpacity) && W.lighting_lumcount)
- UpdateAffectingLights()
+ . = W
- return W
+ lighting_overlay = old_lighting_overlay
+ affecting_lights = old_affecting_lights
+ if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update)
+ reconsider_lights()
+ if(dynamic_lighting != old_dynamic_lighting)
+ if(dynamic_lighting)
+ lighting_build_overlays()
+ else
+ lighting_clear_overlays()
/turf/proc/AddDecal(const/image/decal)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/turf/proc/AddDecal() called tick#: [world.time]")
@@ -612,6 +612,9 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/turf/proc/dismantle_wall() called tick#: [world.time]")
return
+/turf/change_area(oldarea, newarea)
+ lighting_build_overlays()
+
/////////////////////////////////////////////////////
/turf/proc/spawn_powerup()
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index d31eb087c92..3f8c6807de4 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -177,7 +177,8 @@ var/list/admin_verbs_debug = list(
#ifdef PROFILE_MACHINES
/client/proc/cmd_admin_dump_macprofile,
#endif
- /client/proc/debugNatureMapGenerator
+ /client/proc/debugNatureMapGenerator,
+ /client/proc/callatomproc
)
var/list/admin_verbs_possess = list(
/proc/possess,
diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm
index ae2797f5121..4c333b9493f 100644
--- a/code/modules/admin/verbs/adminjump.dm
+++ b/code/modules/admin/verbs/adminjump.dm
@@ -12,11 +12,10 @@
return
var/list/turfs = list()
- for(var/area/Ar in A.related)
- for(var/turf/T in Ar)
- if(T.density)
- continue
- turfs.Add(T)
+ for(var/turf/T in A)
+ if(T.density)
+ continue
+ turfs.Add(T)
var/turf/T = pick_n_take(turfs)
if(!T)
diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm
index ffa66007c8e..16a64311983 100644
--- a/code/modules/admin/verbs/massmodvar.dm
+++ b/code/modules/admin/verbs/massmodvar.dm
@@ -172,46 +172,9 @@
if("text")
var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null
if(new_value == null) return
- O.vars[variable] = new_value
- if(method)
- if(istype(O, /mob))
- for(var/mob/M in mob_list)
- if ( istype(M , O.type) )
- M.vars[variable] = O.vars[variable]
-
- else if(istype(O, /obj))
- for(var/obj/A in world)
- if ( istype(A , O.type) )
- A.vars[variable] = O.vars[variable]
-
- else if(istype(O, /turf))
- for(var/turf/A in turfs)
- if ( istype(A , O.type) )
- A.vars[variable] = O.vars[variable]
- else
- if(istype(O, /mob))
- for(var/mob/M in mob_list)
- if (M.type == O.type)
- M.vars[variable] = O.vars[variable]
-
- else if(istype(O, /obj))
- for(var/obj/A in world)
- if (A.type == O.type)
- A.vars[variable] = O.vars[variable]
-
- else if(istype(O, /turf))
- for(var/turf/A in turfs)
- if (A.type == O.type)
- A.vars[variable] = O.vars[variable]
-
- if("num")
- var/new_value = input("Enter new number:","Num",\
- O.vars[variable]) as num|null
- if(new_value == null) return
-
- if(variable=="luminosity")
- O.SetLuminosity(new_value)
+ if(variable == "light_color")
+ O.set_light(l_color = new_value)
else
O.vars[variable] = new_value
@@ -219,24 +182,91 @@
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_color")
+ M.set_light(l_color = 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_color")
+ A.set_light(l_color = new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in turfs)
if ( istype(A , O.type) )
- if(variable=="luminosity")
- A.SetLuminosity(new_value)
+ if(variable == "light_color")
+ A.set_light(l_color = new_value)
+ else
+ A.vars[variable] = O.vars[variable]
+ else
+ if(istype(O, /mob))
+ for(var/mob/M in mob_list)
+ if (M.type == O.type)
+ if(variable == "light_color")
+ M.set_light(l_color = 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 == "light_color")
+ A.set_light(l_color = new_value)
+ else
+ A.vars[variable] = O.vars[variable]
+
+ else if(istype(O, /turf))
+ for(var/turf/A in turfs)
+ if (A.type == O.type)
+ if(variable == "light_color")
+ A.set_light(l_color = new_value)
+ else
+ A.vars[variable] = O.vars[variable]
+
+ if("num")
+ var/new_value = input("Enter new number:","Num",\
+ O.vars[variable]) as num|null
+ if(new_value == null) return
+
+ if(variable=="light_range")
+ O.set_light(new_value)
+ else if(variable == "light_power")
+ O.set_light(l_power = new_value)
+ else
+ O.vars[variable] = new_value
+
+ if(method)
+ if(istype(O, /mob))
+ for(var/mob/M in mob_list)
+ if ( istype(M , O.type) )
+ if(variable=="light_range")
+ M.set_light(new_value)
+ else if(variable == "light_power")
+ M.set_light(l_power = 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=="light_range")
+ A.set_light(new_value)
+ else if(variable == "light_power")
+ A.set_light(l_power = new_value)
+ else
+ A.vars[variable] = O.vars[variable]
+
+ else if(istype(O, /turf))
+ for(var/turf/A in turfs)
+ if ( istype(A , O.type) )
+ if(variable=="light_range")
+ A.set_light(new_value)
+ else if(variable == "light_power")
+ A.set_light(l_power = new_value)
else
A.vars[variable] = O.vars[variable]
@@ -244,24 +274,30 @@
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 if(variable == "light_power")
+ M.set_light(l_power = 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 if(variable == "light_power")
+ A.set_light(l_power = new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in turfs)
if (A.type == O.type)
- if(variable=="luminosity")
- A.SetLuminosity(new_value)
+ if(variable=="light_range")
+ A.set_light(new_value)
+ else if(variable == "light_power")
+ A.set_light(l_power = new_value)
else
A.vars[variable] = O.vars[variable]
diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm
index 704f0b15255..a4e78bafae4 100644
--- a/code/modules/admin/verbs/modifyvariables.dm
+++ b/code/modules/admin/verbs/modifyvariables.dm
@@ -503,15 +503,26 @@ var/list/forbidden_varedit_object_types = list(
return .(O.vars[variable])
if("text")
- var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|message
- if(var_new==null) return
- O.vars[variable] = var_new
+ if(variable == "light_color")
+ var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|message
+ if(var_new==null) return
+ O.set_light(l_color = var_new)
+ else
+ var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|message
+ if(var_new==null) return
+ 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=="light_power")
+ var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
+ if(var_new == null) return
+ O.set_light(l_power = 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
diff --git a/code/modules/awaymissions/maploader/writer.dm b/code/modules/awaymissions/maploader/writer.dm
index c07938b442b..c2f49728518 100644
--- a/code/modules/awaymissions/maploader/writer.dm
+++ b/code/modules/awaymissions/maploader/writer.dm
@@ -21,6 +21,7 @@
"Z"
)
var/list/blacklist = list(
+ /atom/movable/lighting_overlay,
/obj/effect/beam,
/obj/item/projectile
)
diff --git a/code/modules/bomberman/bomberman.dm b/code/modules/bomberman/bomberman.dm
index 9a7741f50a3..655021febf1 100644
--- a/code/modules/bomberman/bomberman.dm
+++ b/code/modules/bomberman/bomberman.dm
@@ -261,7 +261,7 @@ var/global/list/bombermangear = list()
icon_state = "explosion_core"
density = 0
anchored = 1
- layer = LIGHTING_LAYER+1
+ layer = LIGHTING_LAYER + 1
var/destroy_environnement = 0
var/hurt_players = 0
@@ -920,9 +920,7 @@ var/global/list/arenas = list()
//now we just need to add a thunderdome jukebox to every map
var/area/A = new
A.name = name
- A.tagbase = "[A.type]_[md5(name)]"
A.tag = "[A.type]/[md5(name)]"
- A.master = A
A.power_equip = 0
A.power_light = 0
A.power_environ = 0
diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm
index b24e91ba322..b0186edf047 100644
--- a/code/modules/clothing/head/hardhat.dm
+++ b/code/modules/clothing/head/hardhat.dm
@@ -4,6 +4,7 @@
icon_state = "hardhat0_yellow"
flags = FPRINT
item_state = "hardhat0_yellow"
+ light_power = 1.5
var/brightness_on = 4 //luminosity when on
var/on = 0
_color = "yellow" //Determines used sprites: hardhat[on]_[_color] and hardhat[on]_[_color]2 (lying down sprite)
@@ -12,29 +13,15 @@
action_button_name = "Toggle Helmet Light"
siemens_coefficient = 0.9
- attack_self(mob/user)
- if(!isturf(user.loc))
- user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities.
- return
- on = !on
- 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 && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_on)
-// user.UpdateLuminosity()
- SetLuminosity(brightness_on)
+/obj/item/clothing/head/hardhat/attack_self(mob/user)
+ on = !on
+ icon_state = "hardhat[on]_[_color]"
+ item_state = "hardhat[on]_[_color]"
+ if(on)
+ set_light(brightness_on)
+ else
+ set_light(0)
/obj/item/clothing/head/hardhat/orange
icon_state = "hardhat0_orange"
diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm
index c165e1f0ba6..df572d415e2 100644
--- a/code/modules/clothing/head/misc_special.dm
+++ b/code/modules/clothing/head/misc_special.dm
@@ -68,6 +68,7 @@
icon_state = "cake0"
flags = FPRINT
body_parts_covered = HEAD|EYES
+ light_power = 0.5
var/onfire = 0.0
var/status = 0
var/fire_resist = T0C+1300 //this is the max temp it can stand before you start to cook. although it might not burn away, you take damage
@@ -98,10 +99,12 @@
src.damtype = "fire"
src.icon_state = "cake1"
processing_objects.Add(src)
+ set_light(2)
else
src.force = null
src.damtype = "brute"
src.icon_state = "cake0"
+ set_light(0)
return
@@ -148,20 +151,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()
- SetLuminosity(0)
-
- dropped(mob/user)
- if(on && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_on)
-// user.UpdateLuminosity()
- SetLuminosity(brightness_on)
+ if(on) set_light(brightness_on)
+ else set_light(0)
/*
* Kitty ears
@@ -187,10 +178,6 @@
mob.Blend(earbit, ICON_OVERLAY)
mob2.Blend(earbit2, ICON_OVERLAY)
-
-
-
-
/obj/item/clothing/head/butt
name = "butt"
desc = "So many butts, so little time."
diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm
index 5589f84db5e..91c5cd2b124 100644
--- a/code/modules/clothing/spacesuits/plasmamen.dm
+++ b/code/modules/clothing/spacesuits/plasmamen.dm
@@ -54,31 +54,14 @@
action_button_name = "Toggle Helmet Light"
/obj/item/clothing/head/helmet/space/plasmaman/attack_self(mob/user)
- if(!isturf(user.loc))
- user << "You cannot turn the light on while in this [user.loc]" //To prevent some lighting anomalities.
- return
if(no_light)
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) set_light(brightness_on)
+ else set_light(0)
user.update_inv_head()
-/obj/item/clothing/head/helmet/space/plasmaman/pickup(mob/user)
- if(on)
- user.SetLuminosity(user.luminosity + brightness_on)
-// user.UpdateLuminosity()
- SetLuminosity(0)
-
-/obj/item/clothing/head/helmet/space/plasmaman/dropped(mob/user)
- if(on && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_on)
-// user.UpdateLuminosity()
- SetLuminosity(brightness_on)
-
-
-
// ENGINEERING
/obj/item/clothing/suit/space/plasmaman/assistant
name = "plasmaman assistant suit"
diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm
index f559b8a3b80..921325afd27 100644
--- a/code/modules/clothing/spacesuits/rig.dm
+++ b/code/modules/clothing/spacesuits/rig.dm
@@ -6,6 +6,7 @@
item_state = "eng_helm"
armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 80)
allowed = list(/obj/item/device/flashlight)
+ light_power = 1.7
var/brightness_on = 4 //Luminosity when on. If modified, do NOT run update_brightness() directly
var/on = 0 //Remember to run update_brightness() when modified, otherwise disasters happen
var/no_light = 0 //Disables the helmet light when set to 1. Make sure to run check_light() if this is updated
@@ -46,26 +47,14 @@
else //We have a light
action_button_name = initial(action_button_name) //Make sure we restore the action button
-//This thing is a hack to circumvent lighting not working in containers (a mob's hands or pockets being a container)
-//Why that is the case is a mystery for the ages, but it should work
-//Now uses ismob(loc) to cut down on the bullshit, the proc checks if it needs to deduct lighting from a mob or from the world (more properly, the tile on which it is sitting)
-//Note to coders : DO NOT EVER FIRE THIS UNLESS YOU TOGGLE A LIGHT ON OR OFF BEFOREHAND. AND NO, CERTAINLY NOT IF YOU UPDATE BRIGHTNESS_ON
/obj/item/clothing/head/helmet/space/rig/proc/update_brightness()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/item/clothing/head/helmet/space/rig/proc/update_brightness() called tick#: [world.time]")
if(on)
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity + brightness_on)
- else if(isturf(loc))
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
else
- if(ismob(loc))
- var/mob/carrier = loc
- carrier.SetLuminosity(carrier.luminosity - brightness_on)
- else if(isturf(loc))
- SetLuminosity(0)
+ set_light(0)
update_icon()
/obj/item/clothing/head/helmet/space/rig/update_icon()
@@ -75,24 +64,16 @@
/obj/item/clothing/head/helmet/space/rig/attack_self(mob/user)
if(no_light)
return
- if(!isturf(user.loc))
- user << "You cannot turn the light on while in this [loc]" //To prevent some lighting anomalities.
- return
on = !on
- update_brightness()
update_icon()
user.update_inv_head()
-/obj/item/clothing/head/helmet/space/rig/pickup(mob/user)
if(on)
- user.SetLuminosity(user.luminosity + brightness_on)
- SetLuminosity(0)
-
-/obj/item/clothing/head/helmet/space/rig/dropped(mob/user)
- if(on && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_on)
- SetLuminosity(brightness_on)
+ set_light(brightness_on)
+ else
+ set_light(0)
+ user.update_inv_head()
/obj/item/clothing/suit/space/rig
name = "engineering hardsuit"
diff --git a/code/modules/detectivework/detective_work.dm b/code/modules/detectivework/detective_work.dm
index bd65b569e63..69bdc827f5b 100644
--- a/code/modules/detectivework/detective_work.dm
+++ b/code/modules/detectivework/detective_work.dm
@@ -60,7 +60,7 @@ obj/machinery/computer/forensic_scanning
var/canclear = 1
var/authenticated = 0
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
//Here's the structure for files: each entry is a list, and entry one in that list is the string of their
//full and scrambled fingerprint. This acts as the method to arrange evidence. Each subsequent entry is list
diff --git a/code/modules/events/bluespaceanomaly.dm b/code/modules/events/bluespaceanomaly.dm
index 829e9c0db10..4079fa575f6 100644
--- a/code/modules/events/bluespaceanomaly.dm
+++ b/code/modules/events/bluespaceanomaly.dm
@@ -70,6 +70,7 @@
if(A.anchored && istype(A, /obj/machinery)) continue
if(istype(A, /obj/structure/disposalpipe )) continue
if(istype(A, /obj/structure/cable )) continue
+ if(istype(A, /atom/movable/lighting_overlay)) continue
var/turf/newloc = locate(A.x + x_distance, A.y + y_distance, TO.z) // calculate the new place
A.forceMove(newloc)
diff --git a/code/modules/events/infestation.dm b/code/modules/events/infestation.dm
index 7bffb389b66..f684bfaa637 100644
--- a/code/modules/events/infestation.dm
+++ b/code/modules/events/infestation.dm
@@ -57,11 +57,10 @@
//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)
+ if(!F.contents.len)
+ turfs += F
var/list/spawn_types = list()
var/max_number
diff --git a/code/modules/html_interface/map/crew/crew.dm b/code/modules/html_interface/map/crew/crew.dm
index 2fff05d4fab..6615380338c 100644
--- a/code/modules/html_interface/map/crew/crew.dm
+++ b/code/modules/html_interface/map/crew/crew.dm
@@ -9,7 +9,8 @@
var/list/tracked = list( )
var/track_special_role
- l_color = LIGHT_COLOR_BLUE
+ light_color = LIGHT_COLOR_BLUE
+ light_range_on = 2
/obj/machinery/computer/crew/New()
tracked = list()
diff --git a/code/modules/hydroponics/hydro_tray.dm b/code/modules/hydroponics/hydro_tray.dm
index 1d4a304dd7b..de3b1caa104 100644
--- a/code/modules/hydroponics/hydro_tray.dm
+++ b/code/modules/hydroponics/hydro_tray.dm
@@ -299,15 +299,13 @@
//' update_connected_network()
// Handle light requirements.
- var/area/A = T.loc
- if(A)
- var/light_available
- if(A.lighting_use_dynamic)
- light_available = max(0,min(10,T.lighting_lumcount)-5)
- else
- light_available = 5
- if(abs(light_available - seed.ideal_light) > seed.light_tolerance)
- health -= healthmod
+
+ var/light_available = 5
+ if(T.dynamic_lighting)
+ light_available = T.get_lumcount(0.5) * 10
+
+ if(abs(light_available - seed.ideal_light) > seed.light_tolerance)
+ health -= healthmod
// Toxin levels beyond the plant's tolerance cause damage, but
// toxins are sucked up each tick and slowly reduce over time.
@@ -512,14 +510,14 @@
// Update bioluminescence.
if(seed)
if(seed.biolum)
- SetLuminosity(round(seed.potency/10))
+ set_light(round(seed.potency/10))
if(seed.biolum_colour)
- l_color = seed.biolum_colour
+ light_color = seed.biolum_colour
else
- l_color = null
+ light_color = null
return
- SetLuminosity(0)
+ set_light(0)
return
// If a weed growth is sufficient, this proc is called.
@@ -835,13 +833,9 @@
else //Somewhere we shouldn't be, panic
return
- var/area/A = get_area(T)
- var/light_available
- if(A)
- if(A.lighting_use_dynamic)
- light_available = max(0,min(10,T.lighting_lumcount))
- else
- light_available = 5
+ var/light_available = 5
+ if(T.dynamic_lighting)
+ light_available = T.get_lumcount() * 10
user << "The tray's sensor suite is reporting a light level of [light_available] lumens and a temperature of [environment.temperature]K."
diff --git a/code/modules/hydroponics/seed_datums.dm b/code/modules/hydroponics/seed_datums.dm
index a6d5ae3b8cb..3a51da53b89 100644
--- a/code/modules/hydroponics/seed_datums.dm
+++ b/code/modules/hydroponics/seed_datums.dm
@@ -622,8 +622,8 @@ proc/populate_seed_list()
if(biolum)
if(biolum_colour)
- product.l_color = biolum_colour
- product.SetLuminosity(biolum)
+ product.light_color = biolum_colour
+ product.set_light(biolum)
//Handle spawning in living, mobile products (like dionaea).
if(istype(product,/mob/living))
diff --git a/code/modules/hydroponics/vines.dm b/code/modules/hydroponics/vines.dm
index 4bd436951b1..e0b30ffef23 100644
--- a/code/modules/hydroponics/vines.dm
+++ b/code/modules/hydroponics/vines.dm
@@ -192,14 +192,14 @@
// Update bioluminescence.
if(seed.biolum)
- SetLuminosity(1+round(seed.potency/10))
+ set_light(1+round(seed.potency/10))
if(seed.biolum_colour)
- l_color = seed.biolum_colour
+ light_color = seed.biolum_colour
else
- l_color = null
+ light_color = null
return
else
- SetLuminosity(0)
+ set_light(0)
// Update flower/product overlay.
overlays.len = 0
@@ -300,16 +300,11 @@
die()
return
- var/area/A = T.loc
- if(A)
- var/light_available
- if(A.lighting_use_dynamic)
- light_available = max(0,min(10,T.lighting_lumcount)-5)
- else
- light_available = 5
- if(abs(light_available - seed.ideal_light) > seed.light_tolerance)
- die()
- return
+ var/light_available = T.get_lumcount(0.5) * 10
+
+ if(abs(light_available - seed.ideal_light) > seed.light_tolerance)
+ die()
+ return
/obj/effect/plant_controller
diff --git a/code/modules/lighting/__lighting_docs.dm b/code/modules/lighting/__lighting_docs.dm
new file mode 100644
index 00000000000..a5ff9450e49
--- /dev/null
+++ b/code/modules/lighting/__lighting_docs.dm
@@ -0,0 +1,74 @@
+/*
+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.
+ - SetLuminosity() is now set_light() and takes the three variables above.
+ - Variables can be left as null to not update them.
+ - SetOpacity() 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:
+
+global: (uh, I placed the only one in lighting_system.dm)
+ - var/list/all_lighting_overlays; Just a list of ALL of the lighting overlays.
+
+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
+ - var/list/lighting_overlays; list of lighting overlays in the turf. (only used if higher resolutions
+ - var/lighting_overlay; ref to the lighting overlay (only used if resolution is 1)
+
+ - 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
+ - proc/get_lumcount(var/minlum = 0, var/maxlum = 1)
+ - Returns a decimal according to the amount of lums on a turf's overlay (also averages them)
+ - With default arguments (based on the fact that 0 = pitch black and 1 = full bright), it will return .5 for a 50% lit tile.
+
+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
+*/
diff --git a/code/modules/lighting/light_source.dm b/code/modules/lighting/light_source.dm
new file mode 100644
index 00000000000..a702ea663fd
--- /dev/null
+++ b/code/modules/lighting/light_source.dm
@@ -0,0 +1,286 @@
+/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/tmp/old_lum_r
+ var/tmp/old_lum_g
+ var/tmp/old_lum_b
+
+ var/list/effect_str
+ var/list/effect_turf
+
+ var/applied
+
+ var/vis_update //Whetever we should smartly recalculate visibility. and then only update tiles that became (in) visible to us
+ 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_str = list()
+ effect_turf = list()
+
+ update()
+
+ return ..()
+
+/datum/light_source/proc/destroy()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/destroy() called tick#: [world.time]")
+ 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)
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/update() called tick#: [world.time]")
+ 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
+ if(!needs_update)
+ lighting_update_lights += src
+ needs_update = 1
+
+/datum/light_source/proc/force_update()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/force_update() called tick#: [world.time]")
+ force_update = 1
+ if(!needs_update)
+ needs_update = 1
+ lighting_update_lights += src
+
+/datum/light_source/proc/vis_update()
+ if(!needs_update)
+ needs_update = 1
+ lighting_update_lights += src
+
+ vis_update = 1
+
+/datum/light_source/proc/check()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/check() called tick#: [world.time]")
+ if(!source_atom || !light_range || !light_power)
+ 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(light_range && light_power && !applied)
+ . = 1
+
+ if(. || source_atom.light_color != light_color)//Save the old lumcounts if we need to update, if the colour changed DO IT BEFORE we parse the colour and LOSE the old lumcounts!
+ old_lum_r = lum_r
+ old_lum_g = lum_g
+ old_lum_b = lum_b
+
+ if(source_atom.light_color != light_color)
+ light_color = source_atom.light_color
+ parse_light_color()
+ . = 1
+
+/datum/light_source/proc/parse_light_color()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/parse_light_color() called tick#: [world.time]")
+ 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)
+ writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/falloff() called tick#: [world.time]")
+ #if LIGHTING_FALLOFF == 1 // circular
+ . = (O.x - source_turf.x)**2 + (O.y - source_turf.y)**2 + LIGHTING_HEIGHT
+ #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
+ . = abs(O.x - source_turf.x) + abs(O.y - source_turf.y) + LIGHTING_HEIGHT
+ #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()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/apply_lum() called tick#: [world.time]")
+ applied = 1
+ if(istype(source_turf))
+ for(var/turf/T in dview(light_range, source_turf, INVISIBILITY_LIGHTING))
+ if(T.lighting_overlay)
+
+ #if LIGHTING_FALLOFF == 1 // circular
+ . = (T.lighting_overlay.x - source_turf.x)**2 + (T.lighting_overlay.y - source_turf.y)**2 + LIGHTING_HEIGHT
+ #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
+ . = abs(T.lighting_overlay.x - source_turf.x) + abs(T.lighting_overlay.y - source_turf.y) + LIGHTING_HEIGHT
+ #if LIGHTING_LAMBERTIAN == 1
+ . = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
+ #else
+ . = 1 - CLAMP01(. / light_range)
+ #endif
+ #endif
+ . *= light_power
+
+ if(!.) //Don't add turfs that aren't affected to the affected turfs.
+ continue
+
+ . = round(., LIGHTING_ROUND_VALUE) //Screw sinking points.
+
+ effect_str += .
+
+ T.lighting_overlay.update_lumcount(
+ lum_r * .,
+ lum_g * .,
+ lum_b * .
+ )
+
+ else
+ effect_str += 0
+
+ if(!T.affecting_lights)
+ T.affecting_lights = list()
+
+ T.affecting_lights += src
+ effect_turf += T
+
+/datum/light_source/proc/remove_lum()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/light_source/proc/remove_lum() called tick#: [world.time]")
+ applied = 0
+
+ var/i = 1
+ for(var/turf/T in effect_turf)
+ if(T.affecting_lights)
+ T.affecting_lights -= src
+
+ if(T.lighting_overlay)
+ var/str = effect_str[i]
+ T.lighting_overlay.update_lumcount(-str * old_lum_r, -str * old_lum_g, -str * old_lum_b)
+
+ i++
+
+ effect_str.Cut()
+ effect_turf.Cut()
+
+//Smartly updates the lighting, only removes lum from and adds lum to turfs that actually got changed.
+//This is for lights that need to reconsider due to nearby opacity changes.
+//Stupid dumb copy pasta because BYOND and speed.
+/datum/light_source/proc/smart_vis_update()
+ var/list/view[0]
+ for(var/turf/T in dview(light_range, source_turf, INVISIBILITY_LIGHTING))
+ view += T //Filter out turfs.
+
+ //This is the part where we calculate new turfs (if any)
+ var/list/new_turfs = view - effect_turf //This will result with all the tiles that are added.
+ for(var/turf/T in new_turfs)
+ //Big huge copy paste from apply_lum() incoming because screw unreadable defines and screw proc call overhead.
+ if(T.lighting_overlay)
+
+ #if LIGHTING_FALLOFF == 1 // circular
+ . = (T.lighting_overlay.x - source_turf.x)**2 + (T.lighting_overlay.y - source_turf.y)**2 + LIGHTING_HEIGHT
+ #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
+ . = abs(T.lighting_overlay.x - source_turf.x) + abs(T.lighting_overlay.y - source_turf.y) + LIGHTING_HEIGHT
+ #if LIGHTING_LAMBERTIAN == 1
+ . = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
+ #else
+ . = 1 - CLAMP01(. / light_range)
+ #endif
+ #endif
+ . *= light_power
+
+ if(!.) //Don't add turfs that aren't affected to the affected turfs.
+ continue
+
+ . = round(., LIGHTING_ROUND_VALUE)
+
+ effect_str += .
+
+ T.lighting_overlay.update_lumcount(
+ lum_r * .,
+ lum_g * .,
+ lum_b * .
+ )
+
+ else
+ effect_str += 0
+
+ if(!T.affecting_lights)
+ T.affecting_lights = list()
+
+ T.affecting_lights += src
+ effect_turf += T
+
+ var/list/old_turfs = effect_turf - view
+ for(var/turf/T in old_turfs)
+ //Insert not-so-huge copy paste from remove_lum().
+ var/idx = effect_turf.Find(T) //Get the index, luckily Find() is cheap in small lists like this. (with small I mean under a couple thousand len)
+ if(T.affecting_lights)
+ T.affecting_lights -= src
+
+ if(T.lighting_overlay)
+ var/str = effect_str[idx]
+ T.lighting_overlay.update_lumcount(-str * lum_r, -str * lum_g, -str * lum_b)
+
+ effect_turf.Cut(idx, idx + 1)
+ effect_str.Cut(idx, idx + 1)
diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm
new file mode 100644
index 00000000000..c9e038eda78
--- /dev/null
+++ b/code/modules/lighting/lighting_atom.dm
@@ -0,0 +1,77 @@
+/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)
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/proc/set_light() called tick#: [world.time]")
+ 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()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/proc/update_light() called tick#: [world.time]")
+ if(gcDestroyed) return
+ 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/proc/set_opacity(new_opacity)
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/proc/set_opacity() called tick#: [world.time]")
+ 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()
+
+/atom/Entered(atom/movable/Obj, atom/OldLoc) //Implemented here because forceMove() doesn't call Move()
+ . = ..()
+
+ if(Obj && OldLoc != src)
+ for(var/datum/light_source/L in Obj.light_sources)
+ L.source_atom.update_light()
\ No newline at end of file
diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm
new file mode 100644
index 00000000000..7fbc9fa0342
--- /dev/null
+++ b/code/modules/lighting/lighting_overlay.dm
@@ -0,0 +1,115 @@
+/atom/movable/lighting_overlay
+ name = ""
+ mouse_opacity = 0
+ anchored = 1
+
+ icon_state = "light1"
+ icon = LIGHTING_ICON
+ layer = LIGHTING_LAYER
+ invisibility = INVISIBILITY_LIGHTING
+ blend_mode = BLEND_MULTIPLY
+ color = "#000000"
+
+ var/lum_r
+ var/lum_g
+ var/lum_b
+
+ var/needs_update
+
+/atom/movable/lighting_overlay/New()
+ . = ..()
+ verbs.Cut()
+
+/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b)
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/movable/lighting_overlay/proc/update_lumcount() called tick#: [world.time]")
+ if(!delta_r && !delta_g && !delta_b) //Nothing is being changed all together.
+ return
+
+ var/should_update = 0
+
+ if(!needs_update) //If this isn't true, we're already updating anyways.
+ if(max(lum_r, lum_g, lum_b) < 1) //Any change that could happen WILL change appearance.
+ should_update = 1
+
+ else if(max(lum_r + delta_r, lum_g + delta_g, lum_b + delta_b) < 1) //The change would bring us under 1 max lum, again, guaranteed to change appearance.
+ should_update = 1
+
+ else //We need to make sure that the colour ratios won't change in this code block.
+ var/mx1 = max(lum_r, lum_g, lum_b)
+ var/mx2 = max(lum_r + delta_r, lum_g + delta_g, lum_b + delta_b)
+
+ if(lum_r / mx1 != (lum_r + delta_r) / mx2 || lum_g / mx1 != (lum_g + delta_g) / mx2 || lum_b / mx1 != (lum_b + delta_b) / mx2) //Stuff would change.
+ should_update = 1
+
+ lum_r += delta_r
+ lum_g += delta_g
+ lum_b += delta_b
+
+ if(!needs_update && should_update)
+ needs_update = 1
+ lighting_update_overlays |= src
+
+/atom/movable/lighting_overlay/proc/update_overlay()
+ //writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/atom/movable/lighting_overlay/proc/update_overlay() called tick#: [world.time]")
+ 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_TRANSITION_SPEED
+ )
+ #else
+ color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
+ #endif
+
+ var/turf/T = loc
+
+ if(istype(T)) //Incase we're not on a turf, pool ourselves, something happened.
+ if(color != "#000000")
+ T.luminosity = 1
+ else //No light, set the turf's luminosity to 0 to remove it from view()
+ #if LIGHTING_TRANSITIONS == 1
+ spawn(LIGHTING_TRANSITION_SPEED)
+ T.luminosity = 0
+ #else
+ T.luminosity = 0
+ #endif
+
+ universe.OnTurfTick(T)
+ else
+ warning("A lighting overlay realised it's loc was NOT a turf (actual loc: [loc], [loc.type]) in update_overlay() and got pooled!")
+ returnToPool(src)
+
+/atom/movable/lighting_overlay/resetVariables()
+// testing("Lighting_overlays: resetvars called")
+ loc = null
+
+ lum_r = 0
+ lum_g = 0
+ lum_b = 0
+
+ color = "#000000"
+
+
+ needs_update = 0
+
+/atom/movable/lighting_overlay/Destroy()
+ all_lighting_overlays -= src
+ lighting_update_overlays -= src
+
+ var/turf/T = loc
+ if(istype(T))
+ T.lighting_overlay = null
+
+/atom/movable/lighting_overlay/singuloCanEat()
+ return 0
+
+/atom/movable/lighting_overlay/ex_act(severity)
+ return 0
+
+//Override here to prevent things accidentally moving around overlays.
+/atom/movable/lighting_overlay/forceMove(atom/destination, var/harderforce = 0)
+ if(harderforce)
+ .= ..()
diff --git a/code/modules/lighting/lighting_system.dm b/code/modules/lighting/lighting_system.dm
new file mode 100644
index 00000000000..6373d29d5d3
--- /dev/null
+++ b/code/modules/lighting/lighting_system.dm
@@ -0,0 +1,29 @@
+/var/list/lighting_update_lights = list()
+/var/list/lighting_update_overlays = list()
+/var/list/all_lighting_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)
+ //writepanic("[__FILE__].[__LINE__] (no type)([usr ? usr.ckey : ""]) \\/proc/create_lighting_overlays() called tick#: [world.time]")
+ var/area/A
+ if(zlevel == 0) // populate all zlevels
+ for(var/turf/T in turfs)
+ if(T.dynamic_lighting)
+ A = T.loc
+ if(A.lighting_use_dynamic)
+ var/atom/movable/lighting_overlay/O = getFromPool(/atom/movable/lighting_overlay, T)
+ all_lighting_overlays |= O
+ T.lighting_overlay = O
+
+ 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)
+ var/atom/movable/lighting_overlay/O = getFromPool(/atom/movable/lighting_overlay, T)
+ all_lighting_overlays |= O
+ T.lighting_overlay = O
diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm
index 7ad7f452848..01713fa37fe 100644
--- a/code/modules/lighting/lighting_turf.dm
+++ b/code/modules/lighting/lighting_turf.dm
@@ -5,7 +5,8 @@
/turf/proc/reconsider_lights()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/turf/proc/reconsider_lights() called tick#: [world.time]")
for(var/datum/light_source/L in affecting_lights)
- L.force_update()
+ L.vis_update()
+
/turf/proc/lighting_clear_overlays()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/turf/proc/lighting_clear_overlays() called tick#: [world.time]")
diff --git a/code/modules/media/broadcast/transmitters/broadcast.dm b/code/modules/media/broadcast/transmitters/broadcast.dm
index 2ae7f2ad4b6..4108749d90a 100644
--- a/code/modules/media/broadcast/transmitters/broadcast.dm
+++ b/code/modules/media/broadcast/transmitters/broadcast.dm
@@ -4,7 +4,7 @@
icon = 'icons/obj/machines/broadcast.dmi'
icon_state = "broadcaster"
- l_color="#4285F4"
+ light_color = LIGHT_COLOR_BLUE
use_power = 1
idle_power_usage = 50
active_power_usage = 1000
@@ -115,10 +115,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"
diff --git a/code/modules/media/jukebox.dm b/code/modules/media/jukebox.dm
index 5fa444914c2..ce64f4d911b 100644
--- a/code/modules/media/jukebox.dm
+++ b/code/modules/media/jukebox.dm
@@ -687,7 +687,7 @@ var/global/loopModeNames=list(
desc = "It really doesn't get any better."
icon = 'icons/obj/bus.dmi'
icon_state = ""
- l_color = "#000066"
+ light_color = LIGHT_COLOR_BLUE
luminosity = 0
layer = FLY_LAYER+1
pixel_x = -32
@@ -716,7 +716,7 @@ var/global/loopModeNames=list(
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/media/jukebox/superjuke/adminbus/proc/deploy() called tick#: [world.time]")
update_media_source()
icon_state = "jukebox"
- SetLuminosity(4)
+ set_light(4)
flick("deploying",src)
/obj/machinery/media/jukebox/superjuke/adminbus/proc/repack()
@@ -727,7 +727,7 @@ var/global/loopModeNames=list(
if(popup)
popup.close()
playing = 0
- SetLuminosity(0)
+ set_light(0)
icon_state = ""
flick("repacking",src)
update_music()
diff --git a/code/modules/medical/cloning.dm b/code/modules/medical/cloning.dm
index af713dff3b7..44dbdcc9cc2 100644
--- a/code/modules/medical/cloning.dm
+++ b/code/modules/medical/cloning.dm
@@ -28,7 +28,10 @@
machine_flags = EMAGGABLE | SCREWTOGGLE | CROWDESTROY | MULTITOOL_MENU
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
+ use_auto_lights = 1
+ light_range_on = 3
+ light_power_on = 2
/obj/machinery/cloning/clonepod/full
biomass = CLONE_BIOMASS // * 3 - N3X
@@ -36,14 +39,6 @@
/obj/machinery/cloning/clonepod/multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
return ""
-
-/obj/machinery/cloning/clonepod/power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)) && attempting)
- SetLuminosity(2)
- else
- SetLuminosity(0)
-
/********************************************************************
** Adding Stock Parts to VV so preconstructed shit has its candy **
********************************************************************/
diff --git a/code/modules/medical/computer/cloning.dm b/code/modules/medical/computer/cloning.dm
index ca9c8c9b513..db5b62df1a6 100644
--- a/code/modules/medical/computer/cloning.dm
+++ b/code/modules/medical/computer/cloning.dm
@@ -17,7 +17,7 @@
var/obj/item/weapon/disk/data/diskette = null //Mostly so the geneticist can steal everything.
var/loading = 0 // Nice loading text
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/cloning/New()
..()
diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm
index 1630f004ee0..8a283e964cc 100644
--- a/code/modules/mining/machine_processing.dm
+++ b/code/modules/mining/machine_processing.dm
@@ -7,7 +7,7 @@
density = 1
anchored = 1
circuit = "/obj/item/weapon/circuitboard/smeltcomp"
- l_color = LIGHT_COLOR_GREEN
+ light_color = LIGHT_COLOR_GREEN
var/frequency = FREQ_DISPOSAL //Same as conveyors.
var/smelter_tag = null
@@ -273,7 +273,9 @@
idle_power_usage = 50
active_power_usage = 500 //This shit's able to compress tiny little diamonds into really big diamonds, of course this uses a lot of power.
machine_flags = SCREWTOGGLE | CROWDESTROY | MULTITOOL_MENU
- l_color = LIGHT_COLOR_ORANGE
+ light_power_on = 2
+ light_range_on = 3
+ light_color = LIGHT_COLOR_ORANGE
var/atom/movable/mover //Virtual atom used to check passing ability on the out turf.
@@ -308,10 +310,10 @@
/obj/machinery/mineral/processing_unit/update_icon()
if(stat & (NOPOWER | BROKEN) || !on)
icon_state = "furnace_o"
- SetLuminosity(0)
+ set_light(0)
else if(on)
icon_state = "furnace"
- SetLuminosity(2)
+ set_light(light_range_on, light_power_on)
/obj/machinery/mineral/processing_unit/RefreshParts()
var/i = 0
diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm
index d3e84fc5da8..5df7ac039b8 100644
--- a/code/modules/mining/machine_stacking.dm
+++ b/code/modules/mining/machine_stacking.dm
@@ -4,7 +4,7 @@
name = "stacking machine console"
icon = 'icons/obj/computer.dmi'
icon_state = "computer_generic"
- l_color = LIGHT_COLOR_GREEN
+ light_color = LIGHT_COLOR_GREEN
circuit = "/obj/item/weapon/circuitboard/stacking_machine_console"
var/stacker_tag//The ID of the stacker this console should control
diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm
index e5963900d49..76a89ef0672 100644
--- a/code/modules/mining/mine_items.dm
+++ b/code/modules/mining/mine_items.dm
@@ -5,7 +5,7 @@
name = "Light-emtter"
anchored = 1
unacidable = 1
- luminosity = 8
+ light_range = 8
/**********************Miner Lockers**************************/
@@ -121,7 +121,7 @@ proc/move_mining_shuttle()
circuit = "/obj/item/weapon/circuitboard/mining_shuttle"
var/location = 0 //0 = station, 1 = mining base
machine_flags = EMAGGABLE | SCREWTOGGLE
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/mining_shuttle/attack_hand(user as mob)
if(..(user))
@@ -164,6 +164,8 @@ proc/move_mining_shuttle()
icon_state = "lantern"
desc = "A mining lantern."
brightness_on = 6 // luminosity when on
+ light_power = 2
+ light_color = LIGHT_COLOR_TUNGSTEN
/*****************************Pickaxe********************************/
diff --git a/code/modules/mining/mine_structures.dm b/code/modules/mining/mine_structures.dm
index f4493fddfb8..c35daa442b9 100644
--- a/code/modules/mining/mine_structures.dm
+++ b/code/modules/mining/mine_structures.dm
@@ -50,21 +50,13 @@
icon_state = "hanginglantern"
anchored = 1
layer = 5
- l_color = LIGHT_COLOR_TUNGSTEN
+ light_range = 6 //Luminosity of hanging lanterns
+ light_power = 2
+ light_color = LIGHT_COLOR_TUNGSTEN
ghost_write = 0 //Can't be too safe
ghost_read = 0
var/flickering = 0 //SPOOK
-/obj/structure/hanging_lantern/New()
- ..()
- alllights += src
- SetLuminosity(5)
-
-/obj/structure/hanging_lantern/Destroy()
- alllights -= src
- SetLuminosity(0)
- ..()
-
/obj/structure/hanging_lantern/attack_hand(mob/user)
user.visible_message("[user] takes the mining lantern off the \the [src].", \
@@ -85,8 +77,8 @@
flickering = 1
spawn(0)
for(var/i = 0; i < amount; i++)
- SetLuminosity(0)
+ set_light(0)
spawn(rand(5, 15))
- SetLuminosity(5)
- SetLuminosity(5)
+ set_light(6, 2, LIGHT_COLOR_TUNGSTEN)
+ set_light(6, 2, LIGHT_COLOR_TUNGSTEN)
flickering = 0
diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm
index 4c829dccc15..2083358cd07 100644
--- a/code/modules/mining/ores_coins.dm
+++ b/code/modules/mining/ores_coins.dm
@@ -193,7 +193,7 @@
/obj/item/weapon/ore/cytine/attack_hand(mob/user as mob)
var/obj/item/weapon/glowstick/G = new /obj/item/weapon/glowstick(user.loc)
G.color = color
- G.l_color = color
+ G.light_color = color
del(src)
/obj/item/weapon/ore/uqill
diff --git a/code/modules/mining/surprise.dm b/code/modules/mining/surprise.dm
index ac6a04e0a7e..432062b617b 100644
--- a/code/modules/mining/surprise.dm
+++ b/code/modules/mining/surprise.dm
@@ -344,6 +344,8 @@ var/global/list/mining_surprises = typesof(/mining_surprise)-/mining_surprise
if(clean)
for(var/O in cur_loc)
+ if(islightingoverlay(O)) //Don't want lighting overlays to be deleted.
+ continue
qdel(O)
if(x == 0 || x==x_size-1 || y==0 || y==y_size-1)
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index 3a07ec4e862..3ea9117b667 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -1052,10 +1052,8 @@ var/global/list/organ_damage_overlays = list(
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
+ light_amount = T.get_lumcount(0.5) * 10
+
nutrition += light_amount
traumatic_shock -= light_amount
@@ -1072,10 +1070,11 @@ var/global/list/organ_damage_overlays = list(
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
+ if(T.dynamic_lighting)
+ light_amount = T.get_lumcount() * 10
+ else
+ light_amount = 10
+
if(light_amount > 2) //if there's enough light, start dying
take_overall_damage(1,1)
else if (light_amount < 2) //heal in the dark
@@ -1665,8 +1664,8 @@ var/global/list/organ_damage_overlays = list(
//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/turf/T = get_turf(src)
+ if(!T.get_lumcount())
playsound_local(src,pick(scarySounds),50, 1, -1)
// separate proc so we can jump out of it when we've succeeded in spreading disease.
diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm
index 5dab53b54de..97099df835f 100644
--- a/code/modules/mob/living/carbon/monkey/life.dm
+++ b/code/modules/mob/living/carbon/monkey/life.dm
@@ -476,11 +476,10 @@
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
-
+ if(T.dynamic_lighting)
+ light_amount = T.get_lumcount(0.5)
+ else
+ light_amount = 5
nutrition += light_amount
traumatic_shock -= light_amount
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index fa239b15e73..2fb762d8c2a 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -142,7 +142,7 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/mob/living/proc/IgniteMob() called tick#: [world.time]")
if(fire_stacks > 0 && !on_fire)
on_fire = 1
- src.SetLuminosity(src.luminosity + 3)
+ set_light(src.light_range + 3)
update_fire()
/mob/living/proc/ExtinguishMob()
@@ -150,7 +150,7 @@
if(on_fire)
on_fire = 0
fire_stacks = 0
- src.SetLuminosity(src.luminosity - 3)
+ set_light(src.light_range - 3)
update_fire()
/mob/living/proc/update_fire()
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 10925ae9894..41e94627bf1 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -774,7 +774,7 @@ var/list/ai_list = list()
src << "Camera lights deactivated."
for (var/obj/machinery/camera/C in lit_cameras)
- C.SetLuminosity(0)
+ C.set_light(0)
lit_cameras = list()
return
@@ -801,10 +801,10 @@ var/list/ai_list = list()
remove = lit_cameras - visible
for (var/obj/machinery/camera/C in remove)
- C.SetLuminosity(0)
+ C.set_light(0)
lit_cameras -= C
for (var/obj/machinery/camera/C in add)
- C.SetLuminosity(AI_CAMERA_LUMINOSITY)
+ C.set_light(AI_CAMERA_LUMINOSITY)
lit_cameras |= C
diff --git a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm
index 341efeabae5..4a340859b47 100644
--- a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm
+++ b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm
@@ -85,7 +85,7 @@
if(src.can_use())
cameranet.addCamera(src)
else
- src.SetLuminosity(0)
+ src.set_light(0)
cameranet.removeCamera(src)
/obj/machinery/camera/New()
diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm
index 2ecaba2b442..c9e8834c7a5 100644
--- a/code/modules/mob/living/silicon/ai/life.dm
+++ b/code/modules/mob/living/silicon/ai/life.dm
@@ -45,7 +45,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
@@ -85,7 +85,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
@@ -99,7 +99,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
@@ -126,18 +126,17 @@
var/PRP //like ERP with the code, at least this stuff is no more 4x sametext
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 AIarea)
+ 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
diff --git a/code/modules/mob/living/silicon/mommi/inventory.dm b/code/modules/mob/living/silicon/mommi/inventory.dm
index 65f516ff195..64c9fa07ca1 100644
--- a/code/modules/mob/living/silicon/mommi/inventory.dm
+++ b/code/modules/mob/living/silicon/mommi/inventory.dm
@@ -53,7 +53,7 @@
client.screen -= tool_state
tool_state = W
W.layer = 20
- contents += W
+ W.forceMove(src)
// Make crap we pick up active so there's less clicking and carpal. - N3X
module_active=tool_state
@@ -168,7 +168,7 @@
tool_state = null
inv_tool.icon_state = "inv1"
if(is_in_modules(TS))
- TS.loc = src.module
+ TS.forceMove(src.module)
hud_used.update_robot_modules_display()
/mob/living/silicon/robot/mommi/uneq_all()
@@ -229,7 +229,7 @@
tool_state = null
inv_tool.icon_state = "inv1"
if(is_in_modules(TS))
- TS.loc = src.module
+ TS.forceMove(src.module)
hud_used.update_robot_modules_display()
diff --git a/code/modules/mob/living/silicon/mommi/update_icons.dm b/code/modules/mob/living/silicon/mommi/update_icons.dm
index b11985888fc..b1adaf6a933 100644
--- a/code/modules/mob/living/silicon/mommi/update_icons.dm
+++ b/code/modules/mob/living/silicon/mommi/update_icons.dm
@@ -19,10 +19,10 @@
/mob/living/silicon/robot/mommi/updateicon()
// Clear all overlays.
overlays.len = 0
-
+
// Set the MoMMI's icon to its subtype
icon_state=subtype
-
+
// Add a panel image if the MoMMI is open
if(opened) // TODO: Open the front "head" panel
if(wiresexposed)
@@ -34,7 +34,7 @@
// Add the MoMMI eyes
// Put our eyes just on top of the lighting, so it looks emissive in maint tunnels.
- var/overlay_layer = LIGHTING_LAYER+1
+ var/overlay_layer = LIGHTING_LAYER + 1
if(layer != MOB_LAYER)
overlay_layer=TURF_LAYER+0.2
overlays += image(icon,"eyes-[subtype][emagged?"-emagged":""]",overlay_layer)
diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm
index 8dee101b7d2..1b16bbef687 100644
--- a/code/modules/mob/living/silicon/robot/inventory.dm
+++ b/code/modules/mob/living/silicon/robot/inventory.dm
@@ -28,7 +28,7 @@
contents -= module
if(module)
- module.loc = src.module
+ module.forceMove(src.module)
hud_used.update_robot_modules_display()
return 1
@@ -80,21 +80,21 @@
module_state_1 = O
O.layer = 20
O.screen_loc = inv1.screen_loc
- contents += O
+ O.forceMove(src)
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode |= module_state_1:sight_mode
else if(!module_state_2)
module_state_2 = O
O.layer = 20
O.screen_loc = inv2.screen_loc
- contents += O
+ O.forceMove(src)
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode |= module_state_2:sight_mode
else if(!module_state_3)
module_state_3 = O
O.layer = 20
O.screen_loc = inv3.screen_loc
- contents += O
+ O.forceMove(src)
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode |= module_state_3:sight_mode
else
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index fb583160d3a..39d3895a28d 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -1138,7 +1138,7 @@
overlays.len = 0
if(stat == 0 && cell != null)
- overlays += image(icon,"eyes-[icon_state]",LIGHTING_LAYER+1)
+ overlays += image(icon,"eyes-[icon_state]", LIGHTING_LAYER + 1)
if(opened)
if(custom_sprite)//Custom borgs also have custom panels, heh
diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm
index e52c7d78917..e68fbf3a0bf 100644
--- a/code/modules/mob/living/simple_animal/constructs.dm
+++ b/code/modules/mob/living/simple_animal/constructs.dm
@@ -339,7 +339,7 @@
/mob/living/simple_animal/construct/proc/updateicon()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/mob/living/simple_animal/construct/proc/updateicon() called tick#: [world.time]")
overlays = 0
- var/overlay_layer = LIGHTING_LAYER+1
+ var/overlay_layer = LIGHTING_LAYER + 1
if(layer != MOB_LAYER)
overlay_layer=TURF_LAYER+0.2
diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm
index 109cc54f547..c121b830563 100644
--- a/code/modules/mob/living/simple_animal/friendly/corgi.dm
+++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm
@@ -117,7 +117,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()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index c0a842fa254..327c506b047 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -239,7 +239,7 @@ var/global/obj/screen/fuckstat/FUCK = new
narsimage = image('icons/obj/narsie.dmi',src.loc,"narsie",9,1)
narsimage.mouse_opacity = 0
if(!narglow) //Create narglow
- narglow = image('icons/obj/narsie.dmi',narsimage.loc,"glow-narsie",LIGHTING_LAYER+2,1)
+ narglow = image('icons/obj/narsie.dmi',narsimage.loc,"glow-narsie", LIGHTING_LAYER + 2, 1)
narglow.mouse_opacity = 0
/* Animating narsie works like shit thanks to fucking byond
if(!N.old_x || !N.old_y)
@@ -304,7 +304,7 @@ var/global/obj/screen/fuckstat/FUCK = new
var/turf/T_mob = get_turf(src)
if((R.z == T_mob.z) && (get_dist(R,T_mob) <= (R.consume_range+10)) && !(R in view(T_mob)))
if(!riftimage)
- riftimage = image('icons/obj/rift.dmi',T_mob,"rift",LIGHTING_LAYER+2,1)
+ riftimage = image('icons/obj/rift.dmi',T_mob,"rift", LIGHTING_LAYER + 2, 1)
riftimage.mouse_opacity = 0
var/new_x = 32 * (R.x - T_mob.x) + R.pixel_x
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 8578f6dae29..c80c032e709 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -1252,11 +1252,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 areaMaster.related)
- for(var/obj/machinery/light/L in A)
- L.on = 1
- L.broken()
- sleep(1)
+ for(var/obj/machinery/light/L in areaMaster)
+ L.on = 1
+ L.broken()
+ sleep(1)
/obj/machinery/power/apc/Destroy()
areaMaster.remove_apc(src)
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index 005b9ca24fb..5d7dfab93e3 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -95,7 +95,7 @@ By design, d1 is the smallest direction and d2 is the highest
cable_list -= src
if(istype(attached))
- attached.SetLuminosity(0)
+ attached.set_light(0)
attached.icon_state = "powersink0"
attached.mode = 0
processing_objects.Remove(attached)
@@ -149,9 +149,9 @@ By design, d1 is the smallest direction and d2 is the highest
return
if(src.d1) // 0-X cables are 1 unit, X-X cables are 2 units long
- getFromPool(/obj/item/stack/cable_coil, T, 2, l_color)
+ getFromPool(/obj/item/stack/cable_coil, T, 2, light_color)
else
- getFromPool(/obj/item/stack/cable_coil, T, 1, l_color)
+ getFromPool(/obj/item/stack/cable_coil, T, 1, light_color)
for(var/mob/O in viewers(src, null))
O.show_message("[user] cuts the cable.", 1)
@@ -223,18 +223,18 @@ By design, d1 is the smallest direction and d2 is the highest
returnToPool(src)
if(2.0)
if(prob(50))
- getFromPool(/obj/item/stack/cable_coil, src.loc, src.d1 ? 2 : 1, l_color)
+ getFromPool(/obj/item/stack/cable_coil, src.loc, src.d1 ? 2 : 1, light_color)
returnToPool(src)
if(3.0)
if(prob(25))
- getFromPool(/obj/item/stack/cable_coil, src.loc, src.d1 ? 2 : 1, l_color)
+ getFromPool(/obj/item/stack/cable_coil, src.loc, src.d1 ? 2 : 1, light_color)
returnToPool(src)
return
/obj/structure/cable/proc/cableColor(var/colorC = "red")
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/structure/cable/proc/cableColor() called tick#: [world.time]")
- l_color = colorC
+ light_color = colorC
switch(colorC)
if("pink")
color = CABLE_PINK
diff --git a/code/modules/power/cable_heavyduty.dm b/code/modules/power/cable_heavyduty.dm
index f5336e8a597..18f1d5ffce2 100644
--- a/code/modules/power/cable_heavyduty.dm
+++ b/code/modules/power/cable_heavyduty.dm
@@ -26,5 +26,5 @@
/obj/structure/cable/heavyduty/cableColor(var/colorC)
_color = "red"
- l_color = "red"
+ light_color = LIGHT_COLOR_RED
return
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index 3c8fa050a8d..e61ef022d63 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -52,8 +52,8 @@
for(var/area/A in range(src,effectiverange))
if(A.name == "Space")
continue // No (de)gravitizing space.
- if(A.master && !( A.master in localareas) )
- localareas += A.master
+ if(!(A in localareas))
+ localareas += A
/obj/machinery/computer/gravity_control_computer/proc/findgenerator()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/computer/gravity_control_computer/proc/findgenerator() called tick#: [world.time]")
@@ -132,7 +132,7 @@
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in machines)
- if((A.master in G.localareas) && (G.on))
+ if((A in G.localareas) && (G.on))
break
if(!G)
A.gravitychange(0,A)
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 1e0cd089fd0..a87bbdbc77b 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -143,7 +143,9 @@ var/global/list/obj/machinery/light/alllights = list()
var/on = 0 // 1 if on, 0 if off
var/on_gs = 0
var/static_power_used = 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 = 4
+ 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
@@ -169,7 +171,9 @@ var/global/list/obj/machinery/light/alllights = list()
icon_state = "lbulb1"
base_state = "bulb"
fitting = "bulb"
- brightness = 4
+ brightness_range = 4
+ brightness_power = 2
+ brightness_color = LIGHT_COLOR_TUNGSTEN
cost = 4
desc = "A small lighting fixture."
light_type = /obj/item/weapon/light/bulb
@@ -179,7 +183,8 @@ var/global/list/obj/machinery/light/alllights = list()
name = "spotlight"
fitting = "large tube"
light_type = /obj/item/weapon/light/tube/large
- brightness = 8
+ brightness_range = 8
+ brightness_power = 3
cost = 8
/obj/machinery/light/built/New()
@@ -198,6 +203,10 @@ var/global/list/obj/machinery/light/alllights = list()
alllights += src
spawn(2)
+ var/area/A = get_area(src)
+ if(A && !A.requires_power)
+ on = 1
+
switch(fitting)
if("tube")
if(prob(2))
@@ -236,7 +245,7 @@ var/global/list/obj/machinery/light/alllights = list()
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)
@@ -250,13 +259,13 @@ var/global/list/obj/machinery/light/alllights = list()
status = LIGHT_BURNED
icon_state = "l[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 = (cost * 10)
if(on != on_gs)
@@ -316,7 +325,9 @@ var/global/list/obj/machinery/light/alllights = list()
user << "You insert the [L.name]."
switchcount = L.switchcount
rigged = L.rigged
- brightness = L.brightness
+ brightness_range = L.brightness_range
+ brightness_power = L.brightness_power
+ brightness_color = L.brightness_color
cost = L.cost
base_state = L.base_state
light_type = L.type
@@ -494,7 +505,9 @@ var/global/list/obj/machinery/light/alllights = list()
var/obj/item/weapon/light/L = new light_type()
L.status = status
L.rigged = rigged
- L.brightness = src.brightness
+ 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
@@ -530,7 +543,6 @@ var/global/list/obj/machinery/light/alllights = list()
if(status == LIGHT_OK)
return
status = LIGHT_OK
- brightness = initial(brightness)
on = 1
update()
@@ -595,7 +607,9 @@ var/global/list/obj/machinery/light/alllights = list()
var/switchcount = 0 // number of times switched
starting_materials = list(MAT_IRON = 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
var/cost = 2 //How much power does it consume in an idle state?
var/fitting = "tube"
@@ -607,7 +621,8 @@ var/global/list/obj/machinery/light/alllights = list()
item_state = "c_tube"
starting_materials = list(MAT_GLASS = 100)
w_type = RECYK_GLASS
- brightness = 8
+ brightness_range = 8
+ brightness_power = 3
cost = 8
/obj/item/weapon/light/tube/he
@@ -619,7 +634,8 @@ var/global/list/obj/machinery/light/alllights = list()
/obj/item/weapon/light/tube/large
w_class = 2
name = "large light tube"
- brightness = 15
+ brightness_range = 15
+ brightness_power = 4
cost = 15
/obj/item/weapon/light/bulb
@@ -629,8 +645,10 @@ var/global/list/obj/machinery/light/alllights = list()
base_state = "bulb"
item_state = "contvapour"
fitting = "bulb"
+ brightness_range = 5
+ brightness_power = 2
+ brightness_color = LIGHT_COLOR_TUNGSTEN
starting_materials = list(MAT_GLASS = 100)
- brightness = 5
cost = 5
w_type = RECYK_GLASS
@@ -639,6 +657,7 @@ var/global/list/obj/machinery/light/alllights = list()
desc = "An efficient light used to reduce strain on the station's power grid."
base_state = "hebulb"
cost = 1
+ brightness_color = null//These should be white
/obj/item/weapon/light/throw_impact(atom/hit_atom)
..()
@@ -650,8 +669,9 @@ var/global/list/obj/machinery/light/alllights = list()
icon_state = "fbulb"
base_state = "fbulb"
item_state = "egg4"
+ brightness_range = 5
+ brightness_power = 2
starting_materials = list(MAT_GLASS = 100)
- brightness = 5
// update the icon state and description of the light
@@ -673,9 +693,9 @@ var/global/list/obj/machinery/light/alllights = list()
..()
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()
diff --git a/code/modules/power/monitor.dm b/code/modules/power/monitor.dm
index ab719b2141a..6c60bfa83f9 100644
--- a/code/modules/power/monitor.dm
+++ b/code/modules/power/monitor.dm
@@ -6,6 +6,11 @@
icon = 'icons/obj/computer.dmi'
icon_state = "power"
+ use_auto_lights = 1
+ light_range_on = 3
+ light_power_on = 2
+ light_color = LIGHT_COLOR_YELLOW
+
//computer stuff
density = 1
anchored = 1.0
diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm
index 4d76bd975c2..6af39fbd32c 100644
--- a/code/modules/power/power.dm
+++ b/code/modules/power/power.dm
@@ -140,10 +140,19 @@
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/proc/power_change() called tick#: [world.time]")
if(powered(power_channel))
stat &= ~NOPOWER
- else
+ if(!use_auto_lights)
+ return
+ set_light(light_range_on, light_power_on)
+
+ else
stat |= NOPOWER
+ if(!use_auto_lights)
+ return
+ set_light(0)
+
+
// connect the machine to a powernet if a node cable is present on the turf
/obj/machinery/power/proc/connect_to_network()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/power/proc/connect_to_network() called tick#: [world.time]")
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index 8a5ef7f684c..f52c194fc74 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -21,7 +21,7 @@
var/parts = null
var/datum/wires/particle_acc/control_box/wires = null
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/particle_accelerator/control_box/New()
wires = new(src)
diff --git a/code/modules/power/solars/control.dm b/code/modules/power/solars/control.dm
index 92f0044c05e..dc492e3cb02 100644
--- a/code/modules/power/solars/control.dm
+++ b/code/modules/power/solars/control.dm
@@ -15,7 +15,10 @@
var/trackdir = 1 //-1 = CCW, 1 = CW
var/nexttime = 0 //Next clock time that manual tracking will move the array
- l_color = "#FF9933"
+ light_color = LIGHT_COLOR_YELLOW
+ use_auto_lights = 1
+ light_range_on = 3
+ light_power_on = 2
/obj/machinery/power/solar/control/initialize()
..()
@@ -128,7 +131,7 @@
// AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\modules\power\solar.dm:407: var/t = "Solar Generator Control
"
+ // C:\Users\Rob\\documents\\\projects\vgstation13\code\\modules\\\power\solar.dm:407: var/t = "Solar Generator Control
"
var/t = {"Solar Generator Control
Generated power : [round(lastgen)] W
Station Orbital Period : [60/abs(sun.rotationRate)] minutes
diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm
index 1de9ccf0c58..4f72a71629c 100644
--- a/code/modules/power/turbine.dm
+++ b/code/modules/power/turbine.dm
@@ -37,7 +37,7 @@
var/id_tag = 0
var/door_status = 0
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
// the inlet stage of the gas turbine electricity generator
diff --git a/code/modules/projectiles/projectile/flare.dm b/code/modules/projectiles/projectile/flare.dm
index b7eb36b8736..2e5b020a708 100644
--- a/code/modules/projectiles/projectile/flare.dm
+++ b/code/modules/projectiles/projectile/flare.dm
@@ -6,8 +6,8 @@
var/embed = 1
var/obj/shotloc = null //Where the flare was shot from (stored to be retrieved when the projectile dies)
flag = "bullet"
- l_color = "#AA0033"
- luminosity = 5
+ light_color = LIGHT_COLOR_FLARE
+ light_range = 5
/obj/item/projectile/flare/New()
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index 3dbf849f6be..8372cf39432 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -380,7 +380,10 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
var/pillsprite = "1"
var/client/has_sprites = list()
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
+ light_range_on = 3
+ light_power_on = 2
+ use_auto_lights = 1
machine_flags = SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK
@@ -795,7 +798,7 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
var/wait = null
var/obj/item/weapon/reagent_containers/glass/beaker = null
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
var/targetMoveKey
/********************************************************************
diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm
index 5797c8eee39..8526190b72e 100644
--- a/code/modules/reagents/reagent_containers/food/drinks.dm
+++ b/code/modules/reagents/reagent_containers/food/drinks.dm
@@ -1156,21 +1156,9 @@
/obj/item/weapon/reagent_containers/food/drinks/proc/update_brightness(var/mob/user = null)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/item/weapon/reagent_containers/food/drinks/proc/update_brightness() called tick#: [world.time]")
if(lit)
- SetLuminosity(src.brightness_lit)
+ set_light(src.brightness_lit)
else
- SetLuminosity(0)
-
-/obj/item/weapon/reagent_containers/food/drinks/pickup(mob/user)
- if(lit && molotov)
- user.SetLuminosity(user.luminosity + brightness_lit)
- SetLuminosity(0)
-
-
-/obj/item/weapon/reagent_containers/food/drinks/dropped(mob/user)
- if(src && lit && molotov && !luminosity)
- user.SetLuminosity(user.luminosity - brightness_lit)
- SetLuminosity(brightness_lit)
-
+ set_light(0)
/obj/item/weapon/reagent_containers/food/drinks/update_icon()
src.overlays.len = 0
diff --git a/code/modules/reagents/reagent_containers/food/drinks/drinkingglass.dm b/code/modules/reagents/reagent_containers/food/drinks/drinkingglass.dm
index 1489ab960d7..5478501df8e 100644
--- a/code/modules/reagents/reagent_containers/food/drinks/drinkingglass.dm
+++ b/code/modules/reagents/reagent_containers/food/drinks/drinkingglass.dm
@@ -31,8 +31,8 @@
flammable = 0
if(!molotov)
lit = 0
- l_color = null
- SetLuminosity(0)
+ light_color = null
+ set_light(0)
isGlass = 1
switch(reagents.get_master_reagent_id())
if("beer")
@@ -203,7 +203,7 @@
icon_state = "b52glass"
name = "\improper B-52"
desc = "Kahlua, Irish Cream, and congac. You will get bombed."
- l_color = "#000080"
+ light_color = "#000080"
if(!lit)
flammable = 1
if("atomicbomb")
diff --git a/code/modules/reagents/reagent_containers/food/snacks/grown.dm b/code/modules/reagents/reagent_containers/food/snacks/grown.dm
index e095415ab86..9c2ce7678bb 100644
--- a/code/modules/reagents/reagent_containers/food/snacks/grown.dm
+++ b/code/modules/reagents/reagent_containers/food/snacks/grown.dm
@@ -151,20 +151,6 @@
icon_state = "glowberrypile"
plantname = "glowberries"
-/obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/Del()
- if(istype(loc,/mob))
- loc.SetLuminosity(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))
-
-/obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/dropped(mob/user)
- if(!luminosity)
- user.SetLuminosity(round(user.luminosity - (potency/5), 1))
- src.SetLuminosity(round(potency/5, 1))
-
/obj/item/weapon/reagent_containers/food/snacks/grown/cocoapod
name = "cocoa pod"
desc = "Can be ground into cocoa powder."
@@ -234,7 +220,7 @@
user << "You roll a godly blunt."
var/obj/item/clothing/mask/cigarette/blunt/deus/rolled/B = new/obj/item/clothing/mask/cigarette/blunt/deus/rolled(src.loc)
reagents.trans_to(B, (reagents.total_volume))
- B.l_color = filling_color
+ B.light_color = filling_color
user.put_in_hands(B)
user.drop_from_inventory(src)
qdel(src)
@@ -541,21 +527,6 @@
user << "You plant the glowshroom."
-/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/Del()
- if(istype(loc,/mob))
- loc.SetLuminosity(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))
-
-/obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user)
- if(!luminosity)
- user.SetLuminosity(round(user.luminosity - (potency/10), 1))
- SetLuminosity(round(potency/10,1))
-
-
// *************************************
// Complex Grown Object Defines -
// Putting these at the bottom so they don't clutter the list up. -Cheridan
diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm
index 796efde28ef..637301298f6 100644
--- a/code/modules/recycling/disposal.dm
+++ b/code/modules/recycling/disposal.dm
@@ -546,7 +546,7 @@
// now everything inside the disposal gets put into the holder
// note AM since can contain mobs or objs
for(var/atom/movable/AM in D)
- AM.loc = src
+ AM.forceMove(src)
if(istype(AM, /mob/living/carbon/human))
var/mob/living/carbon/human/H = AM
if((M_FAT in H.mutations) && (H.species && H.species.flags & CAN_BE_FAT)) // is a human and fat?
@@ -566,7 +566,7 @@
D.expel(src) // no trunk connected, so expel immediately
return
- loc = D.trunk
+ forceMove(D.trunk)
active = 1
dir = DOWN
spawn(1)
@@ -632,7 +632,7 @@
proc/merge(var/obj/structure/disposalholder/other)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/merge() called tick#: [world.time]")
for(var/atom/movable/AM in other)
- AM.loc = src // move everything in other holder to this one
+ AM.forceMove(src) // move everything in other holder to this one
if(ismob(AM))
var/mob/M = AM
if(M.client) // if a client mob, update eye to follow this holder
@@ -695,7 +695,7 @@
// this is unlikely, but just dump out everything into the turf in case
for(var/atom/movable/AM in H)
- AM.loc = T
+ AM.forceMove(T)
AM.pipe_eject(0)
qdel(H)
..()
@@ -728,9 +728,9 @@
if(H2 && !H2.active)
H.merge(H2)
- H.loc = P
+ H.forceMove(P)
else // if wasn't a pipe, then set loc to turf
- H.loc = T
+ H.forceMove(T)
return null
return P
@@ -774,7 +774,7 @@
T = loc
if(T.density) // dense ouput turf, so stop holder
H.active = 0
- H.loc = src.
+ H.forceMove(src)
return
if(T.intact && istype(T,/turf/simulated/floor)) //intact floor, pop the tile
var/turf/simulated/floor/F = T
@@ -794,7 +794,7 @@
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
if(H)
for(var/atom/movable/AM in H)
- AM.loc = T
+ AM.forceMove(T)
AM.pipe_eject(direction)
spawn(1)
if(AM)
@@ -809,7 +809,7 @@
for(var/atom/movable/AM in H)
target = get_offset_target_turf(T, rand(5)-rand(5), rand(5)-rand(5))
- AM.loc = T
+ AM.forceMove(T)
AM.pipe_eject(0)
spawn(1)
if(AM)
@@ -843,7 +843,7 @@
// this is unlikely, but just dump out everything into the turf in case
for(var/atom/movable/AM in H)
- AM.loc = T
+ AM.forceMove(T)
AM.pipe_eject(0)
qdel(H)
return
@@ -1351,7 +1351,7 @@
if(H)
for(var/atom/movable/AM in H)
- AM.loc = src.loc
+ AM.forceMove(src.loc)
AM.pipe_eject(dir)
spawn(5)
if(AM)
diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm
index 4d68cf61e56..74cba7205ba 100644
--- a/code/modules/research/protolathe.dm
+++ b/code/modules/research/protolathe.dm
@@ -16,7 +16,7 @@ it creates. All the menus and other manipulation commands are in the R&D console
build_time = PROTOLATHE_BUILD_TIME
build_number = 2
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
research_flags = CONSOLECONTROL | HASOUTPUT | TAKESMATIN | HASMAT_OVER | LOCKBOXES
@@ -36,9 +36,9 @@ it creates. All the menus and other manipulation commands are in the R&D console
/obj/machinery/r_n_d/fabricator/protolathe/power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
+ set_light(2)
else
- SetLuminosity(0)
+ set_light(0)
/obj/machinery/r_n_d/fabricator/protolathe/New()
. = ..()
diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm
index 0b3bd540bfd..5ec34fd4629 100644
--- a/code/modules/research/rdconsole.dm
+++ b/code/modules/research/rdconsole.dm
@@ -68,8 +68,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
req_access = list(access_tox) //Data and setting manipulation requires scientist access.
starting_materials = list()
-
- l_color = "#CD00CD"
+
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/rdconsole/proc/Maximize()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/obj/machinery/computer/rdconsole/proc/Maximize() called tick#: [world.time]")
@@ -1055,8 +1055,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
req_access = list(access_tox)
circuit = "/obj/item/weapon/circuitboard/rdconsole/mommi"
- l_color = "#CD00CD"
-
/obj/machinery/computer/rdconsole/robotics
name = "Robotics R&D Console"
id = 2
@@ -1064,8 +1062,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
req_access=list()
circuit = "/obj/item/weapon/circuitboard/rdconsole/robotics"
- l_color = "#CD00CD"
-
/obj/machinery/computer/rdconsole/mechanic
name = "Mechanics R&D Console"
id = 4
@@ -1073,20 +1069,14 @@ won't update every console in existence) but it's more of a hassle to do. Also,
req_access=list()
circuit = "/obj/item/weapon/circuitboard/rdconsole/mechanic"
- l_color = "#CD00CD"
-
/obj/machinery/computer/rdconsole/core
name = "Core R&D Console"
id = 1
req_access = list(access_tox)
circuit = "/obj/item/weapon/circuitboard/rdconsole"
- l_color = "#CD00CD"
-
/obj/machinery/computer/rdconsole/pod
name = "Pod Bay R&D Console"
id = 5
req_access=list()
circuit = "/obj/item/weapon/circuitboard/rdconsole/pod"
-
- l_color = "#CD00CD"
diff --git a/code/modules/research/research_shuttle.dm b/code/modules/research/research_shuttle.dm
index 9d90a2fd3d0..999ade20021 100644
--- a/code/modules/research/research_shuttle.dm
+++ b/code/modules/research/research_shuttle.dm
@@ -82,7 +82,7 @@ proc/move_research_shuttle()
circuit = "/obj/item/weapon/circuitboard/research_shuttle"
var/location = 0 //0 = station, 1 = research base
machine_flags = EMAGGABLE | SCREWTOGGLE
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
/obj/machinery/computer/research_shuttle/attack_hand(user as mob)
if(..(user))
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index b4f935519cf..7a082ccdacb 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -169,7 +169,7 @@
var/list/consoles = list()
var/badmin = 0
- l_color = "#CD00CD"
+ light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/rdservercontrol/Topic(href, href_list)
if(..())
diff --git a/code/modules/spells/aoe_turf/conjure/construct.dm b/code/modules/spells/aoe_turf/conjure/construct.dm
index fb04db349b3..7cc06efdb1a 100644
--- a/code/modules/spells/aoe_turf/conjure/construct.dm
+++ b/code/modules/spells/aoe_turf/conjure/construct.dm
@@ -130,7 +130,7 @@
name = "Juggerwall"
icon = 'icons/effects/effects.dmi'
icon_state = "m_shield_cult"
- l_color = "#B40000"
+ light_color = LIGHT_COLOR_RED
luminosity = 2
/obj/effect/forcefield/cult/cultify()
diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm
index 430964add4c..1a763aacfb6 100644
--- a/code/modules/supermatter/supermatter.dm
+++ b/code/modules/supermatter/supermatter.dm
@@ -22,7 +22,7 @@
var/max_luminosity = 8 // Now varies based on power.
- l_color = "#ffcc00"
+ light_color = LIGHT_COLOR_YELLOW
// What it's referred to in the alerts
var/short_name = "Crystal"
@@ -285,8 +285,10 @@
power -= (power/500)**3
+ var/light_value = Clamp(round(Clamp(power / max_power, 0, 1) * max_luminosity), 0, max_luminosity)
+
// Lighting based on power output.
- SetLuminosity(Clamp(round(Clamp(power/max_power,0,1)*max_luminosity),0,max_luminosity))
+ set_light(light_value, light_value / 2)
return 1
diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm
index 353d549d7c6..c61d73994ba 100644
--- a/code/modules/telesci/telesci_computer.dm
+++ b/code/modules/telesci/telesci_computer.dm
@@ -24,7 +24,7 @@
var/teleport_cell_usage=1000 // 100% of a standard cell
processing=1
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/telescience/New()
..()
diff --git a/code/modules/virus2/centrifuge.dm b/code/modules/virus2/centrifuge.dm
index a7801024526..de0943be974 100644
--- a/code/modules/virus2/centrifuge.dm
+++ b/code/modules/virus2/centrifuge.dm
@@ -10,7 +10,7 @@
var/obj/item/weapon/reagent_containers/glass/beaker/vial/sample = null
var/datum/disease2/disease/virus2 = null
- l_color = "#000000"
+ light_color = null
/obj/machinery/computer/centrifuge/attackby(var/obj/item/weapon/reagent_containers/glass/beaker/vial/I, var/mob/user as mob)
if(!istype(I))
@@ -26,7 +26,7 @@
/obj/machinery/computer/centrifuge/update_icon()
..()
if(! (stat & (BROKEN|NOPOWER)) && (isolating || curing))
- l_color = "#7BF9FF"
+ light_color = LIGHT_COLOR_CYAN
icon_state = "centrifuge_moving"
/obj/machinery/computer/centrifuge/attack_hand(var/mob/user as mob)
diff --git a/code/modules/virus2/diseasesplicer.dm b/code/modules/virus2/diseasesplicer.dm
index 6dd3cbaf875..5e4bfb23c05 100644
--- a/code/modules/virus2/diseasesplicer.dm
+++ b/code/modules/virus2/diseasesplicer.dm
@@ -12,7 +12,7 @@
var/splicing = 0
var/scanning = 0
- l_color = "#0000FF"
+ light_color = LIGHT_COLOR_GREEN
/obj/machinery/computer/diseasesplicer/attackby(var/obj/I as obj, var/mob/user as mob)
if(!(istype(I,/obj/item/weapon/virusdish) || istype(I,/obj/item/weapon/diseasedisk)))
diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm
index 5254edbfdac..52792869ee6 100644
--- a/code/modules/virus2/effect.dm
+++ b/code/modules/virus2/effect.dm
@@ -820,7 +820,7 @@ var/list/compatible_mobs = list(/mob/living/carbon/human, /mob/living/carbon/mon
name = "Lantern Syndrome"
stage = 2
/datum/disease2/effect/lantern/activate(var/mob/living/carbon/mob,var/multiplier)
- mob.SetLuminosity(4)
+ mob.set_light(4)
mob << "You are glowing!"
diff --git a/icons/effects/lighting_overlay.dmi b/icons/effects/lighting_overlay.dmi
new file mode 100644
index 0000000000000000000000000000000000000000..1ff16d2b78b6a89fd525856cfee87830095ec9c0
GIT binary patch
literal 260
zcmeAS@N?(olHy`uVBq!ia0vp^2|($P6U!|9apHq}T#{LR=3VIPm}ff9=fnEkF^*
zk|4ie28U-i(tw1VBG)!
literal 0
HcmV?d00001
diff --git a/vgstation13.dme b/vgstation13.dme
index 4d92a188370..cc46a17f2f6 100644
--- a/vgstation13.dme
+++ b/vgstation13.dme
@@ -108,13 +108,11 @@
#include "code\ATMOSPHERICS\hvac\spaceheater.dm"
#include "code\ATMOSPHERICS\pipe\construction.dm"
#include "code\ATMOSPHERICS\pipe\pipe_dispenser.dm"
-#include "code\controllers\_DynamicAreaLighting_TG.dm"
#include "code\controllers\configuration.dm"
#include "code\controllers\failsafe.dm"
#include "code\controllers\garbage.dm"
#include "code\controllers\hooks-defs.dm"
#include "code\controllers\hooks.dm"
-#include "code\controllers\lighting_controller.dm"
#include "code\controllers\master_controller.dm"
#include "code\controllers\shuttle_controller.dm"
#include "code\controllers\verbs.dm"
@@ -1070,6 +1068,12 @@
#include "code\modules\library\computers\base.dm"
#include "code\modules\library\computers\checkout.dm"
#include "code\modules\library\computers\public.dm"
+#include "code\modules\lighting\light_source.dm"
+#include "code\modules\lighting\lighting_atom.dm"
+#include "code\modules\lighting\lighting_overlay.dm"
+#include "code\modules\lighting\lighting_system.dm"
+#include "code\modules\lighting\lighting_turf.dm"
+#include "code\modules\lighting\~lighting_undefs.dm"
#include "code\modules\liquid\splash_simulation.dm"
#include "code\modules\maps\map_objects.dm"
#include "code\modules\maps\nests.dm"