From e1249fc64052639b2ce5a7b1c1f7945a2e2a4165 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sun, 10 May 2015 09:48:04 -0700 Subject: [PATCH] Lighting overhaul. This commit overhauls the lighting system to Bay12 standards. It is better in pretty much every way. --- .../components/unary/vent_pump.dm | 2 - .../components/unary/vent_scrubber.dm | 2 - code/LINDA/LINDA_fire.dm | 4 +- code/__HELPERS/game.dm | 21 +- code/__HELPERS/unsorted.dm | 4 +- code/controllers/Processes/lighting.dm | 26 - code/controllers/_DynamicAreaLighting_TG.dm | 449 ------------------ code/controllers/failsafe.dm | 21 - code/controllers/lighting_controller.dm | 127 ----- code/controllers/verbs.dm | 11 +- code/game/area/Space Station 13 areas.dm | 23 +- code/game/area/areas.dm | 143 +++--- code/game/atoms.dm | 2 +- code/game/atoms_movable.dm | 18 +- code/game/dna/genes/goon_powers.dm | 8 +- code/game/gamemodes/blob/theblob.dm | 4 +- code/game/gamemodes/cult/cult_structures.dm | 3 +- code/game/gamemodes/events/biomass.dm | 7 +- code/game/gamemodes/events/spacevines.dm | 7 +- .../shadowling/shadowling_abilities.dm | 8 +- code/game/gamemodes/vampire/vampire_powers.dm | 13 +- code/game/machinery/Sleeper.dm | 6 +- code/game/machinery/adv_med.dm | 6 +- code/game/machinery/alarm.dm | 38 +- .../atmoalter/area_atmos_computer.dm | 12 +- code/game/machinery/bots/bots.dm | 6 +- code/game/machinery/camera/camera.dm | 2 +- code/game/machinery/cloning.dm | 6 +- .../machinery/computer/HolodeckControl.dm | 4 +- code/game/machinery/computer/Operating.dm | 2 +- code/game/machinery/computer/aifixer.dm | 4 +- code/game/machinery/computer/arcade.dm | 6 +- code/game/machinery/computer/atmos_alert.dm | 2 +- code/game/machinery/computer/camera.dm | 62 +-- code/game/machinery/computer/card.dm | 2 +- code/game/machinery/computer/cloning.dm | 24 +- .../game/machinery/computer/communications.dm | 10 +- code/game/machinery/computer/computer.dm | 8 +- code/game/machinery/computer/law.dm | 4 +- code/game/machinery/computer/medical.dm | 2 +- code/game/machinery/computer/message.dm | 4 +- code/game/machinery/computer/power.dm | 8 +- code/game/machinery/computer/prisoner.dm | 2 +- code/game/machinery/computer/robot.dm | 2 +- code/game/machinery/computer/security.dm | 2 +- code/game/machinery/computer/shuttle.dm | 4 +- code/game/machinery/computer/station_alert.dm | 2 +- code/game/machinery/computer/store.dm | 2 +- code/game/machinery/cryo.dm | 6 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/machinery/doors/alarmlock.dm | 2 - code/game/machinery/doors/brigdoors.dm | 4 +- code/game/machinery/doors/door.dm | 6 +- code/game/machinery/doors/poddoor.dm | 138 +++--- code/game/machinery/doors/shutters.dm | 6 +- code/game/machinery/doors/windowdoor.dm | 4 +- code/game/machinery/flasher.dm | 6 +- code/game/machinery/floodlight.dm | 6 +- code/game/machinery/hologram.dm | 12 +- code/game/machinery/hydroponics.dm | 31 +- code/game/machinery/igniter.dm | 4 +- code/game/machinery/lightswitch.dm | 13 +- code/game/machinery/newscaster.dm | 2 +- code/game/machinery/telecomms/logbrowser.dm | 4 +- code/game/machinery/telecomms/telemonitor.dm | 4 +- .../machinery/telecomms/traffic_control.dm | 6 +- code/game/machinery/turntable.dm | 19 +- code/game/machinery/turret_control.dm | 14 +- code/game/machinery/turrets.dm | 10 +- code/game/mecha/equipment/tools/tools.dm | 6 +- code/game/mecha/mecha.dm | 4 +- code/game/objects/effects/aliens.dm | 2 +- code/game/objects/effects/anomalies.dm | 2 +- .../objects/effects/decals/Cleanable/misc.dm | 2 +- code/game/objects/effects/glowshroom.dm | 2 +- code/game/objects/explosion.dm | 10 +- code/game/objects/items/blueprints.dm | 28 +- code/game/objects/items/candle.dm | 17 +- code/game/objects/items/devices/PDA/PDA.dm | 16 +- code/game/objects/items/devices/flashlight.dm | 30 +- .../objects/items/devices/lightreplacer.dm | 10 +- code/game/objects/items/devices/powersink.dm | 8 +- .../objects/items/weapons/cigs_lighters.dm | 17 +- code/game/objects/structures/false_walls.dm | 4 +- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/objects/structures/spirit_board.dm | 12 +- code/game/objects/structures/window.dm | 52 +- code/game/supplyshuttle.dm | 8 +- code/game/turfs/simulated/floor.dm | 14 +- code/game/turfs/simulated/floor_types.dm | 5 +- code/game/turfs/space/space.dm | 1 + code/game/turfs/turf.dm | 25 +- code/game/vehicles/spacepods/spacepod.dm | 4 +- code/modules/admin/verbs/massmodvar.dm | 28 +- code/modules/admin/verbs/modifyvariables.dm | 4 +- code/modules/clothing/head/hardhat.dm | 16 +- code/modules/clothing/spacesuits/plasmamen.dm | 12 +- code/modules/clothing/spacesuits/rig.dm | 20 +- code/modules/computer3/computer.dm | 10 +- code/modules/computer3/networking.dm | 7 +- code/modules/events/infestation.dm | 8 +- code/modules/hydroponics/vines.dm | 13 +- code/modules/jungle/falsewall.dm | 4 +- code/modules/jungle/misc_helpers.dm | 2 +- code/modules/lighting/__lighting_docs.dm | 67 +++ code/modules/lighting/_lighting_defs.dm | 10 + code/modules/lighting/light_source.dm | 169 +++++++ code/modules/lighting/lighting_atom.dm | 81 ++++ code/modules/lighting/lighting_overlay.dm | 48 ++ code/modules/lighting/lighting_process.dm | 23 + code/modules/lighting/lighting_system.dm | 47 ++ code/modules/lighting/lighting_turf.dm | 29 ++ code/modules/lighting/~lighting_underfs.dm | 10 + .../media/broadcast/transmitters/broadcast.dm | 6 +- code/modules/mining/machine_processing.dm | 2 +- code/modules/mining/mine_items.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 21 +- 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 | 16 +- .../silicon/ai/freelook/update_triggers.dm | 2 +- code/modules/mob/living/silicon/ai/life.dm | 26 +- .../silicon/robot/drone/drone_abilities.dm | 4 +- .../living/simple_animal/friendly/corgi.dm | 6 +- .../mob/living/simple_animal/friendly/crab.dm | 2 +- .../living/simple_animal/hostile/statue.dm | 14 +- code/modules/mob/mob_defines.dm | 2 +- code/modules/power/apc.dm | 9 +- code/modules/power/cable.dm | 2 +- code/modules/power/lighting.dm | 73 ++- code/modules/power/power.dm | 29 +- .../power/singularity/containment_field.dm | 2 +- code/modules/power/singularity/singularity.dm | 2 +- code/modules/projectiles/gun.dm | 32 +- .../reagent_containers/food/snacks/grown.dm | 20 +- code/modules/supermatter/supermatter.dm | 12 +- code/modules/vehicle/vehicle.dm | 6 +- code/modules/virus2/effect.dm | 4 +- code/setup.dm | 2 + icons/effects/lighting_overlay.dmi | Bin 0 -> 260 bytes paradise.dme | 12 +- 141 files changed, 1195 insertions(+), 1449 deletions(-) delete mode 100644 code/controllers/Processes/lighting.dm delete mode 100644 code/controllers/_DynamicAreaLighting_TG.dm delete mode 100644 code/controllers/lighting_controller.dm create mode 100644 code/modules/lighting/__lighting_docs.dm create mode 100644 code/modules/lighting/_lighting_defs.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_process.dm create mode 100644 code/modules/lighting/lighting_system.dm create mode 100644 code/modules/lighting/lighting_turf.dm create mode 100644 code/modules/lighting/~lighting_underfs.dm create mode 100644 icons/effects/lighting_overlay.dmi diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index b9bbbdc82e5..5b9ce52bb25 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -56,8 +56,6 @@ /obj/machinery/atmospherics/unary/vent_pump/New() icon = null initial_loc = get_area(loc) - if (initial_loc.master) - initial_loc = initial_loc.master area_uid = initial_loc.uid if (!id_tag) assign_uid() diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index b5596305577..bafdbd43e3b 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -35,8 +35,6 @@ /obj/machinery/atmospherics/unary/vent_scrubber/New() icon = null initial_loc = get_area(loc) - if (initial_loc.master) - initial_loc = initial_loc.master area_uid = initial_loc.uid if (!id_tag) assign_uid() diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm index 0f173f97fda..822c96f6632 100644 --- a/code/LINDA/LINDA_fire.dm +++ b/code/LINDA/LINDA_fire.dm @@ -47,7 +47,8 @@ icon = 'icons/effects/fire.dmi' icon_state = "1" layer = TURF_LAYER - luminosity = 3 + + light_color = "#ED9200" var/volume = 125 var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST @@ -56,6 +57,7 @@ /obj/effect/hotspot/New() ..() + set_light(7) air_master.hotspots += src /obj/effect/hotspot/proc/perform_exposure() diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index c8ddbc6e40a..3f53eef443d 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -13,7 +13,7 @@ var/area/A = get_area(O) if (isarea(A)) - return A.master + return A /proc/get_area(O) var/atom/location = O @@ -51,21 +51,6 @@ return heard - - - -//Magic constants obtained by using linear regression on right-angled triangles of sides 0=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :) - else return (k1*dx) + (k2*dy) -#undef k1 -#undef k2 - /proc/circlerange(center=usr,radius=3) var/turf/centerturf = get_turf(center) @@ -317,7 +302,7 @@ proc/isInSight(var/atom/A, var/atom/B) if(override_age || player_old_enough_antag(G.client,be_special_flag)) candidates += G.client afk_bracket += 600 // Add a minute to the bracket, for every attempt - + return candidates /proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480) @@ -456,6 +441,6 @@ proc/isInSight(var/atom/A, var/atom/B) /proc/MinutesToTicks(var/minutes as num) return minutes * 60 * 10 - + /proc/SecondsToTicks(var/seconds) return seconds * 10 \ No newline at end of file diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c269df248b5..d95a0ea6ce8 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1019,7 +1019,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl // if(AR.lighting_use_dynamic) //TODO: rewrite this code so it's not messed by lighting ~Carn // X.opacity = !X.opacity -// X.SetOpacity(!X.opacity) +// X.set_opacity(!X.opacity) toupdate += X @@ -1175,7 +1175,7 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0) // if(AR.lighting_use_dynamic) // X.opacity = !X.opacity -// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn +// X.sd_set_opacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn toupdate += X diff --git a/code/controllers/Processes/lighting.dm b/code/controllers/Processes/lighting.dm deleted file mode 100644 index bbf9ecd2f99..00000000000 --- a/code/controllers/Processes/lighting.dm +++ /dev/null @@ -1,26 +0,0 @@ -/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/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm deleted file mode 100644 index 7ed1a047a0d..00000000000 --- a/code/controllers/_DynamicAreaLighting_TG.dm +++ /dev/null @@ -1,449 +0,0 @@ -/* - Modified DynamicAreaLighting for TGstation - Coded by Carnwennan - - This is TG's 'new' lighting system. It's basically a heavily modified combination of Forum_Account's and - ShadowDarke's respective lighting libraries. Credits, where due, to them. - - Like sd_DAL (what we used to use), it changes the shading overlays of areas by splitting each type of area into sub-areas - by using the var/tag variable and moving turfs into the contents list of the correct sub-area. This method is - much less costly than using overlays or objects. - - Unlike sd_DAL however it uses a queueing system. Everytime we call a change to opacity or luminosity - (through SetOpacity() or SetLuminosity()) we are simply updating variables and scheduling certain lights/turfs for an - update. Actual updates are handled periodically by the lighting_controller. This carries additional overheads, however it - means that each thing is changed only once per lighting_controller.processing_interval ticks. Allowing for greater control - over how much priority we'd like lighting updates to have. It also makes it possible for us to simply delay updates by - setting lighting_controller.processing = 0 at say, the start of a large explosion, waiting for it to finish, and then - turning it back on with lighting_controller.processing = 1. - - Unlike our old system there are hardcoded maximum luminositys (different for certain atoms). - This is to cap the cost of creating lighting effects. - (without this, an atom with luminosity of 20 would have to update 41^2 turfs!) :s - - Also, in order for the queueing system to work, each light remembers the effect it casts on each turf. This is going to - have larger memory requirements than our previous system but it's easily worth the hassle for the greater control we - gain. It also reduces cost of removing lighting effects by a lot! - - Known Issues/TODO: - Shuttles still do not have support for dynamic lighting (I hope to fix this at some point) - No directional lighting support. (prototype looked ugly) -*/ - -#define LIGHTING_CIRCULAR 1 //comment this out to use old square lighting effects. -#define LIGHTING_LAYER 10 //Drawing layer for lighting overlays -#define LIGHTING_ICON 'icons/effects/ss13_dark_alpha6.dmi' //Icon used for lighting shading effects - -datum/light_source - var/atom/owner - var/changed = 1 - var/list/effect = list() - var/__x = 0 //x coordinate at last update - var/__y = 0 //y coordinate at last update - var/__z = 0 //z coordinate at last update - - var/_l_color //do not use directly, only used as reference for updating - var/col_r - var/col_g - var/col_b - - - New(atom/A) - if(!istype(A)) - CRASH("The first argument to the light object's constructor must be the atom that is the light source. Expected atom, received '[A]' instead.") - ..() - owner = A - readrgb(owner.l_color) - __x = owner.x - __y = owner.y - __z = owner.z - // the lighting object maintains a list of all light sources - lighting_controller.lights += src - - - //Check a light to see if its effect needs reprocessing. If it does, remove any old effect and create a new one - proc/check() - if(!owner) - remove_effect() - return 1 //causes it to be removed from our list of lights. The garbage collector will then destroy it. - - // check to see if we've moved since last update - if(owner.x != __x || owner.y != __y || owner.z != __z) - __x = owner.x - __y = owner.y - __z = owner.z - changed = 1 - - if (owner.l_color != _l_color) - changed = 1 - - if(changed) - changed = 0 - remove_effect() - return add_effect() - return 0 - - - proc/remove_effect() - // before we apply the effect we remove the light's current effect. - for(var/turf/T in effect) // negate the effect of this light source - T.update_lumcount(-effect[T], col_r, col_g, col_b, 1) - effect.Cut() // clear the effect list - - proc/add_effect() - // only do this if the light is turned on and is on the map - if(owner.loc && owner.luminosity > 0) - readrgb(owner.l_color) - effect = list() - for(var/turf/T in view(owner.get_light_range(),get_turf(owner))) - var/delta_lumen = lum(T) - if(delta_lumen > 0) - effect[T] = delta_lumen - T.update_lumcount(delta_lumen, col_r, col_g, col_b, 0) - - return 0 - else - owner.light = null - return 1 //cause the light to be removed from the lights list and garbage collected once it's no - //longer referenced by the queue - - proc/lum(turf/A) - if (owner.trueLuminosity < 1) - return 0 - var/dist - if(!A) - dist = 0 - else -#ifdef LIGHTING_CIRCULAR - dist = cheap_hypotenuse(A.x, A.y, __x, __y) -#else - dist = max(abs(A.x - __x), abs(A.y - __y)) -#endif - if (owner.trueLuminosity > 100) // This will never happen... right? - return sqrt(owner.trueLuminosity) - dist - else - return sqrtTable[owner.trueLuminosity] - dist - - proc/readrgb(col) - _l_color = col - if(col) - col_r = GetRedPart(col) - col_g = GetGreenPart(col) - col_b = GetBluePart(col) - else - col_r = null - -atom - var/datum/light_source/light - var/trueLuminosity = 0 // Typically 'luminosity' squared. The builtin luminosity must remain linear. - // We may read it, but NEVER set it directly. - var/l_color - -//Turfs with opacity when they are constructed will trigger nearby lights to update -//Turfs and atoms with luminosity when they are constructed will create a light_source automatically -turf/New() - ..() - if(luminosity) - if(light) WARNING("[type] - Don't set lights up manually during New(), We do it automatically.") - trueLuminosity = luminosity * luminosity - light = new(src) - -//Movable atoms with opacity when they are constructed will trigger nearby lights to update -//Movable atoms with luminosity when they are constructed will create a light_source automatically -atom/movable/New() - ..() - if(opacity) - if(isturf(loc)) - if(loc:lighting_lumcount > 1) - UpdateAffectingLights() - if(luminosity) - if(light) WARNING("[type] - Don't set lights up manually during New(), We do it automatically.") - trueLuminosity = luminosity * luminosity - light = new(src) - - -//Sets our luminosity. -//If we have no light it will create one. -//If we are setting luminosity to 0 the light will be cleaned up by the controller and garbage collected once all its -//queues are complete. -//if we have a light already it is merely updated, rather than making a new one. -atom/proc/SetLuminosity(new_luminosity, trueLum = FALSE) - if(new_luminosity < 0) - new_luminosity = 0 - if(!trueLum) - new_luminosity *= new_luminosity - if(light) - if(trueLuminosity != new_luminosity) //non-luminous lights are removed from the lights list in add_effect() - light.changed = 1 - else - if(new_luminosity) - light = new(src) - trueLuminosity = new_luminosity - if (trueLuminosity < 1) - luminosity = 0 - else if (trueLuminosity <= 100) - luminosity = sqrtTable[trueLuminosity] - else - luminosity = sqrt(trueLuminosity) - -atom/proc/AddLuminosity(delta_luminosity) - if(delta_luminosity > 0) - SetLuminosity(trueLuminosity + delta_luminosity*delta_luminosity, TRUE) - else if(delta_luminosity < 0) - SetLuminosity(trueLuminosity - delta_luminosity*delta_luminosity, TRUE) - -area/SetLuminosity(new_luminosity) //we don't want dynamic lighting for areas - luminosity = !!new_luminosity - trueLuminosity = luminosity - - -//change our opacity (defaults to toggle), and then update all lights that affect us. -atom/proc/SetOpacity(new_opacity) - if(new_opacity == null) - new_opacity = !opacity //default = toggle opacity - else if(opacity == new_opacity) - return 0 //opacity hasn't changed! don't bother doing anything - opacity = new_opacity //update opacity, the below procs now call light updates. - return 1 - -turf/SetOpacity(new_opacity) - if(..()==1) //only bother if opacity changed - if(lighting_lumcount) //only bother with an update if our turf is currently affected by a light - UpdateAffectingLights() - -/atom/movable/SetOpacity(new_opacity) - if(..()==1) //only bother if opacity changed - if(isturf(loc)) //only bother with an update if we're on a turf - var/turf/T = loc - if(T.lighting_lumcount) //only bother with an update if our turf is currently affected by a light - UpdateAffectingLights() - - -turf - var/lighting_lumcount = 0 - var/lighting_changed = 0 - var/color_lighting_lumcount = 0 - - var/lumcount_r = 0 - var/lumcount_g = 0 - var/lumcount_b = 0 - var/light_col_sources = 0 - -turf/space - lighting_lumcount = 4 //starlight - -turf/proc/update_lumcount(amount, col_r, col_g, col_b, removing = 0) - lighting_lumcount += amount - - if(!isnull(col_r)) //col_r is the "key" var, if it's null so will the rest - if(removing) - light_col_sources-- - lumcount_r -= col_r - lumcount_g -= col_g - lumcount_b -= col_b - else - light_col_sources++ - lumcount_r += col_r - lumcount_g += col_g - lumcount_b += col_b - - if(light_col_sources) - var/r_avg = max(0, min(255, round(lumcount_r / light_col_sources, 16) + 15)) - var/g_avg = max(0, min(255, round(lumcount_g / light_col_sources, 16) + 15)) - var/b_avg = max(0, min(255, round(lumcount_b / light_col_sources, 16) + 15)) - l_color = rgb(r_avg, g_avg, b_avg) - else - l_color = null - - color_lighting_lumcount = max(color_lighting_lumcount + amount, 0) // Minimum of 0. - - if(!lighting_changed) - lighting_controller.changed_turfs += src - lighting_changed = 1 - -turf/proc/lighting_tag(const/level) - var/area/A = loc - return A.tagbase + "sd_L[level]" - -turf/proc/build_lighting_area(const/tag, const/level, const/color_light) - var/area/Area = loc - var/area/A = new Area.type() // create area if it wasn't found - // replicate vars - for(var/V in Area.vars) - switch(V) - if ("contents","lighting_overlay", "color_overlay", "overlays") - continue - else - if(issaved(Area.vars[V])) A.vars[V] = Area.vars[V] - - A.tag = tag - A.lighting_subarea = 1 - A.lighting_space = 0 // in case it was copied from a space subarea - - if (l_color != A.l_color) - A.l_color = l_color - //color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states) - //world << "[color_light] [color_lighting_lumcount]" - - A.SetLightLevel(level, color_light) - Area.related += A - return A - -turf/proc/shift_to_subarea() - lighting_changed = 0 - var/area/Area = loc - - if(!istype(Area) || !Area.lighting_use_dynamic) return - - var/level = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states) - var/new_tag = lighting_tag(level) - - // pomf - If we have a lighting color that is not null, apply the new tag to seperate the areas. - if (l_color) - // pomf - We append the (rounded!) color lighting lumcount so we can have colored lights. - new_tag += "[l_color][min(max(round(color_lighting_lumcount,1),0),lighting_controller.lighting_states)]" - - if(Area.tag!=new_tag) //skip if already in this area - var/area/A = locate(new_tag) // find an appropriate area - var/color_light = min(max(round(color_lighting_lumcount,1),0),lighting_controller.lighting_states) - - if (!A) - A = build_lighting_area(new_tag, level, color_light) - else if (l_color != A.l_color) - A.l_color = l_color - //color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states) - A.SetLightLevel(level, color_light) - - A.contents += src // move the turf into the area - -// Dedicated lighting sublevel for space turfs -// helps us depower things in space, remove space fire alarms, -// and evens out space lighting -turf/space/lighting_tag(var/level) - var/area/A = loc - return A.tagbase + "sd_L_space" -turf/space/build_lighting_area(var/tag,var/level) - var/area/A = ..(tag,4) - A.lighting_space = 1 - A.SetLightLevel(4) - A.icon_state = null - return A - - -area - var/lighting_use_dynamic = 1 //Turn this flag off to prevent sd_DynamicAreaLighting from affecting this area - var/image/lighting_overlay //tracks the darkness image of the area for easy removal - var/lighting_subarea = 0 //tracks whether we're a lighting sub-area - var/lighting_space = 0 // true for space-only lighting subareas - var/tagbase - var/image/color_overlay //Tracks the color image. - - proc/SetLightLevel(light, color_light = 0) - if(!src) return - if(light <= 0) - light = 0 - luminosity = 0 - else - if(light > lighting_controller.lighting_states) - light = lighting_controller.lighting_states - luminosity = 1 - - if(lighting_overlay) - overlays -= lighting_overlay - lighting_overlay.icon_state = "[light]" - else - lighting_overlay = image(LIGHTING_ICON,,num2text(light),LIGHTING_LAYER) - - if (color_overlay) - overlays.Remove(color_overlay) - color_overlay.icon_state = "5" - else - if (l_color) - color_overlay = image('icons/effects/effects.dmi', ,"5", 10.1) - //color_overlay = image('icons/effects/effects.dmi', ,"white", 10.1) - - if (istype(color_overlay)) - color_overlay.color = l_color - - - switch (color_light) - if (6) - color_overlay.icon_state = "5" - //color_overlay.alpha = 180 - if (5) - color_overlay.icon_state = "4" - //color_overlay.alpha = 150 - if (4) - color_overlay.icon_state = "3" - //color_overlay.alpha = 120 - if (3) - color_overlay.icon_state = "2" - //color_overlay.alpha = 90 - if (2) - color_overlay.icon_state = "1" - //color_overlay.alpha = 60 - if (1) - color_overlay.icon_state = "1" - color_overlay.alpha = 200 - //color_overlay.alpha = 30 - if (-INFINITY to 0) - //world << "Zero or below, [color_light]." - color_overlay.alpha = 0 - else - //world << "Setting the alpha to max... color_light [color_light]." - color_overlay.alpha = 180 - - color_overlay.blend_mode = BLEND_ADD - if (color_overlay.color) - overlays.Add(color_overlay) - - if (isnull(color_overlay)) - overlays.Add(lighting_overlay) - else if (light < 6) - overlays.Add(lighting_overlay) - - proc/SetDynamicLighting() - - src.lighting_use_dynamic = 1 - for(var/turf/T in src.contents) - T.update_lumcount(0) - - proc/InitializeLighting() //TODO: could probably improve this bit ~Carn - tagbase = "[type]" - if(!tag) tag = tagbase - if(!lighting_use_dynamic) - if(!lighting_subarea) // see if this is a lighting subarea already - //show the dark overlay so areas, not yet in a lighting subarea, won't be bright as day and look silly. - SetLightLevel(4) - -//#undef LIGHTING_LAYER -#undef LIGHTING_CIRCULAR -//#undef LIGHTING_ICON - -#define LIGHTING_MAX_LUMINOSITY_STATIC 8 //Maximum luminosity to reduce lag. -#define LIGHTING_MAX_LUMINOSITY_MOBILE 5 //Moving objects have a lower max luminosity since these update more often. (lag reduction) -#define LIGHTING_MAX_LUMINOSITY_TURF 1 //turfs have a severely shortened range to protect from inevitable floor-lighttile spam. - -//set the changed status of all lights which could have possibly lit this atom. -//We don't need to worry about lights which lit us but moved away, since they will have change status set already -//This proc can cause lots of lights to be updated. :( -atom/proc/UpdateAffectingLights() - for(var/atom/A in oview(LIGHTING_MAX_LUMINOSITY_STATIC-1,src)) - if(A.light) - A.light.changed = 1 //force it to update at next process() - -//caps luminosity effects max-range based on what type the light's owner is. -atom/proc/get_light_range() - return min(luminosity, LIGHTING_MAX_LUMINOSITY_STATIC) - -atom/movable/get_light_range() - return min(luminosity, LIGHTING_MAX_LUMINOSITY_MOBILE) - -obj/machinery/light/get_light_range() - return min(luminosity, LIGHTING_MAX_LUMINOSITY_STATIC) - -turf/get_light_range() - return min(luminosity, LIGHTING_MAX_LUMINOSITY_TURF) - -#undef LIGHTING_MAX_LUMINOSITY_STATIC -#undef LIGHTING_MAX_LUMINOSITY_MOBILE -#undef LIGHTING_MAX_LUMINOSITY_TURF diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index a2a6274a8ab..02259c274da 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -14,10 +14,6 @@ var/global/datum/controller/failsafe/failsafe var/masterControllerIteration = 0 var/masterControllerAlertLevel = 0 - // lighting - var/lightingControllerIteration = 0 - var/lightingControllerAlertLevel = 0 - /datum/controller/failsafe/New() . = ..() @@ -58,21 +54,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/lighting_controller.dm b/code/controllers/lighting_controller.dm deleted file mode 100644 index a7decbc1185..00000000000 --- a/code/controllers/lighting_controller.dm +++ /dev/null @@ -1,127 +0,0 @@ -var/datum/controller/lighting/lighting_controller = new () - -datum/controller/lighting - processing_interval = 5 //setting this too low will probably kill the server. Don't be silly with it! - var/process_cost = 0 - - var/lighting_states = 7 - - var/list/lights = list() - var/lights_workload_max = 0 - -// var/list/changed_lights() //TODO: possibly implement this to reduce on overheads? - - var/list/changed_turfs = list() - var/changed_turfs_workload_max = 0 - -datum/controller/lighting/New() - lighting_states = max( 0, length(icon_states(LIGHTING_ICON))-1 ) - if(lighting_controller != src) - if(istype(lighting_controller,/datum/controller/lighting)) - Recover() //if we are replacing an existing lighting_controller (due to a crash) we attempt to preserve as much as we can - qdel(lighting_controller) - lighting_controller = src - - -//Workhorse of lighting. It cycles through each light to see which ones need their effects updating. It updates their -//effects and then processes every turf in the queue, moving the turfs to the corresponing lighting sub-area. -//All queue lists prune themselves, which will cause lights with no luminosity to be garbage collected (cheaper and safer -//than deleting them). Processing interval should be roughly half a second for best results. -//By using queues we are ensuring we don't perform more updates than are necessary -datum/controller/lighting/proc/process() - processing = 1 - spawn(0) - //set background = 1 - while(1) - if(processing) - iteration++ - var/started = world.timeofday - - lights_workload_max = max(lights_workload_max,lights.len) - for(var/i=1, i<=lights.len, i++) - var/datum/light_source/L = lights[i] - if(L && !L.check()) - continue - lights.Cut(i,i+1) - i-- - - sleep(-1) - - changed_turfs_workload_max = max(changed_turfs_workload_max,changed_turfs.len) - for(var/i=1, i<=changed_turfs.len, i++) - var/turf/T = changed_turfs[i] - if(T && T.lighting_changed) - T.shift_to_subarea() - changed_turfs.Cut() // reset the changed list - - process_cost = (world.timeofday - started) - - sleep(processing_interval) - -//same as above except it attempts to shift ALL turfs in the world regardless of lighting_changed status -//Does not loop. Should be run prior to process() being called for the first time. -//Note: if we get additional z-levels at runtime (e.g. if the gateway thin ever gets finished) we can initialize specific -//z-levels with the z_level argument -datum/controller/lighting/proc/Initialize(var/z_level) - processing = 0 - spawn(-1) - //set background = 1 - for(var/i=1, i<=lights.len, i++) - var/datum/light_source/L = lights[i] - if(L.check()) - lights.Cut(i,i+1) - i-- - - var/z_start = 1 - var/z_finish = world.maxz - if(z_level) - z_level = round(z_level,1) - if(z_level > 0 && z_level <= world.maxz) - z_start = z_level - z_finish = z_level - - for(var/k=z_start,k<=z_finish,k++) - for(var/i=1,i<=world.maxx,i++) - for(var/j=1,j<=world.maxy,j++) - var/turf/T = locate(i,j,k) - if(T) T.shift_to_subarea() - - changed_turfs.Cut() // reset the changed list - - -//Used to strip valid information from an existing controller and transfer it to a replacement -//It works by using spawn(-1) to transfer the data, if there is a runtime the data does not get transfered but the loop -//does not crash -datum/controller/lighting/proc/Recover() - if(!istype(lighting_controller.changed_turfs,/list)) - lighting_controller.changed_turfs = list() - if(!istype(lighting_controller.lights,/list)) - lighting_controller.lights = list() - - for(var/i=1, i<=lighting_controller.lights.len, i++) - var/datum/light_source/L = lighting_controller.lights[i] - if(istype(L)) - spawn(-1) //so we don't crash the loop (inefficient) - L.check() - lights += L //If we didn't runtime then this will get transferred over - - for(var/i=1, i<=lighting_controller.changed_turfs.len, i++) - var/turf/T = lighting_controller.changed_turfs[i] - if(istype(T) && T.lighting_changed) - spawn(-1) - T.shift_to_subarea() - - var/msg = "## DEBUG: [time2text(world.timeofday)] lighting_controller restarted. Reports:\n" - for(var/varname in lighting_controller.vars) - switch(varname) - if("tag","bestF","type","parent_type","vars") continue - else - var/varval1 = lighting_controller.vars[varname] - var/varval2 = vars[varname] - if(istype(varval1,/list)) - varval1 = "/list([length(varval1)])" - varval2 = "/list([length(varval2)])" - msg += "\t [varname] = [varval1] -> [varval2]\n" - world.log << msg - -#undef LIGHTING_ICON diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm index 90e877b0443..3e04e3dc8ae 100644 --- a/code/controllers/verbs.dm +++ b/code/controllers/verbs.dm @@ -22,7 +22,7 @@ master_controller.asteroid_ore_map = new /datum/ore_distribution() master_controller.asteroid_ore_map.populate_distribution_map() -/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply")) +/client/proc/restart_controller(controller in list("Master","Failsafe","Supply")) set category = "Debug" set name = "Restart Controller" set desc = "Restart one of the various periodic loop controllers for the game (be careful!)" @@ -38,10 +38,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") supply_controller.process() feedback_add_details("admin_verb","RSupply") @@ -49,7 +45,7 @@ return -/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Scheduler")) +/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Scheduler")) set category = "Debug" set name = "Debug Controller" set desc = "Debug the various periodic loop controllers for the game (be careful!)" @@ -65,9 +61,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 590324593c2..f9c041f82af 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -28,8 +28,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station icon = 'icons/turf/areas.dmi' icon_state = "unknown" layer = 10 + luminosity = 1 mouse_opacity = 0 - invisibility = INVISIBILITY_LIGHTING 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/list/apc = list() 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 var/air_doors_activated = 0 @@ -113,14 +110,12 @@ var/list/ghostteleportlocs = list() /area/admin/ name = "\improper Admin Room" icon_state = "start" - lighting_use_dynamic = 0 requires_power = 0 /area/adminconstruction name = "\improper Admin Testing Area" icon_state = "start" - lighting_use_dynamic = 0 requires_power = 0 @@ -128,10 +123,8 @@ var/list/ghostteleportlocs = list() //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 /area/shuttle/arrival name = "\improper Arrival Shuttle" @@ -232,29 +225,21 @@ var/list/ghostteleportlocs = list() 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/gamma/space icon_state = "shuttle" name = "\improper Gamma Armory" requires_power = 0 - luminosity = 0 - lighting_use_dynamic = 1 /area/shuttle/gamma/station icon_state = "shuttle" name = "\improper Gamma Armory Station" requires_power = 0 - luminosity = 0 - lighting_use_dynamic = 1 /area/shuttle/prison/ name = "\improper Prison Shuttle" @@ -429,6 +414,7 @@ var/list/ghostteleportlocs = list() name = "\improper Centcom" icon_state = "centcom" requires_power = 0 + lighting_use_dynamic = 0 /area/centcom/control name = "\improper Centcom Control" @@ -466,6 +452,7 @@ var/list/ghostteleportlocs = list() name = "\improper Syndicate Mothership" icon_state = "syndie-ship" requires_power = 0 + lighting_use_dynamic = 0 /area/syndicate_mothership/control name = "\improper Syndicate Control Room" @@ -1113,7 +1100,6 @@ var/list/ghostteleportlocs = list() /area/holodeck name = "\improper Holodeck" icon_state = "Holodeck" - luminosity = 1 lighting_use_dynamic = 0 /area/holodeck/alphadeck @@ -1249,7 +1235,6 @@ var/list/ghostteleportlocs = list() /area/solar requires_power = 0 - luminosity = 1 lighting_use_dynamic = 0 auxport diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index a5e9b3876eb..5c0f20f3cd9 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -8,8 +8,6 @@ /proc/area_contents(var/area/A) if(!istype(A)) return null var/list/contents = list() - for(var/area/LSA in A.related) - contents += LSA.contents return contents // === @@ -20,9 +18,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) active_areas += src all_areas += src @@ -36,20 +32,15 @@ // 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/proc/poweralert(var/state, var/obj/source as obj) @@ -57,16 +48,15 @@ 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) - if(!report_alerts) - break - cameras += C - if(state == 1) + for (var/obj/machinery/camera/C in src) + if(!report_alerts) + break + cameras += C + if(state == 1) - C.network.Remove("Power Alarms") - else - C.network.Add("Power Alarms") + C.network.Remove("Power Alarms") + else + C.network.Add("Power Alarms") for (var/mob/living/silicon/aiPlayer in player_list) if(!report_alerts) break @@ -93,15 +83,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 // 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])") @@ -111,13 +100,11 @@ // 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) - if(!report_alerts) - break - cameras += C - C.network.Add("Atmosphere Alarms") + for(var/obj/machinery/camera/C in src) + if(!report_alerts) + break + cameras += C + C.network.Add("Atmosphere Alarms") for(var/mob/living/silicon/aiPlayer in player_list) if(!report_alerts) break @@ -130,11 +117,10 @@ CloseFirelocks() // Dropping from danger level 2. else if (atmosalm == 2) - for(var/area/RA in related) - for(var/obj/machinery/camera/C in RA) - if(!report_alerts) - break - C.network.Remove("Atmosphere Alarms") + for(var/obj/machinery/camera/C in src) + if(!report_alerts) + break + C.network.Remove("Atmosphere Alarms") for(var/mob/living/silicon/aiPlayer in player_list) if(!report_alerts) break @@ -179,12 +165,11 @@ mouse_opacity = 0 CloseFirelocks() var/list/cameras = list() - for(var/area/RA in related) - for (var/obj/machinery/camera/C in RA) - if(!report_alerts) - continue - cameras.Add(C) - C.network.Add("Fire Alarms") + for (var/obj/machinery/camera/C in src) + if(!report_alerts) + continue + cameras.Add(C) + C.network.Add("Fire Alarms") for (var/mob/living/silicon/ai/aiPlayer in player_list) if(!report_alerts) continue @@ -199,11 +184,10 @@ fire = 0 mouse_opacity = 0 updateicon() - for(var/area/RA in related) - for (var/obj/machinery/camera/C in RA) - if(!report_alerts) - continue - C.network.Remove("Fire Alarms") + for (var/obj/machinery/camera/C in src) + if(!report_alerts) + continue + C.network.Remove("Fire Alarms") for (var/mob/living/silicon/ai/aiPlayer in player_list) if(!report_alerts) continue @@ -293,67 +277,66 @@ /area/proc/powered(var/chan) // return true if the area has power to given channel - 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 // called when power status changes /area/proc/power_change() - master.powerupdate = 2 - 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() + powerupdate = 2 + 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(var/chan) var/used = 0 switch(chan) if(LIGHT) - used += master.used_light + used += used_light if(EQUIP) - used += master.used_equip + used += used_equip if(ENVIRON) - used += master.used_environ + used += used_environ if(TOTAL) - used += master.used_light + master.used_equip + master.used_environ + used += used_light + used_equip + used_environ return used /area/proc/clear_usage() - master.used_equip = 0 - master.used_light = 0 - master.used_environ = 0 + used_equip = 0 + used_light = 0 + used_environ = 0 /area/proc/use_power(var/amount, var/chan) 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/proc/use_battery_power(var/amount, var/chan) 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(A) @@ -418,15 +401,11 @@ L.client.played = 0 /area/proc/gravitychange(var/gravitystate = 0, var/area/A) - A.has_gravity = gravitystate - for(var/area/SubA in A.related) - SubA.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(var/mob/living/carbon/human/M) if(istype(M,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to. diff --git a/code/game/atoms.dm b/code/game/atoms.dm index d5317a1586d..a6d56952128 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -34,7 +34,7 @@ var/global/list/ghdel_profiling = list() /atom/Destroy() - SetOpacity(0) + set_opacity(0) if(reagents) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index dcbe4e4462e..148d8d323d6 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -14,6 +14,7 @@ var/no_spin = 0 var/moved_recently = 0 var/mob/pulledby = null + var/simulated //filter for actions - used by lighting overlays var/area/areaMaster var/hard_deleted = 0 @@ -24,23 +25,8 @@ /atom/movable/Destroy() - if(opacity) - if(isturf(loc)) - if(loc:lighting_lumcount > 1) - UpdateAffectingLights() - gcDestroyed = "Bye, world!" - tag = null + . = ..() loc = null -/* - if(istype(beams) && beams.len) - for(var/obj/effect/beam/B in beams) - if(B && B.target == src) - B.target = null - if(B.master && B.master.target == src) - B.master.target = null - beams.len = 0 -*/ - ..() /proc/delete_profile(var/type, code = 0) if(!ticker || !ticker.current_state < 3) return diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index a98313eefdb..39ad38d668f 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -56,7 +56,13 @@ var/turf/simulated/T = get_turf(M) if(!istype(T)) return - if(T.lighting_lumcount <= 2) + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + var/light_available + if(L) + light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5) + else + light_available = 5 + if(light_available <= 2) M.alpha = round(255 * 1.15) else M.alpha = round(255 * 0.80) diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index 7c336b0acab..1ad62999ecf 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -2,7 +2,7 @@ /obj/effect/blob name = "blob" icon = 'icons/mob/blob.dmi' - luminosity = 0 + light_range = 0 desc = "Some blob creature thingy" density = 0 opacity = 0 @@ -146,7 +146,7 @@ health -= damage update_icon() return - + attack_animal(mob/living/simple_animal/M as mob) M.changeNext_move(CLICK_CD_MELEE) M.do_attack_animation(src) diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm index 0b8c0cf6755..126601c31dd 100644 --- a/code/game/gamemodes/cult/cult_structures.dm +++ b/code/game/gamemodes/cult/cult_structures.dm @@ -18,7 +18,8 @@ name = "Pylon" desc = "A floating crystal that hums with an unearthly energy" icon_state = "pylon" - luminosity = 5 + light_range = 5 + light_color = "#3e0000" /obj/structure/cult/tome diff --git a/code/game/gamemodes/events/biomass.dm b/code/game/gamemodes/events/biomass.dm index 598dad6abd6..e820c1880e6 100644 --- a/code/game/gamemodes/events/biomass.dm +++ b/code/game/gamemodes/events/biomass.dm @@ -166,10 +166,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/events/spacevines.dm b/code/game/gamemodes/events/spacevines.dm index 03d938a455e..399b13ff660 100644 --- a/code/game/gamemodes/events/spacevines.dm +++ b/code/game/gamemodes/events/spacevines.dm @@ -5,10 +5,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/shadowling/shadowling_abilities.dm b/code/game/gamemodes/shadowling/shadowling_abilities.dm index f59c579f969..86c0c4e5b36 100644 --- a/code/game/gamemodes/shadowling/shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/shadowling_abilities.dm @@ -55,7 +55,7 @@ L.update(0) for(var/obj/item/device/pda/P in T.contents) P.fon = 0 - P.SetLuminosity(0) + P.set_light(0) for(var/obj/effect/glowshroom/G in orange(2, usr)) //Very small radius G.visible_message("\The [G] withers away!") qdel(G) @@ -69,15 +69,15 @@ F.update_brightness() for(var/obj/item/device/pda/P in H) P.fon = 0 - P.SetLuminosity(0) //failsafe + P.set_light(0) //failsafe for(var/obj/item/clothing/head/helmet/space/rig/R in H) if(R.on) R.on = 0 R.icon_state = "rig[R.on]-[R._color]" H.update_inv_head() R.visible_message("[R]'s light fades and turns off.") - H.SetLuminosity(H.luminosity - R.brightness_on) - R.SetLuminosity(0) + H.set_light(H.luminosity - R.brightness_on) + R.set_light(0) if(H != usr) H << "You feel a chill and are plunged into darkness." H.luminosity = 0 //This might not be required, but it just acts as another failsafe. diff --git a/code/game/gamemodes/vampire/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers.dm index 3ec453f56d7..8a59cb6d147 100644 --- a/code/game/gamemodes/vampire/vampire_powers.dm +++ b/code/game/gamemodes/vampire/vampire_powers.dm @@ -270,6 +270,12 @@ alpha = 255 return var/turf/simulated/T = get_turf(src) + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + var/light_available + if(L) + light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5) + else + light_available = 5 if(!istype(T)) return 0 @@ -277,7 +283,7 @@ if(!mind.vampire.iscloaking) alpha = 255 return 0 - if(T.lighting_lumcount <= 2) + if(light_available <= 2) alpha = round((255 * 0.15)) return 1 else @@ -439,8 +445,11 @@ if(T.x>world.maxx-outer_tele_radius || T.xworld.maxy-outer_tele_radius || T.y max_lum) continue + if(lightingcount > max_lum) continue turfs += T if(!turfs.len) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 4d4bbaee2f5..f39a7b06eca 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -222,14 +222,14 @@ idle_power_usage = 1250 active_power_usage = 2500 - l_color = "#7BF9FF" + light_color = "#7BF9FF" power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/sleeper/New() ..() diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 2fe1c9b2c4d..d94b779d631 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -10,14 +10,14 @@ idle_power_usage = 1250 active_power_usage = 2500 - l_color = "#00FF00" + light_color = "#00FF00" power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/bodyscanner/New() ..() diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 917a2212365..88ec385db88 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -95,11 +95,10 @@ /obj/machinery/alarm/proc/apply_preset(var/no_cycle_after=0) // Propogate settings. - for (var/area/A in alarm_area.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 alarm_area) + 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 @@ -151,8 +150,6 @@ /obj/machinery/alarm/proc/first_run() alarm_area = get_area(src) - if (alarm_area.master) - alarm_area = alarm_area.master area_uid = alarm_area.uid if (name == "alarm") name = "[alarm_area.name] Air Alarm" @@ -296,11 +293,10 @@ /obj/machinery/alarm/proc/elect_master() - for (var/area/A in alarm_area.related) - for (var/obj/machinery/alarm/AA in A) - if (!(AA.stat & (NOPOWER|BROKEN))) - alarm_area.master_air_alarm = AA - return 1 + for (var/obj/machinery/alarm/AA in alarm_area) + if (!(AA.stat & (NOPOWER|BROKEN))) + alarm_area.master_air_alarm = AA + return 1 return 0 /obj/machinery/alarm/proc/get_danger_level(var/current_value, var/list/danger_levels) @@ -471,9 +467,9 @@ /obj/machinery/alarm/proc/air_doors_close(manual) var/area/A = get_area(src) - if(!A.master.air_doors_activated) - A.master.air_doors_activated = 1 - for(var/obj/machinery/door/E in A.master.all_doors) + if(!A.air_doors_activated) + A.air_doors_activated = 1 + for(var/obj/machinery/door/E in A.all_doors) if(istype(E,/obj/machinery/door/firedoor)) if(!E:blocked) if(E.operating) @@ -507,9 +503,9 @@ /obj/machinery/alarm/proc/air_doors_open(manual) var/area/A = get_area(loc) - if(A.master.air_doors_activated) - A.master.air_doors_activated = 0 - for(var/obj/machinery/door/E in A.master.all_doors) + if(A.air_doors_activated) + A.air_doors_activated = 0 + for(var/obj/machinery/door/E in A.all_doors) if(istype(E, /obj/machinery/door/firedoor)) if(!E:blocked) if(E.operating) @@ -1381,8 +1377,6 @@ Just a object used in constructing fire alarms user.machine = src var/area/A = get_area(src) ASSERT(isarea(A)) - if(A.master) - A = A.master var/d1 var/d2 if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) @@ -1421,8 +1415,6 @@ Just a object used in constructing fire alarms return var/area/A = get_area(src) ASSERT(isarea(A)) - if(A.master) - A = A.master A.partyreset() return @@ -1431,8 +1423,6 @@ Just a object used in constructing fire alarms return var/area/A = get_area(src) ASSERT(isarea(A)) - if(A.master) - A = A.master A.partyalert() return diff --git a/code/game/machinery/atmoalter/area_atmos_computer.dm b/code/game/machinery/atmoalter/area_atmos_computer.dm index 94d4d5348d3..c055f7b70b4 100644 --- a/code/game/machinery/atmoalter/area_atmos_computer.dm +++ b/code/game/machinery/atmoalter/area_atmos_computer.dm @@ -9,13 +9,13 @@ var/range = 25 - l_color = "#7BF9FF" + light_color = "#7BF9FF" power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) //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." @@ -151,14 +151,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 @@ -177,7 +173,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/bots/bots.dm b/code/game/machinery/bots/bots.dm index f540d21ed8d..5e7bdab9e6d 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -2,7 +2,7 @@ /obj/machinery/bot icon = 'icons/obj/aibots.dmi' layer = MOB_LAYER - luminosity = 3 + light_range = 3 use_power = 0 var/obj/item/weapon/card/id/botcard // the ID card that the bot "holds" var/list/prev_access = list() @@ -87,12 +87,12 @@ /obj/machinery/bot/proc/turn_on() if(stat) return 0 on = 1 - SetLuminosity(initial(luminosity)) + set_light(initial(light_range)) return 1 /obj/machinery/bot/proc/turn_off() on = 0 - SetLuminosity(0) + set_light(0) bot_reset() //Resets an AI's call, should it exist. /obj/machinery/bot/New() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index e60921e700b..7a84218a844 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -71,7 +71,7 @@ network = list() cameranet.removeCamera(src) stat |= EMPED - SetLuminosity(0) + set_light(0) triggerCameraAlarm() emped = emped+1 //Increase the number of consecutive EMP's var/thisemp = emped //Take note of which EMP this proc is for diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index a1a1e5f5f49..ca74948ce0a 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -24,13 +24,13 @@ var/speed_coeff var/efficiency - l_color = "#00FF00" + light_color = "#00FF00" power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/clonepod/New() ..() diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index a14da59c097..edb61d5a6fa 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 = "#7BF9FF" attack_ai(var/mob/user as mob) @@ -163,7 +163,7 @@ /obj/machinery/computer/HolodeckControl/attackby(var/obj/item/weapon/D as obj, var/mob/user as mob, params) return - + /obj/machinery/computer/HolodeckControl/emag_act(user as mob) if(!emagged) playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 9f73b206443..367918883e2 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/table = null - l_color = "#0000FF" + light_color = "#0000FF" /obj/machinery/computer/operating/New() ..() diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 51c8626c1d1..f576ae8d1b8 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -7,7 +7,7 @@ var/mob/living/silicon/ai/occupant = null var/active = 0 - l_color = "#CD00CD" + light_color = "#CD00CD" /obj/machinery/computer/aifixer/New() src.overlays += image('icons/obj/computer.dmi', "ai-fixer-empty") @@ -19,7 +19,7 @@ user << "This terminal isn't functioning right now, get it working!" return I:transfer_ai("AIFIXER","AICARD",src,user) - + ..() return diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index eeea46d400b..413af2d9037 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -3,7 +3,7 @@ desc = "random arcade machine" icon = 'icons/obj/computer.dmi' icon_state = "arcade" - l_color = "#00FF00" + light_color = "#00FF00" var/list/prizes = list( /obj/item/weapon/storage/box/snappops = 2, /obj/item/clothing/under/syndicate/tacticool = 2, @@ -47,9 +47,9 @@ /obj/machinery/computer/arcade/power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/computer/arcade/New() ..() diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 5e9bb34866b..e59e5eec359 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 = "#7BF9FF" /obj/machinery/computer/atmos_alert/initialize() diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 8015eb399b5..5f1c0117048 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -1,7 +1,8 @@ +var/camera_cache_id = 1 + /proc/invalidateCameraCache() - for(var/obj/machinery/computer/security/s in world) - s.camera_cache = null - + camera_cache_id = (++camera_cache_id % 999999) + /obj/machinery/computer/security name = "Camera Monitor" desc = "Used to access the various cameras networks on the station." @@ -10,8 +11,9 @@ var/obj/machinery/camera/current = null var/list/network = list("") var/last_pic = 1.0 - l_color = "#B40000" - var/mapping = 0 + light_color = "#B40000" + var/mapping = 0 + var/cache_id = 0 var/list/networks[0] var/list/tempnets[0] var/list/data[0] @@ -26,21 +28,21 @@ networks["Research"] = list(access_rd,access_hos,access_captain) networks["Prison"] = list(access_hos,access_captain) networks["Labor"] = list(access_hos,access_captain) - networks["Interrogation"] = list(access_hos,access_captain) + networks["Interrogation"] = list(access_hos,access_captain) networks["Atmosphere Alarms"] = list(access_ce,access_hos,access_captain) - networks["Fire Alarms"] = list(access_ce,access_hos,access_captain) + networks["Fire Alarms"] = list(access_ce,access_hos,access_captain) networks["Power Alarms"] = list(access_ce,access_hos,access_captain) - networks["Supermatter"] = list(access_ce,access_hos,access_captain) - networks["MiniSat"] = list(access_rd,access_hos,access_captain) - networks["Singularity"] = list(access_ce,access_hos,access_captain) + networks["Supermatter"] = list(access_ce,access_hos,access_captain) + networks["MiniSat"] = list(access_rd,access_hos,access_captain) + networks["Singularity"] = list(access_ce,access_hos,access_captain) networks["Anomaly Isolation"] = list(access_rd,access_hos,access_captain) networks["Toxins"] = list(access_rd,access_hos,access_captain) networks["Telepad"] = list(access_rd,access_hos,access_captain) networks["TestChamber"] = list(access_rd,access_hos,access_captain) - networks["ERT"] = list(access_cent_specops_commander,access_cent_commander) + networks["ERT"] = list(access_cent_specops_commander,access_cent_commander) networks["CentCom"] = list(access_cent_security,access_cent_commander) networks["Thunderdome"] = list(access_cent_thunder,access_cent_commander) - + attack_ai(var/mob/user as mob) return attack_hand(user) @@ -52,17 +54,17 @@ return null user.reset_view(current) return 1 - + // Network configuration attackby(I as obj, user as mob, params) access = list() if(istype(I,/obj/item/weapon/card/id)) // If hit by a regular ID card. - var/obj/item/weapon/card/id/E = I + var/obj/item/weapon/card/id/E = I access = E.access ui_interact(user) else ..() - + emag_act(user as mob) if(!emagged) emagged = 1 @@ -70,12 +72,12 @@ ui_interact(user) else ui_interact(user) - + ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) if(src.z > 6) return if(stat & (NOPOWER|BROKEN)) return - if(user.stat) return - + if(user.stat) return + var/data[0] @@ -104,14 +106,14 @@ data["current"] = cam data["cameras"] = cameras - + tempnets.Cut() if(emagged) access = list(access_captain) // Assume captain level access when emagged data["emagged"] = 1 if(isAI(user) || isrobot(user)) access = list(access_captain) // Assume captain level access when AI - + // Loop through the ID's permission, and check which networks the ID has access to. for(var/l in networks) // Loop through networks. for(var/m in networks[l]) // Loop through access levels of the networks. @@ -119,10 +121,10 @@ if(l in network) // Checks if the network is currently active. tempnets.Add(list(list("name" = l, "active" = 1))) else - tempnets.Add(list(list("name" = l, "active" = 0))) + tempnets.Add(list(list("name" = l, "active" = 0))) break data["networks"] = tempnets - + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) ui = new(user, src, ui_key, "sec_camera.tmpl", "Camera Console", 900, 800) @@ -135,7 +137,7 @@ ui.set_initial_data(data) ui.open() ui.set_auto_update(1) - + Topic(href, href_list) if(href_list["switchTo"]) if(src.z>6 || stat&(NOPOWER|BROKEN)) return @@ -165,7 +167,7 @@ nanomanager.update_uis(src) else . = ..() - + attack_hand(var/mob/user as mob) access = list() if (src.z > 6) @@ -175,22 +177,22 @@ if(!isAI(user)) user.set_machine(src) - + if(ishuman(user)) var/mob/living/carbon/human/H = user if(H.wear_id) var/obj/item/weapon/card/id/gold/C = H.wear_id access = C.access - + ui_interact(user) - + // Check if camera is accessible when jumping proc/can_access_camera(var/obj/machinery/camera/C) var/list/shared_networks = src.network & C.network if(shared_networks.len) return 1 return 0 - + // Switching to cameras proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C) if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.can_use() )) && (!istype(user, /mob/living/silicon/ai))) @@ -239,14 +241,14 @@ return if(can_access_camera(jump_to)) switch_to_camera(user,jump_to) - + // Camera control: mouse. /atom/DblClick() ..() if(istype(usr.machine,/obj/machinery/computer/security)) var/obj/machinery/computer/security/console = usr.machine console.jump_on_click(usr,src) - + // Camera control: arrow keys. /mob/Move(n,direct) if(istype(machine,/obj/machinery/computer/security)) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index c134b649c39..a44aa104e62 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -11,7 +11,7 @@ var/mode = 0.0 var/printing = null - l_color = "#0000FF" + light_color = "#0000FF" proc/is_centcom() return istype(src, /obj/machinery/computer/card/centcom) diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index d818d5fd574..81aec1aed6c 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -16,7 +16,7 @@ var/autoprocess = 0 var/data[0] - l_color = "#0000FF" + light_color = "#0000FF" /obj/machinery/computer/cloning/New() ..() @@ -36,8 +36,8 @@ for(var/datum/dna2/record/R in src.records) if(!(pod1.occupant || pod1.mess)) if(pod1.growclone(R)) - records.Remove(R) - + records.Remove(R) + /obj/machinery/computer/cloning/proc/updatemodules() src.scanner = findscanner() src.pod1 = findcloner() @@ -113,7 +113,7 @@ data["pod"] = src.pod1 data["loading"] = loading data["autoprocess"] = autoprocess - if(scanner && pod1 && ((scanner.scan_level > 2) || (pod1.efficiency > 5))) + if(scanner && pod1 && ((scanner.scan_level > 2) || (pod1.efficiency > 5))) data["autoallowed"] = 1 else data["autoallowed"] = 0 @@ -123,19 +123,19 @@ data["temp"] = temp data["scantemp"] = scantemp data["disk"] = src.diskette - var/list/temprecords[0] + var/list/temprecords[0] for(var/datum/dna2/record/R in src.records) var tempRealName = R.dna.real_name temprecords.Add(list(list("record" = "\ref[R]", "realname" = tempRealName))) data["records"] = temprecords - + if(src.menu == 3) if (src.active_record) data["activerecord"] = "\ref[src.active_record]" var/obj/item/weapon/implant/health/H = null if(src.active_record.implant) H = locate(src.active_record.implant) - + if ((H) && (istype(H))) data["health"] = H.sensehealth() data["realname"] = src.active_record.dna.real_name @@ -145,13 +145,13 @@ data["enoughbiomass"] = 1 else data["enoughbiomass"] = 0 - + // Set up the Nano UI ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) ui = new(user, src, ui_key, "cloning_console.tmpl", "Cloning Console UI", 640, 480) - ui.set_initial_data(data) - ui.open() + ui.set_initial_data(data) + ui.open() /obj/machinery/computer/cloning/Topic(href, href_list) if(..()) @@ -179,7 +179,7 @@ nanomanager.update_uis(src) if("stopautoprocess") autoprocess = 0 - nanomanager.update_uis(src) + nanomanager.update_uis(src) //No locking an open scanner. else if ((href_list["lock"]) && (!isnull(src.scanner))) @@ -267,7 +267,7 @@ else if (href_list["refresh"]) nanomanager.update_uis(src) - else if (href_list["clone"]) + else if (href_list["clone"]) var/datum/dna2/record/C = locate(href_list["clone"]) //Look for that player! They better be dead! if(C) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index e5aeabf72ae..ecd428fca1e 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -55,11 +55,11 @@ var/shuttle_call/shuttle_calls[0] var/stat_msg1 var/stat_msg2 var/display_type="blank" - + var/datum/announcement/priority/crew_announcement = new - l_color = "#0000FF" - + light_color = "#0000FF" + /obj/machinery/computer/communications/New() ..() crew_announcement.newscast = 1 @@ -252,7 +252,7 @@ var/shuttle_call/shuttle_calls[0] if(!emagged) src.emagged = 1 user << "You scramble the communication routing circuits!" - + /obj/machinery/computer/communications/attack_ai(var/mob/user as mob) return src.attack_hand(user) @@ -426,7 +426,7 @@ var/shuttle_call/shuttle_calls[0] if(world.time < 54000) // 30 minute grace period to let the game get going user << "The shuttle is refueling. Please wait another [round((54000-world.time)/60)] minutes before trying again." return - + if(ticker.mode.name == "epidemic") user << "Under directive 7-10, [station_name()] is quarantined until further notice." return diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index 14011f549b5..fb995b4b487 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -93,9 +93,9 @@ ..() update_icon() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/computer/proc/set_broken() @@ -106,7 +106,7 @@ // Adds line breaks text = replacetext(text, "\n", "
") return text - + /obj/machinery/computer/attack_ghost(user as mob) return src.attack_hand(user) @@ -114,7 +114,7 @@ /* Observers can view computers, but not actually use them via Topic*/ if(istype(user, /mob/dead/observer)) return 0 return ..() - + /obj/machinery/computer/attackby(I as obj, user as mob, params) if(istype(I, /obj/item/weapon/screwdriver) && circuit) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 4802e855af2..9cd5ca6a143 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 = "#FFFFFF" verb/AccessInternals() @@ -86,6 +86,6 @@ else usr << "[src.current.name] selected for law changes." return - + attack_ghost(user as mob) return 1 diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 23a8c3ed16f..c665214ed33 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 = "#0000FF" /obj/machinery/computer/med_data/attack_ai(user as mob) return src.attack_hand(user) diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 3cf15c5308a..9cc273c1716 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -33,7 +33,7 @@ var/customjob = "Admin" var/custommessage = "This is a test, please ignore." - l_color = "#50AB00" + light_color = "#50AB00" /obj/machinery/computer/message_monitor/attackby(obj/item/weapon/O as obj, mob/living/user as mob, params) @@ -48,7 +48,7 @@ ..() return - + /obj/machinery/computer/message_monitor/emag_act(user as mob) // Will create sparks and print out the console's password. You will then have to wait a while for the console to be back online. // It'll take more time if there's more characters in the password.. diff --git a/code/game/machinery/computer/power.dm b/code/game/machinery/computer/power.dm index 06f8cfe5692..69c9b4a54e0 100644 --- a/code/game/machinery/computer/power.dm +++ b/code/game/machinery/computer/power.dm @@ -11,7 +11,7 @@ idle_power_usage = 20 active_power_usage = 80 - l_color = "#FF9933" + light_color = "#FF9933" //fix for issue 521, by QualityVan. //someone should really look into why circuits have a powernet var, it's several kinds of retarded. @@ -23,14 +23,14 @@ if(isturf(T)) attached = locate() in T if(attached) - powernet = attached.get_powernet() - + powernet = attached.get_powernet() + /obj/machinery/power/monitor/attack_ai(mob/user) add_fingerprint(user) if(stat & (BROKEN|NOPOWER)) return - interact(user) + interact(user) /obj/machinery/power/monitor/attack_hand(mob/user) add_fingerprint(user) diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 7b4b37665b0..3fa4f812240 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -14,7 +14,7 @@ var/screen = 0 // 0 - No Access Denied, 1 - Access allowed var/obj/item/weapon/card/id/prisoner/inserted_id - l_color = "#B40000" + light_color = "#B40000" attack_ai(var/mob/user as mob) diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index 12af8c24d65..8ecc35cdc70 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -10,7 +10,7 @@ circuit = /obj/item/weapon/circuitboard/robotics var/temp = null - l_color = "#CD00CD" + light_color = "#CD00CD" /obj/machinery/computer/robotics/proc/can_control(var/mob/user, var/mob/living/silicon/robot/R) if(!istype(R)) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 1094ede2762..20e05123ef8 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 = "#B40000" /obj/machinery/computer/secure_data/attackby(obj/item/O as obj, user as mob, params) diff --git a/code/game/machinery/computer/shuttle.dm b/code/game/machinery/computer/shuttle.dm index ee4a88fb89b..74a0dab54e5 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 = "#7BF9FF" attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob, params) @@ -57,7 +57,7 @@ src.authorized.len = 0 src.authorized = list( ) return - + emag_act(user as mob) if (!emagged) var/choice = alert(user, "Would you like to launch the shuttle?","Shuttle control", "Launch", "Cancel") diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm index 3ed66a1dec2..772fe446e4e 100644 --- a/code/game/machinery/computer/station_alert.dm +++ b/code/game/machinery/computer/station_alert.dm @@ -6,7 +6,7 @@ circuit = "/obj/item/weapon/circuitboard/stationalert" var/alarms = list("Fire"=list(), "Atmosphere"=list(), "Power"=list()) - l_color = "#7BF9FF" + light_color = "#7BF9FF" attack_ai(mob/user) diff --git a/code/game/machinery/computer/store.dm b/code/game/machinery/computer/store.dm index 9ab45f15d94..4ac0a7e315a 100644 --- a/code/game/machinery/computer/store.dm +++ b/code/game/machinery/computer/store.dm @@ -4,7 +4,7 @@ icon_state = "comm_logs" circuit = "/obj/item/weapon/circuitboard/merch" - l_color = "#50AB00" + light_color = "#50AB00" /obj/item/weapon/circuitboard/merch name = "\improper Merchandise Computer Circuitboard" diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 8449c006cb0..b89caed1dc3 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -17,13 +17,13 @@ var/current_heat_capacity = 50 var/efficiency - l_color = "#FFFFFF" + light_color = "#FFFFFF" power_change() ..() if(!(stat & (BROKEN|NOPOWER))) - SetLuminosity(2) + set_light(2) else - SetLuminosity(0) + set_light(0) /obj/machinery/atmospherics/unary/cryo_cell/New() ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index ec8b45ef78b..617214ea5c5 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -926,7 +926,7 @@ About the new airlock wires panel: sleep(5) update_icon() if(visible && !glass) - SetOpacity(1) + set_opacity(1) operating = 0 air_update_turf(1) update_freelok_sight() 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/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 978b6057866..027dded2c38 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -38,11 +38,11 @@ pixel_y = ((src.dir & 3)? (src.dir ==1 ? 24 : -32) : (0)) spawn(20) - for(var/obj/machinery/door/window/brigdoor/M in world) + for(var/obj/machinery/door/window/brigdoor/M in machines) if (M.id == src.id) targets += M - for(var/obj/machinery/flasher/F in world) + for(var/obj/machinery/flasher/F in machines) if(F.id == src.id) targets += F diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 6588131ac9f..2c0bd7a6ae9 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -235,13 +235,13 @@ if(!operating) operating = 1 do_animate("opening") - src.SetOpacity(0) + src.set_opacity(0) sleep(5) src.density = 0 sleep(5) src.layer = 2.7 update_icon() - SetOpacity(0) + set_opacity(0) operating = 0 air_update_turf(1) update_freelok_sight() @@ -269,7 +269,7 @@ sleep(5) update_icon() if(visible && !glass) - SetOpacity(1) //caaaaarn! + set_opacity(1) //caaaaarn! operating = 0 air_update_turf(1) update_freelok_sight() diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index 36f62d6befd..7bbc05fb073 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -58,7 +58,7 @@ 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 @@ -74,7 +74,7 @@ src.operating = 1 flick("pdoorc0", src) src.icon_state = "pdoor0" - src.SetOpacity(0) + src.set_opacity(0) sleep(5) src.density = 0 sleep(5) @@ -94,7 +94,7 @@ src.operating = 1 flick("pdoorc1", src) src.icon_state = "pdoor1" - src.SetOpacity(initial(opacity)) + src.set_opacity(initial(opacity)) air_update_turf(1) update_freelok_sight() sleep(5) @@ -115,9 +115,9 @@ src.operating = 1 flick("pdoorc0", src) src.icon_state = "pdoor0" - src.SetOpacity(0) - f1.SetOpacity(0) - f2.SetOpacity(0) + src.set_opacity(0) + f1.set_opacity(0) + f2.set_opacity(0) sleep(10) src.density = 0 @@ -145,9 +145,9 @@ f2.density = 1 sleep(10) - src.SetOpacity(initial(opacity)) - f1.SetOpacity(initial(opacity)) - f2.SetOpacity(initial(opacity)) + src.set_opacity(initial(opacity)) + f1.set_opacity(initial(opacity)) + f2.set_opacity(initial(opacity)) update_nearby_tiles() @@ -165,14 +165,14 @@ src.icon_state = "pdoor0" sleep(10) src.density = 0 - src.SetOpacity(0) + src.set_opacity(0) f1.density = 0 - f1.SetOpacity(0) + f1.set_opacity(0) f2.density = 0 - f2.SetOpacity(0) + f2.set_opacity(0) f3.density = 0 - f3.SetOpacity(0) + f3.set_opacity(0) air_update_turf(1) update_freelok_sight() @@ -193,14 +193,14 @@ src.density = 1 f1.density = 1 - f1.SetOpacity(1) + f1.set_opacity(1) f2.density = 1 - f2.SetOpacity(1) + f2.set_opacity(1) f3.density = 1 - f3.SetOpacity(1) + f3.set_opacity(1) if (src.visible) - src.SetOpacity(1) + src.set_opacity(1) air_update_turf(1) update_freelok_sight() @@ -219,16 +219,16 @@ src.icon_state = "pdoor0" sleep(10) src.density = 0 - src.SetOpacity(0) + src.set_opacity(0) f1.density = 0 - f1.SetOpacity(0) + f1.set_opacity(0) f2.density = 0 - f2.SetOpacity(0) + f2.set_opacity(0) f3.density = 0 - f3.SetOpacity(0) + f3.set_opacity(0) f4.density = 0 - f4.SetOpacity(0) + f4.set_opacity(0) air_update_turf(1) update_freelok_sight() @@ -249,16 +249,16 @@ src.density = 1 f1.density = 1 - f1.SetOpacity(1) + f1.set_opacity(1) f2.density = 1 - f2.SetOpacity(1) + f2.set_opacity(1) f3.density = 1 - f3.SetOpacity(1) + f3.set_opacity(1) f4.density = 1 - f4.SetOpacity(1) + f4.set_opacity(1) if (src.visible) - src.SetOpacity(1) + src.set_opacity(1) air_update_turf(1) update_freelok_sight() @@ -277,12 +277,12 @@ src.icon_state = "pdoor0" sleep(10) src.density = 0 - src.sd_SetOpacity(0) + src.sd_set_opacity(0) f1.density = 0 - f1.sd_SetOpacity(0) + f1.sd_set_opacity(0) f2.density = 0 - f2.sd_SetOpacity(0) + f2.sd_set_opacity(0) update_nearby_tiles() @@ -302,12 +302,12 @@ src.density = 1 f1.density = 1 - f1.sd_SetOpacity(1) + f1.sd_set_opacity(1) f2.density = 1 - f2.sd_SetOpacity(1) + f2.sd_set_opacity(1) if (src.visible) - src.sd_SetOpacity(1) + src.sd_set_opacity(1) update_nearby_tiles() sleep(10) @@ -326,14 +326,14 @@ src.icon_state = "pdoor0" sleep(10) src.density = 0 - src.SetOpacity(0) + src.set_opacity(0) f1.density = 0 - f1.SetOpacity(0) + f1.set_opacity(0) f2.density = 0 - f2.SetOpacity(0) + f2.set_opacity(0) f3.density = 0 - f3.SetOpacity(0) + f3.set_opacity(0) air_update_turf(1) update_freelok_sight() @@ -354,14 +354,14 @@ src.density = 1 f1.density = 1 - f1.SetOpacity(1) + f1.set_opacity(1) f2.density = 1 - f2.SetOpacity(1) + f2.set_opacity(1) f3.density = 1 - f3.SetOpacity(1) + f3.set_opacity(1) if (src.visible) - src.SetOpacity(1) + src.set_opacity(1) air_update_turf(1) update_freelok_sight() @@ -380,16 +380,16 @@ src.icon_state = "pdoor0" sleep(10) src.density = 0 - src.SetOpacity(0) + src.set_opacity(0) f1.density = 0 - f1.SetOpacity(0) + f1.set_opacity(0) f2.density = 0 - f2.SetOpacity(0) + f2.set_opacity(0) f3.density = 0 - f3.SetOpacity(0) + f3.set_opacity(0) f4.density = 0 - f4.SetOpacity(0) + f4.set_opacity(0) air_update_turf(1) update_freelok_sight() @@ -410,16 +410,16 @@ src.density = 1 f1.density = 1 - f1.SetOpacity(1) + f1.set_opacity(1) f2.density = 1 - f2.SetOpacity(1) + f2.set_opacity(1) f3.density = 1 - f3.SetOpacity(1) + f3.set_opacity(1) f4.density = 1 - f4.SetOpacity(1) + f4.set_opacity(1) if (src.visible) - src.SetOpacity(1) + src.set_opacity(1) air_update_turf(1) update_freelok_sight() @@ -441,8 +441,8 @@ f2 = new/obj/machinery/door/poddoor/filler_object (get_step(src,EAST)) f1.density = density f2.density = density - f1.sd_SetOpacity(opacity) - f2.sd_SetOpacity(opacity) + f1.sd_set_opacity(opacity) + f2.sd_set_opacity(opacity) Destroy() del f1 @@ -460,8 +460,8 @@ f2 = new/obj/machinery/door/poddoor/filler_object (get_step(src,NORTH)) f1.density = density f2.density = density - f1.sd_SetOpacity(opacity) - f2.sd_SetOpacity(opacity) + f1.sd_set_opacity(opacity) + f2.sd_set_opacity(opacity) Destroy() del f1 @@ -482,9 +482,9 @@ f1.density = density f2.density = density f3.density = density - f1.SetOpacity(opacity) - f2.SetOpacity(opacity) - f3.SetOpacity(opacity) + f1.set_opacity(opacity) + f2.set_opacity(opacity) + f3.set_opacity(opacity) Destroy() del f1 @@ -506,9 +506,9 @@ f1.density = density f2.density = density f3.density = density - f1.SetOpacity(opacity) - f2.SetOpacity(opacity) - f3.SetOpacity(opacity) + f1.set_opacity(opacity) + f2.set_opacity(opacity) + f3.set_opacity(opacity) Destroy() del f1 @@ -533,10 +533,10 @@ f2.density = density f3.density = density f4.density = density - f1.SetOpacity(opacity) - f2.SetOpacity(opacity) - f3.SetOpacity(opacity) - f4.SetOpacity(opacity) + f1.set_opacity(opacity) + f2.set_opacity(opacity) + f3.set_opacity(opacity) + f4.set_opacity(opacity) Destroy() del f1 @@ -562,10 +562,10 @@ f2.density = density f3.density = density f4.density = density - f1.SetOpacity(opacity) - f2.SetOpacity(opacity) - f3.SetOpacity(opacity) - f4.SetOpacity(opacity) + f1.set_opacity(opacity) + f2.set_opacity(opacity) + f3.set_opacity(opacity) + f4.set_opacity(opacity) Destroy() del f1 diff --git a/code/game/machinery/doors/shutters.dm b/code/game/machinery/doors/shutters.dm index c09226db1ee..d140ce42888 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 @@ -40,7 +40,7 @@ icon_state = "shutter0" sleep(10) density = 0 - SetOpacity(0) + set_opacity(0) air_update_turf(1) update_freelok_sight() @@ -59,7 +59,7 @@ icon_state = "shutter1" density = 1 if(visible) - SetOpacity(1) + set_opacity(1) air_update_turf(1) update_freelok_sight() diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index d4cd6c3e500..7a3a945721d 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -118,7 +118,7 @@ sleep(10) src.density = 0 -// src.sd_SetOpacity(0) //TODO: why is this here? Opaque windoors? ~Carn +// src.sd_set_opacity(0) //TODO: why is this here? Opaque windoors? ~Carn air_update_turf(1) update_freelok_sight() @@ -142,7 +142,7 @@ src.density = 1 // if(src.visible) -// SetOpacity(1) //TODO: why is this here? Opaque windoors? ~Carn +// set_opacity(1) //TODO: why is this here? Opaque windoors? ~Carn air_update_turf(1) update_freelok_sight() sleep(10) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index d2607397967..2c2458df37b 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -25,17 +25,17 @@ /* /obj/machinery/flasher/New() sleep(4) //<--- What the fuck are you doing? D= - src.sd_SetLuminosity(2) + src.sd_set_light(2) */ /obj/machinery/flasher/power_change() if ( powered() ) stat &= ~NOPOWER icon_state = "[base_state]1" -// src.sd_SetLuminosity(2) +// src.sd_set_light(2) else stat |= ~NOPOWER icon_state = "[base_state]1-p" -// src.sd_SetLuminosity(0) +// src.sd_set_light(0) //Don't want to render prison breaks impossible /obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob, params) diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index b6da9e11d95..9c3b04f36d6 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -26,7 +26,7 @@ if(cell.charge <= 0) on = 0 updateicon() - SetLuminosity(0) + set_light(0) src.visible_message("[src] shuts down due to lack of power!") return @@ -50,7 +50,7 @@ if(on) on = 0 user << "\blue You turn off the light" - SetLuminosity(0) + set_light(0) else if(!cell) return @@ -58,7 +58,7 @@ return on = 1 user << "\blue You turn on the light" - SetLuminosity(brightness_on) + set_light(brightness_on) updateicon() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index a04ed3f2053..bb6948eda6b 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -105,8 +105,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.holo = src master = A//AI is the master. @@ -114,12 +114,12 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ return 1 /obj/machinery/hologram/holopad/proc/clear_holo() -// hologram.SetLuminosity(0)//Clear lighting. //handled by the lighting controller when its ower is deleted +// hologram.set_light(0)//Clear lighting. //handled by the lighting controller when its ower is deleted del(hologram)//Get rid of hologram. if(master.holo == src) master.holo = 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 @@ -136,7 +136,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. @@ -148,7 +148,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ hologram.loc = get_turf(master.eyeobj) return 1 - + // Simple helper to face what you clicked on, in case it should be needed in more than one place /obj/machinery/hologram/holopad/proc/face_atom(var/atom/A) if( !hologram || !A || !hologram.x || !hologram.y || !A.x || !A.y ) return diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm index d5fb43f4d97..c58cd06fae9 100644 --- a/code/game/machinery/hydroponics.dm +++ b/code/game/machinery/hydroponics.dm @@ -283,11 +283,11 @@ */ // Handle light requirements. - var/area/A = T.loc - if(A) + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) var/light_available - if(A.lighting_use_dynamic) - light_available = max(0,min(10,T.lighting_lumcount)-5) + if(L) + light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5) else light_available = 5 if(abs(light_available - seed.ideal_light) > seed.light_tolerance) @@ -502,14 +502,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. @@ -923,15 +923,16 @@ if(!environment) //We're in a crate or nullspace, bail out. return - var/area/A = T.loc + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T var/light_available - if(A) - if(A.lighting_use_dynamic) - light_available = max(0,min(10,T.lighting_lumcount)-5) - else - light_available = 5 + var/light_string + if(L) + light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5) + else + light_available = 5 + light_string = "a light level of [light_available] lumens" - usr << "The tray's sensor suite is reporting a light level of [light_available] lumens and a temperature of [environment.temperature]K." + usr << "The tray's sensor suite is reporting [light_string] and a temperature of [environment.temperature]K." /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid() set name = "Toggle Tray Lid" diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 9577a539203..598d448d746 100755 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -65,11 +65,11 @@ if ( powered() && disable == 0 ) stat &= ~NOPOWER icon_state = "[base_state]" -// src.sd_SetLuminosity(2) +// src.sd_set_light(2) else stat |= ~NOPOWER icon_state = "[base_state]-p" -// src.sd_SetLuminosity(0) +// src.sd_set_light(0) /obj/machinery/sparker/attackby(obj/item/weapon/W as obj, mob/user as mob, params) if(istype(W, /obj/item/device/detective_scanner)) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index f75ebc4171c..666c49c3e8d 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -50,15 +50,14 @@ on = !on - for(var/area/A in area.master.related) - A.lightswitch = on - A.updateicon() + area.lightswitch = on + area.updateicon() - for(var/obj/machinery/light_switch/L in A) - L.on = on - L.updateicon() + for(var/obj/machinery/light_switch/L in area) + L.on = on + L.updateicon() - area.master.power_change() + area.power_change() /obj/machinery/light_switch/power_change() diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 5ce4008235f..bb5c005550a 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -98,7 +98,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co var/c_locked=0; //Will our new channel be locked to public submissions? var/hitstaken = 0 //Death at 3 hits from an item with force>=15 var/datum/feed_channel/viewing_channel = null - luminosity = 0 + light_range = 0 anchored = 1 diff --git a/code/game/machinery/telecomms/logbrowser.dm b/code/game/machinery/telecomms/logbrowser.dm index 2fb2cd3cc69..713d326edc1 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 = "#50AB00" /obj/machinery/computer/telecomms/server name = "Telecommunications Server Monitor" @@ -246,7 +246,7 @@ del(src) src.updateUsrDialog() return - + emag_act(user as mob) if(!emagged) playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1) diff --git a/code/game/machinery/telecomms/telemonitor.dm b/code/game/machinery/telecomms/telemonitor.dm index 23969177606..d8bc0fb0972 100644 --- a/code/game/machinery/telecomms/telemonitor.dm +++ b/code/game/machinery/telecomms/telemonitor.dm @@ -19,8 +19,8 @@ var/temp = "" // temporary feedback messages circuit = "/obj/item/weapon/circuitboard/comm_monitor" - - l_color = "#50AB00" + + light_color = "#50AB00" 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 889623b60e6..58239808add 100644 --- a/code/game/machinery/telecomms/traffic_control.dm +++ b/code/game/machinery/telecomms/traffic_control.dm @@ -14,10 +14,10 @@ var/storedcode = "" // code stored - l_color = "#50AB00" + light_color = "#50AB00" req_access = list(access_tcomsat) - circuit = "/obj/item/weapon/circuitboard/comm_traffic" + circuit = "/obj/item/weapon/circuitboard/comm_traffic" proc/update_ide() @@ -235,7 +235,7 @@ del(src) src.updateUsrDialog() return - + /obj/machinery/computer/telecomms/traffic/emag_act(user as mob) if(!emagged) playsound(get_turf(src), 'sound/effects/sparks4.ogg', 75, 1) diff --git a/code/game/machinery/turntable.dm b/code/game/machinery/turntable.dm index 5c2591cd241..2fe0c313a6a 100644 --- a/code/game/machinery/turntable.dm +++ b/code/game/machinery/turntable.dm @@ -57,17 +57,16 @@ // M.music = 1 var/area/A = src.loc.loc - for(var/area/RA in A.related) - for(var/obj/machinery/party/lasermachine/L in RA) - L.turnon() + for(var/obj/machinery/party/lasermachine/L in A) + L.turnon() playing = 1 while(playing == 1) for(var/mob/M in world) - if((M.loc.loc in A.related) && M.music == 0) + if((M.loc.loc in A) && M.music == 0) //world << "Found the song..." M << S M.music = 1 - else if(!(M.loc.loc in A.related) && M.music == 1) + else if(!(M.loc.loc in A) && M.music == 1) var/sound/Soff = sound(null) Soff.channel = 10 M << Soff @@ -148,9 +147,8 @@ M.music = 0 playing = 0 var/area/A = src.loc.loc - for(var/area/RA in A.related) - for(var/obj/machinery/party/lasermachine/L in RA) - L.turnoff() + for(var/obj/machinery/party/lasermachine/L in A) + L.turnoff() @@ -278,6 +276,5 @@ /obj/machinery/party/lasermachine/proc/turnoff() var/area/A = src.loc.loc - for(var/area/RA in A.related) - for(var/obj/effects/laser/F in RA) - del(F) + for(var/obj/effects/laser/F in A) + del(F) diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm index 83bd5b5217d..55399f8b199 100644 --- a/code/game/machinery/turret_control.dm +++ b/code/game/machinery/turret_control.dm @@ -46,12 +46,11 @@ /obj/machinery/turretid/initialize() if(!control_area) - var/area/CA = get_area(src) - control_area = CA.master + control_area = get_area(src) else if(istext(control_area)) for(var/area/A in world) if(A.name && A.name==control_area) - control_area = A.master + control_area = A break if(control_area) @@ -88,7 +87,7 @@ user << "You [ locked ? "lock" : "unlock"] the panel." return return ..() - + /obj/machinery/turretid/emag_act(user as mob) if(!emagged) user << "You short out the turret controls' access analysis module." @@ -137,7 +136,7 @@ /obj/machinery/turretid/Topic(href, href_list, var/nowindow = 0) if(..()) return 1 - + if(isLocked(usr)) return 1 @@ -176,9 +175,8 @@ TC.ailock = ailock if(istype(control_area)) - for(var/area/sub_area in control_area.related) - for (var/obj/machinery/porta_turret/aTurret in sub_area) - aTurret.setState(TC) + for (var/obj/machinery/porta_turret/aTurret in control_area) + aTurret.setState(TC) update_icon() diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index 171586d255a..90ceb3a0d1f 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -13,9 +13,6 @@ /area/turret_protected/Entered(O) ..() - if( master && master != src ) - return master.Entered(O) - if( iscarbon(O) ) turretTargets |= O else if( istype(O, /obj/mecha) ) @@ -31,9 +28,6 @@ return 1 /area/turret_protected/Exited(O) - if( master && master != src ) - return master.Exited(O) - if( ismob(O) && !issilicon(O) ) turretTargets -= O else if( istype(O, /obj/mecha) ) @@ -125,8 +119,6 @@ /obj/machinery/turret/proc/get_protected_area() var/area/turret_protected/TP = get_area(src) if(istype(TP)) - if(TP.master && TP.master != TP) - TP = TP.master return TP return @@ -331,7 +323,7 @@ spawn(13) qdel(src) - + /obj/machinery/turret/attack_animal(mob/living/simple_animal/M as mob) M.changeNext_move(CLICK_CD_MELEE) M.do_attack_animation(src) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index c618ec8c72f..bfe5ade766a 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -782,7 +782,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 @@ -829,13 +829,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/mecha.dm b/code/game/mecha/mecha.dm index 0785ff11b29..faf33ba5682 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1007,8 +1007,8 @@ set popup_menu = 0 if(usr!=occupant) return lights = !lights - if(lights) SetLuminosity(luminosity + lights_power) - else SetLuminosity(luminosity - lights_power) + if(lights) set_light(light_range + lights_power) + else set_light(light_range - lights_power) src.occupant_message("Toggled lights [lights?"on":"off"].") log_message("Toggled lights [lights?"on":"off"].") return diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index cb94f416ff7..246ac489204 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -272,7 +272,7 @@ name = "glowing resin" desc = "Blue bioluminescence shines from beneath the surface." icon_state = "weednode" - luminosity = 1 + light_range = 1 var/node_range = NODERANGE diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index c66706a18b3..1716c0773ef 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -12,7 +12,7 @@ var/obj/item/device/assembly/signaler/anomaly/aSignal = null /obj/effect/anomaly/New() - SetLuminosity(initial(luminosity)) + set_light(initial(luminosity)) aSignal = new(src) aSignal.code = rand(1,100) diff --git a/code/game/objects/effects/decals/Cleanable/misc.dm b/code/game/objects/effects/decals/Cleanable/misc.dm index bc73b6689b4..266c72c1a17 100644 --- a/code/game/objects/effects/decals/Cleanable/misc.dm +++ b/code/game/objects/effects/decals/Cleanable/misc.dm @@ -67,7 +67,7 @@ density = 0 anchored = 1 layer = 2 - luminosity = 1 + light_range = 1 icon = 'icons/effects/effects.dmi' icon_state = "greenglow" diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm index edb7031f1e4..ae04632a0f8 100644 --- a/code/game/objects/effects/glowshroom.dm +++ b/code/game/objects/effects/glowshroom.dm @@ -45,7 +45,7 @@ processing_objects += src - SetLuminosity(round(potency/10)) + set_light(round(potency/10)) lastTick = world.timeofday diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index b88f63baab8..59a7e666623 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -56,8 +56,8 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa msg_admin_attack("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (JMP)") log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") - var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit - lighting_controller.processing = 0 + //var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit + //lighting_controller.processing = 0 var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild if(defer_powernet_rebuild != 2) defer_powernet_rebuild = 1 @@ -72,7 +72,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa var/z0 = epicenter.z for(var/turf/T in trange(max_range, epicenter)) - var/dist = cheap_pythag(T.x - x0,T.y - y0) + var/dist = sqrt((T.x - x0)**2 + (T.y - y0)**2) if(config.reactionary_explosions) var/turf/Trajectory = T @@ -95,7 +95,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa if(T) for(var/atom_movable in T.contents) //bypass type checking since only atom/movable can be contained by turfs anyway var/atom/movable/AM = atom_movable - if(AM) AM.ex_act(dist) + if(AM && AM.simulated) AM.ex_act(dist) // if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density) // PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience! if(dist > 0) @@ -124,7 +124,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa sleep(8) - if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing + //if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing if(!powernet_rebuild_was_deferred_already) if(defer_powernet_rebuild != 2) defer_powernet_rebuild = 0 diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index fa111bef46b..4a4783c0f52 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -103,7 +103,6 @@ /obj/item/areaeditor/proc/get_area() var/turf/T = get_turf(usr) var/area/A = T.loc - A = A.master return A @@ -150,7 +149,6 @@ return var/area/A = new A.name = str - A.tagbase="[A.type]_[md5(str)]" // without this dynamic light system ruin everithing //var/ma //ma = A.master ? "[A.master]" : "(null)" //world << "DEBUG: create_area:
A.name=[A.name]
A.tag=[A.tag]
A.master=[ma]" @@ -159,7 +157,6 @@ A.power_environ = 0 A.always_unpowered = 0 move_turfs_to_area(turfs, A) - A.SetDynamicLighting() interact() return @@ -179,8 +176,7 @@ usr << "The given name is too long. The area's name is unchanged." return set_area_machinery_title(A,str,prevname) - for(var/area/RA in A.related) - RA.name = str + A.name = str usr << "You rename the '[prevname]' to '[str]'." interact() return @@ -189,20 +185,18 @@ /obj/item/areaeditor/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle) if (!oldtitle) // or replacetext goes to infinite loop return - for(var/area/RA in A.related) - for(var/obj/machinery/alarm/M in RA) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/power/apc/M in RA) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in RA) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/atmospherics/unary/vent_pump/M in RA) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/door/M in RA) - M.name = replacetext(M.name,oldtitle,title) + for(var/obj/machinery/alarm/M in A) + M.name = replacetext(M.name,oldtitle,title) + for(var/obj/machinery/power/apc/M in A) + M.name = replacetext(M.name,oldtitle,title) + for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in A) + M.name = replacetext(M.name,oldtitle,title) + for(var/obj/machinery/atmospherics/unary/vent_pump/M in A) + M.name = replacetext(M.name,oldtitle,title) + for(var/obj/machinery/door/M in A) + M.name = replacetext(M.name,oldtitle,title) //TODO: much much more. Unnamed airlocks, cameras, etc. - /obj/item/areaeditor/proc/check_tile_is_border(var/turf/T2,var/dir) if (istype(T2, /turf/space)) return BORDER_SPACE //omg hull breach we all going to die here diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index a68258e6a1c..c37b6269274 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -48,7 +48,7 @@ //src.damtype = "fire" for(var/mob/O in viewers(usr, null)) O.show_message(flavor_text, 1) - SetLuminosity(CANDLE_LUM) + set_light(CANDLE_LUM) processing_objects.Add(src) @@ -72,17 +72,4 @@ if(lit) lit = 0 update_icon() - SetLuminosity(0) - user.SetLuminosity(user.luminosity - CANDLE_LUM) - - - pickup(mob/user) - if(lit) - SetLuminosity(0) - user.SetLuminosity(user.luminosity + CANDLE_LUM) - - - dropped(mob/user) - if(lit) - user.SetLuminosity(user.luminosity - CANDLE_LUM) - SetLuminosity(CANDLE_LUM) + set_light(0) \ No newline at end of file diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 323a86208a7..1daaa8d5dc6 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -327,16 +327,6 @@ var/global/list/obj/item/device/pda/PDAs = list() /* * The Actual PDA */ -/obj/item/device/pda/pickup(mob/user) - if(fon) - SetLuminosity(0) - user.SetLuminosity(user.luminosity + f_lum) - -/obj/item/device/pda/dropped(mob/user) - if(fon) - user.SetLuminosity(user.luminosity - f_lum) - SetLuminosity(f_lum) - /obj/item/device/pda/New() ..() PDAs += src @@ -623,12 +613,10 @@ var/global/list/obj/item/device/pda/PDAs = list() if("Light") if(fon) fon = 0 - if(src in U.contents) U.SetLuminosity(U.luminosity - f_lum) - else SetLuminosity(0) + set_light(0) else fon = 1 - if(src in U.contents) U.SetLuminosity(U.luminosity + f_lum) - else SetLuminosity(f_lum) + set_light(f_lum) if("Medical Scan") if(scanmode == 1) scanmode = 0 diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 05a851b0d28..54fd0026833 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -17,24 +17,17 @@ ..() if(on) icon_state = "[initial(icon_state)]-on" - SetLuminosity(brightness_on) + set_light(brightness_on) else icon_state = initial(icon_state) - SetLuminosity(0) + set_light(0) /obj/item/device/flashlight/proc/update_brightness(var/mob/user = null) if(on) icon_state = "[initial(icon_state)]-on" - if(loc == user) - user.SetLuminosity(user.luminosity + brightness_on) - else if(isturf(loc)) - SetLuminosity(brightness_on) + set_light(brightness_on) else - icon_state = initial(icon_state) - if(loc == user) - user.SetLuminosity(user.luminosity - brightness_on) - else if(isturf(loc)) - SetLuminosity(0) + set_light(0) /obj/item/device/flashlight/attack_self(mob/user) if(!isturf(user.loc)) @@ -87,19 +80,6 @@ else return ..() - -/obj/item/device/flashlight/pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) - SetLuminosity(0) - - -/obj/item/device/flashlight/dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) - SetLuminosity(brightness_on) - - /obj/item/device/flashlight/pen name = "penlight" desc = "A pen-sized light, used by medical staff." @@ -197,7 +177,7 @@ on = 1 //Bio-luminesence has one setting, on. /obj/item/device/flashlight/slime/New() - SetLuminosity(brightness_on) + set_light(brightness_on) spawn(1) //Might be sloppy, but seems to be necessary to prevent further runtimes and make these work as intended... don't judge me! update_brightness() icon_state = initial(icon_state) diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index 3d9e623d53b..bb94f55b571 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -103,7 +103,7 @@ /obj/item/device/lightreplacer/emag_act(user as mob) if(!emagged) Emag() - + /obj/item/device/lightreplacer/attack_self(mob/user) /* // This would probably be a bit OP. If you want it though, uncomment the code. if(isrobot(user)) @@ -147,7 +147,9 @@ var/obj/item/weapon/light/L1 = new target.light_type(target.loc) L1.status = target.status L1.rigged = target.rigged - L1.brightness = target.brightness + L1.brightness_range = target.brightness_range + L1.brightness_power = target.brightness_power + L1.brightness_color = target.brightness_color L1.switchcount = target.switchcount target.switchcount = 0 L1.update() @@ -160,7 +162,9 @@ target.status = L2.status target.switchcount = L2.switchcount target.rigged = emagged - target.brightness = L2.brightness + target.brightness_range = L2.brightness_range + target.brightness_power = L2.brightness_power + target.brightness_color = L2.brightness_color target.on = target.has_power() target.update() del(L2) diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index f9907855224..7c11ef5b5d6 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -53,7 +53,7 @@ for(var/mob/M in viewers(user)) if(M == user) continue M << "[user] detaches the power sink from the cable." - SetLuminosity(0) + set_light(0) icon_state = "powersink0" return @@ -61,7 +61,7 @@ ..() Destroy() - SetLuminosity(0) + set_light(0) processing_objects.Remove(src) // attached.attached = null attached = null @@ -93,7 +93,7 @@ if(M == user) continue M << "[user] deactivates the power sink!" mode = 1 - SetLuminosity(0) + set_light(0) icon_state = "powersink0" processing_objects.Remove(src) @@ -101,7 +101,7 @@ if(attached) var/datum/powernet/PN = attached.get_powernet() if(PN) - SetLuminosity(12) + set_light(12) // found a powernet, so drain up to max power from it diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index aacdc9c6e37..623e117e9f1 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -432,7 +432,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM user.adjustFireLoss(5) user.visible_message("After a few attempts, [user] manages to light the [src], they however burn their finger in the process.") - user.SetLuminosity(user.luminosity + 2) + set_light(2) processing_objects.Add(src) else lit = 0 @@ -445,7 +445,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM else user.visible_message("[user] quietly shuts off the [src].") - user.SetLuminosity(user.luminosity - 2) + set_light(0) processing_objects.Remove(src) else return ..() @@ -478,19 +478,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM return -/obj/item/weapon/lighter/pickup(mob/user) - if(lit) - SetLuminosity(0) - user.SetLuminosity(user.luminosity+2) - return - - -/obj/item/weapon/lighter/dropped(mob/user) - if(lit) - user.SetLuminosity(user.luminosity-2) - SetLuminosity(2) - return - /////////// //ROLLING// /////////// diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index b69126768e0..d673ac3c1b9 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -65,7 +65,7 @@ do_the_flick() sleep(4) density = 0 - SetOpacity(0) + set_opacity(0) update_icon(0) else var/srcturf = get_turf(src) @@ -75,7 +75,7 @@ do_the_flick() density = 1 sleep(4) - SetOpacity(1) + set_opacity(1) update_icon() opening = 0 diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index d4d3dc787c0..fe66664c0bd 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -179,7 +179,7 @@ /obj/structure/mineral_door/uranium mineralType = "uranium" hardness = 3 - luminosity = 2 + light_range = 2 /obj/structure/mineral_door/sandstone mineralType = "sandstone" diff --git a/code/game/objects/structures/spirit_board.dm b/code/game/objects/structures/spirit_board.dm index d1be680de0a..8ddfa279ea1 100644 --- a/code/game/objects/structures/spirit_board.dm +++ b/code/game/objects/structures/spirit_board.dm @@ -62,13 +62,11 @@ //lighting check var/light_amount = 0 var/turf/T = get_turf(src) - var/area/A = T.loc - - if(A) - if(A.lighting_use_dynamic) - light_amount = T.lighting_lumcount - else - light_amount = 10 + var/atom/movable/lighting_overlay/LO = locate(/atom/movable/lighting_overlay) in T + if(LO) + light_amount = max(0,min(10,LO.lum_r + LO.lum_g + LO.lum_b)-5) + else + light_amount = 5 if(light_amount > 2) M << "It's too bright here to use [src.name]!" diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 4bcadcb265d..cee422463e3 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -467,4 +467,54 @@ var/global/wcColored desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window." icon_state = "fwindow" basestate = "fwindow" - health = 30 \ No newline at end of file + health = 30 + +/obj/structure/window/reinforced/polarized + name = "electrochromic window" + desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it." + var/id + +/obj/structure/window/reinforced/polarized/proc/toggle() + if(opacity) + animate(src, color="#FFFFFF", time=5) + set_opacity(0) + else + animate(src, color="#222222", time=5) + set_opacity(1) + + + +/obj/machinery/button/windowtint + name = "window tint control" + icon = 'icons/obj/power.dmi' + icon_state = "light0" + desc = "A remote control switch for polarized windows." + var/range = 7 + var/id = 0 + var/active = 0 + +/obj/machinery/button/windowtint/attack_hand(mob/user as mob) + if(..()) + return 1 + + toggle_tint() + +/obj/machinery/button/windowtint/proc/toggle_tint() + use_power(5) + + active = !active + update_icon() + + for(var/obj/structure/window/reinforced/polarized/W in range(src,range)) + if (W.id == src.id || !W.id) + spawn(0) + W.toggle() + return + +/obj/machinery/button/windowtint/power_change() + ..() + if(active && !powered(power_channel)) + toggle_tint() + +/obj/machinery/button/windowtint/update_icon() + icon_state = "light[active]" \ No newline at end of file diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index c93ececa8df..3331861c136 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -20,18 +20,14 @@ var/list/mechtoys = list( /obj/item/toy/prize/phazon ) -/area/supply/station //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. +/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 diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 55954dc957f..66f674189fb 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -109,19 +109,19 @@ turf/simulated/floor/proc/update_icon() switch(T.state) if(0) icon_state = "light_on" - SetLuminosity(5) + set_light(5) if(1) var/num = pick("1","2","3","4") icon_state = "light_on_flicker[num]" - SetLuminosity(5) + set_light(5) if(2) icon_state = "light_on_broken" - SetLuminosity(5) + set_light(5) if(3) 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) @@ -338,7 +338,7 @@ turf/simulated/floor/proc/update_icon() if(!floor_tile) return del(floor_tile) icon_plating = "plating" - SetLuminosity(0) + set_light(0) floor_tile = null intact = 0 broken = 0 @@ -354,7 +354,7 @@ turf/simulated/floor/proc/update_icon() broken = 0 burnt = 0 intact = 1 - SetLuminosity(0) + set_light(0) if(T) if(istype(T,/obj/item/stack/tile/plasteel)) floor_tile = T diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm index 5ea347aa51e..82e6a2ca5fc 100644 --- a/code/game/turfs/simulated/floor_types.dm +++ b/code/game/turfs/simulated/floor_types.dm @@ -11,7 +11,7 @@ /turf/simulated/floor/light name = "Light floor" - luminosity = 5 + light_range = 5 icon_state = "light_on" floor_tile = new/obj/item/stack/tile/light @@ -273,12 +273,11 @@ thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT heat_capacity = 700000 - lighting_lumcount = 4 //starlight // accepts_lighting=0 // Don't apply overlays New() ..() - // Fucking cockshit dickfuck shitslut + set_light(4) //starlight name = "catwalk" update_icon(1) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index e954e5f95b1..c6dfddcee38 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -2,6 +2,7 @@ icon = 'icons/turf/space.dmi' name = "\proper space" icon_state = "0" + dynamic_lighting = 0 temperature = TCMB thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index ebefbf0ca20..6e175078e34 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -28,6 +28,8 @@ var/PathNode/PNode = null //associated PathNode in the A* algorithm + var/dynamic_lighting = 1 + /turf/New() ..() for(var/atom/movable/AM as mob|obj in src) @@ -226,8 +228,9 @@ /turf/proc/ChangeTurf(var/path) if(!path) return if(path == type) return src - var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/old_opacity = opacity + var/old_dynamic_lighting = dynamic_lighting + var/list/old_affecting_lights = affecting_lights if(air_master) air_master.remove_from_active(src) @@ -237,18 +240,18 @@ W:Assimilate_Air() W.RemoveLattice() - W.lighting_lumcount += old_lumcount - if(old_lumcount != W.lighting_lumcount) //light levels of the turf have changed. We need to shift it to another lighting-subarea - W.lighting_changed = 1 - lighting_controller.changed_turfs += W - - if(old_opacity != W.opacity) //opacity has changed. Need to update surrounding lights - if(W.lighting_lumcount) //unless we're being illuminated, don't bother (may be buggy, hard to test) - W.UpdateAffectingLights() - W.levelupdate() W.CalculateAdjacentTurfs() - return W + . = W + + affecting_lights = old_affecting_lights + if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting)) + reconsider_lights() + if(dynamic_lighting != old_dynamic_lighting) + if(dynamic_lighting) + lighting_build_overlays() + else + lighting_clear_overlays() //////Assimilate Air////// /turf/simulated/proc/Assimilate_Air() diff --git a/code/game/vehicles/spacepods/spacepod.dm b/code/game/vehicles/spacepods/spacepod.dm index feeb98b2751..bea7372b1de 100644 --- a/code/game/vehicles/spacepods/spacepod.dm +++ b/code/game/vehicles/spacepods/spacepod.dm @@ -799,9 +799,9 @@ obj/spacepod/verb/toggleLights() /obj/spacepod/proc/lightsToggle() lights = !lights if(lights) - SetLuminosity(luminosity + lights_power) + set_light(luminosity + lights_power) else - SetLuminosity(luminosity - lights_power) + set_light(luminosity - lights_power) occupant << "Toggled lights [lights?"on":"off"]." return diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index a35fb151745..d5dc51adf75 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -208,8 +208,8 @@ O.vars[variable]) as num|null if(new_value == null) return - if(variable=="luminosity") - O.SetLuminosity(new_value) + if(variable=="light_range") + O.set_light(new_value) else O.vars[variable] = new_value @@ -217,24 +217,24 @@ if(istype(O, /mob)) for(var/mob/M in mob_list) if ( istype(M , O.type) ) - if(variable=="luminosity") - M.SetLuminosity(new_value) + if(variable=="light_range") + M.set_light(new_value) else M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) for(var/obj/A in world) if ( istype(A , O.type) ) - if(variable=="luminosity") - A.SetLuminosity(new_value) + if(variable=="light_range") + A.set_light(new_value) else A.vars[variable] = O.vars[variable] else if(istype(O, /turf)) for(var/turf/A in world) if ( istype(A , O.type) ) - if(variable=="luminosity") - A.SetLuminosity(new_value) + if(variable=="light_range") + A.set_light(new_value) else A.vars[variable] = O.vars[variable] @@ -242,24 +242,24 @@ if(istype(O, /mob)) for(var/mob/M in mob_list) if (M.type == O.type) - if(variable=="luminosity") - M.SetLuminosity(new_value) + if(variable=="light_range") + M.set_light(new_value) else M.vars[variable] = O.vars[variable] else if(istype(O, /obj)) for(var/obj/A in world) if (A.type == O.type) - if(variable=="luminosity") - A.SetLuminosity(new_value) + if(variable=="light_range") + A.set_light(new_value) else A.vars[variable] = O.vars[variable] else if(istype(O, /turf)) for(var/turf/A in world) if (A.type == O.type) - if(variable=="luminosity") - A.SetLuminosity(new_value) + if(variable=="light_range") + A.set_light(new_value) else A.vars[variable] = O.vars[variable] diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index c7d5853ae31..f8e24a5ec27 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -448,10 +448,10 @@ var/list/forbidden_varedit_object_types = list( O.vars[variable] = var_new if("num") - if(variable=="luminosity") + if(variable=="light_range") var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num if(var_new == null) return - O.SetLuminosity(var_new) + O.set_light(var_new) else if(variable=="stat") var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num if(var_new == null) return diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index 42b985289a7..03687253564 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -21,20 +21,8 @@ icon_state = "hardhat[on]_[_color]" item_state = "hardhat[on]_[_color]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) - - pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) -// user.UpdateLuminosity() //TODO: Carn - SetLuminosity(0) - - dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) -// user.UpdateLuminosity() - SetLuminosity(brightness_on) + if(on) set_light(brightness_on) + else set_light(0) /obj/item/clothing/head/hardhat/orange diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index 49972acd934..b4ac12b893a 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -57,22 +57,22 @@ return on = !on icon_state = "[base_state][on]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) + if(on) user.set_light(user.luminosity + brightness_on) + else user.set_light(user.luminosity - brightness_on) user.update_inv_head() /obj/item/clothing/head/helmet/space/eva/plasmaman/pickup(mob/user) if(on) - user.SetLuminosity(user.luminosity + brightness_on) + user.set_light(user.luminosity + brightness_on) // user.UpdateLuminosity() - SetLuminosity(0) + set_light(0) /obj/item/clothing/head/helmet/space/eva/plasmaman/dropped(mob/user) if(on) - user.SetLuminosity(user.luminosity - brightness_on) + user.set_light(user.luminosity - brightness_on) // user.UpdateLuminosity() - SetLuminosity(brightness_on) + set_light(brightness_on) diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm index e54b737584f..cae0a398ea4 100644 --- a/code/modules/clothing/spacesuits/rig.dm +++ b/code/modules/clothing/spacesuits/rig.dm @@ -35,25 +35,13 @@ icon_state = "rig[on]-[_color]" // item_state = "rig[on]-[color]" - if(on) user.SetLuminosity(user.luminosity + brightness_on) - else user.SetLuminosity(user.luminosity - brightness_on) + if(on) set_light(brightness_on) + else set_light(0) if(istype(user,/mob/living/carbon/human)) var/mob/living/carbon/human/H = user H.update_inv_head() - pickup(mob/user) - if(on) - user.SetLuminosity(user.luminosity + brightness_on) -// user.UpdateLuminosity() - SetLuminosity(0) - - dropped(mob/user) - if(on) - user.SetLuminosity(user.luminosity - brightness_on) -// user.UpdateLuminosity() - SetLuminosity(brightness_on) - /obj/item/clothing/suit/space/rig name = "hardsuit" desc = "A special space suit for environments that might pose hazards beyond just the vacuum of space. Provides more protection than a standard space suit." @@ -393,7 +381,7 @@ flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | STOPSPRESSUREDMAGE | THICKMATERIAL flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE cold_protection = HEAD - user.AddLuminosity(brightness_on) + set_light(brightness_on) else user << "You switch your helmet to combat mode." name = "blood-red hardsuit helmet (combat)" @@ -401,7 +389,7 @@ flags = BLOCKHAIR flags_inv = HIDEEARS cold_protection = null - user.AddLuminosity(-brightness_on) + set_light(0) update_icon() playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1) diff --git a/code/modules/computer3/computer.dm b/code/modules/computer3/computer.dm index 9ea3bff1b36..157fc1e6d2e 100644 --- a/code/modules/computer3/computer.dm +++ b/code/modules/computer3/computer.dm @@ -75,15 +75,15 @@ set name = "Reset Computer" set category = "Object" set src in view(1) - + if(usr.stat || usr.restrained() || usr.lying || !istype(usr, /mob/living)) usr << "\red You can't do that." return - + if(!Adjacent(usr)) usr << "You can't reach it." return - + Reset() New(var/L, var/built = 0) @@ -280,8 +280,8 @@ chan = power_channel var/area/A = get_area(loc) - if(istype(A) && A.master && A.master.powered(chan)) - A.master.use_power(amount, chan) + if(istype(A) && A.powered(chan)) + A.use_power(amount, chan) else if(battery && battery.charge > 0) battery.use(amount) diff --git a/code/modules/computer3/networking.dm b/code/modules/computer3/networking.dm index 12341e2b6fc..f31f4516c2c 100644 --- a/code/modules/computer3/networking.dm +++ b/code/modules/computer3/networking.dm @@ -143,10 +143,9 @@ if(typekey == null) typekey = /obj/machinery var/list/machines = list() - for(var/area/area in A.related) - for(var/obj/O in area.contents) - if(istype(O,typekey)) - machines |= O + for(var/obj/O in A.contents) + if(istype(O,typekey)) + machines |= O return machines verify_machine(var/obj/previous) if(!previous) return 0 diff --git a/code/modules/events/infestation.dm b/code/modules/events/infestation.dm index 444da4675ef..b4a659491c4 100644 --- a/code/modules/events/infestation.dm +++ b/code/modules/events/infestation.dm @@ -63,11 +63,9 @@ //world << " checking [areapath]" var/area/A = locate(areapath) //world << " A: [A], contents.len: [A.contents.len]" - for(var/area/B in A.related) - //world << " B: [B], contents.len: [B.contents.len]" - for(var/turf/simulated/floor/F in B.contents) - if(!F.contents.len) - turfs += F + for(var/turf/simulated/floor/F in A.contents) + if(!F.contents.len) + turfs += F var/list/spawn_types = list() var/max_number diff --git a/code/modules/hydroponics/vines.dm b/code/modules/hydroponics/vines.dm index 35d321789e0..90375ec98cc 100644 --- a/code/modules/hydroponics/vines.dm +++ b/code/modules/hydroponics/vines.dm @@ -181,14 +181,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.Cut() @@ -270,9 +270,10 @@ var/area/A = T.loc if(A) + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T var/light_available - if(A.lighting_use_dynamic) - light_available = max(0,min(10,T.lighting_lumcount)-5) + if(L) + light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5) else light_available = 5 if(abs(light_available - seed.ideal_light) > seed.light_tolerance) diff --git a/code/modules/jungle/falsewall.dm b/code/modules/jungle/falsewall.dm index a83711609da..d2d21628d55 100644 --- a/code/modules/jungle/falsewall.dm +++ b/code/modules/jungle/falsewall.dm @@ -44,7 +44,7 @@ flick("[mineral]fwall_opening", src) sleep(15) src.density = 0 - SetOpacity(0) + set_opacity(0) opening = 0 else opening = 1 @@ -55,5 +55,5 @@ flick("[mineral]fwall_closing", src) density = 1 sleep(15) - SetOpacity(1) + set_opacity(1) opening = 0 diff --git a/code/modules/jungle/misc_helpers.dm b/code/modules/jungle/misc_helpers.dm index 1e1b4d45129..6936a877dff 100644 --- a/code/modules/jungle/misc_helpers.dm +++ b/code/modules/jungle/misc_helpers.dm @@ -92,7 +92,7 @@ // if(AR.lighting_use_dynamic) // X.opacity = !X.opacity -// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn +// X.sd_set_opacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn toupdate += X diff --git a/code/modules/lighting/__lighting_docs.dm b/code/modules/lighting/__lighting_docs.dm new file mode 100644 index 00000000000..8ef93935e9c --- /dev/null +++ b/code/modules/lighting/__lighting_docs.dm @@ -0,0 +1,67 @@ +/* +BS12 object based lighting system +*/ + +/* +Changes from tg DAL: + - Lighting is done using objects instead of subareas. + - Animated transitions. (newer tg DAL has this) + - Full colours with mixing. + - Support for lights on shuttles. + + - Code: + - Instead of one flat luminosity var, light is represented by 3 atom vars: + - light_range; range in tiles of the light, used for calculating falloff, + - light_power; multiplier for the brightness of lights, + - light_color; hex string representing the RGB colour of the light. + - setLuminousity() is now set_light() and takes the three variables above. + - Variables can be left as null to not update them. + - set_opacity() is now set_opacity(). + - Areas have luminosity set to 1 permanently, no hard-lighting. + - Objects inside other objects can have lights and they properly affect the turf. (flashlights) + - area/master and area/list/related have been eviscerated since subareas aren't needed. +*/ + +/* +Relevant vars/procs: + +atom: (lighting_atom.dm) + - var/light_range; range in tiles of the light, used for calculating falloff + - var/light_power; multiplier for the brightness of lights + - var/light_color; hex string representing the RGB colour of the light + + - var/datum/light_source/light; light source datum for this atom, only present if light_range && light_power + - var/list/light_sources; light sources in contents that are shining through this object, including this object + + - proc/set_light(l_range, l_power, l_color): + - Sets light_range/power/color to non-null args and calls update_light() + - proc/set_opacity(new_opacity): + - Sets opacity to new_opacity. + - If opacity has changed, call turf.reconsider_lights() to fix light occlusion + - proc/update_light(): + - Updates the light var on this atom, deleting or creating as needed and calling .update() + + +turf: (lighting_turf.dm) + - var/list/affecting_lights; list of light sources that are shining onto this turf + + - proc/reconsider_lights(): + - Force all light sources shining onto this turf to update + + - proc/lighting_clear_overlays(): + - Delete (manual GC) all light overlays on this turf, used when changing turf to space + - proc/lighting_build_overlays(): + - Create lighting overlays for this turf + + +atom/movable/lighting_overlay: (lighting_overlay.dm) + - var/lum_r, var/lum_g, var/lum_b; lumcounts of each colour + - var/needs_update; set on update_lumcount, checked by lighting process + + - var/xoffset, var/yoffset; (only present when using sub-tile overlays) fractional offset of this overlay in the tile + + - proc/update_lumcount(delta_r, delta_g, delta_b): + - Change the lumcount vars and queue the overlay for update + - proc/update_overlay() + - Called by the lighting process to update the color of the overlay +*/ \ No newline at end of file diff --git a/code/modules/lighting/_lighting_defs.dm b/code/modules/lighting/_lighting_defs.dm new file mode 100644 index 00000000000..842d741a806 --- /dev/null +++ b/code/modules/lighting/_lighting_defs.dm @@ -0,0 +1,10 @@ +#define LIGHTING_INTERVAL 5 // frequency, in 1/10ths of a second, of the lighting process + +#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square +#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources +#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone +#define LIGHTING_TRANSITIONS 1 // smooth, animated transitions, similar to /tg/station + +#define LIGHTING_RESOLUTION 1 // resolution of the lighting overlays, powers of 2 only, max of 32 +#define LIGHTING_LAYER 10 // drawing layer for lighting overlays +#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects \ No newline at end of file diff --git a/code/modules/lighting/light_source.dm b/code/modules/lighting/light_source.dm new file mode 100644 index 00000000000..41c66359671 --- /dev/null +++ b/code/modules/lighting/light_source.dm @@ -0,0 +1,169 @@ +/datum/light_source + var/atom/top_atom + var/atom/source_atom + + var/turf/source_turf + var/light_power + var/light_range + var/light_color // string, decomposed by parse_light_color() + + var/lum_r + var/lum_g + var/lum_b + + var/list/effect_r + var/list/effect_g + var/list/effect_b + var/list/effect_turf + + var/applied + + var/needs_update + var/destroyed + var/force_update + +/datum/light_source/New(atom/owner, atom/top) + source_atom = owner + if(!source_atom.light_sources) source_atom.light_sources = list() + source_atom.light_sources += src + top_atom = top + if(top_atom != source_atom) + if(!top.light_sources) top.light_sources = list() + top_atom.light_sources += src + + source_turf = top_atom + light_power = source_atom.light_power + light_range = source_atom.light_range + light_color = source_atom.light_color + + parse_light_color() + + effect_r = list() + effect_g = list() + effect_b = list() + effect_turf = list() + + update() + + return ..() + +/datum/light_source/proc/destroy() + destroyed = 1 + force_update() + if(source_atom) source_atom.light_sources -= src + if(top_atom) top_atom.light_sources -= src + +/datum/light_source/proc/update(atom/new_top_atom) + if(new_top_atom && new_top_atom != top_atom) + if(top_atom != source_atom) top_atom.light_sources -= src + top_atom = new_top_atom + if(top_atom != source_atom) + if(!top_atom.light_sources) top_atom.light_sources = list() + top_atom.light_sources += src + lighting_update_lights += src + needs_update = 1 + +/datum/light_source/proc/force_update() + needs_update = 1 + force_update = 1 + lighting_update_lights += src + +/datum/light_source/proc/check() + if(!source_atom) + destroy() + return 1 + + if(!top_atom) + top_atom = source_atom + . = 1 + + if(istype(top_atom, /turf)) + if(source_turf != top_atom) + source_turf = top_atom + . = 1 + else if(top_atom.loc != source_turf) + source_turf = top_atom.loc + . = 1 + + if(source_atom.light_power != light_power) + light_power = source_atom.light_power + . = 1 + + if(source_atom.light_range != light_range) + light_range = source_atom.light_range + . = 1 + + if(source_atom.light_color != light_color) + light_color = source_atom.light_color + parse_light_color() + . = 1 + + if(light_range && light_power && !applied) + . = 1 + +/datum/light_source/proc/parse_light_color() + if(light_color) + lum_r = GetRedPart(light_color) / 255 + lum_g = GetGreenPart(light_color) / 255 + lum_b = GetBluePart(light_color) / 255 + else + lum_r = 1 + lum_g = 1 + lum_b = 1 + +/datum/light_source/proc/falloff(atom/movable/lighting_overlay/O) + #if LIGHTING_FALLOFF == 1 // circular + #if LIGHTING_RESOLUTION == 1 + . = (O.x - source_turf.x)**2 + (O.y - source_turf.y)**2 + LIGHTING_HEIGHT + #else + . = (O.x - source_turf.x + O.xoffset)**2 + (O.y - source_turf.y + O.yoffset)**2 + LIGHTING_HEIGHT + #endif + + #if LIGHTING_LAMBERTIAN == 1 + . = CLAMP01((1 - CLAMP01(sqrt(.) / light_range)) * (1 / (sqrt(. + 1)))) + #else + . = 1 - CLAMP01(sqrt(.) / light_range) + #endif + + #elif LIGHTING_FALLOFF == 2 // square + #if LIGHTING_RESOLUTION == 1 + . = abs(O.x - source_turf.x) + abs(O.y - source_turf.y) + LIGHTING_HEIGHT + #else + . = abs(O.x - source_turf.x + O.xoffset) + abs(O.y - source_turf.y + O.yoffset) + LIGHTING_HEIGHT + #endif + + #if LIGHTING_LAMBERTIAN == 1 + . = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + ))) + #else + . = 1 - CLAMP01(. / light_range) + #endif + #endif + +/datum/light_source/proc/apply_lum() + applied = 1 + if(istype(source_turf)) + for(var/atom/movable/lighting_overlay/O in view(light_range, source_turf)) + var/strength = light_power * falloff(O) + + effect_r[O] = lum_r * strength + effect_g[O] = lum_g * strength + effect_b[O] = lum_b * strength + + O.update_lumcount(lum_r * strength, lum_g * strength, lum_b * strength) + for(var/turf/T in view(light_range, source_turf)) + if(!T.affecting_lights) T.affecting_lights = list() + T.affecting_lights += src + effect_turf += T + +/datum/light_source/proc/remove_lum() + applied = 0 + for(var/atom/movable/lighting_overlay/O in effect_r) + O.update_lumcount(-effect_r[O], -effect_g[O], -effect_b[O]) + + for(var/turf/T in effect_turf) + if(T.affecting_lights) T.affecting_lights -= src + + effect_r.Cut() + effect_g.Cut() + effect_b.Cut() + effect_turf.Cut() \ No newline at end of file diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm new file mode 100644 index 00000000000..53a44c79bf7 --- /dev/null +++ b/code/modules/lighting/lighting_atom.dm @@ -0,0 +1,81 @@ +/atom + var/light_power = 1 // intensity of the light + var/light_range = 0 // range in tiles of the light + var/light_color // RGB string representing the colour of the light + + var/datum/light_source/light + var/list/light_sources + +/atom/proc/set_light(l_range, l_power, l_color) + if(l_power != null) light_power = l_power + if(l_range != null) light_range = l_range + if(l_color != null) light_color = l_color + + update_light() + +/atom/proc/update_light() + if(!light_power || !light_range) + if(light) + light.destroy() + light = null + else + if(!istype(loc, /atom/movable)) + . = src + else + . = loc + + if(light) + light.update(.) + else + light = new /datum/light_source(src, .) + +/atom/New() + . = ..() + if(light_power && light_range) + update_light() + +/atom/Destroy() + if(light) + light.destroy() + light = null + return ..() + +/atom/movable/Destroy() + var/turf/T = loc + if(opacity && istype(T)) + T.reconsider_lights() + return ..() + +/atom/movable/Move() + var/turf/old_loc = loc + . = ..() + + if(loc != old_loc) + for(var/datum/light_source/L in light_sources) + L.source_atom.update_light() + + var/turf/new_loc = loc + if(istype(old_loc) && opacity) + old_loc.reconsider_lights() + + if(istype(new_loc) && opacity) + new_loc.reconsider_lights() + +/atom/proc/set_opacity(new_opacity) + var/old_opacity = opacity + opacity = new_opacity + var/turf/T = loc + if(old_opacity != new_opacity && istype(T)) + T.reconsider_lights() + +/obj/item/equipped() + . = ..() + update_light() + +/obj/item/pickup() + . = ..() + update_light() + +/obj/item/dropped() + . = ..() + update_light() \ 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..e14ccd8f63f --- /dev/null +++ b/code/modules/lighting/lighting_overlay.dm @@ -0,0 +1,48 @@ +/atom/movable/lighting_overlay + name = "loverlay" + mouse_opacity = 0 + simulated = 0 + anchored = 1 + + icon = LIGHTING_ICON + layer = LIGHTING_LAYER + invisibility = INVISIBILITY_LIGHTING + blend_mode = BLEND_MULTIPLY + color = "#000000" + + var/lum_r + var/lum_g + var/lum_b + + #if LIGHTING_RESOLUTION != 1 + var/xoffset + var/yoffset + #endif + + var/needs_update + +/atom/movable/lighting_overlay/New() + . = ..() + verbs.Cut() + +/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b) + lum_r += delta_r + lum_g += delta_g + lum_b += delta_b + + needs_update = 1 + lighting_update_overlays += src + +/atom/movable/lighting_overlay/proc/update_overlay() + var/mx = max(lum_r, lum_g, lum_b) + . = 1 // factor + if(mx > 1) + . = 1/mx + #if LIGHTING_TRANSITIONS == 1 + animate(src, + color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .), + LIGHTING_INTERVAL - 1 + ) + #else + color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .) + #endif \ No newline at end of file diff --git a/code/modules/lighting/lighting_process.dm b/code/modules/lighting/lighting_process.dm new file mode 100644 index 00000000000..a16a0317db5 --- /dev/null +++ b/code/modules/lighting/lighting_process.dm @@ -0,0 +1,23 @@ +/datum/controller/process/lighting/setup() + name = "lighting" + schedule_interval = LIGHTING_INTERVAL + + create_lighting_overlays() + +/datum/controller/process/lighting/doWork() + for(var/datum/light_source/L in lighting_update_lights) + if(L.needs_update) + if(L.destroyed) + L.remove_lum() + else if(L.check() || L.force_update) + L.remove_lum() + L.apply_lum() + L.force_update = 0 + L.needs_update = 0 + lighting_update_lights.Cut() + + for(var/atom/movable/lighting_overlay/O in lighting_update_overlays) + if(O.needs_update) + O.update_overlay() + O.needs_update = 0 + lighting_update_overlays.Cut() \ No newline at end of file diff --git a/code/modules/lighting/lighting_system.dm b/code/modules/lighting/lighting_system.dm new file mode 100644 index 00000000000..17a2f99578c --- /dev/null +++ b/code/modules/lighting/lighting_system.dm @@ -0,0 +1,47 @@ +/var/list/lighting_update_lights = list() +/var/list/lighting_update_overlays = list() + +/area/var/lighting_use_dynamic = 1 + +// duplicates lots of code, but this proc needs to be as fast as possible. +/proc/create_lighting_overlays(zlevel = 0) + var/state = "light[LIGHTING_RESOLUTION]" + var/area/A + if(zlevel == 0) // populate all zlevels + for(var/turf/T in world) + if(T.dynamic_lighting) + A = T.loc + if(A.lighting_use_dynamic) + #if LIGHTING_RESOLUTION == 1 + var/atom/movable/lighting_overlay/O = new(T) + O.icon_state = state + #else + for(var/i = 0; i < LIGHTING_RESOLUTION; i++) + for(var/j = 0; j < LIGHTING_RESOLUTION; j++) + var/atom/movable/lighting_overlay/O = new(T) + O.pixel_x = i * (32 / LIGHTING_RESOLUTION) + O.pixel_y = j * (32 / LIGHTING_RESOLUTION) + O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.icon_state = state + #endif + else + for(var/x = 1; x <= world.maxx; x++) + for(var/y = 1; y <= world.maxy; y++) + var/turf/T = locate(x, y, zlevel) + if(T.dynamic_lighting) + A = T.loc + if(A.lighting_use_dynamic) + #if LIGHTING_RESOLUTION == 1 + var/atom/movable/lighting_overlay/O = new(T) + O.icon_state = state + #else + for(var/i = 0; i < LIGHTING_RESOLUTION; i++) + for(var/j = 0; j < LIGHTING_RESOLUTION; j++) + var/atom/movable/lighting_overlay/O = new(T) + O.pixel_x = i * (32 / LIGHTING_RESOLUTION) + O.pixel_y = j * (32 / LIGHTING_RESOLUTION) + O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.icon_state = state + #endif \ No newline at end of file diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm new file mode 100644 index 00000000000..11d89409478 --- /dev/null +++ b/code/modules/lighting/lighting_turf.dm @@ -0,0 +1,29 @@ +/turf + var/list/affecting_lights + +/turf/proc/reconsider_lights() + for(var/datum/light_source/L in affecting_lights) + L.force_update() + +/turf/proc/lighting_clear_overlays() + for(var/atom/movable/lighting_overlay/L in src) + L.loc = null + +/turf/proc/lighting_build_overlays() + if(!locate(/atom/movable/lighting_overlay) in src) + var/state = "light[LIGHTING_RESOLUTION]" + var/area/A = loc + if(A.lighting_use_dynamic) + #if LIGHTING_RESOLUTION == 1 + var/atom/movable/lighting_overlay/O = new(src) + O.icon_state = state + #else + for(var/i = 0; i < LIGHTING_RESOLUTION; i++) + for(var/j = 0; j < LIGHTING_RESOLUTION; j++) + var/atom/movable/lighting_overlay/O = new(src) + O.pixel_x = i * (32 / LIGHTING_RESOLUTION) + O.pixel_y = j * (32 / LIGHTING_RESOLUTION) + O.xoffset = (((2*i + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.yoffset = (((2*j + 1) / (LIGHTING_RESOLUTION * 2)) - 0.5) + O.icon_state = state + #endif \ No newline at end of file diff --git a/code/modules/lighting/~lighting_underfs.dm b/code/modules/lighting/~lighting_underfs.dm new file mode 100644 index 00000000000..0f3651e15e5 --- /dev/null +++ b/code/modules/lighting/~lighting_underfs.dm @@ -0,0 +1,10 @@ +#undef LIGHTING_INTERVAL + +#undef LIGHTING_FALLOFF +#undef LIGHTING_LAMBERTIAN +#undef LIGHTING_HEIGHT +#undef LIGHTING_TRANSITIONS + +#undef LIGHTING_RESOLUTION +#undef LIGHTING_LAYER +#undef LIGHTING_ICON \ No newline at end of file diff --git a/code/modules/media/broadcast/transmitters/broadcast.dm b/code/modules/media/broadcast/transmitters/broadcast.dm index 63e7c933f4e..8461eaaafb4 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="#4285F4" use_power = 1 idle_power_usage = 50 active_power_usage = 1000 @@ -110,10 +110,10 @@ return if(on) overlays+="broadcaster on" - SetLuminosity(3) // OH FUUUUCK + set_light(3) // OH FUUUUCK use_power = 2 else - SetLuminosity(1) // Only the tile we're on. + set_light(1) // Only the tile we're on. use_power = 1 if(sources.len) overlays+="broadcaster linked" diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index e7346698f56..dccf5715bf9 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -104,7 +104,7 @@ icon_state = "furnace" density = 1 anchored = 1 - luminosity = 3 + light_range = 3 var/obj/machinery/mineral/input = null var/obj/machinery/mineral/output = null var/obj/machinery/mineral/console = null diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 0e927cc2aee..61902d6deab 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**************************/ diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 71226aa8bfb..48aa5fee4d4 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -734,10 +734,11 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing if(isturf(loc)) //else, there's considered to be no light var/turf/T = loc - var/area/A = T.loc - if(A) - if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights - else light_amount = 5 + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights + else + light_amount = 5 nutrition += light_amount traumatic_shock -= light_amount @@ -755,10 +756,11 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc var/light_amount = 0 if(isturf(loc)) var/turf/T = loc - var/area/A = T.loc - if(A) - if(A.lighting_use_dynamic) light_amount = T.lighting_lumcount - else light_amount = 10 + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = L.lum_r + L.lum_g + L.lum_b //hardcapped so it's not abused by having a ton of flashlights + else + light_amount = 10 if(light_amount > species.light_dam) //if there's enough light, start dying if(species.light_effect_amp) adjustFireLoss(5) //This gets doubled by Shadowling's innate fire weakness, so it ends up being 10. @@ -1349,7 +1351,8 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc //0.1% chance of playing a scary sound to someone who's in complete darkness if(isturf(loc) && rand(1,1000) == 1) var/turf/currentTurf = loc - if(!currentTurf.lighting_lumcount) + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in currentTurf + if(L && L.lum_r + L.lum_g + L.lum_b == 0) playsound_local(src,pick(scarySounds),50, 1, -1) // Separate proc so we can jump out of it when we've succeeded in spreading disease. diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 1a3bfc3f05a..e2d7a25adfa 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -434,10 +434,11 @@ var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing if(isturf(loc)) //else, there's considered to be no light var/turf/T = loc - var/area/A = T.loc - if(A) - if(A.lighting_use_dynamic) light_amount = min(10,T.lighting_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights - else light_amount = 5 + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights + else + light_amount = 5 nutrition += light_amount traumatic_shock -= light_amount diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index b61d58223c6..e1715187d33 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -203,14 +203,14 @@ /mob/living/proc/IgniteMob() if(fire_stacks > 0 && !on_fire) on_fire = 1 - src.AddLuminosity(3) + set_light(light_range + 3,l_color = "#ED9200") update_fire() /mob/living/proc/ExtinguishMob() if(on_fire) on_fire = 0 fire_stacks = 0 - src.AddLuminosity(-3) + set_light(max(0,light_range - 3)) update_fire() /mob/living/proc/update_fire() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 15a08aaea8d..5545e9f09bc 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -654,13 +654,13 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/reset_view(atom/A) if(current) - current.SetLuminosity(0) + current.set_light(0) if(istype(A,/obj/machinery/camera)) current = A ..() if(istype(A,/obj/machinery/camera)) - if(camera_light_on) A.SetLuminosity(AI_CAMERA_LUMINOSITY) - else A.SetLuminosity(0) + if(camera_light_on) A.set_light(AI_CAMERA_LUMINOSITY) + else A.set_light(0) /mob/living/silicon/ai/proc/botcall() set category = "AI Commands" @@ -941,7 +941,7 @@ var/list/ai_verbs_default = list( src << "Camera lights [camera_light_on ? "activated" : "deactivated"]." if(!camera_light_on) if(current) - current.SetLuminosity(0) + current.set_light(0) current = null else lightNearbyCamera() @@ -970,20 +970,20 @@ var/list/ai_verbs_default = list( if(src.current) var/obj/machinery/camera/camera = near_range_camera(src.eyeobj) if(camera && src.current != camera) - src.current.SetLuminosity(0) + src.current.set_light(0) if(!camera.light_disabled) src.current = camera - src.current.SetLuminosity(AI_CAMERA_LUMINOSITY) + src.current.set_light(AI_CAMERA_LUMINOSITY) else src.current = null else if(isnull(camera)) - src.current.SetLuminosity(0) + src.current.set_light(0) src.current = null else var/obj/machinery/camera/camera = near_range_camera(src.eyeobj) if(camera && !camera.light_disabled) src.current = camera - src.current.SetLuminosity(AI_CAMERA_LUMINOSITY) + src.current.set_light(AI_CAMERA_LUMINOSITY) camera_light_on = world.timeofday + 1 * 20 // Update the light every 2 seconds. 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 e7baed57748..328bd8c28c9 100644 --- a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm +++ b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm @@ -83,7 +83,7 @@ if(src.can_use()) cameranet.addCamera(src) else - src.SetLuminosity(0) + src.set_light(0) cameranet.removeCamera(src) /obj/machinery/camera/New() diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 477565b9cca..8d7e99f423b 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -9,7 +9,7 @@ src.cameraFollow = null src.reset_view(null) src.unset_machine() - + src.updatehealth() if (src.malfhack) @@ -48,7 +48,7 @@ loc = T.loc if (istype(loc, /area)) //stage = 4 - if (!loc.master.power_equip && !istype(src.loc,/obj/item)) + if (!loc.power_equip && !istype(src.loc,/obj/item)) //stage = 5 blind = 1 @@ -89,6 +89,9 @@ else //stage = 6 + + var/area/current_area = get_area(src) + src.blind.screen_loc = "1,1 to 15,15" if (src.blind.layer!=18) src.blind.layer = 18 @@ -98,7 +101,7 @@ src.see_in_dark = 0 src.see_invisible = SEE_INVISIBLE_LIVING - if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item)) + if (((!loc.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item)) if (src:aiRestorePowerRoutine==0) src:aiRestorePowerRoutine = 1 @@ -112,7 +115,7 @@ spawn(20) src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection." sleep(50) - if (loc.master.power_equip) + if (loc.power_equip) if (!istype(T, /turf/space)) src << "Alert cancelled. Power has been restored without our assistance." src:aiRestorePowerRoutine = 0 @@ -136,21 +139,20 @@ theAPC = something break */ - var/PRP //like ERP with the code, at least this stuff is no more 4x sametext + var/PRP for (PRP=1, PRP<=4, PRP++) - var/area/AIarea = get_area(src) - for(var/area/A in AIarea.master.related) - for (var/obj/machinery/power/apc/APC in A) - if (!(APC.stat & BROKEN)) - theAPC = APC - break + for (var/obj/machinery/power/apc/APC in current_area) + if (!(APC.stat & BROKEN)) + theAPC = APC + break + if (!theAPC) switch(PRP) if (1) src << "Unable to locate APC!" else src << "Lost connection with the APC!" src:aiRestorePowerRoutine = 2 return - if (loc.master.power_equip) + if (loc.power_equip) if (!istype(T, /turf/space)) src << "Alert cancelled. Power has been restored without our assistance." src:aiRestorePowerRoutine = 0 diff --git a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm index 2de72f237f3..8ed8db27fcf 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm @@ -39,9 +39,9 @@ set category = "Drone" if(luminosity) - SetLuminosity(0) + set_light(0) return - SetLuminosity(2) + set_light(2) //Actual picking-up event. /mob/living/silicon/robot/drone/attack_hand(mob/living/carbon/human/M as mob) diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index 9c22893e198..38a3243c1bb 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -120,7 +120,7 @@ emote_hear = list("barks", "woofs", "yaps","pants") emote_see = list("shakes its head", "shivers") desc = "It's a corgi." - SetLuminosity(0) + set_light(0) inventory_head.loc = src.loc inventory_head = null regenerate_icons() @@ -295,7 +295,7 @@ emote_hear = list("barks christmas songs", "yaps merrily") emote_see = list("looks for presents", "checks his list") desc = "He's very fond of milk and cookies." - SetLuminosity(6) + set_light(6) if(/obj/item/clothing/head/soft) name = "Corgi Tech [real_name]" desc = "The reason your yellow gloves have chew-marks." @@ -303,7 +303,7 @@ name = "[real_name] the red-nosed Corgi" emote_hear = list("lights the way", "illuminates", "yaps") desc = "He has a very shiny nose." - SetLuminosity(1) + set_light(1) //IAN! SQUEEEEEEEEE~ diff --git a/code/modules/mob/living/simple_animal/friendly/crab.dm b/code/modules/mob/living/simple_animal/friendly/crab.dm index 8bdc0eef805..fde8333ebdb 100644 --- a/code/modules/mob/living/simple_animal/friendly/crab.dm +++ b/code/modules/mob/living/simple_animal/friendly/crab.dm @@ -95,7 +95,7 @@ emote_hear = list("clicks") emote_see = list("clacks") desc = "Free crabs!" - src.sd_SetLuminosity(0) + src.sd_set_light(0) inventory_head.loc = src.loc inventory_head = null else diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 30115ec7957..c6f07751097 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -112,11 +112,23 @@ /mob/living/simple_animal/hostile/statue/proc/can_be_seen(var/turf/destination) // Check for darkness var/turf/T = get_turf(loc) + var/light_amount + var/DLlight_amount + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights + else + light_amount = 5 + var/atom/movable/lighting_overlay/DL = locate(/atom/movable/lighting_overlay) in destination + if(DL) + DLlight_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights + else + DLlight_amount = 5 if(T && destination) // Don't check it twice if our destination is the tile we are on or we can't even get to our destination if(T == destination) destination = null - else if(!T.lighting_lumcount && !destination.lighting_lumcount) // No one can see us in the darkness, right? + else if(light_amount <= 1 && DLlight_amount <= 1) // No one can see us in the darkness, right? return null // We aren't in darkness, loop for viewers. diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index f43759f4279..6c8d2762690 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -222,7 +222,7 @@ var/player_logged = 0 var/turf/listed_turf = null //the current turf being examined in the stat panel - var/list/shouldnt_see = list() //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes + var/list/shouldnt_see = list(/atom/movable/lighting_overlay) //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes var/kills=0 diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 48d3a52b0b0..89f288d0131 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1325,11 +1325,10 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on) if( cell && cell.charge>=20) cell.use(20); spawn(0) - for(var/area/A in area.related) - for(var/obj/machinery/light/L in A) - L.on = 1 - L.broken() - sleep(1) + for(var/obj/machinery/light/L in area) + L.on = 1 + L.broken() + sleep(1) /obj/machinery/power/apc/Destroy() if(malfai && operating) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index b66644e9179..4efe44ee90d 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -91,7 +91,7 @@ powernet.cut_cable(src) // update the powernets cable_list -= src /* if(istype(attached)) - attached.SetLuminosity(0) + attached.set_light(0) attached.icon_state = "powersink0" attached.mode = 0 processing_objects.Remove(attached) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 26fb14f92e8..ac145588874 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -141,7 +141,9 @@ power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list var/on = 0 // 1 if on, 0 if off var/on_gs = 0 - var/brightness = 8 // luminosity when on, also used in power calculation + var/brightness_range = 8 // luminosity when on, also used in power calculation + var/brightness_power = 3 + var/brightness_color = null var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN var/flickering = 0 var/light_type = /obj/item/weapon/light/tube // the type of light item @@ -157,7 +159,9 @@ icon_state = "bulb1" base_state = "bulb" fitting = "bulb" - brightness = 4 + brightness_range = 4 + brightness_power = 2 + brightness_color = "#a0a080" desc = "A small lighting fixture." light_type = /obj/item/weapon/light/bulb @@ -178,7 +182,8 @@ name = "spotlight" fitting = "large tube" light_type = /obj/item/weapon/light/tube/large - brightness = 12 + brightness_range = 12 + brightness_power = 4 /obj/machinery/light/built/New() status = LIGHT_EMPTY @@ -195,13 +200,20 @@ ..() spawn(2) + var/area/A = get_area(src) + if(A && !A.requires_power) + on = 1 + switch(fitting) if("tube") - brightness = 8 + brightness_range = 8 + brightness_power = 3 if(prob(2)) broken(1) if("bulb") - brightness = 4 + brightness_range = 4 + brightness_power = 2 + brightness_color = "#a0a080" if(prob(5)) broken(1) spawn(1) @@ -235,7 +247,7 @@ update_icon() if(on) - if(luminosity != brightness) + if(light_range != brightness_range || light_power != brightness_power || light_color != brightness_color) switchcount++ if(rigged) if(status == LIGHT_OK && trigger) @@ -249,15 +261,15 @@ status = LIGHT_BURNED icon_state = "[base_state]-burned" on = 0 - SetLuminosity(0) + set_light(0) else use_power = 2 - SetLuminosity(brightness) + set_light(brightness_range, brightness_power, brightness_color) else use_power = 1 - SetLuminosity(0) + set_light(0) - active_power_usage = (luminosity * 10) + active_power_usage = ((light_range + light_power) * 10) if(on != on_gs) on_gs = on @@ -309,8 +321,9 @@ user << "You insert the [L.name]." switchcount = L.switchcount rigged = L.rigged - brightness = L.brightness - l_color = L.color + brightness_range = L.brightness_range + brightness_power = L.brightness_power + brightness_color = L.brightness_color on = has_power() update() @@ -387,7 +400,7 @@ // true if area has power and lightswitch is on /obj/machinery/light/proc/has_power() var/area/A = src.loc.loc - return A.master.lightswitch && A.master.power_light + return A.lightswitch && A.power_light /obj/machinery/light/proc/flicker(var/amount = rand(10, 20)) if(flickering) return @@ -474,8 +487,9 @@ var/obj/item/weapon/light/L = new light_type() L.status = status L.rigged = rigged - L.brightness = src.brightness - L.color = l_color + L.brightness_range = brightness_range + L.brightness_power = brightness_power + L.brightness_color = brightness_color // light item inherits the switchcount, then zero it L.switchcount = switchcount @@ -501,8 +515,9 @@ var/obj/item/weapon/light/L = new light_type() L.status = status L.rigged = rigged - L.brightness = brightness - L.color = l_color + L.brightness_range = brightness_range + L.brightness_power = brightness_power + L.brightness_color = brightness_color // light item inherits the switchcount, then zero it L.switchcount = switchcount @@ -533,7 +548,6 @@ if(status == LIGHT_OK) return status = LIGHT_OK - brightness = initial(brightness) on = 1 update() @@ -568,7 +582,7 @@ /* /obj/machinery/light/process()//TODO: remove/add this from machines to save on processing as needed ~Carn PRIORITY if(on) - use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT) + use_power(light_range * LIGHTING_POWER_FACTOR, LIGHT) */ // called when area power state changes @@ -608,7 +622,9 @@ var/switchcount = 0 // number of times switched m_amt = 60 var/rigged = 0 // true if rigged to explode - var/brightness = 2 //how much light it gives off + var/brightness_range = 2 //how much light it gives off + var/brightness_power = 1 + var/brightness_color = null /obj/item/weapon/light/tube name = "light tube" @@ -617,12 +633,14 @@ base_state = "ltube" item_state = "c_tube" g_amt = 100 - brightness = 8 + brightness_range = 8 + brightness_power = 3 /obj/item/weapon/light/tube/large w_class = 2 name = "large light tube" - brightness = 15 + brightness_range = 15 + brightness_power = 4 /obj/item/weapon/light/bulb name = "light bulb" @@ -631,7 +649,9 @@ base_state = "lbulb" item_state = "contvapour" g_amt = 100 - brightness = 5 + brightness_range = 5 + brightness_power = 2 + brightness_color = "#a0a080" /obj/item/weapon/light/throw_impact(atom/hit_atom) ..() @@ -644,7 +664,8 @@ base_state = "fbulb" item_state = "egg4" g_amt = 100 - brightness = 5 + brightness_range = 5 + brightness_power = 2 // update the icon state and description of the light @@ -665,9 +686,9 @@ ..() switch(name) if("light tube") - brightness = rand(6,9) + brightness_range = rand(6,9) if("light bulb") - brightness = rand(4,6) + brightness_range = rand(4,6) update() diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index fbb8d479470..54ffa1221fe 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -46,31 +46,20 @@ return 1 var/area/A = src.loc.loc // make sure it's in an area - if(!A || !isarea(A) || !A.master) + if(!A || !isarea(A)) return 0 // if not, then not powered if(chan == -1) chan = power_channel - return A.master.powered(chan) // return power status of the area + return A.powered(chan) // return power status of the area // increment the power usage stats for an area - - -/obj/machinery/proc/use_power(var/amount, var/chan = -1, var/autocalled = 0) // defaults to power_channel - var/A = getArea() - +/obj/machinery/proc/use_power(var/amount, var/chan = -1) // defaults to power_channel + var/area/A = get_area(src) // make sure it's in an area if(!A || !isarea(A)) return - - var/area/B = A - - if (!B.master) - return - - if (-1 == chan) + if(chan == -1) chan = power_channel - - - B.master.use_power(amount, chan) + A.use_power(amount, chan) /obj/machinery/proc/power_change() // called whenever the power settings of the containing area change // by default, check equipment channel & set flag @@ -445,9 +434,9 @@ return null /area/proc/get_apc() - for(var/area/RA in src.related) - if (RA.apc.len >= 1) - return RA.apc[1] + var/obj/machinery/power/apc/FINDME = locate() in src + if (FINDME) + return FINDME //Determines how strong could be shock, deals damage to mob, uses power. diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 971c3ccf98e..c208c805bfa 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -9,7 +9,7 @@ density = 0 unacidable = 1 use_power = 0 - luminosity = 4 + light_range = 4 var/obj/machinery/field_generator/FG1 = null var/obj/machinery/field_generator/FG2 = null var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second. diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 3af4d2fbf2c..6c3172654aa 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -18,7 +18,7 @@ var/global/list/uneatable = list( anchored = 1 density = 1 layer = 6 - luminosity = 6 + light_range = 6 unacidable = 1 //Don't comment this out. use_power = 0 var/current_size = 1 diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 4efee86bb44..96feb8cd89d 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -316,7 +316,7 @@ user.drop_item() user << "You click [S] into place on [src]." if(S.on) - SetLuminosity(0) + set_light(0) F = S A.loc = src update_icon() @@ -359,32 +359,10 @@ /obj/item/weapon/gun/proc/update_gunlight(var/mob/user = null) if(F) if(F.on) - if(loc == user) - user.AddLuminosity(F.brightness_on) - else if(isturf(loc)) - SetLuminosity(F.brightness_on) + set_light(F.brightness_on) else - if(loc == user) - user.AddLuminosity(-F.brightness_on) - else if(isturf(loc)) - SetLuminosity(0) + set_light(0) update_icon() else - if(loc == user) - user.AddLuminosity(-5) - else if(isturf(loc)) - SetLuminosity(0) - return - -/obj/item/weapon/gun/pickup(mob/user) - if(F) - if(F.on) - user.AddLuminosity(F.brightness_on) - SetLuminosity(0) - -/obj/item/weapon/gun/dropped(mob/user) - if(F) - if(F.on) - user.AddLuminosity(-F.brightness_on) - SetLuminosity(F.brightness_on) - + set_light(0) + return \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/food/snacks/grown.dm b/code/modules/reagents/reagent_containers/food/snacks/grown.dm index 3c91caf7431..1f23b5cb849 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/grown.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/grown.dm @@ -185,16 +185,16 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/Destroy() if(istype(loc,/mob)) - loc.SetLuminosity(round(loc.luminosity - potency/5,1)) + loc.set_light(round(loc.luminosity - potency/5,1)) ..() /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/pickup(mob/user) - src.SetLuminosity(0) - user.SetLuminosity(round(user.luminosity + (potency/5),1)) + src.set_light(0) + user.set_light(round(user.luminosity + (potency/5),1)) /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/dropped(mob/user) - user.SetLuminosity(round(user.luminosity - (potency/5),1)) - src.SetLuminosity(round(potency/5,1)) + user.set_light(round(user.luminosity - (potency/5),1)) + src.set_light(round(potency/5,1)) /obj/item/weapon/reagent_containers/food/snacks/grown/cocoapod name = "cocoa pod" @@ -613,16 +613,16 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/Destroy() if(istype(loc,/mob)) - loc.SetLuminosity(round(loc.luminosity - potency/10,1)) + loc.set_light(round(loc.luminosity - potency/10,1)) ..() /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user) - SetLuminosity(0) - user.SetLuminosity(round(user.luminosity + (potency/10),1)) + set_light(0) + user.set_light(round(user.luminosity + (potency/10),1)) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user) - user.SetLuminosity(round(user.luminosity - (potency/10),1)) - SetLuminosity(round(potency/10,1)) + user.set_light(round(user.luminosity - (potency/10),1)) + set_light(round(potency/10,1)) //Tobacco/varieties /obj/item/weapon/reagent_containers/food/snacks/grown/tobacco diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm index cea70a189a6..a1844d19760 100644 --- a/code/modules/supermatter/supermatter.dm +++ b/code/modules/supermatter/supermatter.dm @@ -26,7 +26,7 @@ icon_state = "darkmatter" density = 1 anchored = 0 - luminosity = 4 + light_range = 4 var/gasefficency = 0.25 @@ -41,7 +41,7 @@ var/emergency_alert = "CRYSTAL DELAMINATION IMMINENT." var/explosion_point = 1000 - l_color = "#8A8A00" + light_color = "#8A8A00" var/warning_color = "#B8B800" var/emergency_color = "#D9D900" @@ -102,10 +102,8 @@ //Changes color and luminosity of the light to these values if they were not already set /obj/machinery/power/supermatter/proc/shift_light(var/lum, var/clr) - if(l_color != clr) - l_color = clr - if(luminosity != lum) - SetLuminosity(lum) + if(lum != light_range || clr != light_color) + set_light(lum, l_color = clr) /obj/machinery/power/supermatter/process() @@ -151,7 +149,7 @@ explode() else - shift_light(4,initial(l_color)) + shift_light(4,initial(light_color)) if(grav_pulling) supermatter_pull() diff --git a/code/modules/vehicle/vehicle.dm b/code/modules/vehicle/vehicle.dm index d345c31ea21..d74897a1b76 100644 --- a/code/modules/vehicle/vehicle.dm +++ b/code/modules/vehicle/vehicle.dm @@ -5,7 +5,7 @@ density = 1 anchored = 1 animate_movement=1 - luminosity = 3 + light_range = 3 var/attack_log = null var/on = 0 @@ -179,13 +179,13 @@ if(powered && cell.charge < charge_use) return 0 on = 1 - luminosity = initial(luminosity) + set_light(initial(light_range)) update_icon() return 1 /obj/vehicle/proc/turn_off() on = 0 - luminosity = 0 + set_light(0) update_icon() /obj/vehicle/proc/Emag(mob/user as mob) diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index b2e05635f42..cad7b7ab154 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -482,7 +482,7 @@ name = "Lantern Syndrome" stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) - mob.SetLuminosity(5) + mob.set_light(5) mob << "You are glowing brightly!" @@ -866,7 +866,7 @@ var/list/compatible_mobs = list(/mob/living/carbon/human, /mob/living/carbon/mon name = "Lantern Syndrome" stage = 2 activate(var/mob/living/carbon/mob,var/multiplier) - mob.SetLuminosity(4) + mob.set_light(4) mob << "You are glowing!" diff --git a/code/setup.dm b/code/setup.dm index c14124cb929..ba72060d9f1 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -974,3 +974,5 @@ var/list/hit_appends = list("-OOF", "-ACK", "-UGH", "-HRNK", "-HURGH", "-GLORF") #define CLICK_CD_TKSTRANGLE 10 #define CLICK_CD_POINT 10 #define CLICK_CD_RESIST 20 + +#define CLAMP01(x) max(0, min(1, x)) \ No newline at end of file diff --git a/icons/effects/lighting_overlay.dmi b/icons/effects/lighting_overlay.dmi new file mode 100644 index 0000000000000000000000000000000000000000..d27785068bb96915f80240098ba6ac19e66a3ba6 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^2|(>knv?>FNHaeCLNg+q7bafu9CLm$kCaTB13pY44ypl(e^sy z+qxles-)oZGc6XWVn;NMO_crS8v0$=)ZX!HX9F`k!(QJ&pXYabK#o%Jba4#Pn3(*7 zpM}T3z{jFMPuAjp<{3%WFU;~Eiue{3OEpL^oXS}%`8+@EGf+K)r>mdKI;Vst0F