From 6e274cd39507930e3323f079d2e6839a49d6e824 Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Sat, 25 Aug 2012 16:06:57 +0000 Subject: [PATCH] New lighting, it's essentially just the old DAL system with a queue. Comments for lighting: 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. 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 is a hardcoded maximum luminosity. This is to discourage coders using large luminosity values for dynamic lighting, as the cost of lighting grows rapidly at large luminosity levels (especially when changing opacity at runtime) 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 hopefully it's worth the hassle for the greater control we gain. Besides, there are far far worse uses of needless lists in the game, it'd be worth pruning some of them to offset costs. Known Issues/TODO: admin-spawned turfs will have broken lumcounts. Not willing to fix it at this moment mob luminosity will be lower than expected when one of multiple light sources is dropped after exceeding the maximum luminosity Shuttles still do not have support for dynamic lighting (I hope to fix this at some point) No directional lighting support. Fairly easy to add this and the code is ready. When opening airlocks etc, lighting does not always update to account for the change in opacity. Explosions now cause lighting to cease processing temporarily. Moved controller datums to the code/controllers directory. I plan on standardising them. "Master","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI" controller datums can be accessed via the debug controller verb (used to be the debug master controller verb) Supply shuttle now uses a controller datum. Shuttles tend to arrive up to 30 seconds late, this is not a bug. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4537 316c924e-a436-60f5-8080-3fe189b3f50e --- code/FEA/FEA_fire.dm | 3 +- code/controllers/_DynamicAreaLighting_TG.dm | 305 +++++++ code/{datums => controllers}/configuration.dm | 0 code/controllers/lighting_controller.dm | 81 ++ code/controllers/master_controller.dm | 210 +++++ .../shuttle_controller.dm | 0 .../tension.dm => controllers/tensioner.dm} | 0 code/controllers/verbs.dm | 67 ++ code/datums/helper_datums/teleport.dm | 7 - code/defines/area/Space Station 13 areas.dm | 28 +- code/defines/obj/decal.dm | 1 + code/defines/procs/gamehelpers.dm | 17 +- code/defines/procs/helpers.dm | 26 +- code/game/area/areas.dm | 91 +- code/game/asteroid/asteroid.dm | 11 +- code/game/cellautomata.dm | 4 +- .../gamemodes/changeling/changeling_powers.dm | 2 +- .../gamemodes/changeling/modularchangling.dm | 7 +- code/game/gamemodes/cult/cult_structures.dm | 2 +- code/game/gamemodes/gameticker.dm | 9 +- code/game/jobs/access.dm | 3 +- code/game/machinery/bots/bots.dm | 1 + code/game/machinery/camera.dm | 2 +- code/game/machinery/doors/airlock.dm | 12 +- code/game/machinery/doors/door.dm | 7 +- code/game/machinery/doors/poddoor.dm | 33 +- code/game/machinery/doors/shutters.dm | 28 +- code/game/machinery/doors/windowdoor.dm | 6 +- code/game/machinery/flasher.dm | 9 +- code/game/machinery/hologram.dm | 9 +- code/game/machinery/hydroponics.dm | 23 +- code/game/machinery/igniter.dm | 4 +- code/game/machinery/shieldgen.dm | 3 +- code/game/machinery/status_display.dm | 8 +- code/game/master_controller.dm | 219 ----- code/game/mecha/mecha.dm | 11 +- code/game/objects/devices/PDA/PDA.dm | 29 +- code/game/objects/devices/PDA/cart.dm | 10 +- code/game/objects/devices/flashlight.dm | 27 +- code/game/objects/devices/powersink.dm | 8 +- code/game/objects/effects/aliens.dm | 6 +- code/game/objects/effects/decals/blood.dm | 2 - code/game/objects/effects/effect_system.dm | 8 +- code/game/objects/effects/glowshroom.dm | 10 +- code/game/objects/explosion.dm | 16 +- code/game/objects/explosion2.dm | 2 + code/game/objects/items/candle.dm | 14 +- .../objects/items/weapons/cigs_lighters.dm | 15 +- code/game/objects/items/weapons/twohanded.dm | 4 +- code/game/objects/structures.dm | 28 +- code/game/objects/structures/mineral_doors.dm | 5 +- code/game/supplyshuttle.dm | 847 +++++++++--------- code/game/turfs/turf.dm | 87 +- code/modules/admin/admin_verbs.dm | 8 +- code/modules/admin/verbs/massmodvar.dm | 14 +- code/modules/admin/verbs/modifyvariables.dm | 2 +- code/modules/clothing/head/hardhat.dm | 18 +- code/modules/clothing/head/misc_special.dm | 18 +- code/modules/clothing/spacesuits/rig.dm | 18 +- code/modules/mining/mine_turfs.dm | 19 +- code/modules/mob/living/carbon/human/life.dm | 22 +- code/modules/mob/living/carbon/monkey/life.dm | 3 - code/modules/mob/living/silicon/ai/ai.dm | 15 +- .../mob/living/silicon/ai/freelook/chunk.dm | 4 +- .../silicon/ai/freelook/update_triggers.dm | 2 +- code/modules/mob/living/silicon/robot/life.dm | 1 - .../modules/mob/living/simple_animal/corgi.dm | 4 +- code/modules/mob/mob.dm | 5 - code/modules/mob/mob_defines.dm | 3 - code/modules/power/apc.dm | 11 +- code/modules/power/lighting.dm | 46 +- code/modules/power/sd_DynamicAreaLighting.dm | 596 ------------ .../power/singularity/containment_field.dm | 6 +- code/modules/power/singularity/singularity.dm | 3 +- code/modules/reagents/grenade_launcher.dm | 2 +- .../reagents/reagent_containers/borghydro.dm | 2 +- .../reagent_containers/food/condiment.dm | 4 +- .../reagent_containers/food/drinks.dm | 4 +- .../reagent_containers/food/snacks.dm | 2 +- .../reagent_containers/food/snacks/grown.dm | 22 +- .../reagents/reagent_containers/spray.dm | 4 +- code/modules/reagents/syringe_gun.dm | 2 +- html/changelog.html | 8 + icons/effects/alert.dmi | Bin 1220 -> 0 bytes icons/effects/ss13_dark_alpha7.dmi | Bin 2706 -> 467 bytes icons/effects/ss13_dark_alpha7_DEBUG.dmi | Bin 0 -> 2851 bytes icons/turf/areas.dmi | Bin 17943 -> 18782 bytes maps/tgstation.2.0.9.dmm | 4 +- tgstation.dme | 525 +---------- 89 files changed, 1519 insertions(+), 2245 deletions(-) create mode 100644 code/controllers/_DynamicAreaLighting_TG.dm rename code/{datums => controllers}/configuration.dm (100%) create mode 100644 code/controllers/lighting_controller.dm create mode 100644 code/controllers/master_controller.dm rename code/{datums => controllers}/shuttle_controller.dm (100%) rename code/{datums/helper_datums/tension.dm => controllers/tensioner.dm} (100%) create mode 100644 code/controllers/verbs.dm delete mode 100644 code/game/master_controller.dm delete mode 100644 code/modules/power/sd_DynamicAreaLighting.dm delete mode 100644 icons/effects/alert.dmi create mode 100644 icons/effects/ss13_dark_alpha7_DEBUG.dmi diff --git a/code/FEA/FEA_fire.dm b/code/FEA/FEA_fire.dm index 022af7230a4..d28df56a340 100644 --- a/code/FEA/FEA_fire.dm +++ b/code/FEA/FEA_fire.dm @@ -54,6 +54,7 @@ icon = 'icons/effects/fire.dmi' icon_state = "1" layer = TURF_LAYER + luminosity = 3 var/volume = 125 var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST @@ -136,7 +137,6 @@ New() ..() dir = pick(cardinal) - sd_SetLuminosity(3) return @@ -144,7 +144,6 @@ if (istype(loc, /turf/simulated)) var/turf/simulated/T = loc loc:active_hotspot = null - src.sd_SetLuminosity(0) if(T.to_be_destroyed) var/chance_of_deletion diff --git a/code/controllers/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm new file mode 100644 index 00000000000..8a00ca9e1fa --- /dev/null +++ b/code/controllers/_DynamicAreaLighting_TG.dm @@ -0,0 +1,305 @@ +/* + Modified DynamicAreaLighting for TGstation - Coded by Carnwennan + + This is TG's 'new' lighting system. It's basically a heavily modified mix of 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. + + 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 is a hardcoded maximum luminosity. This is to discourage coders using large luminosity values + for dynamic lighting, as the cost of lighting grows rapidly at large luminosity levels (especially when changing opacity + at runtime) + + 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 hopefully it's worth the hassle for the greater control we + gain. Besides, there are far far worse uses of needless lists in the game, it'd be worth pruning some of them to offset + costs. + + Known Issues/TODO: + admin-spawned turfs will have broken lumcounts. Not willing to fix it at this moment + mob luminosity will be lower than expected when one of multiple light sources is dropped after exceeding the maximum luminosity + Shuttles still do not have support for dynamic lighting (I hope to fix this at some point) + No directional lighting support. Fairly easy to add this and the code is ready. + When opening airlocks etc, lighting does not always update to account for the change in opacity. +*/ + +#define LIGHTING_MAX_LUMINOSITY 12 //Hard maximum luminosity to prevet lag which could be caused by coders making mini-suns +#define LIGHTING_MAX_LUMINOSITY_MOB 7 //Mobs get their own max because 60-odd human suns running around would be pretty silly +#define LIGHTING_LAYER 10 //Drawing layer for lighting overlays +#define LIGHTING_ICON 'icons/effects/ss13_dark_alpha7.dmi' //Icon used for lighting shading effects + +datum/controller/lighting/New() //moved here so its in the define. eek :S + lighting_states = max( 0, length(icon_states(LIGHTING_ICON))-1 ) + +datum/light_source + var/atom/owner + var/changed = 1 + var/mobile = 1 + var/list/effect = list() + + var/__x = 0 //x coordinate at last update + var/__y = 0 //y coordinate at last update + + + 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 + + if(istype(owner, /atom/movable)) mobile = 1 //apparantly this is faster than type-checking + else mobile = 0 //Perhaps removing support for luminous turfs would be a good idea. + + __x = owner.x + __y = owner.y + + // 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. + + if(mobile) + // check to see if we've moved since last update + if(owner.x != __x || owner.y != __y) + __x = owner.x + __y = owner.y + 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. + if(effect.len) + for(var/turf in effect) // negate the effect of this light source + var/turf/T = turf + T.update_lumcount(-effect[T]) + 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) + effect = new_effect() // identify the effects of this light source + for(var/turf in effect) + var/turf/T = turf + T.update_lumcount(effect[T]) // apply the effect + 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/new_effect() + . = list() + + for(var/turf/T in view(owner.luminosity, owner)) +// var/area/A = T.loc +// if(!A) continue + var/change_in_lumcount = lum(T) + if(change_in_lumcount > 0) + .[T] = change_in_lumcount + + return . + + + proc/lum(turf/A) + return owner.luminosity - max(abs(A.x-__x),abs(A.y-__y)) +// var/dist = cheap_hypotenuse(A.x,A.y,__x,__y) //fetches the pythagorean distance between A and the light +// if(owner.luminosity < dist) //if the turf is outside the radius the light doesn't illuminate it +// return 0 +// return round(owner.luminosity - (dist/2),0.1) + +atom + var/datum/light_source/light + +//Turfs with opacity when they are constructed will trigger nearby lights to update +//Turfs atoms with luminosity when they are constructed will create a light_source automatically +//TODO: lag reduction +turf/New() + ..() + if(opacity) + UpdateAffectingLights() + if(luminosity) + world.log << "[type] has luminosity at New()" + if(light) world.log << "## WARNING: [type] - Don't set lights up manually during New(), We do it automatically." + 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 +//TODO: lag reduction +atom/movable/New() + ..() + if(opacity) + UpdateAffectingLights() + if(luminosity) + if(light) world.log << "## WARNING: [type] - Don't set lights up manually during New(), We do it automatically." + light = new(src) + +//Turfs with opacity will trigger nearby lights to update at next lighting process. +//TODO: is this really necessary? Removing it could help reduce lag during singulo-mayhem somewhat +turf/Del() + if(opacity) + UpdateAffectingLights() + ..() + +//Objects with opacity will trigger nearby lights to update at next lighting process. +atom/movable/Del() + if(opacity) + UpdateAffectingLights() + ..() + +//Sets our luminosity. Enforces a hardcoded maximum luminosity by default. This maximum can be overridden but it is extremely +//unwise to do so. +//If we have no light it will create one. +//If we are setting luminosity to 0 the light will be cleaned up and delted once all its queues are complete +//if we have a light already it is merely updated +atom/proc/SetLuminosity(new_luminosity, max_luminosity = LIGHTING_MAX_LUMINOSITY) + if(new_luminosity < 0) + new_luminosity = 0 +// world.log << "## WARNING: [type] - luminosity cannot be negative" + else if(max_luminosity < new_luminosity) + new_luminosity = max_luminosity +// if(luminosity != new_luminosity) +// world.log << "## WARNING: [type] - LIGHT_MAX_LUMINOSITY exceeded" + + if(isturf(loc)) + if(light) + if(luminosity != new_luminosity) //TODO: remove lights from the light list when they're not luminous? DONE in add_effect + light.changed = 1 + else + if(new_luminosity) + light = new(src) + + luminosity = new_luminosity + +//Snowflake code to prevent mobs becoming suns (lag-prevention) +mob/SetLuminosity(new_luminosity) + ..(new_luminosity,LIGHTING_MAX_LUMINOSITY_MOB) + +//change our opacity (defaults to toggle), and then update all lights that affect us. +atom/proc/SetOpacity(var/new_opacity) + if(new_opacity == null) new_opacity = !opacity + else if(opacity == new_opacity) return + opacity = new_opacity + + UpdateAffectingLights() + +//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 +atom/proc/UpdateAffectingLights() + var/turf/T = src + if(!isturf(T)) + T = loc + if(!isturf(T)) return + for(var/atom in range(LIGHTING_MAX_LUMINOSITY,T)) //TODO: this will probably not work very well :( + var/atom/A = atom + if(A.light && A.luminosity) + A.light.changed = 1 //force it to update at next process() + +// for(var/light in lighting_controller.lights) //TODO: this will probably laaaaaag +// var/datum/light_source/L = light +// if(L.changed) continue +// if(!L.owner) continue +// if(!L.owner.luminosity) continue +// if(src in L.effect) +// L.changed = 1 + +turf + var/lighting_lumcount = 0 + var/lighting_changed = 0 + +turf/space + lighting_lumcount = 4 //starlight + +turf/proc/update_lumcount(amount) + lighting_lumcount += amount +// if(lighting_lumcount < 0 || lighting_lumcount > 100) +// world.log << "## WARNING: [type] ([src]) lighting_lumcount = [lighting_lumcount]" + if(!lighting_changed) + lighting_controller.changed_turfs += src + lighting_changed = 1 + +turf/proc/shift_to_subarea() + lighting_changed = 0 + + var/area/Area = loc + if(!istype(Area) || !Area.lighting_use_dynamic) return + + // change the turf's area depending on its brightness + // restrict light to valid levels + var/light = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states) + var/new_tag = "[Area.type]sd_L[light]" + + if(Area.tag!=new_tag) //skip if already in this area + var/area/A = locate(new_tag) // find an appropriate area + if(!A) + 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","overlays") continue + else + if(issaved(Area.vars[V])) A.vars[V] = Area.vars[V] + + A.tag = new_tag + A.lighting_subarea = 1 + A.SetLightLevel(light) + + Area.related += A + + A.contents += src // move the turf into the area + +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 + + proc/SetLightLevel(light) + 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) + + overlays += lighting_overlay + + proc/InitializeLighting() //TODO: could probably improve this bit ~Carn + if(!tag) tag = "[type]" + 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_MAX_LUMINOSITY +#undef LIGHTING_MAX_LUMINOSITY_MOB +#undef LIGHTING_LAYER +#undef LIGHTING_ICON \ No newline at end of file diff --git a/code/datums/configuration.dm b/code/controllers/configuration.dm similarity index 100% rename from code/datums/configuration.dm rename to code/controllers/configuration.dm diff --git a/code/controllers/lighting_controller.dm b/code/controllers/lighting_controller.dm new file mode 100644 index 00000000000..d67f9fb31a1 --- /dev/null +++ b/code/controllers/lighting_controller.dm @@ -0,0 +1,81 @@ +var/datum/controller/lighting/lighting_controller = new () + +datum/controller/lighting + var/processing = 0 + var/processing_interval = 4 //setting this too low will probably kill the server. Don't be silly with it! + var/process_cost = 0 + var/iteration = 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 + +//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) + var/started = world.timeofday + + if(processing) + iteration++ + 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.check()) + 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 \ No newline at end of file diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm new file mode 100644 index 00000000000..80a7659035d --- /dev/null +++ b/code/controllers/master_controller.dm @@ -0,0 +1,210 @@ +var/global/datum/controller/game_controller/master_controller //Set in world.New() +var/global/datum/failsafe/Failsafe +var/global/controller_iteration = 0 + + +var/global/last_tick_timeofday = world.timeofday +var/global/last_tick_duration = 0 + +datum/controller/game_controller + var/processing = 0 + + var/global/air_master_ready = 0 + var/global/sun_ready = 0 + var/global/mobs_ready = 0 + var/global/diseases_ready = 0 + var/global/machines_ready = 0 + var/global/objects_ready = 0 + var/global/networks_ready = 0 + var/global/powernets_ready = 0 + var/global/ticker_ready = 0 + + //Used for MC 'proc break' debugging + var/global/obj/last_obj_processed + var/global/datum/disease/last_disease_processed + var/global/obj/machinery/last_machine_processed + var/global/mob/last_mob_processed + + + proc/setup() + if(master_controller && (master_controller != src)) + del(src) + return + //There can be only one master. + + if(!air_master) + air_master = new /datum/controller/air_system() + air_master.setup() + + if(!job_master) + job_master = new /datum/controller/occupations() + if(job_master.SetupOccupations()) + world << "\red \b Job setup complete" + job_master.LoadJobs("config/jobs.txt") + + world.tick_lag = config.Ticklag + + createRandomZlevel() + + setup_objects() + + setupgenetics() + + + for(var/i = 0, i < max_secret_rooms, i++) + make_mining_asteroid_secret() + + syndicate_code_phrase = generate_code_phrase()//Sets up code phrase for traitors, for the round. + syndicate_code_response = generate_code_phrase() + + emergency_shuttle = new /datum/shuttle_controller/emergency_shuttle() + + if(!ticker) + ticker = new /datum/controller/gameticker() + + setupfactions() + + spawn + ticker.pregame() + + proc/setup_objects() + world << "\red \b Initializing objects" + sleep(-1) + + for(var/obj/object in world) + object.initialize() + + world << "\red \b Initializing pipe networks" + sleep(-1) + + for(var/obj/machinery/atmospherics/machine in world) + machine.build_network() + + world << "\red \b Initializing atmos machinery." + sleep(-1) + for(var/obj/machinery/atmospherics/unary/vent_pump/T in world) + T.broadcast_status() + for(var/obj/machinery/atmospherics/unary/vent_scrubber/T in world) + T.broadcast_status() + + world << "\red \b Initializations complete." + + + proc/process() + processing = 1 + spawn(0) + set background = 1 + while(1) + var/currenttime = world.timeofday + var/diff = (currenttime - last_tick_timeofday) / 10 + last_tick_timeofday = currenttime + last_tick_duration = diff + + if(processing) + + controller_iteration++ + + var/start_time = world.timeofday + + air_master_ready = 0 + sun_ready = 0 + mobs_ready = 0 + diseases_ready = 0 + machines_ready = 0 + objects_ready = 0 + networks_ready = 0 + powernets_ready = 0 + ticker_ready = 0 + + spawn(0) + air_master.process() + air_master_ready = 1 + + sleep(1) + + spawn(0) + sun.calc_position() + sun_ready = 1 + + sleep(-1) + + spawn(0) + for(var/mob/M in world) + last_mob_processed = M + M.Life() + mobs_ready = 1 + + sleep(-1) + + spawn(0) + for(var/datum/disease/D in active_diseases) + last_disease_processed = D + D.process() + diseases_ready = 1 + + spawn(0) + for(var/obj/machinery/machine in machines) + if(machine) + last_machine_processed = machine + machine.process() + if(machine && machine.use_power) + machine.auto_use_power() + + machines_ready = 1 + + sleep(1) + + spawn(-1) + for(var/obj/object in processing_objects) + last_obj_processed = object + object.process() + objects_ready = 1 + + sleep(-1) + + spawn(-1) + for(var/datum/pipe_network/network in pipe_networks) + network.process() + networks_ready = 1 + + spawn(-1) + for(var/datum/powernet/P in powernets) + P.reset() + powernets_ready = 1 + + sleep(-1) + + spawn(-1) + ticker.process() + ticker_ready = 1 + + var/IL_check = 0 //Infinite loop check (To report when the master controller breaks.) + while(!air_master_ready || !sun_ready || !mobs_ready || !diseases_ready || !machines_ready || !objects_ready || !networks_ready || !powernets_ready || !ticker_ready) + IL_check++ + if(IL_check > 600) + var/MC_report = "air_master_ready = [air_master_ready]; sun_ready = [sun_ready]; mobs_ready = [mobs_ready]; diseases_ready = [diseases_ready]; machines_ready = [machines_ready]; objects_ready = [objects_ready]; networks_ready = [networks_ready]; powernets_ready = [powernets_ready]; ticker_ready = [ticker_ready];" + message_admins("PROC BREAKAGE WARNING: The game's master contorller appears to be stuck in one of it's cycles. It has looped through it's delaying loop [IL_check] times.") + message_admins("The master controller reports: [MC_report]") + if(!diseases_ready) + if(last_disease_processed) + message_admins("DISEASE PROCESSING stuck on [last_disease_processed]", 0, 1) + else + message_admins("DISEASE PROCESSING stuck on unknown") + if(!machines_ready) + if(last_machine_processed) + message_admins("MACHINE PROCESSING stuck on [last_machine_processed]", 0, 1) + else + message_admins("MACHINE PROCESSING stuck on unknown") + if(!objects_ready) + if(last_obj_processed) + message_admins("OBJ PROCESSING stuck on [last_obj_processed]", 0, 1) + else + message_admins("OBJ PROCESSING stuck on unknown") + log_admin("PROC BREAKAGE WARNING: infinite_loop_check = [IL_check]; [MC_report];") + message_admins("Master controller breaking out of delaying loop. Restarting the round is advised if problem persists. DO NOT manually restart the master controller.") + break; + sleep(1) + + sleep(world.timeofday+12-start_time) + else + sleep(10) \ No newline at end of file diff --git a/code/datums/shuttle_controller.dm b/code/controllers/shuttle_controller.dm similarity index 100% rename from code/datums/shuttle_controller.dm rename to code/controllers/shuttle_controller.dm diff --git a/code/datums/helper_datums/tension.dm b/code/controllers/tensioner.dm similarity index 100% rename from code/datums/helper_datums/tension.dm rename to code/controllers/tensioner.dm diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm new file mode 100644 index 00000000000..78e3bce9de4 --- /dev/null +++ b/code/controllers/verbs.dm @@ -0,0 +1,67 @@ +//TODO: rewrite and standardise all controller datums to the datum/controller type +//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) + +/client/proc/restart_controller(controller in list("Master","Lighting","Supply Shuttle")) + set category = "Debug" + set name = "Restart Controller" + set desc = "Restart one of the various periodic loop controllers for the game (be careful!)" + + if(!holder) return + usr = null + src = null + switch(controller) + if("Master") + master_controller.process() + feedback_add_details("admin_verb","RMC") + if("Lighting") + lighting_controller.process() + feedback_add_details("admin_verb","RLighting") + if("Supply Shuttle") + supply_shuttle.process() + feedback_add_details("admin_verb","RSupply") + message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.", 1) + return + + +/client/proc/debug_controller(controller in list("Master","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI")) + set category = "Debug" + set name = "Debug Controller" + set desc = "Debug the various periodic loop controllers for the game (be careful!)" + + if(!holder) return + switch(controller) + if("Master") + debug_variables(master_controller) + feedback_add_details("admin_verb","DMC") + 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") + if("Jobs") + debug_variables(job_master) + feedback_add_details("admin_verb","DJobs") + if("Sun") + debug_variables(sun) + feedback_add_details("admin_verb","DSun") + if("Radio") + debug_variables(radio_controller) + feedback_add_details("admin_verb","DRadio") + if("Supply Shuttle") + debug_variables(supply_shuttle) + feedback_add_details("admin_verb","DSupply") + if("Emergency Shuttle") + debug_variables(emergency_shuttle) + feedback_add_details("admin_verb","DEmergency") + if("Configuration") + debug_variables(config) + feedback_add_details("admin_verb","DConf") + if("pAI") + debug_variables(paiController) + feedback_add_details("admin_verb","DpAI") + message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.", 1) + return diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 4267328dcad..0297e902207 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -108,10 +108,6 @@ playSpecials(curturf,effectin,soundin) - // Remove any luminosity etc. - var/prevlum = teleatom.luminosity - teleatom.luminosity = 0 - if(force_teleport) teleatom.forceMove(destturf) playSpecials(destturf,effectout,soundout) @@ -119,9 +115,6 @@ if(teleatom.Move(destturf)) playSpecials(destturf,effectout,soundout) - // Re-Apply lum - teleatom.sd_SetLuminosity(prevlum) - destarea.Entered(teleatom) return 1 diff --git a/code/defines/area/Space Station 13 areas.dm b/code/defines/area/Space Station 13 areas.dm index e6e24e4f70a..676e8268322 100644 --- a/code/defines/area/Space Station 13 areas.dm +++ b/code/defines/area/Space Station 13 areas.dm @@ -48,7 +48,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station 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/lights // list of all lights on this area /*Adding a wizard area teleport list because motherfucking lag -- Urist*/ /*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/ @@ -122,10 +122,10 @@ proc/process_ghost_teleport_locs() //place to another. Look at escape shuttle for example. //All shuttles show now be under shuttle since we have smooth-wall code. -/area/shuttle //DO NOT TURN THE SD_LIGHTING STUFF ON FOR SHUTTLES. IT BREAKS THINGS. +/area/shuttle //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. requires_power = 0 luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/shuttle/arrival name = "\improper Arrival Shuttle" @@ -227,14 +227,14 @@ proc/process_ghost_teleport_locs() name = "\improper Alien Shuttle Base" requires_power = 1 luminosity = 0 - sd_lighting = 1 + lighting_use_dynamic = 1 /area/shuttle/alien/mine icon_state = "shuttle" name = "\improper Alien Shuttle Mine" requires_power = 1 luminosity = 0 - sd_lighting = 1 + lighting_use_dynamic = 1 /area/shuttle/prison/ name = "\improper Prison Shuttle" @@ -306,7 +306,7 @@ proc/process_ghost_teleport_locs() icon_state = "start" requires_power = 0 luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 has_gravity = 1 // === end remove @@ -786,7 +786,7 @@ proc/process_ghost_teleport_locs() name = "\improper Holodeck" icon_state = "Holodeck" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/holodeck/alphadeck name = "\improper Holodeck Alpha" @@ -854,7 +854,7 @@ proc/process_ghost_teleport_locs() /area/solar requires_power = 0 luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 auxport name = "\improper Fore Port Solar Array" @@ -1335,25 +1335,25 @@ proc/process_ghost_teleport_locs() name = "\improper AI Sat Ext" icon_state = "storage" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/turret_protected/AIsatextFS name = "\improper AI Sat Ext" icon_state = "storage" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/turret_protected/AIsatextAS name = "\improper AI Sat Ext" icon_state = "storage" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/turret_protected/AIsatextAP name = "\improper AI Sat Ext" icon_state = "storage" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 /area/turret_protected/NewAIMain name = "\improper AI Main New" @@ -1435,7 +1435,7 @@ proc/process_ghost_teleport_locs() /area/turret_protected/AssistantRoom name = "\improper Assistant Room" icon_state = "storage" - sd_lighting = 0 + lighting_use_dynamic = 0 ///////////////////////////////////////////////////////////////////// /* @@ -1507,7 +1507,7 @@ var/list/the_station_areas = list ( name = "Keelin's private beach" icon_state = "null" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 requires_power = 0 var/sound/mysound = null diff --git a/code/defines/obj/decal.dm b/code/defines/obj/decal.dm index cbf71a24dc8..0ff3334e9c9 100644 --- a/code/defines/obj/decal.dm +++ b/code/defines/obj/decal.dm @@ -227,6 +227,7 @@ density = 0 anchored = 1 layer = 2 + luminosity = 1 icon = 'icons/effects/effects.dmi' icon_state = "greenglow" diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index 92c31d1c844..b6b8d5fe7d6 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -50,20 +50,13 @@ //Magic constants obtained by using linear regression on right-angled triangles of sides 0=b) - return (k1*a) + (k2*b) //No sqrt or powers :) - else - return (k1*b) + (k2*a) +/proc/cheap_hypotenuse(Ax,Ay,Bx,By) // T is just the second atom to check distance to center with + var/dx = abs(Ax - Bx) //sides of right-angled triangle + var/dy = abs(Ay - By) + if(dx>=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :) + else return (k1*dx) + (k2*dy) #undef k1 #undef k2 diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index cf3aadfd759..c6b03fb60a0 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -914,22 +914,22 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl if(!istype(M,/mob)) continue M.loc = X - var/area/AR = X.loc +// var/area/AR = X.loc - if(AR.sd_lighting) - X.opacity = !X.opacity - X.sd_SetOpacity(!X.opacity) +// 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) toupdate += X if(turftoleave) var/turf/ttl = new turftoleave(T) - var/area/AR2 = ttl.loc +// var/area/AR2 = ttl.loc - if(AR2.sd_lighting) - ttl.opacity = !ttl.opacity - ttl.sd_SetOpacity(!ttl.opacity) +// if(AR2.lighting_use_dynamic) //TODO: rewrite this code so it's not messed by lighting ~Carn +// ttl.opacity = !ttl.opacity +// ttl.sd_SetOpacity(!ttl.opacity) fromupdate += ttl @@ -1089,14 +1089,14 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0) for(var/V in T.vars) - if(!(V in list("type","loc","locs","vars", "parent", "parent_type","verbs","ckey","key","x","y","z","contents", "luminosity", "sd_light_spill",))) + if(!(V in list("type","loc","locs","vars", "parent", "parent_type","verbs","ckey","key","x","y","z","contents", "luminosity"))) X.vars[V] = T.vars[V] - var/area/AR = X.loc +// var/area/AR = X.loc - if(AR.sd_lighting) - X.opacity = !X.opacity - X.sd_SetOpacity(!X.opacity) +// 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 toupdate += X diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index de3a5db7067..53f76cdde6b 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -3,80 +3,43 @@ // === -/area/ +/area var/global/global_uid = 0 var/uid /area/New() - + icon_state = "" + layer = 10 master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references src.loc.loc.master ~Carn - src.icon = 'icons/effects/alert.dmi' uid = ++global_uid - spawn(1) - //world.log << "New: [src] [tag]" - var/sd_created = findtext(tag,"sd_L") - sd_New(sd_created) - if(sd_created) - related += src - return - related = list(src) + related = list(src) - src.icon = 'icons/effects/alert.dmi' - src.layer = 10 - // update_lights() - if(name == "Space") // override defaults for space - requires_power = 1 - always_unpowered = 1 - sd_SetLuminosity(1) - power_light = 0 - power_equip = 0 - power_environ = 0 - //has_gravity = 0 // Space has gravity. Because.. because. + if(type == /area) // override defaults for space. TODO: make space areas of type /area/space rather than /area + requires_power = 1 + always_unpowered = 1 + lighting_use_dynamic = 1 + power_light = 0 + power_equip = 0 + power_environ = 0 +// lighting_state = 4 + //has_gravity = 0 // Space has gravity. Because.. because. - if(!requires_power) - power_light = 0//rastaf0 - power_equip = 0//rastaf0 - power_environ = 0//rastaf0 - luminosity = 1 - sd_lighting = 0 // *DAL* - else - luminosity = 0 - //sd_SetLuminosity(0) // *DAL* + if(requires_power) + luminosity = 0 + else + 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() - - - /*spawn(5) - for(var/turf/T in src) // count the number of turfs (for lighting calc) - if(no_air) - T.oxygen = 0 // remove air if so specified for this area - T.n2 = 0 - T.res_vars() - - */ - - - spawn(15) - src.power_change() // all machines set to current power level, also updates lighting icon - -/* -/proc/get_area(area/A) - while (A) - if (istype(A, /area)) - return A - - A = A.loc - return null -*/ -/* -/area/proc/update_lights() - var/new_power = 0 - for(var/obj/machinery/light/L in src.contents) - if(L.on) - new_power += (L.luminosity * 20) - lighting_power_usage = new_power - return -*/ /area/proc/poweralert(var/state, var/obj/source as obj) if (state != poweralm) poweralm = state diff --git a/code/game/asteroid/asteroid.dm b/code/game/asteroid/asteroid.dm index ad71d8e66cc..b4b97892bfe 100644 --- a/code/game/asteroid/asteroid.dm +++ b/code/game/asteroid/asteroid.dm @@ -2,7 +2,7 @@ var/global/max_secret_rooms = 3 - +/* proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 or null - random, 1 - nothing, 2 - iron, 3 - silicon if(!size) size = pick(100;2,50;3,35;4,25;6,10;12) @@ -43,7 +43,8 @@ proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 max_secret_rooms-- return 1 - +*/ +/* /proc/populate_w_asteroids(var/z,var/density=null) if(!density) density = pick(10,20,40) @@ -55,7 +56,7 @@ proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 if(start_loc && spawn_asteroid(start_loc)) density-- return - +*/ //this is terrible! -Pete /* /datum/game_mode/proc/setup_sectors() @@ -79,7 +80,7 @@ proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 else break world << "\blue \b Randomization complete." -/* + //debug for(x=1,x<=global_map.len,x++) var/list/y_arr = global_map[x] @@ -92,7 +93,7 @@ proc/spawn_asteroid(var/turf/start_loc,var/type,var/size,var/richness)//type: 0 else t = "Empty Cold Space" world << "Global map [x] - [y] contains [t] (Z = [y_arr[y]])" //debug -*/ + return /datum/game_mode/proc/spawn_exporation_packs() diff --git a/code/game/cellautomata.dm b/code/game/cellautomata.dm index 5495d0a75bb..a2262008c14 100644 --- a/code/game/cellautomata.dm +++ b/code/game/cellautomata.dm @@ -113,8 +113,8 @@ src.update_status() master_controller = new /datum/controller/game_controller() - spawn(-1) - master_controller.setup() + spawn(-1) master_controller.setup() + lighting_controller.Initialize() return //Crispy fullban diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 89f9435483d..f2f6820ce01 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -344,7 +344,7 @@ set category = "Changeling" set name = "Regenerative Stasis (20)" - var/datum/changeling/changeling = changeling_power(20,0,100,UNCONSCIOUS) + var/datum/changeling/changeling = changeling_power(20,0,100,DEAD) if(!changeling) return changeling.chem_charges -= 20 diff --git a/code/game/gamemodes/changeling/modularchangling.dm b/code/game/gamemodes/changeling/modularchangling.dm index c49e0a72112..f62a485e9b0 100644 --- a/code/game/gamemodes/changeling/modularchangling.dm +++ b/code/game/gamemodes/changeling/modularchangling.dm @@ -27,8 +27,8 @@ var/list/datum/power/changeling/powerinstances = list() /datum/power/changeling/fakedeath name = "Regenerative Stasis" - desc = "We fake our death while we regenerate our form, even through death." - helptext = "Must be used before death." + desc = "We become weakened to a death-like state, where we will rise again from death." + helptext = "Can be used before or after death. Duration varies greatly." genomecost = 0 allowduringlesserform = 1 verbpath = /mob/proc/changeling_fakedeath @@ -56,7 +56,7 @@ var/list/datum/power/changeling/powerinstances = list() /datum/power/changeling/silence_sting name = "Silence Sting" desc = "We silently sting a human, completely silencing them for a short time." - helptext = "Does not provide a warning to a victim that they have been stung, until they try to speak and can not." + helptext = "Does not provide a warning to a victim that they have been stung, until they try to speak and cannot." genomecost = 2 allowduringlesserform = 1 verbpath = /mob/proc/changeling_silence_sting @@ -64,6 +64,7 @@ var/list/datum/power/changeling/powerinstances = list() /datum/power/changeling/transformation_sting name = "Transformation Sting" desc = "We silently sting a human, injecting a retrovirus that forces them to transform into another." + helptext = "Does not provide a warning to others. The victim will transform much like a changeling would." genomecost = 3 verbpath = /mob/proc/changeling_transformation_sting diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm index 52c80ec70d3..fdb374f3b8b 100644 --- a/code/game/gamemodes/cult/cult_structures.dm +++ b/code/game/gamemodes/cult/cult_structures.dm @@ -24,7 +24,7 @@ name = "Desk" desc = "A desk covered in arcane manuscripts and tomes in unknown languages. Looking at the text makes your skin crawl" icon_state = "tomealtar" - luminosity = 5 +// luminosity = 5 //sprites for this no longer exist -Pete //(they were stolen from another game anyway) diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 49341193c19..0763ae8025a 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -129,11 +129,12 @@ var/global/datum/controller/gameticker/ticker if(admins_number == 0) send2irc("Server", "Round just started with no admins online!") - spawn() supply_ticker() // Added to kick-off the supply shuttle regenerating points -- TLE + supply_shuttle.process() //Start the supply shuttle regenerating points -- TLE + master_controller.process() //Start master_controller.process() + lighting_controller.process() //Start processing DynamicAreaLighting updates - //Start master_controller.process() - spawn master_controller.process() - if (config.sql_enabled) + + if(config.sql_enabled) spawn(3000) statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE return 1 diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index c92bedb091e..0d7b054514b 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -87,6 +87,7 @@ /obj/var/req_one_access_txt = "0" /obj/New() + ..() //NOTE: If a room requires more than one access (IE: Morgue + medbay) set the req_acesss_txt to "5;6" if it requires 5 and 6 if(src.req_access_txt) var/list/req_access_str = dd_text2list(req_access_txt,";") @@ -106,7 +107,7 @@ if(n) req_one_access += n - ..() + //returns 1 if this mob has sufficient access to use this object /obj/proc/allowed(mob/M) diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index eb037aed6e9..67c8cbeb939 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -3,6 +3,7 @@ /obj/machinery/bot icon = 'icons/obj/aibots.dmi' layer = MOB_LAYER + luminosity = 2 var/obj/item/weapon/card/id/botcard // the ID card that the bot "holds" var/on = 1 var/health = 0 //do not forget to set health for your bot! diff --git a/code/game/machinery/camera.dm b/code/game/machinery/camera.dm index d9bd72a9a34..b8b9ba8e106 100644 --- a/code/game/machinery/camera.dm +++ b/code/game/machinery/camera.dm @@ -165,7 +165,7 @@ network = null //Not the best way but it will do. I think. cameranet.removeCamera(src) stat |= EMPED - sd_SetLuminosity(0) + SetLuminosity(0) spawn(900) network = initial(network) icon_state = initial(icon_state) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index cf6e0d9ee01..8ad5a30b9fb 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1207,8 +1207,7 @@ About the new airlock wires panel: src.density = 0 update_icon() - if(!glass) - src.sd_SetOpacity(0) + src.SetOpacity(0) //ugh...lots of lag for something so trivial src.operating = 0 return user << "\red You need to be wielding the Fire axe to do that." @@ -1224,8 +1223,7 @@ About the new airlock wires panel: src.density = 0 update_icon() - if(!glass) - src.sd_SetOpacity(0) + src.SetOpacity(0) //ugh...lots of lag for something so trivial src.operating = 0 return @@ -1243,8 +1241,7 @@ About the new airlock wires panel: sleep(15) update_icon() - if((src.visible) && (!glass)) - src.sd_SetOpacity(1) + src.SetOpacity(initial(opacity)) src.operating = 0 else user << "\red You need to be wielding the Fire axe to do that." @@ -1258,8 +1255,7 @@ About the new airlock wires panel: sleep(15) update_icon() - if((src.visible) && (!glass)) - src.sd_SetOpacity(1) + src.SetOpacity(initial(opacity)) src.operating = 0 else diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 9694e5708df..60421d31490 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -204,12 +204,12 @@ animate("opening") icon_state = "door0" - src.sd_SetOpacity(0) + src.SetOpacity(0) sleep(10) src.layer = 2.7 src.density = 0 update_icon() - src.sd_SetOpacity(0) +// src.SetOpacity(0) update_nearby_tiles() if(operating) operating = 0 @@ -235,8 +235,7 @@ sleep(10) update_icon() - if(visible && !glass) - src.sd_SetOpacity(1) + src.SetOpacity(initial(opacity)) operating = 0 update_nearby_tiles() return diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index 290c3ea02f5..60253441a26 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -20,9 +20,9 @@ src.operating = 1 flick("pdoorc0", src) src.icon_state = "pdoor0" + src.SetOpacity(0) sleep(15) src.density = 0 - src.sd_SetOpacity(0) src.operating = 0 return return @@ -36,9 +36,9 @@ src.operating = 1 flick("pdoorc0", src) src.icon_state = "pdoor0" + src.SetOpacity(0) sleep(10) src.density = 0 - src.sd_SetOpacity(0) update_nearby_tiles() if(operating == 1) //emag again @@ -55,15 +55,14 @@ flick("pdoorc1", src) src.icon_state = "pdoor1" src.density = 1 - if (src.visible) - src.sd_SetOpacity(1) + src.SetOpacity(initial(opacity)) update_nearby_tiles() sleep(10) src.operating = 0 return - +/* /obj/machinery/door/poddoor/two_tile_hor/open() if (src.operating == 1) //doors can still open when emag-disabled return @@ -73,14 +72,14 @@ src.operating = 1 flick("pdoorc0", src) src.icon_state = "pdoor0" + src.SetOpacity(0) + f1.SetOpacity(0) + f2.SetOpacity(0) + sleep(10) src.density = 0 - src.sd_SetOpacity(0) - f1.density = 0 - f1.sd_SetOpacity(0) f2.density = 0 - f2.sd_SetOpacity(0) update_nearby_tiles() @@ -97,18 +96,18 @@ src.operating = 1 flick("pdoorc1", src) src.icon_state = "pdoor1" + src.density = 1 - f1.density = 1 - f1.sd_SetOpacity(1) f2.density = 1 - f2.sd_SetOpacity(1) - - if (src.visible) - src.sd_SetOpacity(1) - update_nearby_tiles() sleep(10) + src.SetOpacity(initial(opacity)) + f1.SetOpacity(initial(opacity)) + f2.SetOpacity(initial(opacity)) + + update_nearby_tiles() + src.operating = 0 return @@ -370,7 +369,7 @@ del f3 del f4 ..() - +*/ /obj/machinery/door/poddoor/filler_object name = "" icon_state = "" \ No newline at end of file diff --git a/code/game/machinery/doors/shutters.dm b/code/game/machinery/doors/shutters.dm index 9f2b447ab92..2734b632d7d 100644 --- a/code/game/machinery/doors/shutters.dm +++ b/code/game/machinery/doors/shutters.dm @@ -11,15 +11,15 @@ src.add_fingerprint(user) if (!( istype(C, /obj/item/weapon/crowbar) || (istype(C, /obj/item/weapon/twohanded/fireaxe) && C:wielded == 1) )) return - if ((src.density && (stat & NOPOWER) && !( src.operating ))) - spawn( 0 ) - src.operating = 1 + if(src.density && (stat & NOPOWER) && !src.operating) + operating = 1 + spawn(-1) flick("shutterc0", src) - src.icon_state = "shutter0" + icon_state = "shutter0" sleep(15) - src.density = 0 - src.sd_SetOpacity(0) - src.operating = 0 + density = 0 + SetOpacity(0) + operating = 0 return return @@ -28,20 +28,20 @@ return if (!ticker) return 0 - if(!src.operating) //in case of emag - src.operating = 1 + if(!operating) //in case of emag + operating = 1 flick("shutterc0", src) src.icon_state = "shutter0" sleep(10) src.density = 0 - src.sd_SetOpacity(0) + SetOpacity(0) update_nearby_tiles() if(operating == 1) //emag again - src.operating = 0 + operating = 0 if(autoclose) spawn(150) - autoclose() + autoclose() //TODO: note to self: look into this ~Carn return 1 /obj/machinery/door/poddoor/shutters/close() @@ -51,8 +51,8 @@ flick("shutterc1", src) src.icon_state = "shutter1" src.density = 1 - if (src.visible) - src.sd_SetOpacity(1) + if(src.visible) + SetOpacity(1) update_nearby_tiles() sleep(10) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 6a237f26f8a..e37762fa488 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -106,7 +106,7 @@ sleep(10) src.density = 0 - src.sd_SetOpacity(0) +// src.sd_SetOpacity(0) //TODO: why is this here? Opaque windoors? ~Carn update_nearby_tiles() if(operating == 1) //emag again @@ -122,8 +122,8 @@ src.icon_state = text("[]", src.base_state) src.density = 1 - if (src.visible) - src.sd_SetOpacity(1) +// if(src.visible) +// SetOpacity(1) //TODO: why is this here? Opaque windoors? ~Carn update_nearby_tiles() sleep(10) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 447d4e80aff..ac2ec0da461 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -22,19 +22,20 @@ base_state = "pflash" density = 1 +/* /obj/machinery/flasher/New() - sleep(4) + sleep(4) //<--- What the fuck are you doing? D= src.sd_SetLuminosity(2) - +*/ /obj/machinery/flasher/power_change() if ( powered() ) stat &= ~NOPOWER icon_state = "[base_state]1" - src.sd_SetLuminosity(2) +// src.sd_SetLuminosity(2) else stat |= ~NOPOWER icon_state = "[base_state]1-p" - src.sd_SetLuminosity(0) +// src.sd_SetLuminosity(0) //Don't want to render prison breaks impossible /obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 0aea3b5cb8b..671f9a2feed 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -11,6 +11,7 @@ Possible to do for anyone motivated enough: Give an AI variable for different hologram icons. Itegrate EMP effect to disable the unit. */ + /obj/machinery/hologram/holopad/attack_hand(var/mob/living/carbon/human/user) //Carn: Hologram requests. if(!istype(user)) return @@ -70,10 +71,10 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ hologram.icon = A.holo_icon hologram.mouse_opacity = 0//So you can't click on it. hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them. - hologram.sd_SetLuminosity(1)//To make it glowy. hologram.anchored = 1//So space wind cannot drag it. hologram.name = "AI hologram"//If someone decides to right click. - sd_SetLuminosity(1)//To make the pad glowy. + hologram.SetLuminosity(2) //hologram lighting + SetLuminosity(2) //pad lighting icon_state = "holopad1" A.current = src master = A//AI is the master. @@ -81,12 +82,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.sd_SetLuminosity(0)//Clear lighting. +// hologram.SetLuminosity(0)//Clear lighting. //handled by the lighting controller when its ower is deleted del(hologram)//Get rid of hologram. if(master.current == src) master.current = null master = null//Null the master, since no-one is using it now. - sd_SetLuminosity(0)//Clear lighting for the parent. + SetLuminosity(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 diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm index f0cede8d291..34d2743ce99 100644 --- a/code/game/machinery/hydroponics.dm +++ b/code/game/machinery/hydroponics.dm @@ -176,14 +176,11 @@ obj/machinery/hydroponics/proc/updateicon() if(src.harvest) overlays += image('icons/obj/hydroponics.dmi', icon_state="over_harvest3") - if(myseed) - if(luminosity && !istype(myseed,/obj/item/seeds/glowshroom)) //revert luminosity to 0 - sd_SetLuminosity(0) - else if(!luminosity && istype(myseed,/obj/item/seeds/glowshroom)) //update luminosity - sd_SetLuminosity(myseed.potency/10) + if(!luminosity) + if(istype(myseed,/obj/item/seeds/glowshroom)) + SetLuminosity(round(myseed.potency/10)) else - if(luminosity) - sd_SetLuminosity(0) + SetLuminosity(0) return @@ -978,7 +975,6 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) updateicon() /////////////////////////////////////////////////////////////////////////////// - /obj/machinery/hydroponics/soil //Not actually hydroponics at all! Honk! name = "soil" icon = 'icons/obj/hydroponics.dmi' @@ -1003,12 +999,9 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob) else overlays += image('icons/obj/hydroponics.dmi', icon_state="[src.myseed.species]-grow[src.myseed.growthstages]") - if(myseed) - if(luminosity && !istype(myseed,/obj/item/seeds/glowshroom)) - sd_SetLuminosity(0) - else if(!luminosity && istype(myseed,/obj/item/seeds/glowshroom)) - sd_SetLuminosity(myseed.potency/10) + if(!luminosity) + if(istype(myseed,/obj/item/seeds/glowshroom)) + SetLuminosity(round(myseed.potency/10)) else - if(luminosity) - sd_SetLuminosity(0) + SetLuminosity(0) return \ No newline at end of file diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index fb3adac4044..7459a175edd 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -53,11 +53,11 @@ if ( powered() && disable == 0 ) stat &= ~NOPOWER icon_state = "[base_state]" - src.sd_SetLuminosity(2) +// src.sd_SetLuminosity(2) else stat |= ~NOPOWER icon_state = "[base_state]-p" - src.sd_SetLuminosity(0) +// src.sd_SetLuminosity(0) /obj/machinery/sparker/attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/device/detective_scanner)) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index d45f9361079..faef446796b 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -597,6 +597,7 @@ anchored = 1 density = 1 unacidable = 1 + luminosity = 3 var/needs_power = 0 var/active = 1 // var/power = 10 @@ -612,8 +613,6 @@ src.gen_secondary = B if(A && B) needs_power = 1 - spawn(1) - src.sd_SetLuminosity(3) /obj/machinery/shieldwall/attack_hand(mob/user as mob) return diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 74e83930d69..a7d8978f468 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -89,14 +89,14 @@ if(mode==4) // supply shuttle timer var/disp1 var/disp2 - if(supply_shuttle_moving) + if(supply_shuttle.moving) disp1 = "SPPLY" disp2 = get_supply_shuttle_timer() if(lentext(disp1) > 5) disp1 = "**~**" else - if(supply_shuttle_at_station) + if(supply_shuttle.at_station) disp1 = "SPPLY" disp2 = "STATN" else @@ -185,8 +185,8 @@ return "" proc/get_supply_shuttle_timer() - if(supply_shuttle_moving) - var/timeleft = round((supply_shuttle_time - world.timeofday) / 10,1) + if(supply_shuttle.moving) + var/timeleft = round((supply_shuttle.eta_timeofday - world.timeofday) / 10,1) return "[add_zero(num2text((timeleft / 60) % 60),2)]~[add_zero(num2text(timeleft % 60), 2)]" // note ~ translates into a blinking : return "" diff --git a/code/game/master_controller.dm b/code/game/master_controller.dm deleted file mode 100644 index d76e51681a1..00000000000 --- a/code/game/master_controller.dm +++ /dev/null @@ -1,219 +0,0 @@ -var/global/datum/controller/game_controller/master_controller //Set in world.New() -var/global/datum/failsafe/Failsafe -var/global/controllernum = "no" -var/global/controller_iteration = 0 - - -var/global/last_tick_timeofday = world.timeofday -var/global/last_tick_duration = 0 - -datum/controller/game_controller - var/processing = 1 - - var/global/air_master_ready = 0 - var/global/sun_ready = 0 - var/global/mobs_ready = 0 - var/global/diseases_ready = 0 - var/global/machines_ready = 0 - var/global/objects_ready = 0 - var/global/networks_ready = 0 - var/global/powernets_ready = 0 - var/global/ticker_ready = 0 - - //Used for MC 'proc break' debugging - var/global/obj/last_obj_processed - var/global/datum/disease/last_disease_processed - var/global/obj/machinery/last_machine_processed - var/global/mob/last_mob_processed - - - proc/setup() - if(master_controller && (master_controller != src)) - del(src) - return - //There can be only one master. - - if(!air_master) - air_master = new /datum/controller/air_system() - air_master.setup() - - if(!job_master) - job_master = new /datum/controller/occupations() - if(job_master.SetupOccupations()) - world << "\red \b Job setup complete" - job_master.LoadJobs("config/jobs.txt") - - world.tick_lag = config.Ticklag - - createRandomZlevel() - - setup_objects() - - setupgenetics() - - - for(var/i = 0, i < max_secret_rooms, i++) - make_mining_asteroid_secret() - - syndicate_code_phrase = generate_code_phrase()//Sets up code phrase for traitors, for the round. - syndicate_code_response = generate_code_phrase() - - emergency_shuttle = new /datum/shuttle_controller/emergency_shuttle() - - if(!ticker) - ticker = new /datum/controller/gameticker() - - setupfactions() - - spawn - ticker.pregame() - - proc/setup_objects() - world << "\red \b Initializing objects" - sleep(-1) - - for(var/obj/object in world) - object.initialize() - - world << "\red \b Initializing pipe networks" - sleep(-1) - - for(var/obj/machinery/atmospherics/machine in world) - machine.build_network() - - world << "\red \b Initializing atmos machinery." - sleep(-1) - for(var/obj/machinery/atmospherics/unary/vent_pump/T in world) - T.broadcast_status() - for(var/obj/machinery/atmospherics/unary/vent_scrubber/T in world) - T.broadcast_status() - - world << "\red \b Initializations complete." - - - proc/process() - - var/currenttime = world.timeofday - var/diff = (currenttime - last_tick_timeofday) / 10 - last_tick_timeofday = currenttime - last_tick_duration = diff - - if(!processing) - return 0 - controllernum = "yes" - spawn (100) - controllernum = "no" - - controller_iteration++ - - var/start_time = world.timeofday - - air_master_ready = 0 - sun_ready = 0 - mobs_ready = 0 - diseases_ready = 0 - machines_ready = 0 - objects_ready = 0 - networks_ready = 0 - powernets_ready = 0 - ticker_ready = 0 - - spawn(0) - air_master.process() - air_master_ready = 1 - - sleep(1) - - spawn(0) - sun.calc_position() - sun_ready = 1 - - sleep(-1) - - spawn(0) - for(var/mob/M in world) - last_mob_processed = M - M.Life() - mobs_ready = 1 - - - - sleep(-1) - - - spawn(0) - for(var/datum/disease/D in active_diseases) - last_disease_processed = D - D.process() - diseases_ready = 1 - - spawn(0) - for(var/obj/machinery/machine in machines) - if(machine) - last_machine_processed = machine - machine.process() - if(machine && machine.use_power) - machine.auto_use_power() - - machines_ready = 1 - - sleep(-1) - sleep(1) - - spawn(0) - for(var/obj/object in processing_objects) - last_obj_processed = object - object.process() - objects_ready = 1 - - spawn(0) - for(var/datum/pipe_network/network in pipe_networks) - network.process() - networks_ready = 1 - - spawn(0) - for(var/datum/powernet/P in powernets) - P.reset() - powernets_ready = 1 - - sleep(-1) - - spawn(0) - ticker.process() - ticker_ready = 1 - - sleep(world.timeofday+12-start_time) - - var/IL_check = 0 //Infinite loop check (To report when the master controller breaks.) - while(!air_master_ready || !sun_ready || !mobs_ready || !diseases_ready || !machines_ready || !objects_ready || !networks_ready || !powernets_ready || !ticker_ready) - IL_check++ - if(IL_check > 600) - var/MC_report = "air_master_ready = [air_master_ready]; sun_ready = [sun_ready]; mobs_ready = [mobs_ready]; diseases_ready = [diseases_ready]; machines_ready = [machines_ready]; objects_ready = [objects_ready]; networks_ready = [networks_ready]; powernets_ready = [powernets_ready]; ticker_ready = [ticker_ready];" - message_admins("PROC BREAKAGE WARNING: The game's master contorller appears to be stuck in one of it's cycles. It has looped through it's delaying loop [IL_check] times.") - message_admins("The master controller reports: [MC_report]") - if(!diseases_ready) - if(last_disease_processed) - message_admins("DISEASE PROCESSING stuck on [last_disease_processed]", 0, 1) - else - message_admins("DISEASE PROCESSING stuck on unknown") - if(!machines_ready) - if(last_machine_processed) - message_admins("MACHINE PROCESSING stuck on [last_machine_processed]", 0, 1) - else - message_admins("MACHINE PROCESSING stuck on unknown") - if(!objects_ready) - if(last_obj_processed) - message_admins("OBJ PROCESSING stuck on [last_obj_processed]", 0, 1) - else - message_admins("OBJ PROCESSING stuck on unknown") - log_admin("PROC BREAKAGE WARNING: infinite_loop_check = [IL_check]; [MC_report];") - message_admins("Master controller breaking out of delaying loop. Restarting the round is advised if problem persists. DO NOT manually restart the master controller.") - break; - sleep(1) - - - spawn - process() - - - return 1 \ No newline at end of file diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 3d175a441e1..0f66460a520 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -944,14 +944,11 @@ set category = "Exosuit Interface" set src = usr.loc set popup_menu = 0 - if(usr!=src.occupant) - return + if(usr!=occupant) return lights = !lights - if(lights) - src.sd_SetLuminosity(src.luminosity + src.lights_power) - else - src.sd_SetLuminosity(src.luminosity - src.lights_power) - src.log_message("Toggled lights.") + if(lights) SetLuminosity(luminosity + lights_power) + else SetLuminosity(luminosity - lights_power) + log_message("Toggled lights.") return diff --git a/code/game/objects/devices/PDA/PDA.dm b/code/game/objects/devices/PDA/PDA.dm index 9a6a82d0826..466125addb1 100644 --- a/code/game/objects/devices/PDA/PDA.dm +++ b/code/game/objects/devices/PDA/PDA.dm @@ -193,20 +193,19 @@ var/global/list/obj/item/device/pda/PDAs = list() * The Actual PDA */ /obj/item/device/pda/pickup(mob/user) - if (fon) - sd_SetLuminosity(0) - user.total_luminosity += f_lum + if(fon) + SetLuminosity(0) + user.SetLuminosity(user.luminosity + f_lum) /obj/item/device/pda/dropped(mob/user) - if (fon) - user.total_luminosity -= f_lum - sd_SetLuminosity(f_lum) + if(fon) + user.SetLuminosity(user.luminosity - f_lum) + SetLuminosity(f_lum) /obj/item/device/pda/New() ..() PDAs += src - spawn(3) - if (default_cartridge) + if(default_cartridge) cartridge = new default_cartridge(src) /obj/item/device/pda/proc/can_use() @@ -496,14 +495,14 @@ var/global/list/obj/item/device/pda/PDAs = list() //MAIN FUNCTIONS=================================== if("Light") - fon = (!fon) - if (src in U.contents) - if (fon) - U.total_luminosity += f_lum - else - U.total_luminosity -= f_lum + if(fon) + fon = 0 + if(src in U.contents) U.SetLuminosity(U.luminosity - f_lum) + else SetLuminosity(0) else - sd_SetLuminosity(fon * f_lum) + fon = 1 + if(src in U.contents) U.SetLuminosity(U.luminosity + f_lum) + else SetLuminosity(f_lum) if("Medical Scan") if(scanmode == 1) scanmode = 0 diff --git a/code/game/objects/devices/PDA/cart.dm b/code/game/objects/devices/PDA/cart.dm index 76c4ed01ae3..5be8dbfa97b 100644 --- a/code/game/objects/devices/PDA/cart.dm +++ b/code/game/objects/devices/PDA/cart.dm @@ -468,17 +468,17 @@ Code: menu = "

Supply Record Interlink

" menu += "
Supply shuttle
" - menu += "Location: [supply_shuttle_moving ? "Moving to station ([supply_shuttle_timeleft] Mins.)":supply_shuttle_at_station ? "Station":"Dock"]
" + menu += "Location: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Dock"]
" menu += "Current approved orders:
    " - for(var/S in supply_shuttle_shoppinglist) + for(var/S in supply_shuttle.shoppinglist) var/datum/supply_order/SO = S - menu += "
  1. [SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]
  2. " + menu += "
  3. #[SO.ordernum] - [SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]
  4. " menu += "
" menu += "Current requests:
    " - for(var/S in supply_shuttle_requestlist) + for(var/S in supply_shuttle.requestlist) var/datum/supply_order/SO = S - menu += "
  1. [SO.object.name] requested by [SO.orderedby]
  2. " + menu += "
  3. #[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]
  4. " menu += "
Upgrade NOW to Space Parts & Space Vendors PLUS for full remote order control and inventory management." if (48) //mulebot control diff --git a/code/game/objects/devices/flashlight.dm b/code/game/objects/devices/flashlight.dm index c42462c4558..db81d5233d7 100644 --- a/code/game/objects/devices/flashlight.dm +++ b/code/game/objects/devices/flashlight.dm @@ -18,25 +18,24 @@ ..() if (on) icon_state = icon_on - src.sd_SetLuminosity(brightness_on) + src.SetLuminosity(brightness_on) else icon_state = icon_off - src.sd_SetLuminosity(0) + src.SetLuminosity(0) /obj/item/device/flashlight/proc/update_brightness(var/mob/user = null) - if (on) + if(on) icon_state = icon_on if(src.loc == user) - user.total_luminosity += brightness_on - else if (isturf(src.loc)) - src.sd_SetLuminosity(brightness_on) - + user.SetLuminosity(user.luminosity + brightness_on) + else if(isturf(loc)) + SetLuminosity(brightness_on) else icon_state = icon_off if(src.loc == user) - user.total_luminosity -= brightness_on - else if (isturf(src.loc)) - src.sd_SetLuminosity(0) + user.SetLuminosity(user.luminosity - brightness_on) + else if(isturf(loc)) + SetLuminosity(0) /obj/item/device/flashlight/attack_self(mob/user) if(!isturf(user.loc)) @@ -85,14 +84,14 @@ /obj/item/device/flashlight/pickup(mob/user) if(on) - user.total_luminosity += brightness_on - src.sd_SetLuminosity(0) + user.SetLuminosity(user.luminosity + brightness_on) + SetLuminosity(0) /obj/item/device/flashlight/dropped(mob/user) if(on) - user.total_luminosity -= brightness_on - src.sd_SetLuminosity(brightness_on) + user.SetLuminosity(user.luminosity - brightness_on) + SetLuminosity(brightness_on) /obj/item/device/flashlight/pen diff --git a/code/game/objects/devices/powersink.dm b/code/game/objects/devices/powersink.dm index 330790ace83..7e4a6d89958 100644 --- a/code/game/objects/devices/powersink.dm +++ b/code/game/objects/devices/powersink.dm @@ -50,7 +50,7 @@ for(var/mob/M in viewers(user)) if(M == user) continue M << "[user] detaches the power sink from the cable." - sd_SetLuminosity(0) + SetLuminosity(0) icon_state = "powersink0" return @@ -85,7 +85,7 @@ if(M == user) continue M << "[user] deactivates the power sink!" mode = 1 - sd_SetLuminosity(0) + SetLuminosity(0) icon_state = "powersink0" processing_objects.Remove(src) @@ -93,9 +93,7 @@ if(attached) var/datum/powernet/PN = attached.get_powernet() if(PN) - if(!luminosity) - sd_SetLuminosity(12) - + SetLuminosity(12) // found a powernet, so drain up to max power from it diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index 341b30c1699..fc6eaac744b 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -175,6 +175,7 @@ icon_state = "weednode" name = "purple sac" desc = "Weird purple octopus-like thing." + luminosity = NODERANGE /obj/effect/alien/weeds/New() ..() @@ -187,11 +188,6 @@ Life() return -/obj/effect/alien/weeds/node/New() - ..() - sd_SetLuminosity(NODERANGE) - return - /obj/effect/alien/weeds/proc/Life() set background = 1 var/turf/U = get_turf(src) diff --git a/code/game/objects/effects/decals/blood.dm b/code/game/objects/effects/decals/blood.dm index da37b28f3de..9cf16281c08 100644 --- a/code/game/objects/effects/decals/blood.dm +++ b/code/game/objects/effects/decals/blood.dm @@ -60,7 +60,5 @@ New() ..() - sd_SetLuminosity(1) - spawn(1200) // 2 minutes del(src) \ No newline at end of file diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index a2e19d19a3e..23ee3d3f6aa 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -936,7 +936,7 @@ steam.start() -- spawns the effect icon = 'icons/effects/effects.dmi' icon_state = "metalfoam" density = 1 - opacity = 0 // changed in New() + opacity = 1 // changed in New() anchored = 1 name = "foamed metal" desc = "A lightweight foamed metal wall." @@ -945,11 +945,11 @@ steam.start() -- spawns the effect New() ..() update_nearby_tiles(1) - spawn(1) - sd_NewOpacity(1) + + Del() - sd_NewOpacity(0) + density = 0 update_nearby_tiles(1) ..() diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm index 9a04308ccf7..9dd3c79c711 100644 --- a/code/game/objects/effects/glowshroom.dm +++ b/code/game/objects/effects/glowshroom.dm @@ -21,7 +21,7 @@ spreadChance = 0 /obj/effect/glowshroom/New() - set background = 1 + ..() dir = CalcDir() @@ -40,11 +40,9 @@ else //if on the floor, glowshroom on-floor sprite icon_state = "glowshroomf" - spawn(2) //allows the luminosity and spread rate to be affected by potency at the moment of creation - sd_SetLuminosity(potency/10) - spawn(delay) - if(src) - Spread() + spawn(delay) + SetLuminosity(round(potency/10)) + Spread() /obj/effect/glowshroom/proc/Spread() set background = 1 diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 0a5b91648fc..bd62085c2fd 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -20,6 +20,10 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa playsound(epicenter, 'sound/effects/explosionfar.ogg', 100, 1, round(devastation_range*2,1) ) playsound(epicenter, "explosion", 100, 1, round(devastation_range,1) ) + + 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 @@ -49,11 +53,15 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa for(var/atom/object in T.contents) object.ex_act(dist) - if(defer_powernet_rebuild != 2) - defer_powernet_rebuild = 0 - //here util we get explosions to be less laggy, might help us identify issues after changes to splosions (because let's face it we've had a few) - world.log << "## Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [(world.timeofday-start)/10] seconds." + world.log << "## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [(world.timeofday-start)/10] seconds." + + sleep(10) + + 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 return 1 diff --git a/code/game/objects/explosion2.dm b/code/game/objects/explosion2.dm index a50a6f5e32d..a1f2687cc85 100644 --- a/code/game/objects/explosion2.dm +++ b/code/game/objects/explosion2.dm @@ -1,4 +1,6 @@ //TODO: Flash range does nothing currently +//NOTE: This has not yet been updated with the lighting deferal stuff. ~Carn +//Needs some work anyway. proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1) spawn(0) diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index 0326ca13b27..ec0677a063c 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -52,7 +52,7 @@ //src.damtype = "fire" for(var/mob/O in viewers(usr, null)) O.show_message(flavor_text, 1) - sd_SetLuminosity(CANDLE_LUM) + SetLuminosity(CANDLE_LUM) processing_objects.Add(src) @@ -75,17 +75,17 @@ if(lit) lit = 0 update_icon() - sd_SetLuminosity(0) - user.total_luminosity -= CANDLE_LUM + SetLuminosity(0) + user.SetLuminosity(user.luminosity - CANDLE_LUM) pickup(mob/user) if(lit) - src.sd_SetLuminosity(0) - user.total_luminosity += CANDLE_LUM + SetLuminosity(0) + user.SetLuminosity(user.luminosity + CANDLE_LUM) dropped(mob/user) if(lit) - user.total_luminosity -= CANDLE_LUM - src.sd_SetLuminosity(CANDLE_LUM) + user.SetLuminosity(user.luminosity - CANDLE_LUM) + SetLuminosity(CANDLE_LUM) diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index dd2d99bebef..15819021ec9 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -106,9 +106,6 @@ ZIPPO if(M.lit > 0) light("\red [user] lights their [name] with their [W].") - else if(istype(W, /obj/item/device/assembly/igniter)) - light("\red [user] fiddles with [W], and manages to light their [name].") - //can't think of any other way to update the overlays :< user.update_inv_wear_mask(0) user.update_inv_l_hand(0) @@ -448,7 +445,7 @@ ZIPPO for(var/mob/O in viewers(user, null)) O.show_message("\red After a few attempts, [user] manages to light the [src], they however burn their finger in the process.", 1) - user.total_luminosity += 2 + user.SetLuminosity(user.luminosity + 2) processing_objects.Add(src) else src.lit = 0 @@ -461,7 +458,7 @@ ZIPPO for(var/mob/O in viewers(user, null)) O.show_message("\red [user] quietly shuts off the [src].", 1) - user.total_luminosity -= 2 + user.SetLuminosity(user.luminosity - 2) processing_objects.Remove(src) else return ..() @@ -490,13 +487,13 @@ ZIPPO pickup(mob/user) if(lit) - src.sd_SetLuminosity(0) - user.total_luminosity += 2 + src.SetLuminosity(0) + user.SetLuminosity(user.luminosity+2) return dropped(mob/user) if(lit) - user.total_luminosity -= 2 - src.sd_SetLuminosity(2) + user.SetLuminosity(user.luminosity-2) + src.SetLuminosity(2) return diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index d7179a54f54..6bb4addccea 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -134,8 +134,8 @@ w_class = 2.0 force_unwielded = 3 force_wielded = 30 - wieldsound = 'saberon.ogg' - unwieldsound = 'saberoff.ogg' + wieldsound = 'sound/weapons/saberon.ogg' + unwieldsound = 'sound/weapons/saberoff.ogg' flags = FPRINT | TABLEPASS | NOSHIELD origin_tech = "magnets=3;syndicate=4" attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index dbb931758a8..33e4e4b961a 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -470,20 +470,14 @@ obj/structure/meteorhit(obj/O as obj) flick("[mineral]fwall_opening", src) sleep(15) src.density = 0 - src.sd_SetOpacity(0) - var/turf/T = src.loc - T.sd_LumReset() - + SetOpacity(0) else flick("[mineral]fwall_closing", src) icon_state = "[mineral]0" sleep(15) src.density = 1 - src.sd_SetOpacity(1) - var/turf/T = src.loc - //T.sd_LumUpdate() + SetOpacity(1) src.relativewall() - T.sd_LumReset() /obj/structure/falsewall/uranium/attack_hand(mob/user as mob) radiate() @@ -583,27 +577,21 @@ obj/structure/meteorhit(obj/O as obj) icon_state = "frwall_open" flick("frwall_opening", src) sleep(15) - src.density = 0 - src.sd_SetOpacity(0) - var/turf/T = src.loc - T.sd_LumReset() - + density = 0 + SetOpacity(0) else icon_state = "r_wall" flick("frwall_closing", src) sleep(15) - src.density = 1 - src.sd_SetOpacity(1) - var/turf/T = src.loc - //T.sd_LumUpdate() - src.relativewall() - T.sd_LumReset() + density = 1 + SetOpacity(1) + relativewall() attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/screwdriver)) var/turf/T = get_turf(src) - user.visible_message("[user] tightens some bolts on the r wall.", "You tighten the bolts on the r wall.") + user.visible_message("[user] tightens some bolts on the r wall.", "You tighten the bolts on the wall.") T.ReplaceWithWall() //Intentionally makes a regular wall instead of an r-wall (no cheap r-walls for you). del(src) diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 4b2a2972f01..b73ab697928 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -198,10 +198,7 @@ /obj/structure/mineral_door/uranium mineralType = "uranium" hardness = 3 - - New() - ..() - sd_SetLuminosity(3) + luminosity = 2 /obj/structure/mineral_door/sandstone mineralType = "sandstone" diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index c75a13022c7..94f3e3123c5 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1,24 +1,10 @@ //Config stuff #define SUPPLY_DOCKZ 2 //Z-level of the Dock. #define SUPPLY_STATIONZ 1 //Z-level of the Station. -#define SUPPLY_POINTSPER 10 //Points per tick. -#define SUPPLY_POINTDELAY 3000 //Delay between ticks in milliseconds. -#define SUPPLY_MOVETIME 1200 //Time to station is milliseconds. -#define SUPPLY_POINTSPERCRATE 5 //Points per crate sent back. #define SUPPLY_STATION_AREATYPE "/area/supply/station" //Type of the supply shuttle area for station #define SUPPLY_DOCK_AREATYPE "/area/supply/dock" //Type of the supply shuttle area for dock -#define SUPPLY_POINTSPERSLIP 2 //points per packing slip sent back stamped. -var/supply_shuttle_moving = 0 -var/supply_shuttle_at_station = 0 -var/list/supply_shuttle_shoppinglist = new/list() -var/list/supply_shuttle_requestlist = new/list() -var/supply_shuttle_can_send = 1 -var/supply_shuttle_time = 0 -var/supply_shuttle_timeleft = 0 -var/supply_shuttle_points = 50 -var/ordernum=0 -var/supplyshuttle_mech_redeem = 0 //You can redeem a full set of mech toys for a reward. +var/datum/controller/supply_shuttle/supply_shuttle = new() var/list/mechtoys = list( /obj/item/toy/prize/ripley, @@ -34,18 +20,18 @@ var/list/mechtoys = list( /obj/item/toy/prize/phazon ) -/area/supply/station //DO NOT TURN THE SD_LIGHTING STUFF ON FOR SHUTTLES. IT BREAKS THINGS. +/area/supply/station //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. name = "supply shuttle" icon_state = "shuttle3" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 requires_power = 0 -/area/supply/dock //DO NOT TURN THE SD_LIGHTING STUFF ON FOR SHUTTLES. IT BREAKS THINGS. +/area/supply/dock //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. name = "supply shuttle" icon_state = "shuttle3" luminosity = 1 - sd_lighting = 0 + lighting_use_dynamic = 0 requires_power = 0 //SUPPLY PACKS MOVED TO /code/defines/obj/supplypacks.dm @@ -84,13 +70,13 @@ var/list/mechtoys = list( desc = "Heavy duty, airtight, plastic flaps." New() //set the turf below the flaps to block air - var/turf/T = get_turf(src.loc) + var/turf/T = get_turf(loc) if(T) T.blocks_air = 1 ..() Del() //lazy hack to set the turf to allow air to pass if it's a simulated floor - var/turf/T = get_turf(src.loc) + var/turf/T = get_turf(loc) if(T) if(istype(T, /turf/simulated/floor)) T.blocks_air = 0 @@ -103,6 +89,7 @@ var/list/mechtoys = list( req_access = list(access_cargo) circuit = "/obj/item/weapon/circuitboard/supplycomp" var/temp = null + var/reqtime = 0 //Cooldown for requisitions - Quarxink var/hacked = 0 var/can_order_contraband = 0 @@ -114,6 +101,7 @@ var/list/mechtoys = list( var/temp = null var/reqtime = 0 //Cooldown for requisitions - Quarxink +/* /obj/effect/marker/supplymarker icon_state = "X" icon = 'icons/misc/mark.dmi' @@ -121,8 +109,10 @@ var/list/mechtoys = list( invisibility = 101 anchored = 1 opacity = 0 +*/ /datum/supply_order + var/ordernum var/datum/supply_packs/object = null var/orderedby = null var/comment = null @@ -138,212 +128,236 @@ var/list/mechtoys = list( var/hidden = 0 var/contraband = 0 -/proc/supply_ticker() - //world << "Supply ticker ticked : Adding [SUPPLY_POINTSPER] to [supply_shuttle_points]." - supply_shuttle_points += SUPPLY_POINTSPER - //world << "New SP total is [supply_shuttle_points]" - spawn(SUPPLY_POINTDELAY) supply_ticker() +/datum/controller/supply_shuttle + var/processing = 1 + var/processing_interval = 300 + var/iteration = 0 + //supply points + var/points = 50 + var/points_per_process = 1 + var/points_per_slip = 2 + var/points_per_crate = 5 + var/mech_redeem = 0 + //control + var/ordernum + var/list/shoppinglist = list() + var/list/requestlist = list() + var/list/supply_packs = list() + //shuttle movement + var/at_station = 0 + var/movetime = 1200 + var/moving = 0 + var/eta_timeofday + var/eta -/proc/supply_process() - while(supply_shuttle_time - world.timeofday > 0) - var/ticksleft = supply_shuttle_time - world.timeofday + New() + ordernum = rand(1,9000) + for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs)) + var/datum/supply_packs/P = new typepath() + supply_packs[P.name] = P - if(ticksleft > 1e5) - supply_shuttle_time = world.timeofday + 10 // midnight rollover + //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station + proc/process() + spawn(0) + set background = 1 + while(1) + if(processing) + iteration++ + points += points_per_process + + if(moving == 1) + var/ticksleft = (eta_timeofday - world.timeofday) + if(ticksleft > 0) + eta = round(ticksleft/600,1) + else + eta = 0 + send() - supply_shuttle_timeleft = round( ((ticksleft / 10)/60) ) - sleep(10) - supply_shuttle_moving = 0 - send_supply_shuttle() + sleep(processing_interval) + proc/send() + var/area/from + var/area/dest + var/area/the_shuttles_way + switch(at_station) + if(1) + from = locate(SUPPLY_STATION_AREATYPE) + dest = locate(SUPPLY_DOCK_AREATYPE) + the_shuttles_way = from + at_station = 0 + if(0) + from = locate(SUPPLY_DOCK_AREATYPE) + dest = locate(SUPPLY_STATION_AREATYPE) + the_shuttles_way = dest + at_station = 1 + moving = 0 -/proc/supply_can_move() - if(supply_shuttle_moving) return 0 + //Do I really need to explain this loop? + for(var/mob/living/unlucky_person in the_shuttles_way) + unlucky_person.gib() -//I know this is an absolutly horrendous way to do this, very inefficient, but it's the only reliable way I can think of. - //Check for mobs - for(var/mob/living/M in mob_list) - var/area/A = get_area(M) - if(!A || !A.type) continue - if(A.type == /area/supply/station) + from.move_contents_to(dest) + + //Check whether the shuttle is allowed to move + proc/can_move() + if(moving) return 0 + + var/area/shuttle = locate(/area/supply/station) + if(!shuttle) return 0 + + if(forbidden_atoms_check(shuttle)) return 0 - //Check for beacons - for(var/obj/item/device/radio/beacon/B in world) - var/area/A = get_area(B) - if(!A || !A.type) continue - if(A.type == /area/supply/station) - return 0 - //Check for mechs. I think this was added because people were somehow on centcomm and bringing back centcomm mechs. - for(var/obj/mecha/Mech in world) - var/area/A = get_area(Mech) - if(!A || !A.type) continue - if(A.type == /area/supply/station) - return 0 - //Check for nuke disk This also prevents multiple nuke disks from being made -Nodrak - for(var/obj/item/weapon/disk/nuclear/N) - var/area/A = get_area(N) - if(!A || !A.type) continue - if(A.type == /area/supply/station) - return 0 - return 1 -/* -Teleport beacon -> wrapping paper -> backpack -> bodybag -> crate -> wrapping paper -> loaded on a mulebot -That would be a teleport beacon inside of 6-layers deep in contents. Meaning you would have to add more loops or more checks. -This method wont take into account storage items developed in the future and doesn't take into account the storage items we have currently. --Nodrak - var/shuttleat = supply_shuttle_at_station ? SUPPLY_STATION_AREATYPE : SUPPLY_DOCK_AREATYPE + return 1 - for(var/turf/T in get_area_turfs(shuttleat) ) - //if((locate(/mob/living) in T) && (!locate(/mob/living/carbon/monkey) in T)) return 0 //old check for living excluded monkeys - if((locate(/mob/living) in T)) return 0 - if((locate(/obj/item/device/radio/beacon) in T)) return 0 - if((locate(/obj/mecha) in T)) return 0 - if((locate(/obj/structure/closet/body_bag) in T)) return 0 - for(var/atom/ATM in T) - if((locate(/mob/living) in ATM)) return 0 - if((locate(/obj/item/device/radio/beacon) in ATM)) return 0 - if((locate(/obj/mecha ) in ATM)) return 0 - if((locate(/obj/structure/closet/body_bag) in ATM)) return 0 - for(var/atom/ATMM in ATM) // okay jesus christ how many recursive packaging options are we going to have guys come on - Quarxink - if((locate(/mob/living) in ATMM)) return 0 - if((locate(/obj/item/device/radio/beacon) in ATMM)) return 0 - if((locate(/obj/mecha ) in ATMM)) return 0 - if((locate(/obj/structure/closet/body_bag) in ATMM)) return 0 - return 1 -*/ -/proc/sell_crates() - var/shuttleat = supply_shuttle_at_station ? SUPPLY_STATION_AREATYPE : SUPPLY_DOCK_AREATYPE + //To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. + proc/forbidden_atoms_check(atom/A) + if(istype(A,/mob/living)) + return 1 + if(istype(A,/obj/item/weapon/disk/nuclear)) + return 1 + if(istype(A,/obj/machinery/nuclearbomb)) + return 1 + if(istype(A,/obj/item/device/radio/beacon)) + return 1 - for(var/turf/T in get_area_turfs(shuttleat) ) - var/obj/item/weapon/paper/slip = locate(/obj/item/weapon/paper/manifest) in T - if(slip) - if(slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense - supply_shuttle_points += SUPPLY_POINTSPERSLIP - del(slip) - var/crate = locate(/obj/structure/closet/crate) in T - if(crate) - if(mechtoys) - var/toysfound = 0 - for(var/toytype in mechtoys) - if( !locate(toytype) in crate ) - break - else - toysfound++ - if(toysfound && toysfound == mechtoys.len) - supplyshuttle_mech_redeem++ - feedback_inc("supply_mech_collection_redeemed") - del(crate) - supply_shuttle_points += SUPPLY_POINTSPERCRATE + for(var/i=1, i<=A.contents.len, i++) + var/atom/B = A.contents[i] + if(.(B)) + return 1 + + //Sellin + proc/sell() + var/shuttle_at + if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE + else shuttle_at = SUPPLY_DOCK_AREATYPE + + var/area/shuttle = locate(shuttle_at) + if(!shuttle) return + + var/list/mechtoys_found = list() + + for(var/atom/movable/MA in shuttle) + if(MA.anchored) continue + if(istype(MA,/obj/structure/closet)) + points += points_per_crate + var/find_slip = 1 + + for(var/atom in MA) + var/atom/A = atom + if(find_slip && istype(A,/obj/item/weapon/paper/manifest)) + var/obj/item/weapon/paper/slip = A + if(slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense + points += points_per_slip + find_slip = 0 + continue + if(A.type in mechtoys) + mechtoys_found["[A.type]"]++ + del(MA) + + if(mechtoys && mechtoys.len && mechtoys_found.len >= mechtoys.len) + var/complete_sets = 10 + for(var/index in mechtoys_found) + complete_sets = min(complete_sets, mechtoys_found[index]) + + if(complete_sets) + mech_redeem += complete_sets + + //Buyin + proc/buy() + if(!shoppinglist.len) return + + var/shuttle_at + if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE + else shuttle_at = SUPPLY_DOCK_AREATYPE + + var/area/shuttle = locate(shuttle_at) + if(!shuttle) return + + var/list/clear_turfs = list() + + for(var/turf/T in shuttle) + if(T.density || T.contents.len) continue + clear_turfs += T + + for(var/S in shoppinglist) + if(!clear_turfs.len) break + var/i = rand(1,clear_turfs.len) + var/turf/pickedloc = clear_turfs[i] + clear_turfs.Cut(i,i+1) + + var/datum/supply_order/SO = S + var/datum/supply_packs/SP = SO.object + + var/atom/A = new SP.containertype(pickedloc) + A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]" + + //supply manifest generation begin + + var/obj/item/weapon/paper/manifest/slip = new /obj/item/weapon/paper/manifest(A) + slip.info = "

[command_name()] Shipping Manifest



" + slip.info +="Order #[SO.ordernum]
" + slip.info +="Destination: [station_name]
" + slip.info +="[supply_shuttle.shoppinglist.len] PACKAGES IN THIS SHIPMENT
" + slip.info +="CONTENTS:
    " + + //spawn the stuff, finish generating the manifest while you're at it + if(SP.access) + A:req_access = list() + A:req_access += text2num(SP.access) + for(var/B in SP.contains) + if(!B) continue + var/thepath = text2path(B) + var/atom/B2 = new thepath(A) + if(SP.amount && B2:amount) B2:amount = SP.amount + slip.info += "
  • [B2.name]
  • " //add the item to the manifest + + //manifest finalisation + slip.info += "

" + slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS
" + + while(0Supply shuttle
- Location: [supply_shuttle_moving ? "Moving to station ([supply_shuttle_timeleft] Mins.)":supply_shuttle_at_station ? "Station":"Dock"]
-
Supply points: [supply_shuttle_points]
+ Location: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Dock"]
+
Supply points: [supply_shuttle.points]

\nRequest items

View approved orders

View requests

@@ -357,103 +371,95 @@ This method wont take into account storage items developed in the future and doe if(..()) return - if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) + if( isturf(loc) && (in_range(src, usr) || istype(usr, /mob/living/silicon)) ) usr.machine = src - if (href_list["order"]) - src.temp = "Supply points: [supply_shuttle_points]


Request what?

" - for(var/S in (typesof(/datum/supply_packs) - /datum/supply_packs) ) - var/datum/supply_packs/N = new S() + if(href_list["order"]) + temp = "Supply points: [supply_shuttle.points]


Request what?

" + for(var/supply_name in supply_shuttle.supply_packs ) + var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name] if(N.hidden || N.contraband) continue //Have to send the type instead of a reference to - src.temp += "[N.name] Cost: [N.cost] " //the obj because it would get caught by the garbage - src.temp += "Print Requisition
" //collector. oh well. - src.temp += "
OK" + temp += "[supply_name] Cost: [N.cost]
" //the obj because it would get caught by the garbage + temp += "
OK" else if (href_list["doorder"]) - var/datum/supply_order/O = new/datum/supply_order () - var/supplytype = href_list["doorder"] - var/datum/supply_packs/P = new supplytype () + if(world.time < reqtime) + for(var/mob/V in hearers(src)) + V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") + return + + //Find the correct supply_pack datum + var/datum/supply_packs/P = supply_shuttle.supply_packs[href_list["doorder"]] + if(!istype(P)) return + + var/timeout = world.time + 600 + var/reason = copytext(sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text),1,MAX_MESSAGE_LEN) + if(world.time > timeout) return + if(!reason) reason = "*None Provided*" + + var/idname = "*None Provided*" + var/idrank = "*None Provided*" + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + idname = H.get_authentification_name() + idrank = H.get_assignment() + else if(issilicon(usr)) + idname = usr.real_name + + supply_shuttle.ordernum++ + var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc) + reqform.name = "Requisition Form - [P.name]" + reqform.info += "

[station_name] Supply Requisition Form


" + reqform.info += "INDEX: #[supply_shuttle.ordernum]
" + reqform.info += "REQUESTED BY: [idname]
" + reqform.info += "RANK: [idrank]
" + reqform.info += "REASON: [reason]
" + reqform.info += "SUPPLY CRATE TYPE: [P.name]
" + reqform.info += "CONTENTS:
    " + + for(var/B in P.contains) + var/thepath = text2path(B) + var/atom/B2 = new thepath() + reqform.info += "
  • [B2.name]
  • " + reqform.info += "

" + reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:
" + + reqform.update_icon() //Fix for appearing blank when printed. + reqtime = (world.time + 5) % 1e5 + + //make our supply_order datum + var/datum/supply_order/O = new /datum/supply_order() + O.ordernum = supply_shuttle.ordernum O.object = P - O.orderedby = usr.name - supply_shuttle_requestlist += O - src.temp = "Thanks for your request. The cargo team will process it as soon as possible.
" - src.temp += "
OK" + O.orderedby = idname + supply_shuttle.requestlist += O - else if (href_list["printform"]) - if (!reqtime) - var/supplytype = href_list["printform"] - var/datum/supply_packs/P = new supplytype () - var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(src.loc) - var/idname = "Unknown" - var/idrank = "Unknown" - var/reason = copytext(sanitize(input(usr,"Reason:","Why do you require this item?","")),1,MAX_MESSAGE_LEN) - if(!reason) - reason = "Unknown" + temp = "Thanks for your request. The cargo team will process it as soon as possible.
" + temp += "
OK" - reqform.name = "Requisition Form - [P.name]" - reqform.info += "

[station_name] Supply Requisition Form


" - - if (istype(usr:wear_id, /obj/item/weapon/card/id)) - if(usr:wear_id.registered_name) - idname = usr:wear_id.registered_name - if(usr:wear_id.assignment) - idrank = usr:wear_id.assignment - if (istype(usr:wear_id, /obj/item/device/pda)) - var/obj/item/device/pda/pda = usr:wear_id - if(pda.owner) - idname = pda.owner - if(pda.ownjob) - idrank = pda.ownjob - else - idname = usr.name - - reqform.info += "REQUESTED BY: [idname]
" - reqform.info += "RANK: [idrank]
" - reqform.info += "REASON: [reason]
" - reqform.info += "SUPPLY CRATE TYPE: [P.name]
" - reqform.info += "Contents:
    " - - for(var/B in P.contains) - var/thepath = text2path(B) - var/atom/B2 = new thepath () - reqform.info += "
  • [B2.name]
  • " - reqform.info += "

" - reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:
" - - reqform.update_icon() //Fix for appearing blank when printed. - reqtime = 5 //5 second cooldown initiated after each printed req, change the number to change the cooldown (in seconds) - Quarxink - spawn(0) - while(reqtime >=1 && src) - sleep(10) - reqtime -- - reqtime = 0 - - else - for (var/mob/V in hearers(src)) - V.show_message("[src]'s monitor flashes, \"[reqtime] seconds remaining until another requisition form may be printed.\"") else if (href_list["vieworders"]) - src.temp = "Current approved orders:

" - for(var/S in supply_shuttle_shoppinglist) + temp = "Current approved orders:

" + for(var/S in supply_shuttle.shoppinglist) var/datum/supply_order/SO = S - src.temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]
" - src.temp += "
OK" + temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]
" + temp += "
OK" else if (href_list["viewrequests"]) - src.temp = "Current requests:

" - for(var/S in supply_shuttle_requestlist) + temp = "Current requests:

" + for(var/S in supply_shuttle.requestlist) var/datum/supply_order/SO = S - src.temp += "[SO.object.name] requested by [SO.orderedby]
" - src.temp += "
OK" + temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]
" + temp += "
OK" else if (href_list["mainmenu"]) - src.temp = null + temp = null - src.add_fingerprint(usr) - src.updateUsrDialog() + add_fingerprint(usr) + updateUsrDialog() return /obj/machinery/computer/supplycomp/attack_hand(var/mob/user as mob) - if(!src.allowed(user)) + if(!allowed(user)) user << "\red Access Denied." return @@ -462,14 +468,14 @@ This method wont take into account storage items developed in the future and doe user.machine = src post_signal("supply") var/dat - if (src.temp) - dat = src.temp + if (temp) + dat = temp else dat += {"
Supply shuttle
- \nLocation: [supply_shuttle_moving ? "Moving to station ([supply_shuttle_timeleft] Mins.)":supply_shuttle_at_station ? "Station":"Away"]
-
\nSupply points: [supply_shuttle_points]
\n
- [supply_shuttle_moving ? "\n*Must be away to order items*
\n
":supply_shuttle_at_station ? "\n*Must be away to order items*
\n
":"\nOrder items
\n
"] - [supply_shuttle_moving ? "\n*Shuttle already called*
\n
":supply_shuttle_at_station ? "\nSend away
\n
":"\nSend to station
\n
"] + \nLocation: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Away"]
+
\nSupply points: [supply_shuttle.points]
\n
+ [supply_shuttle.moving ? "\n*Must be away to order items*
\n
":supply_shuttle.at_station ? "\n*Must be away to order items*
\n
":"\nOrder items
\n
"] + [supply_shuttle.moving ? "\n*Shuttle already called*
\n
":supply_shuttle.at_station ? "\nSend away
\n
":"\nSend to station
\n
"] \nView requests
\n
\nView orders
\n
\nClose"} @@ -481,18 +487,18 @@ This method wont take into account storage items developed in the future and doe /obj/machinery/computer/supplycomp/attackby(I as obj, user as mob) if(istype(I,/obj/item/weapon/card/emag) && !hacked) user << "\blue Special supplies unlocked." - src.hacked = 1 + hacked = 1 return if(istype(I, /obj/item/weapon/screwdriver)) - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) if(do_after(user, 20)) - if (src.stat & BROKEN) + if (stat & BROKEN) user << "\blue The broken glass falls out." - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) - new /obj/item/weapon/shard( src.loc ) + var/obj/structure/computerframe/A = new /obj/structure/computerframe( loc ) + new /obj/item/weapon/shard( loc ) var/obj/item/weapon/circuitboard/supplycomp/M = new /obj/item/weapon/circuitboard/supplycomp( A ) for (var/obj/C in src) - C.loc = src.loc + C.loc = loc A.circuit = M A.state = 3 A.icon_state = "3" @@ -500,172 +506,184 @@ This method wont take into account storage items developed in the future and doe del(src) else user << "\blue You disconnect the monitor." - var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc ) + var/obj/structure/computerframe/A = new /obj/structure/computerframe( loc ) var/obj/item/weapon/circuitboard/supplycomp/M = new /obj/item/weapon/circuitboard/supplycomp( A ) - if(src.can_order_contraband) + if(can_order_contraband) M.contraband_enabled = 1 for (var/obj/C in src) - C.loc = src.loc + C.loc = loc A.circuit = M A.state = 4 A.icon_state = "4" A.anchored = 1 del(src) else - src.attack_hand(user) + attack_hand(user) return /obj/machinery/computer/supplycomp/Topic(href, href_list) + if(!supply_shuttle) + world.log << "## ERROR: Eek. The supply_shuttle controller datum is missing somehow." + return if(..()) return - if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) + if(isturf(loc) && ( in_range(src, usr) || istype(usr, /mob/living/silicon) ) ) usr.machine = src - //From Station to Centcomm - if (href_list["sendtodock"]) - if(!supply_shuttle_at_station || supply_shuttle_moving) return + //Calling the shuttle + if(href_list["send"]) + if(!supply_shuttle.can_move()) + temp = "For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.

OK" - if (!supply_can_move()) - usr << "\red The supply shuttle can not transport station employees, exosuits, classified nuclear codes or homing beacons." - return + else if(supply_shuttle.at_station) + supply_shuttle.moving = -1 + supply_shuttle.sell() + supply_shuttle.send() + temp = "The supply shuttle has departed.

OK" + else + supply_shuttle.moving = 1 + supply_shuttle.buy() + supply_shuttle.eta_timeofday = (world.timeofday + supply_shuttle.movetime) % 864000 + temp = "The supply shuttle has been called and will arrive in [round(supply_shuttle.movetime/600,1)] minutes.

OK" + post_signal("supply") - src.temp = "Shuttle sent.

OK" - src.updateUsrDialog() - post_signal("supply") + else if (href_list["order"]) + if(supply_shuttle.moving) return + temp = "Supply points: [supply_shuttle.points]


Request what?

" - supply_shuttle_shoppinglist = null - supply_shuttle_shoppinglist = new/list() - - sell_crates() - - //Remove anything or anyone that was either left behind or that bypassed supply_can_move() -Nodrak - for(var/area/supply/station/A in world) - for(var/obj/item/I in A.contents) - del(I) - for(var/mob/living/M in A.contents) - del(M) - - send_supply_shuttle() - - //From Centcomm to Station - else if (href_list["sendtostation"]) - if(supply_shuttle_at_station || supply_shuttle_moving) return - - if (!supply_can_move()) - usr << "\red The supply shuttle can not transport station employees, exosuits, classified nuclear codes or homing beacons." - return - - post_signal("supply") - usr << "\blue The supply shuttle has been called and will arrive in [round(((SUPPLY_MOVETIME/10)/60))] minutes." - - src.temp = "Shuttle sent.

OK" - src.updateUsrDialog() - - supply_shuttle_moving = 1 - - process_supply_order() - - supply_shuttle_time = world.timeofday + SUPPLY_MOVETIME - spawn(0) - supply_process() - - if (href_list["order"]) - if(supply_shuttle_moving) return - src.temp = "Supply points: [supply_shuttle_points]


Request what?

" - for(var/S in (typesof(/datum/supply_packs) - /datum/supply_packs) ) - var/datum/supply_packs/N = new S() - if(N.hidden && !src.hacked) continue //Have to send the type instead of a reference to - if(N.contraband && !src.can_order_contraband){continue;} //Agouri -Kavalamarker - src.temp += "[N.name] Cost: [N.cost]
" //the obj because it would get caught by the garbage - src.temp += "
OK" //collector. oh well. + for(var/supply_name in supply_shuttle.supply_packs ) + var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name] + if(N.hidden && !hacked) continue + if(N.contraband && !can_order_contraband) continue + temp += "[supply_name] Cost: [N.cost]
" //the obj because it would get caught by the garbage + temp += "
OK" else if (href_list["doorder"]) + if(world.time < reqtime) + for(var/mob/V in hearers(src)) + V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") + return - if(locate(href_list["doorder"])) //Comes from the requestlist - var/datum/supply_order/O = locate(href_list["doorder"]) - var/datum/supply_packs/P = O.object - supply_shuttle_requestlist -= O + //Find the correct supply_pack datum + var/datum/supply_packs/P = supply_shuttle.supply_packs[href_list["doorder"]] + if(!istype(P)) return - if(supply_shuttle_points >= P.cost) - O.object = P - O.orderedby = usr.name - O.comment = copytext(sanitize(input(usr,"Comment:","Enter comment","")),1,MAX_MESSAGE_LEN) - if(supply_shuttle_points >= P.cost) - supply_shuttle_points -= P.cost - supply_shuttle_shoppinglist += O - src.temp = "Thanks for your order.
" - src.temp += "
OK" + var/timeout = world.time + 600 + var/reason = copytext(sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text),1,MAX_MESSAGE_LEN) + if(world.time > timeout) return + if(!reason) reason = "*None Provided*" + + var/idname = "*None Provided*" + var/idrank = "*None Provided*" + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + idname = H.get_authentification_name() + idrank = H.get_assignment() + else if(issilicon(usr)) + idname = usr.real_name + + supply_shuttle.ordernum++ + var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc) + reqform.name = "Requisition Form - [P.name]" + reqform.info += "

[station_name] Supply Requisition Form


" + reqform.info += "INDEX: #[supply_shuttle.ordernum]
" + reqform.info += "REQUESTED BY: [idname]
" + reqform.info += "RANK: [idrank]
" + reqform.info += "REASON: [reason]
" + reqform.info += "SUPPLY CRATE TYPE: [P.name]
" + reqform.info += "CONTENTS:
    " + + for(var/B in P.contains) + var/thepath = text2path(B) + var/atom/B2 = new thepath() + reqform.info += "
  • [B2.name]
  • " + reqform.info += "

" + reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:
" + + reqform.update_icon() //Fix for appearing blank when printed. + reqtime = (world.time + 5) % 1e5 + + //make our supply_order datum + var/datum/supply_order/O = new /datum/supply_order() + O.ordernum = supply_shuttle.ordernum + O.object = P + O.orderedby = idname + supply_shuttle.requestlist += O + + temp = "Order requst placed.
" + temp += "
OK | Authorize Order" + + else if(href_list["confirmorder"]) + //Find the correct supply_order datum + var/ordernum = text2num(href_list["confirmorder"]) + var/datum/supply_order/O + var/datum/supply_packs/P + temp = "Invalid Request" + for(var/i=1, i<=supply_shuttle.requestlist.len, i++) + var/datum/supply_order/SO = supply_shuttle.requestlist[i] + if(SO.ordernum == ordernum) + O = SO + P = O.object + if(supply_shuttle.points >= P.cost) + supply_shuttle.requestlist.Cut(i,i+1) + supply_shuttle.points -= P.cost + supply_shuttle.shoppinglist += O + temp = "Thanks for your order.
" + temp += "
OK" else - src.temp = "Not enough supply points.
" - src.temp += "
OK" - else - src.temp = "Not enough supply points.
" - src.temp += "
OK" - - else //Comes from the orderform - var/datum/supply_order/O = new/datum/supply_order () - var/supplytype = href_list["doorder"] - var/datum/supply_packs/P = new supplytype () - if(supply_shuttle_points >= P.cost) - O.object = P - O.orderedby = usr.name - O.comment = copytext(sanitize(input(usr,"Comment:","Enter comment","")),1,MAX_MESSAGE_LEN) - if(supply_shuttle_points >= P.cost) - supply_shuttle_points -= P.cost - supply_shuttle_shoppinglist += O - src.temp = "Thanks for your order.
" - src.temp += "
OK" - else - src.temp = "Not enough supply points.
" - src.temp += "
OK" - else - src.temp = "Not enough supply points.
" - src.temp += "
OK" + temp = "Not enough supply points.
" + temp += "
OK" + break else if (href_list["vieworders"]) - src.temp = "Current approved orders:

" - for(var/S in supply_shuttle_shoppinglist) + temp = "Current approved orders:

" + for(var/S in supply_shuttle.shoppinglist) var/datum/supply_order/SO = S - src.temp += "[SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""]
"// (Cancel)
" - src.temp += "
OK" + temp += "#[SO.ordernum] - [SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""]
"// (Cancel)
" + temp += "
OK" /* else if (href_list["cancelorder"]) var/datum/supply_order/remove_supply = href_list["cancelorder"] supply_shuttle_shoppinglist -= remove_supply supply_shuttle_points += remove_supply.object.cost - src.temp += "Canceled: [remove_supply.object.name]


" + temp += "Canceled: [remove_supply.object.name]


" for(var/S in supply_shuttle_shoppinglist) var/datum/supply_order/SO = S - src.temp += "[SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""] (Cancel)
" - src.temp += "
OK" + temp += "[SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""] (Cancel)
" + temp += "
OK" */ else if (href_list["viewrequests"]) - src.temp = "Current requests:

" - for(var/S in supply_shuttle_requestlist) + temp = "Current requests:

" + for(var/S in supply_shuttle.requestlist) var/datum/supply_order/SO = S - src.temp += "[SO.object.name] requested by [SO.orderedby] [supply_shuttle_moving ? "":supply_shuttle_at_station ? "":"Approve Remove"]
" + temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] [supply_shuttle.moving ? "":supply_shuttle.at_station ? "":"Approve Remove"]
" - src.temp += "
Clear list" - src.temp += "
OK" + temp += "
Clear list" + temp += "
OK" else if (href_list["rreq"]) - supply_shuttle_requestlist -= locate(href_list["rreq"]) - src.temp = "Request removed.
" - src.temp += "
OK" + var/ordernum = text2num(href_list["rreq"]) + temp = "Invalid Request.
" + for(var/i=1, i<=supply_shuttle.requestlist.len, i++) + var/datum/supply_order/SO = supply_shuttle.requestlist[i] + if(SO.ordernum == ordernum) + supply_shuttle.requestlist.Cut(i,i+1) + temp = "Request removed.
" + break + temp += "
OK" else if (href_list["clearreq"]) - supply_shuttle_requestlist = null - supply_shuttle_requestlist = new/list() - src.temp = "List cleared.
" - src.temp += "
OK" + supply_shuttle.requestlist.Cut() + temp = "List cleared.
" + temp += "
OK" else if (href_list["mainmenu"]) - src.temp = null + temp = null - src.add_fingerprint(usr) - src.updateUsrDialog() + add_fingerprint(usr) + updateUsrDialog() return /obj/machinery/computer/supplycomp/proc/post_signal(var/command) @@ -683,23 +701,4 @@ This method wont take into account storage items developed in the future and doe -/proc/send_supply_shuttle() - if (supply_shuttle_moving) return - - var/area/the_shuttles_way = locate(SUPPLY_STATION_AREATYPE) - - //Do I really need to explain this loop? - for(var/mob/living/unlucky_person in the_shuttles_way) - unlucky_person.gib() - - var/shuttleat = supply_shuttle_at_station ? SUPPLY_STATION_AREATYPE : SUPPLY_DOCK_AREATYPE - var/shuttleto = !supply_shuttle_at_station ? SUPPLY_STATION_AREATYPE : SUPPLY_DOCK_AREATYPE - - var/area/from = locate(shuttleat) - var/area/dest = locate(shuttleto) - - if(!from || !dest) return - - from.move_contents_to(dest) - supply_shuttle_at_station = !supply_shuttle_at_station diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 9550ee2ef53..cc1c5d95f5e 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -158,7 +158,12 @@ var/atemp = 0 var/turf_count = 0 + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/floor/W = new /turf/simulated/floor( locate(src.x, src.y, src.z) ) + W.lighting_lumcount += old_lumcount + if(old_lumcount != W.lighting_lumcount) + W.lighting_changed = 1 + lighting_controller.changed_turfs += W //////Assimilate Air////// for(var/direction in cardinal)//Only use cardinals to cut down on lag @@ -186,10 +191,6 @@ if(prior_icon) W.icon_state = prior_icon else W.icon_state = "floor" - if (!explode) - W.opacity = 1 - W.sd_SetOpacity(0) - //This is probably gonna make lighting go a bit wonky in bombed areas, but sd_SetOpacity was the primary reason bombs have been so laggy. --NEO W.levelupdate() return W @@ -204,7 +205,13 @@ var/turf_count = 0 //////Assimilate Air////// + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/floor/plating/W = new /turf/simulated/floor/plating( locate(src.x, src.y, src.z) ) + W.lighting_lumcount += old_lumcount + if(old_lumcount != W.lighting_lumcount) + W.lighting_changed = 1 + lighting_controller.changed_turfs += W + for(var/direction in cardinal) var/turf/T = get_step(src,direction) if(istype(T,/turf/space)) @@ -229,15 +236,19 @@ W.dir = old_dir if(prior_icon) W.icon_state = prior_icon else W.icon_state = "plating" - W.opacity = 1 - W.sd_SetOpacity(0) + W.levelupdate() return W /turf/proc/ReplaceWithEngineFloor() var/old_dir = dir + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/floor/engine/E = new /turf/simulated/floor/engine( locate(src.x, src.y, src.z) ) + E.lighting_lumcount += old_lumcount + if(old_lumcount != E.lighting_lumcount) + E.lighting_changed = 1 + lighting_controller.changed_turfs += E E.dir = old_dir E.icon_state = "engine" @@ -302,49 +313,75 @@ /turf/proc/ReplaceWithSpace() var/old_dir = dir + + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) ) + S.lighting_lumcount += old_lumcount + if(old_lumcount != S.lighting_lumcount) + S.lighting_changed = 1 + lighting_controller.changed_turfs += S + S.dir = old_dir S.levelupdate() return S /turf/proc/ReplaceWithLattice() var/old_dir = dir + + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) ) + S.lighting_lumcount += old_lumcount + if(old_lumcount != S.lighting_lumcount) + S.lighting_changed = 1 + lighting_controller.changed_turfs += S + S.dir = old_dir - S.sd_LumReset() new /obj/structure/lattice( locate(src.x, src.y, src.z) ) S.levelupdate() return S /turf/proc/ReplaceWithWall() var/old_icon = icon_state + + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/wall/S = new /turf/simulated/wall( locate(src.x, src.y, src.z) ) + S.lighting_lumcount += old_lumcount + if(old_lumcount != S.lighting_lumcount) + S.lighting_changed = 1 + lighting_controller.changed_turfs += S + S.icon_old = old_icon - S.opacity = 0 - S.sd_NewOpacity(1) - S.sd_LumReset() S.levelupdate() return S /turf/proc/ReplaceWithRWall() var/old_icon = icon_state + + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/wall/r_wall/S = new /turf/simulated/wall/r_wall( locate(src.x, src.y, src.z) ) + S.lighting_lumcount += old_lumcount + if(old_lumcount != S.lighting_lumcount) + S.lighting_changed = 1 + lighting_controller.changed_turfs += S + S.icon_old = old_icon - S.opacity = 0 - S.sd_NewOpacity(1) - S.sd_LumReset() S.levelupdate() return S /turf/proc/ReplaceWithMineralWall(var/ore) var/old_icon = icon_state + + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/turf/simulated/wall/mineral/S = new /turf/simulated/wall/mineral( locate(src.x, src.y, src.z) ) + S.lighting_lumcount += old_lumcount + if(old_lumcount != S.lighting_lumcount) + S.lighting_changed = 1 + lighting_controller.changed_turfs += S + S.icon_old = old_icon - S.opacity = 0 - S.sd_NewOpacity(1) S.mineral = ore - S.New()//Hackish as fuck, but what can you do? -Sieve - S.sd_LumReset() + S.New()//Hackish as fuck, but what can you do? -Sieve //build it into the goddamn new() call up there ^ ~Carn + //e.g. new(turf/loc, mineral) S.levelupdate() return S @@ -1010,7 +1047,7 @@ spawn(100) if(O) del(O) - F.sd_LumReset() +// F.sd_LumReset() //TODO: ~Carn return /turf/simulated/wall/meteorhit(obj/M as obj) @@ -1223,19 +1260,19 @@ turf/simulated/floor/proc/update_icon() switch(T.state) if(0) icon_state = "light_on" - sd_SetLuminosity(5) + SetLuminosity(5) if(1) var/num = pick("1","2","3","4") icon_state = "light_on_flicker[num]" - sd_SetLuminosity(5) + SetLuminosity(5) if(2) icon_state = "light_on_broken" - sd_SetLuminosity(5) + SetLuminosity(5) if(3) icon_state = "light_off" - sd_SetLuminosity(0) + SetLuminosity(0) else - sd_SetLuminosity(0) + SetLuminosity(0) icon_state = "light_off" if(is_grass_floor()) if(!broken && !burnt) @@ -1401,7 +1438,7 @@ turf/simulated/floor/proc/update_icon() if(!floor_tile) return del(floor_tile) icon_plating = "plating" - sd_SetLuminosity(0) + SetLuminosity(0) floor_tile = null intact = 0 broken = 0 @@ -1417,7 +1454,7 @@ turf/simulated/floor/proc/update_icon() broken = 0 burnt = 0 intact = 1 - sd_SetLuminosity(0) + SetLuminosity(0) if(T) if(istype(T,/obj/item/stack/tile/plasteel)) floor_tile = T diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f5b1e49a979..a8e83602fa5 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -222,7 +222,7 @@ //verbs += /proc/togglebuildmode --Merged with view variables //verbs += /client/proc/cmd_modify_object_variables --Merged with view variables verbs += /client/proc/togglebuildmodeself - verbs += /client/proc/debug_master_controller + verbs += /client/proc/debug_controller else return //Game Admin @@ -243,7 +243,7 @@ verbs += /client/proc/make_sound verbs += /client/proc/play_local_sound verbs += /client/proc/send_space_ninja - verbs += /client/proc/restartcontroller //Can call via aproccall --I_hate_easy_things.jpg, Mport --Agouri + verbs += /client/proc/restart_controller //Can call via aproccall --I_hate_easy_things.jpg, Mport --Agouri verbs += /client/proc/Blobize //I need to remember to move/remove this later verbs += /client/proc/Blobcount //I need to remember to move/remove this later verbs += /client/proc/toggle_clickproc //TODO ERRORAGE (Temporary proc while the new clickproc is being tested) @@ -388,7 +388,7 @@ verbs -= /client/proc/air_report verbs -= /client/proc/cmd_admin_say verbs -= /client/proc/cmd_admin_gib_self - verbs -= /client/proc/restartcontroller + verbs -= /client/proc/restart_controller verbs -= /client/proc/play_local_sound verbs -= /client/proc/enable_debug_verbs verbs -= /client/proc/toggleprayers @@ -429,7 +429,7 @@ //verbs -= /client/proc/cmd_switch_radio --removed because tcommsat is staying verbs -= /client/proc/togglebuildmodeself verbs -= /client/proc/kill_airgroup - verbs -= /client/proc/debug_master_controller + verbs -= /client/proc/debug_controller verbs -= /client/proc/check_ai_laws verbs -= /client/proc/cmd_debug_mob_lists return diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index 3dc89498ad2..0acf6863021 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -213,7 +213,7 @@ if(new_value == null) return if(variable=="luminosity") - O.sd_SetLuminosity(new_value) + O.SetLuminosity(new_value) else O.vars[variable] = new_value @@ -222,7 +222,7 @@ for(var/mob/M in mob_list) if ( istype(M , O.type) ) if(variable=="luminosity") - M.sd_SetLuminosity(new_value) + M.SetLuminosity(new_value) else M.vars[variable] = O.vars[variable] @@ -230,7 +230,7 @@ for(var/obj/A in world) if ( istype(A , O.type) ) if(variable=="luminosity") - A.sd_SetLuminosity(new_value) + A.SetLuminosity(new_value) else A.vars[variable] = O.vars[variable] @@ -238,7 +238,7 @@ for(var/turf/A in world) if ( istype(A , O.type) ) if(variable=="luminosity") - A.sd_SetLuminosity(new_value) + A.SetLuminosity(new_value) else A.vars[variable] = O.vars[variable] @@ -247,7 +247,7 @@ for(var/mob/M in mob_list) if (M.type == O.type) if(variable=="luminosity") - M.sd_SetLuminosity(new_value) + M.SetLuminosity(new_value) else M.vars[variable] = O.vars[variable] @@ -255,7 +255,7 @@ for(var/obj/A in world) if (A.type == O.type) if(variable=="luminosity") - A.sd_SetLuminosity(new_value) + A.SetLuminosity(new_value) else A.vars[variable] = O.vars[variable] @@ -263,7 +263,7 @@ for(var/turf/A in world) if (A.type == O.type) if(variable=="luminosity") - A.sd_SetLuminosity(new_value) + A.SetLuminosity(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 837f8ef918a..70f3f4a6681 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -458,7 +458,7 @@ var/list/forbidden_varedit_object_types = list( if(variable=="luminosity") var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num if(var_new == null) return - O.sd_SetLuminosity(var_new) + O.SetLuminosity(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 9f3a021f334..9ae4b0e524f 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -19,22 +19,20 @@ icon_state = "hardhat[on]_[color]" item_state = "hardhat[on]_[color]" - if(on) - user.total_luminosity += brightness_on - else - user.total_luminosity -= brightness_on + if(on) user.SetLuminosity(user.luminosity + brightness_on) + else user.SetLuminosity(user.luminosity - brightness_on) pickup(mob/user) if(on) - user.total_luminosity += brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(0) + user.SetLuminosity(user.luminosity + brightness_on) +// user.UpdateLuminosity() //TODO: Carn + SetLuminosity(0) dropped(mob/user) if(on) - user.total_luminosity -= brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(brightness_on) + user.SetLuminosity(user.luminosity - brightness_on) +// user.UpdateLuminosity() + SetLuminosity(brightness_on) /obj/item/clothing/head/hardhat/orange diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 84e3b48a161..3d217c9f3b1 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -133,22 +133,20 @@ icon_state = "hardhat[on]_[color]" item_state = "hardhat[on]_[color]" - if(on) - user.total_luminosity += brightness_on - else - user.total_luminosity -= brightness_on + if(on) user.SetLuminosity(user.luminosity + brightness_on) + else user.SetLuminosity(user.luminosity - brightness_on) pickup(mob/user) if(on) - user.total_luminosity += brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(0) + user.SetLuminosity(user.luminosity + brightness_on) +// user.UpdateLuminosity() + SetLuminosity(0) dropped(mob/user) if(on) - user.total_luminosity -= brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(brightness_on) + user.SetLuminosity(user.luminosity - brightness_on) +// user.UpdateLuminosity() + SetLuminosity(brightness_on) /* * Kitty ears diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm index a05903d29c7..5ee4278ea65 100644 --- a/code/modules/clothing/spacesuits/rig.dm +++ b/code/modules/clothing/spacesuits/rig.dm @@ -19,22 +19,20 @@ icon_state = "rig[on]-[color]" // item_state = "rig[on]-[color]" - if(on) - user.total_luminosity += brightness_on - else - user.total_luminosity -= brightness_on + if(on) user.SetLuminosity(user.luminosity + brightness_on) + else user.SetLuminosity(user.luminosity - brightness_on) pickup(mob/user) if(on) - user.total_luminosity += brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(0) + user.SetLuminosity(user.luminosity + brightness_on) +// user.UpdateLuminosity() + SetLuminosity(0) dropped(mob/user) if(on) - user.total_luminosity -= brightness_on - user.UpdateLuminosity() - src.sd_SetLuminosity(brightness_on) + user.SetLuminosity(user.luminosity - brightness_on) +// user.UpdateLuminosity() + SetLuminosity(brightness_on) /obj/item/clothing/suit/space/rig name = "engineering hardsuit" diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index cd12abab010..7e28043c2ac 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -185,17 +185,16 @@ shroom.pixel_x = 0 shroom.pixel_y = 0 - W = new /turf/simulated/floor/plating/airless/asteroid( locate(src.x, src.y, src.z) ) - W.dir = old_dir - W.fullUpdateMineralOverlays() + var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) + W = new /turf/simulated/floor/plating/airless/asteroid(src) + W.lighting_lumcount += old_lumcount + if(old_lumcount != W.lighting_lumcount) + W.lighting_changed = 1 + lighting_controller.changed_turfs += W - /* - W.icon_old = old_icon - if(old_icon) W.icon_state = old_icon - */ - W.opacity = 1 - W.sd_SetOpacity(0) - W.sd_LumReset() + W.dir = old_dir + + W.fullUpdateMineralOverlays() W.levelupdate() return W diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ba0b3c6166c..3a1c004fede 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -87,9 +87,6 @@ //stuff in the stomach handle_stomach() - //Flashlights and such - UpdateLuminosity() - //Status updates, death etc. handle_regular_status_updates() //TODO: optimise ~Carn update_canmove() @@ -745,13 +742,16 @@ if(dna && dna.mutantrace == "plant") //couldn't think of a better place to place it, since it handles nutrition -- Urist var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing - if(istype(loc,/turf)) //else, there's considered to be no light - light_amount = min(10,loc:sd_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights - if(istype(loc,/turf/simulated/shuttle))//Now not only will potatomen not starve on the shuttle, they will actually be fed - light_amount = 5 - if(nutrition < 500) //so they can't store nutrition to survive without light forever - nutrition += light_amount - if(light_amount > 0) //if there's enough light, heal + 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 + nutrition += light_amount + if(nutrition > 500) + nutrition = 500 + if(light_amount > 2) //if there's enough light, heal heal_overall_damage(1,1) adjustToxLoss(-1) adjustOxyLoss(-1) @@ -1150,7 +1150,7 @@ //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.sd_lumcount) + if(!currentTurf.lighting_lumcount) playsound_local(src,pick(scarySounds),50, 1, -1) proc/handle_virus_updates() diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 23d0c1b8a25..853801cc4ca 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -53,9 +53,6 @@ if(environment) // More error checking -- TLE handle_environment(environment) - //Flashlights and such - UpdateLuminosity() - //Status updates, death etc. handle_regular_status_updates() update_canmove() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 1a20e131282..c4ccaad779e 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -429,12 +429,13 @@ /mob/living/silicon/ai/reset_view(atom/A) if(current) - current.sd_SetLuminosity(0) + current.SetLuminosity(0) if(istype(A,/obj/machinery/camera)) current = A ..() if(istype(A,/obj/machinery/camera)) - A.sd_SetLuminosity(camera_light_on * AI_CAMERA_LUMINOSITY) + if(camera_light_on) A.SetLuminosity(AI_CAMERA_LUMINOSITY) + else A.SetLuminosity(0) /mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C) @@ -641,7 +642,7 @@ src << "Camera lights [camera_light_on ? "activated" : "deactivated"]." if(!camera_light_on) if(src.current) - src.current.sd_SetLuminosity(0) + src.current.SetLuminosity(0) else src.lightNearbyCamera() @@ -656,16 +657,16 @@ // I have to use range instead of view or the darkness gets in the way. var/camera = near_range_camera(src.eyeobj) if(camera && src.current != camera) - src.current.sd_SetLuminosity(0) + src.current.SetLuminosity(0) src.current = camera - src.current.sd_SetLuminosity(lum) + src.current.SetLuminosity(lum) else if(isnull(camera)) - src.current.sd_SetLuminosity(0) + src.current.SetLuminosity(0) src.current = null camera_light_on = world.timeofday + 1 * 10 // Update the light every 2 seconds. else src.current = near_range_camera(src.eyeobj) - if(src.current) src.current.sd_SetLuminosity(lum) + if(src.current) src.current.SetLuminosity(lum) #undef AI_CAMERA_LUMINOSITY \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/living/silicon/ai/freelook/chunk.dm index 701f5037314..e8d41af0a9b 100644 --- a/code/modules/mob/living/silicon/ai/freelook/chunk.dm +++ b/code/modules/mob/living/silicon/ai/freelook/chunk.dm @@ -90,7 +90,7 @@ for(var/turf/t in visRemoved) if(t in obscuredTurfs) if(!t.obscured) - t.obscured = image('effects/cameravis.dmi', t, "black", 15) + t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15) obscured += t.obscured for(var/mob/aiEye/m in seenby) @@ -129,7 +129,7 @@ for(var/turf/t in obscuredTurfs) if(!t.obscured) - t.obscured = image('effects/cameravis.dmi', t, "black", 15) + t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15) obscured += t.obscured #undef UPDATE_BUFFER \ No newline at end of file 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 c5b0d39b2b3..ba3831b608b 100644 --- a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm +++ b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm @@ -62,7 +62,7 @@ if(src.can_use()) cameranet.addCamera(src) else - src.sd_SetLuminosity(0) + src.SetLuminosity(0) cameranet.removeCamera(src) /obj/machinery/camera/New() diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 49154c9dbb9..a74bed6ec83 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -13,7 +13,6 @@ handle_regular_status_updates() if(client) - UpdateLuminosity() handle_regular_hud_updates() update_items() if (src.stat != DEAD) //still using power diff --git a/code/modules/mob/living/simple_animal/corgi.dm b/code/modules/mob/living/simple_animal/corgi.dm index c073a5f5ece..bffcf7e1eab 100644 --- a/code/modules/mob/living/simple_animal/corgi.dm +++ b/code/modules/mob/living/simple_animal/corgi.dm @@ -78,7 +78,7 @@ emote_hear = list("barks", "woofs", "yaps","pants") emote_see = list("shakes its head", "shivers") desc = "It's a corgi." - src.sd_SetLuminosity(0) + SetLuminosity(0) inventory_head.loc = src.loc inventory_head = null else @@ -214,7 +214,7 @@ name = "Rudolph the Red-Nosed Corgi" emote_hear = list("barks christmas songs", "yaps") desc = "He has a very shiny nose." - src.sd_SetLuminosity(6) + SetLuminosity(6) if(/obj/item/clothing/head/soft) name = "Corgi Tech [real_name]" speak = list("Needs a stamp!", "Request DENIED!", "Fill these out in triplicate!") diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 15ab6b22efb..8147ea42800 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -505,11 +505,6 @@ var/list/slot_equipment_priority = list( \ // ..() return -/mob/proc/UpdateLuminosity() - if(src.total_luminosity == src.last_luminosity) return 0//nothing to do here - src.last_luminosity = src.total_luminosity - sd_SetLuminosity(min(src.total_luminosity,7))//Current hardcode max at 7, should likely be a const somewhere else - return 1 /mob/MouseDrop(mob/M as mob) ..() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index c4f274401d4..4a442e48e62 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -31,9 +31,6 @@ var/obj/screen/pressure = null var/obj/screen/damageoverlay = null - var/total_luminosity = 0 //This controls luminosity for mobs, when you pick up lights and such this is edited. If you want the mob to use lights it must update its lum in its life proc or such. Note clamp this value around 7 or such to prevent massive light lag. - var/last_luminosity = 0 - /*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob. A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such. The current method unnecessarily clusters up the variable list, especially for humans (although rearranging won't really clean it up a lot but the difference will be noticable for other mobs). diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index f7d7d15431a..63410f53301 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -177,7 +177,7 @@ // update the APC icon to show the three base states // also add overlays for indicator lights /obj/machinery/power/apc/proc/updateicon() - src.overlays = null + overlays.Cut() if(opened) var/basestate = "apc[ cell ? "2" : "1" ]" // if opened, show cell if it's inserted if (opened==1) @@ -199,13 +199,10 @@ else icon_state = "apc0" // if closed, update overlays for channel status - if (!(stat & (BROKEN|MAINT))) - overlays += image('icons/obj/power.dmi', "apcox-[locked]") // 0=blue 1=red - overlays += image('icons/obj/power.dmi', "apco3-[charging]") // 0=red, 1=yellow/black 2=green + if(!(stat & (BROKEN|MAINT))) + overlays.Add("apcox-[locked]","apco3-[charging]") // 0=blue 1=red // 0=red, 1=yellow/black 2=green if(operating) - overlays += image('icons/obj/power.dmi', "apco0-[equipment]") // 0=red, 1=green, 2=blue - overlays += image('icons/obj/power.dmi', "apco1-[lighting]") - overlays += image('icons/obj/power.dmi', "apco2-[environ]") + overlays.Add("apco0-[equipment]","apco1-[lighting]","apco2-[environ]") // 0=red, 1=green, 2=blue //attack with an item - open/close cover, insert cell, or (un)lock interface diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 4ebc3b5adf6..73f1feeff3c 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -215,7 +215,7 @@ icon_state = "bulb1" base_state = "bulb" fitting = "bulb" - brightness = 3 + brightness = 4 desc = "A small lighting fixture." light_type = /obj/item/weapon/light/bulb @@ -224,7 +224,7 @@ name = "spotlight" fitting = "large tube" light_type = /obj/item/weapon/light/tube/large - brightness = 15 + brightness = 12 /obj/machinery/light/built/New() status = LIGHT_EMPTY @@ -280,34 +280,28 @@ /obj/machinery/light/proc/update(var/trigger = 1) update_icon() - if(!on) - use_power = 1 + if(on) + if(luminosity != brightness) + switchcount++ + if(rigged) + if(status == LIGHT_OK && trigger) + explode() + else if( prob( min(60, switchcount*switchcount*0.01) ) ) + if(status == LIGHT_OK && trigger) + status = LIGHT_BURNED + icon_state = "[base_state]-burned" + on = 0 + SetLuminosity(0) + else + use_power = 2 + SetLuminosity(brightness) else - use_power = 2 - var/oldlum = luminosity + use_power = 1 + SetLuminosity(0) - //luminosity = on * brightness - sd_SetLuminosity(on * brightness) // *DAL* - - // if the state changed, inc the switching counter - if(oldlum != luminosity) - switchcount++ - - // now check to see if the bulb is burned out - if(status == LIGHT_OK && trigger) - if(on && rigged) - explode() - if( prob( min(60, switchcount*switchcount*0.01) ) ) - status = LIGHT_BURNED - icon_state = "[base_state]-burned" - on = 0 - sd_SetLuminosity(0) - active_power_usage = (luminosity * 20) + active_power_usage = (luminosity * 10) if(on != on_gs) on_gs = on -// var/area/A = get_area(src) -// if(A) -// A.update_lights() // attempt to set the light's on/off status diff --git a/code/modules/power/sd_DynamicAreaLighting.dm b/code/modules/power/sd_DynamicAreaLighting.dm deleted file mode 100644 index eff490a23c4..00000000000 --- a/code/modules/power/sd_DynamicAreaLighting.dm +++ /dev/null @@ -1,596 +0,0 @@ -/* Overview of sd_DynamicAreaLighting as modified for SS13 - * - * - * Use sd_SetLuminosity(value) to change the luminosity of an atom - * rather than setting the luminosity var directly. - * Avoid having luminous objects at compile-time since this can mess up - * the lighting system during map load. Instead use sd_SetLuminosity() in - * the atom's New() proc after a small spawn delay. - * - * Use sd_SetOpacity(value) to change the opacity of an atom (e.g. doors) - * rather than setting the opacity var directly. This ensures that lighting - * will be blocked/unblocked as necessary. - * - * If creating a new opaque atom (e.g. a wall) at runtime, create the atom, - * set its opacity var to zero, then perform sd_SetOpacity(1) - * e.g.: - * - * var/obj/block/B = new(loc) - * B.opacity = 0 - * B.sd_SetOpacity(1) - * - * - * The library creates multiple instances of each /area to split a mapped area - * into different lighting levels. Each area created has a "master" variable - * which is a reference to the original un-split area, and a "related" variable - * which is a reference to the list of split areas. - - */ - - - - - -/********************************************************************\ - sd_DynamicAreaLighting.dm - Shadowdarke (shadowdarke@hotmail.com) - December 12, 2002 - - The sd_DynamicAreaLighting library provides dynamic lighting - with minimal cpu and bandwidth usage by shifting turfs between - five areas which represent varying shades of darkness. - -********************************************************************** -Using sd_DynamicAreaLighting - - This library uses BYOND's built in luminousity variable. In most - cases, all you have to do is set luminosity and let the library - worry about the work. - - There are three cases that the library does not automatically - compensate for, so you will need to use library procs: - - 1) Luminosity changes at run time. - If your program makes changes in luminosity while it is - running, you need to use sd_SetLuminosity(new_luminosity) - so the library can remove the effect of the old luminosity - and apply the new effect. - - 2) Opacity changes at run time. - As with luminosity changes, you need to use - sd_SetOpacity(new_opacity) if your program changes the opacity - of atoms at runtime. - - 3) New atoms that change the opacity of a location. - This is somewhat more complex, and the library doesn't - have a simple proc to take care of it yet. You should use - sd_StripLocalLum() to strip the luminosity effect of - anything shining on that space, create the new atom, then - use sd_ApplyLocalLum() to reapply the luminosity effect. - Examine the sd_SetOpacity() proc for an example of the - procedure. - - All areas will automatically use the sd_DynamicAreaLighting - library when it is included in your project. You may disable - lighting effect in an area by specifically setting the area's - sd_lighting var to 0. For example: - - area/always_lit - luminosity = 1 - sd_lighting = 0 - - This library chops areas into 5 separate areas of differing - light effect, so you may want to modify area Enter(), Exit(), - Entered(), and Exited() procs to make sure the atom has moved - from a different area instead of a different light zone of the - same area. - - IMPORTANT NOTE: Since sd_DynamicAreaLighting uses the view() - proc, large luminosity settings may cause strange effect. You - should limit luminosity to (world.view * 2) or less. - ----------------------------------------------------------------------- -CUSTOM DARKNESS ICONS - sd_DynamicAreaLighting was designed in a barbaric age when BYOND - did not support alpha transperency. Thankfully that age is over. - I left the old icon as the default, since not everyone has - upgraded to BYOND 4.0 or in some cases like software graphics - mode, in which case the old dithered icon is the better choice. - - The dithered icon used 4 standard dithers for the darkness shades - and I saw little reason to allow variation. Starting with sd_DAL - version 10, the library can support more or less shades of - darkness as well. - - To change the icon and/or number of shades of darkness for your - game, just call the sd_SetDarkIcon(dark_icon, num_shades) proc, - where dark_icon is the new icon and num_shades is the number of - shades of darkness in the icon. This is best done in the - world.New() proc, to set it once for the entire game instance. - - For example, to make the included 7 shade alpha transparency icon - your game's darkness icon, use the following code in your game. - -world - New() - ..() - sd_SetDarkIcon('sd_dark_alpha7.dmi', 7) - - There are several demo icons included with this library: - sd_darkstates.dmi - the original 4 shade dithered icon - sd_dark_dither3.dmi - 3 shade dithered icon - sd_dark_alpha4.dmi - 4 shade alpha transparency icon - sd_dark_alpha4b.dmi - lighter version 4 shade alpha - transparency icon - sd_dark_alpha7.dmi - 7 shade alpha transparency icon - - If you want to design your own custom darkness icons, they - have to follow a specific format for the library to use them - properly. The shades of darkness should have be numbered from 0 - as the darkest shade to the number of shades minus one as the - lightest shade. - - For example, the four shade 4 shade transparent icon - sd_dark_alpha4.dmi has 4 icon states: - "0" is black with 204 alpha (80% darkness) - "1" is black with 153 alpha (60% darkness) - "2" is black with 102 alpha (40% darkness) - "3" is black with 51 alpha (20% darkness) - - - The lightest shade ("3" in this case) is NOT completely clear. - There will be no darkness overlay for completely lit areas. The - lightest shade will only be used for places that are just beginning - to get dark. - - The darkest shade ("0") likewise is not 100% obscured. "0" will - be used in completely dark areas, but by leaving it slightly - transparent, characters will be able to barely make out their - immediate surroundings in the darkness (based on the mob - see_in_dark var.) You might prefer to lighten the darkness for - this purpose, like in demo icon sd_dark_alpha4b.dmi. - - ----------------------------------------------------------------------- -DAY/NIGHT CYCLES - - sd_DynamicAreaLighting allows for separate indoor and outdoor - lighting. Areas used for outdoor light cycles should be - designated by setting the area's sd_outside var to 1. For example: - - area/outside - sd_outside = 1 - - You will need to write your own routine for the day/night - cycle so that you can control the timing and degree of lighting - changes. There is an example routine in lightingdemo.dm. - - After your routine determines the amount of light outdoors, - call sd_OutsideLight(light_level) to update the light levels in - all outside areas. light_level should be a value from 0 to - sd_dark_shades, where 0 is darkest and sd_dark_shades is full - light. - - The sd_OutsideLight() proc does not automatically detect a - range out of bounds in case you want to use nonstandard values - for interesting effect. For instance, you could use a negative - value to dampen light sources. - -If you want daylight to spill indoors: - - You will need to add turfs to sd_light_spill_turfs. The - library will automatically add any turf created with - sd_light_spill set, or you may add the turfs yourself at - runtime. - - The turfs in this list act as a source of daylight, shining - into the any areas that are not flagged with sd_outside. - -********************************************************************** -LIBRARY PROCS: -Except in the cases noted above, you shouldn't need to use the procs -in this library. This reference is provided for advanced users. - -Global vars and procs: - var - sd_dark_icon - This is the icon used for the darkness in your world. - DEFAULT VALUE: 'sd_darkstates.dmi' (A dithered icon - designed for BYOND releases before 4.0.) - - sd_dark_shades - The number of darkness icon states in your sd_dark_icon. - DEFAULT VALUE: 4 - - sd_light_layer - The graphic layer that darkness overlays appear on. - This should be higher than anything on the map, but - lower than any HUD displays. - DEFAULT VALUE: 50 - - sd_light_outside - This var is how bright it currently is outside. It - should be a number between 0 and sd_dark_shades. - DEFAULT VALUE: 0 - - sd_top_luminosity - keeps track of the highest luminosity in the world to - prevent getting larger lists than necessary. - - list/sd_outside - A list of outside areas. - - list/sd_light_spill_turfs - A list of turfs where light spills from outside areas into - inside areas. - - proc/sd_OutsideLight(n as num) - Changes the level of light outside (sd_light_outside) to n - and updates all the atoms in sd_outside. - - proc/sd_SetDarkIcon(icon, shades) - Changes the darkness icon and the number shades of darkness - in that icon. - -All atoms have the following procs: - sd_ApplyLum(list/V = view(luminosity,src), center = src) - This proc adds a value to the sd_lumcount of all the - turfs in V, depending on src.luminosity and the - distance between the turf and center. - - sd_StripLum(list/V = view(luminosity,src), center = src) - The reverse of sd_ApplyLum(), sd_StripLum removes luminosity - effect. - - sd_ApplyLocalLum(list/affected = viewers(20,src)) - Applies the lighting effect of all atoms in affected. This - proc is used with sd_StripLocalLum() for effect that may - change the opacity of a turf. - - sd_StripLocalLum() - Strips effect of all local luminous atoms. - RETURNS: list of all the luminous atoms stripped - IMPORTANT! Each sd_StripLocalLum() call should have a matching - sd_ApplyLocalLum() to restore the local effect. - - sd_SetLuminosity(new_luminosity as num) - Sets the atom's luminosity, making adjustments to the - sd_lumcount of local turfs. - - sd_SetOpacity(new_opacity as num) - Sets the atom's opacity, making adjustments to the - sd_lumcount of local turfs. - -Areas have one additional proc and 4 variables: - var - sd_lighting - Turn this flag off to prevent sd_DynamicAreaLighting - from effecting this area. - DEFAULT VALUE: 1 (allow dynamic lighting) - - sd_outside - Set this flag to automatically add this area to the - list of outside areas. - DEAFAULT VALUE: 0 (not an outside area) - - sd_light_level - The current light level of the area. You should use - the sd_LightLevel() proc to set this value, so the - darkness overlays will be changed as well. - DEFAULT VALUE: 0 - - sd_darkimage - Tracks the darkness image of the area for easy - removal in the sd_LightLevel() proc - - proc - sd_LightLevel(level = sd_light_level as num,keep = 1) - Updates the darkness overlay of the area. - If keep = 1, it also updates the area's - sd_light_level var. - -Turfs have these additional procs and vars: - var - sd_lumcount - Used to track the brightness of a turf. - - sd_light_spill - If set, the turf will automatically be added to the - global list sd_light_spill_turfs when created. - DEFAULT VALUE: 0 - - proc - sd_LumUpdate() - Places the turf in the appropriate sd_dark area, - depending on its brightness (sd_lumcount). - - sd_LumReset() - Resets a turf's lumcount by stripping local luminosity, - zeroing the lumcount, then reapplying local luminosity. - - sd_ApplySpill() - Applies to effect of daylight spilling into inside - areas in view of this turf. - - sd_StripSpill() - Removes to effect of daylight spilling into inside - areas in view of this turf. - -\********************************************************************/ - -var/const/sd_dark_icon = 'icons/effects/ss13_dark_alpha7.dmi' // icon used for darkness -var/const/sd_dark_shades = 7 // number of icon state in sd_dark_icon -var/const/sd_light_layer = 10 // graphics layer for light effect -var/sd_top_luminosity = 0 - - // since we're not using these, comment out all occurances to save CPU - /* - list - sd_outside_areas = list() // list of outside areas - sd_light_spill_turfs = list() // list of turfs to calculate light spill from - */ - -// slog = file("DALlog.txt") - -/* -proc - sd_OutsideLight(n as num) - // set the brightness of the outside sunlight - if(sd_light_outside == n) return // same level, no update - if(sd_light_outside) - for(var/turf/T in sd_light_spill_turfs) - T.sd_StripSpill() - sd_light_outside = n - - // make all the outside areas update themselves - for(var/area/A in sd_outside_areas) - A.sd_LightLevel(sd_light_outside + A.sd_light_level,0) - if(n) - for(var/turf/T in sd_light_spill_turfs) - T.sd_ApplySpill() -*/ -/* -proc/sd_SetDarkIcon(icon, shades) - // reset the darkness icon and number of shades of darkness - sd_dark_icon = icon - sd_dark_shades = shades - // change existing areas - for(var/area/A) - if(A.sd_darkimage) A.sd_LightLevel(A.sd_light_level,0) -*/ - -atom/New() - ..() - // if this is not an area and is luminous - if(!isarea(src)&&(luminosity>0)) - spawn(1) // delay to allow map load - sd_ApplyLum() - -atom/Del() - // if this is not an area and is luminous - if(!isarea(src)&&(luminosity>0)) - sd_StripLum() - ..() - -atom/proc/sd_ApplyLum(list/V = view(luminosity,src), center = src) - if(src.luminosity>sd_top_luminosity) - sd_top_luminosity = src.luminosity - // loop through all the turfs in V - for(var/turf/T in V) - /* increase the turf's brightness depending on the - brightness and distance of the lightsource */ - T.sd_lumcount += (luminosity-get_dist(center,T)) - T.sd_LumUpdate() - -atom/proc/sd_StripLum(list/V = view(luminosity,src), center = src) - // loop through all the turfs in V - for(var/turf/T in V) - /* increase the turf's brightness depending on the - brightness and distance of the lightsource */ - T.sd_lumcount -= (luminosity-get_dist(center,T)) -// T.sd_lumcount = max(0, T.sd_lumcount) - // update the turf's area - T.sd_LumUpdate() - -atom/proc/sd_ApplyLocalLum(list/affected = view(sd_top_luminosity,src)) - // Reapplies the lighting effect of all atoms in affected. - for(var/atom/A in affected) - if(A.luminosity) A.sd_ApplyLum() - -atom/proc/sd_StripLocalLum() - /* strips all local luminosity - - RETURNS: list of all the luminous atoms stripped - - IMPORTANT! Each sd_StripLocalLum() call should have a matching - sd_ApplyLocalLum() to restore the local effect. */ - var/list/affected = list() - for(var/atom/A in view(sd_top_luminosity,src)) - var/turfflag = (isturf(src)?1:0) - if(A.luminosity && (get_dist(src,A) <= A.luminosity + turfflag)) - A.sd_StripLum() - affected += A - return affected - -atom/proc/sd_SetLuminosity(new_luminosity as num) - /* This proc should be called everytime you want to change the - luminosity of an atom instead of setting it directly. - - new_luminosity is the new value for luminosity. */ - if(luminosity>0) - sd_StripLum() - luminosity = new_luminosity - if(luminosity>0) - sd_ApplyLum() - - -atom/proc/sd_SetOpacity(new_opacity as num) - if(opacity == (new_opacity ? 1 : 0)) return - - var/list/affected = new - var/atom/A - var/turf/T - var/turf/ATurf - - for(A in range(sd_top_luminosity,src)) - T = A - while(T && !istype(T)) T = T.loc - if(T) - var/list/V = view(A.luminosity,T) - if(!(src in V)) continue - var/turfflag = 0 - if(A == T) turfflag = 1 - if(A.luminosity && get_dist(A,src)<=A.luminosity+turfflag) - affected[A] = V - opacity = new_opacity - if(opacity) - for(A in affected) - ATurf = A - while(ATurf && !istype(ATurf)) ATurf = ATurf.loc - if(ATurf) - for(T in affected[A]-view(A.luminosity, ATurf)) - T.sd_lumcount -= (A.luminosity-get_dist(A,T)) -// T.sd_lumcount = max(0, T.sd_lumcount) - T.sd_LumUpdate() - - - else - for(A in affected) - ATurf = A - while(ATurf && !istype(ATurf)) ATurf = ATurf.loc - if(ATurf) - for(T in view(A.luminosity, ATurf) - affected[A]) - T.sd_lumcount += (A.luminosity-get_dist(A,T)) - T.sd_LumUpdate() - -/// - -atom/proc/sd_NewOpacity(var/new_opacity) - if(opacity != new_opacity) - var/list/affected = sd_StripLocalLum() - opacity = new_opacity - var/atom/T = src - while(T && !isturf(T)) - T = T.loc - if(T) - T:sd_lumcount = 0 - - sd_ApplyLocalLum(affected) - -/// - -turf - var/tmp/sd_lumcount = 0 // the brightness of the turf - - -turf/proc/sd_LumReset() - /* Clear local lum, reset this turf's sd_lumcount, and - re-apply local lum*/ - var/list/affected = sd_StripLocalLum() - sd_lumcount = 0 - sd_ApplyLocalLum(affected) - -turf/proc/sd_LumUpdate() - set background = 1 - var/area/Loc = loc - if(!istype(Loc) || !Loc.sd_lighting) return - - // change the turf's area depending on its brightness - // restrict light to valid levels - var/light = min(max(sd_lumcount,0),sd_dark_shades) - var/ltag = copytext(Loc.tag,1,findtext(Loc.tag,"sd_L")) + "sd_L[light]" - - if(Loc.tag!=ltag) //skip if already in this area - var/area/A = locate(ltag) // find an appropriate area - if(!A) - A = new Loc.type() // create area if it wasn't found - // replicate vars - for(var/V in Loc.vars-"contents") - if(issaved(Loc.vars[V])) A.vars[V] = Loc.vars[V] - - A.tag = ltag - A.sd_LightLevel(light) - - A.contents += src // move the turf into the area - -atom/movable/Move() // when something moves - - var/turf/oldloc = loc // remember for range calculations - // list turfs in view and luminosity range of old loc - var/list/oldview - if(luminosity>0) // if atom is luminous - if(isturf(loc)) - oldview = view(luminosity,loc) - else - oldview = list() - - . = ..() - - if(.&&(luminosity>0)) // if the atom actually moved - if(istype(oldloc)) - sd_StripLum(oldview,oldloc) - oldloc.sd_lumcount++ // correct "off by 1" error in oldloc - sd_ApplyLum() - -area - var/sd_lighting = 1 //Turn this flag off to prevent sd_DynamicAreaLighting from affecting this area - var/sd_light_level = 0 //This is the current light level of the area - var/sd_darkimage //This tracks the darkness image of the area for easy removal - - -area/proc/sd_LightLevel(slevel = sd_light_level as num, keep = 1) - if(!src) return - overlays -= sd_darkimage - - if(keep) sd_light_level = slevel - -// slevel = min(max(slevel,0),sd_dark_shades) // restrict range - - if(slevel > 0) - luminosity = 1 - else - luminosity = 0 - - sd_darkimage = image(sd_dark_icon,,num2text(slevel),sd_light_layer) - overlays += sd_darkimage - -area/proc/sd_New(sd_created) - - if(!tag) tag = "[type]" - spawn(1) // wait a tick - if(sd_lighting) - // see if this area was created by the library - if(!sd_created) - /* show the dark overlay so areas outside of luminous regions - won't be bright as day when they should be dark. */ - sd_LightLevel() - -area/Del() - ..() - related -= src - - - /* extend the mob procs to compensate for sight settings. */ -mob/sd_ApplyLum(list/V, center = src) - if(!V) - if(isturf(loc)) - V = view(luminosity,loc) - else - V = view(luminosity,get_turf(src)) - . = ..(V, center) - -mob/sd_StripLum(list/V, center = src) - if(!V) - if(isturf(loc)) - V = view(luminosity,loc) - else - V = view(luminosity,get_turf(src)) - . = ..(V, center) - -mob/sd_ApplyLocalLum(list/affected) - if(!affected) - if(isturf(loc)) - affected = view(sd_top_luminosity,loc) - else - affected = view(sd_top_luminosity,src) - . = ..(affected) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index d9032068986..a9ee6a25fcd 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -9,15 +9,11 @@ density = 0 unacidable = 1 use_power = 0 + luminosity = 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. -/obj/machinery/containment_field/New() - spawn(1) - src.sd_SetLuminosity(5) - - /obj/machinery/containment_field/Del() if(FG1 && !FG1.clean_up) FG1.cleanup() diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 5a625e21791..38ffd5c1d8a 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -13,6 +13,7 @@ var/global/list/uneatable = list( anchored = 1 density = 1 layer = 6 + luminosity = 6 unacidable = 1 //Don't comment this out. use_power = 0 var/current_size = 1 @@ -279,7 +280,7 @@ var/global/list/uneatable = list( continue if(O.invisibility == 101) src.consume(O) - A:ReplaceWithSpace() + T.ReplaceWithSpace() gain = 2 src.energy += gain return diff --git a/code/modules/reagents/grenade_launcher.dm b/code/modules/reagents/grenade_launcher.dm index 0ee9962e908..d5f1ca734df 100644 --- a/code/modules/reagents/grenade_launcher.dm +++ b/code/modules/reagents/grenade_launcher.dm @@ -61,6 +61,6 @@ log_game("[key_name_admin(user)] used a grenade ([src.name]).") F.active = 1 F.icon_state = initial(icon_state) + "_active" - playsound(user.loc, 'armbomb.ogg', 75, 1, -3) + playsound(user.loc, 'sound/weapons/armbomb.ogg', 75, 1, -3) spawn(15) F.prime() \ No newline at end of file diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 50fe47b800e..374a7857593 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -61,7 +61,7 @@ return /obj/item/weapon/reagent_containers/borghypo/attack_self(mob/user as mob) - playsound(src.loc, 'pop.ogg', 50, 0) //Change the mode + playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) //Change the mode if(mode == 1) mode = 2 charge_tick = 0 //Prevents wasted chems/cell charge if you're cycling through modes. diff --git a/code/modules/reagents/reagent_containers/food/condiment.dm b/code/modules/reagents/reagent_containers/food/condiment.dm index 31a3019c379..d9f196375fb 100644 --- a/code/modules/reagents/reagent_containers/food/condiment.dm +++ b/code/modules/reagents/reagent_containers/food/condiment.dm @@ -33,7 +33,7 @@ spawn(5) reagents.trans_to(M, 10) - playsound(M.loc,'drink.ogg', rand(10,50), 1) + playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 else if( istype(M, /mob/living/carbon/human) ) @@ -54,7 +54,7 @@ spawn(5) reagents.trans_to(M, 10) - playsound(M.loc,'drink.ogg', rand(10,50), 1) + playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 return 0 diff --git a/code/modules/reagents/reagent_containers/food/drinks.dm b/code/modules/reagents/reagent_containers/food/drinks.dm index 320aef73851..b39011bc0ce 100644 --- a/code/modules/reagents/reagent_containers/food/drinks.dm +++ b/code/modules/reagents/reagent_containers/food/drinks.dm @@ -33,7 +33,7 @@ spawn(5) reagents.trans_to(M, gulp_size) - playsound(M.loc,'drink.ogg', rand(10,50), 1) + playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 else if( istype(M, /mob/living/carbon/human) ) @@ -61,7 +61,7 @@ spawn(600) R.add_reagent(refill, fillevel) - playsound(M.loc,'drink.ogg', rand(10,50), 1) + playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1) return 1 return 0 diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index a94cc6d406b..06003a4b6ca 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -75,7 +75,7 @@ return if(reagents) //Handle ingestion of the reagent. - playsound(M.loc,'eatfood.ogg', rand(10,50), 1) + playsound(M.loc,'sound/items/eatfood.ogg', rand(10,50), 1) if(reagents.total_volume) reagents.reaction(M, INGEST) spawn(5) diff --git a/code/modules/reagents/reagent_containers/food/snacks/grown.dm b/code/modules/reagents/reagent_containers/food/snacks/grown.dm index c2fe0060dd5..8745dfc04b1 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/grown.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/grown.dm @@ -216,16 +216,16 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/Del() if(istype(loc,/mob)) - loc.sd_SetLuminosity(loc.luminosity - potency/5) + loc.SetLuminosity(round(loc.luminosity - potency/5,1)) ..() /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/pickup(mob/user) - src.sd_SetLuminosity(0) - user.total_luminosity += potency/5 + src.SetLuminosity(0) + user.SetLuminosity(round(user.luminosity + (potency/5),1)) /obj/item/weapon/reagent_containers/food/snacks/grown/glowberries/dropped(mob/user) - user.total_luminosity -= potency/5 - src.sd_SetLuminosity(potency/5) + user.SetLuminosity(round(user.luminosity - (potency/5),1)) + src.SetLuminosity(round(potency/5,1)) /obj/item/weapon/reagent_containers/food/snacks/grown/cocoapod seed = "/obj/item/seeds/cocoapodseed" @@ -771,7 +771,7 @@ if(istype(src.loc,/mob)) pickup(src.loc) else - src.sd_SetLuminosity(potency/10) + src.SetLuminosity(round(potency/10,1)) lifespan = 120 //ten times that is the delay endurance = 30 maturation = 15 @@ -795,16 +795,16 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/Del() if(istype(loc,/mob)) - loc.sd_SetLuminosity(loc.luminosity - potency/10) + loc.SetLuminosity(round(loc.luminosity - potency/10,1)) ..() /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/pickup(mob/user) - src.sd_SetLuminosity(0) - user.total_luminosity += potency/10 + SetLuminosity(0) + user.SetLuminosity(round(user.luminosity + (potency/10),1)) /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom/glowshroom/dropped(mob/user) - user.total_luminosity -= potency/10 - src.sd_SetLuminosity(potency/10) + user.SetLuminosity(round(user.luminosity + (potency/10),1)) + SetLuminosity(round(potency/10,1)) // ************************************* // Complex Grown Object Defines - diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index b62765df964..c35b3227c76 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -58,7 +58,7 @@ sleep(3) del(D) - playsound(src.loc, 'spray2.ogg', 50, 1, -6) + playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) if(reagents.has_reagent("sacid")) message_admins("[key_name_admin(user)] fired sulphuric acid from a spray bottle.") @@ -181,7 +181,7 @@ sleep(2) del(D) - playsound(src.loc, 'spray2.ogg', 50, 1, -6) + playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) if(reagents.has_reagent("sacid")) message_admins("[key_name_admin(user)] fired sulphuric acid from a chem sprayer.") diff --git a/code/modules/reagents/syringe_gun.dm b/code/modules/reagents/syringe_gun.dm index 75cdf2913bd..89e29932800 100644 --- a/code/modules/reagents/syringe_gun.dm +++ b/code/modules/reagents/syringe_gun.dm @@ -56,7 +56,7 @@ del(S) D.icon_state = "syringeproj" D.name = "syringe" - playsound(user.loc, 'syringeproj.ogg', 50, 1) + playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1) for(var/i=0, i<6, i++) if(!D) break diff --git a/html/changelog.html b/html/changelog.html index 36d15ea3671..3b9b1cd6dfe 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -49,8 +49,16 @@ should be listed in the changelog upon commit tho. Thanks. --> +

August 25, 2012

+

Carnwennan updated:

+
    +
  • New lighting. It should look and feel the same as the old lighting whilst being less taxing on the server. Space has a minimum brightness (IC starlight) and areas that do not use dynamic lighting default to a lighting level of 4, so they aren't dark, but they aren't superbright. Replacing turfs should preserve dynamic lighting. Singulo/bombs should cause a lot less lighting-related lag. There are some minor known issues, see the commit log for details.
  • +
  • Admins can now access most controller datums with the "Debug Controller" verb. Time to break all the things!
  • +
  • Supply shuttle now uses a controller datum. This means admins can see/edit supply orders etc.
  • +
  • Changeling fakedeath can be initiated after death again. Next time you want something reverted, just ask rather than being obnoxious.
  • +

Giacom updated: