From 6b802b61e8bf83d2918262d4635e1208ba763fde Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Wed, 25 Mar 2020 20:57:12 -0400 Subject: [PATCH] Port VOREStation PR 6914 Speed up map load significantly - Set initialized = FALSE on unsimulated turfs that need to intialize. - Most of area/New() to initialize - Faster lookup of self-init on atoms - Split air alarm and fire alarm files, move new to initialize - Tweak decals and opacity Co-authored-by: Aronai Sieyes Co-authored-by: Leshana --- code/__defines/machinery.dm | 5 + code/_helpers/_lists.dm | 15 + code/_helpers/global_lists.dm | 2 - code/controllers/subsystems/air.dm | 2 +- code/controllers/subsystems/atoms.dm | 4 +- code/controllers/subsystems/mapping.dm | 3 +- code/controllers/subsystems/skybox.dm | 32 ++ code/controllers/subsystems/xenoarch.dm | 2 +- code/game/area/areas.dm | 19 +- code/game/atoms.dm | 3 +- code/game/gamemodes/cult/hell_universe.dm | 4 +- .../endgame/supermatter_cascade/blob.dm | 4 +- .../endgame/supermatter_cascade/universe.dm | 2 +- code/game/gamemodes/events/wormholes.dm | 2 +- .../game/machinery/{alarm.dm => air_alarm.dm} | 361 +----------------- code/game/machinery/fire_alarm.dm | 324 ++++++++++++++++ code/game/turfs/simulated.dm | 4 +- code/game/turfs/simulated/dungeon/wall.dm | 12 +- code/game/turfs/simulated/floor.dm | 24 +- code/game/turfs/simulated/floor_types.dm | 2 +- .../game/turfs/simulated/outdoors/outdoors.dm | 4 +- code/game/turfs/simulated/wall_types.dm | 138 ++++--- code/game/turfs/simulated/walls.dm | 4 +- code/game/turfs/space/space.dm | 68 +--- code/game/turfs/turf.dm | 24 +- code/game/turfs/unsimulated/beach.dm | 9 +- code/game/turfs/unsimulated/planetary.dm | 5 +- code/modules/admin/verbs/adminjump.dm | 2 +- code/modules/admin/verbs/atmosdebug.dm | 2 +- code/modules/admin/verbs/grief_fixers.dm | 2 +- code/modules/lighting/lighting_turf.dm | 6 - code/modules/mob/freelook/update_triggers.dm | 4 +- code/modules/overmap/_defines.dm | 4 +- code/modules/random_map/automata/diona.dm | 4 +- code/modules/turbolift/turbolift_turfs.dm | 4 +- maps/~map_system/maps.dm | 11 - polaris.dme | 3 +- 37 files changed, 539 insertions(+), 581 deletions(-) rename code/game/machinery/{alarm.dm => air_alarm.dm} (69%) create mode 100644 code/game/machinery/fire_alarm.dm diff --git a/code/__defines/machinery.dm b/code/__defines/machinery.dm index f7c2457b98..d01ff407a2 100644 --- a/code/__defines/machinery.dm +++ b/code/__defines/machinery.dm @@ -29,6 +29,11 @@ var/global/defer_powernet_rebuild = 0 // True if net rebuild will be called #define MAINT 0x8 // Under maintenance. #define EMPED 0x10 // Temporary broken by EMP pulse. +// Remote control states +#define RCON_NO 1 +#define RCON_AUTO 2 +#define RCON_YES 3 + // Used by firelocks #define FIREDOOR_OPEN 1 #define FIREDOOR_CLOSED 2 diff --git a/code/_helpers/_lists.dm b/code/_helpers/_lists.dm index 8424299382..ba4ef7b017 100644 --- a/code/_helpers/_lists.dm +++ b/code/_helpers/_lists.dm @@ -845,3 +845,18 @@ proc/dd_sortedTextList(list/incoming) if(L.len) . = L[1] L.Cut(1,2) + +//generates a list used to randomize transit animations so they aren't in lockstep +/proc/get_cross_shift_list(var/size) + var/list/result = list() + + result += rand(0, 14) + for(var/i in 2 to size) + var/shifts = list(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) + shifts -= result[i - 1] //consecutive shifts should not be equal + if(i == size) + shifts -= result[1] //because shift list is a ring buffer + result += pick(shifts) + + return result + \ No newline at end of file diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 50cf502639..23f5186bd0 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -19,8 +19,6 @@ var/global/list/side_effects = list() //list of all medical sideeffects types var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking. var/global/list/joblist = list() //list of all jobstypes, minus borg and AI -var/global/list/turfs = list() //list of all turfs - #define all_genders_define_list list(MALE,FEMALE,PLURAL,NEUTER) #define all_genders_text_list list("Male","Female","Plural","Neuter") diff --git a/code/controllers/subsystems/air.dm b/code/controllers/subsystems/air.dm index 0b8b8ec94e..49303e7fa2 100644 --- a/code/controllers/subsystems/air.dm +++ b/code/controllers/subsystems/air.dm @@ -38,7 +38,7 @@ SUBSYSTEM_DEF(air) current_cycle = 0 var/simulated_turf_count = 0 - for(var/turf/simulated/S in turfs) + for(var/turf/simulated/S in world) simulated_turf_count++ S.update_air_properties() CHECK_TICK diff --git a/code/controllers/subsystems/atoms.dm b/code/controllers/subsystems/atoms.dm index 60fccf6dd3..4db490914a 100644 --- a/code/controllers/subsystems/atoms.dm +++ b/code/controllers/subsystems/atoms.dm @@ -8,9 +8,9 @@ SUBSYSTEM_DEF(atoms) init_order = INIT_ORDER_ATOMS flags = SS_NO_FIRE - var/initialized = INITIALIZATION_INSSATOMS + var/static/initialized = INITIALIZATION_INSSATOMS // var/list/created_atoms // This is never used, so don't bother. ~Leshana - var/old_initialized + var/static/old_initialized var/list/late_loaders var/list/created_atoms diff --git a/code/controllers/subsystems/mapping.dm b/code/controllers/subsystems/mapping.dm index 7435aac505..e48b9f557f 100644 --- a/code/controllers/subsystems/mapping.dm +++ b/code/controllers/subsystems/mapping.dm @@ -16,8 +16,7 @@ SUBSYSTEM_DEF(mapping) if(config.generate_map) // Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order. - if(using_map.perform_map_generation()) - using_map.refresh_mining_turfs() + using_map.perform_map_generation() /datum/controller/subsystem/mapping/proc/load_map_templates() diff --git a/code/controllers/subsystems/skybox.dm b/code/controllers/subsystems/skybox.dm index ccf4427d99..82b498f00e 100644 --- a/code/controllers/subsystems/skybox.dm +++ b/code/controllers/subsystems/skybox.dm @@ -6,6 +6,38 @@ SUBSYSTEM_DEF(skybox) flags = SS_NO_FIRE var/list/skybox_cache = list() + var/list/dust_cache = list() + var/list/speedspace_cache = list() + var/list/phase_shift_by_x = list() + var/list/phase_shift_by_y = list() + +/datum/controller/subsystem/skybox/PreInit() + //Static + for (var/i in 0 to 25) + var/image/im = image('icons/turf/space_dust.dmi', "[i]") + im.plane = DUST_PLANE + im.alpha = 128 //80 + im.blend_mode = BLEND_ADD + dust_cache["[i]"] = im + //Moving + for (var/i in 0 to 14) + // NORTH/SOUTH + var/image/im = image('icons/turf/space_dust_transit.dmi', "speedspace_ns_[i]") + im.plane = DUST_PLANE + im.blend_mode = BLEND_ADD + speedspace_cache["NS_[i]"] = im + // EAST/WEST + im = image('icons/turf/space_dust_transit.dmi', "speedspace_ew_[i]") + im.plane = DUST_PLANE + im.blend_mode = BLEND_ADD + speedspace_cache["EW_[i]"] = im + + //Shuffle some lists + phase_shift_by_x = get_cross_shift_list(15) + phase_shift_by_y = get_cross_shift_list(15) + + . = ..() + /datum/controller/subsystem/skybox/Initialize() . = ..() diff --git a/code/controllers/subsystems/xenoarch.dm b/code/controllers/subsystems/xenoarch.dm index d863ad8269..c8184d783e 100644 --- a/code/controllers/subsystems/xenoarch.dm +++ b/code/controllers/subsystems/xenoarch.dm @@ -30,7 +30,7 @@ SUBSYSTEM_DEF(xenoarch) . = ..() /datum/controller/subsystem/xenoarch/proc/SetupXenoarch() - for(var/turf/simulated/mineral/M in turfs) + for(var/turf/simulated/mineral/M in world) if(!M.density || M.z in using_map.xenoarch_exempt_levels) continue diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index e0f0f85049..8bd2c93356 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -43,24 +43,17 @@ var/uid /area/New() - icon_state = "" uid = ++global_uid - all_areas += src - - if(!requires_power) - power_light = 0 - power_equip = 0 - power_environ = 0 - - if(dynamic_lighting) - luminosity = 0 - else - luminosity = 1 - + all_areas += src //Replace with /area in world? Byond optimizes X in world loops. + ..() /area/Initialize() . = ..() + + luminosity = !(dynamic_lighting) + icon_state = "" + return INITIALIZE_HINT_LATELOAD // Areas tradiationally are initialized AFTER other atoms. /area/LateInitialize() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 53167c0e9d..83be2ed012 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -41,8 +41,7 @@ _preloader.load(src) // Pass our arguments to InitAtom so they can be passed to initialize(), but replace 1st with if-we're-during-mapload. - var/do_initialize = SSatoms && SSatoms.initialized // Workaround our non-ideal initialization order: SSatoms may not exist yet. - //var/do_initialize = SSatoms.initialized + var/do_initialize = SSatoms.initialized if(do_initialize > INITIALIZATION_INSSATOMS) args[1] = (do_initialize == INITIALIZATION_INNEW_MAPLOAD) if(SSatoms.InitAtom(src, args)) diff --git a/code/game/gamemodes/cult/hell_universe.dm b/code/game/gamemodes/cult/hell_universe.dm index ee79453933..27dd86df13 100644 --- a/code/game/gamemodes/cult/hell_universe.dm +++ b/code/game/gamemodes/cult/hell_universe.dm @@ -65,11 +65,11 @@ In short: for(var/datum/lighting_corner/L in world) L.update_lumcount(1, 0, 0) - for(var/turf/space/T in turfs) + for(var/turf/space/T in world) OnTurfChange(T) /datum/universal_state/hell/proc/MiscSet() - for(var/turf/simulated/floor/T in turfs) + for(var/turf/simulated/floor/T in world) if(!T.holy && prob(1)) new /obj/effect/gateway/active/cult(T) diff --git a/code/game/gamemodes/endgame/supermatter_cascade/blob.dm b/code/game/gamemodes/endgame/supermatter_cascade/blob.dm index be85616143..88da43257d 100644 --- a/code/game/gamemodes/endgame/supermatter_cascade/blob.dm +++ b/code/game/gamemodes/endgame/supermatter_cascade/blob.dm @@ -14,8 +14,8 @@ var/next_check=0 var/list/avail_dirs = list(NORTH,SOUTH,EAST,WEST) -/turf/unsimulated/wall/supermatter/New() - ..() +/turf/unsimulated/wall/supermatter/Initialize(mapload) + . = ..() START_PROCESSING(SSturfs, src) next_check = world.time+5 SECONDS diff --git a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm index 0c0d4c1a40..8f4f861b42 100644 --- a/code/game/gamemodes/endgame/supermatter_cascade/universe.dm +++ b/code/game/gamemodes/endgame/supermatter_cascade/universe.dm @@ -98,7 +98,7 @@ The access requirements on the Asteroid Shuttles' consoles have now been revoked else L.update_lumcount(0.0, 0.4, 1) - for(var/turf/space/T in turfs) + for(var/turf/space/T in world) OnTurfChange(T) /datum/universal_state/supermatter_cascade/proc/MiscSet() diff --git a/code/game/gamemodes/events/wormholes.dm b/code/game/gamemodes/events/wormholes.dm index 83f4246696..20f7da63f3 100644 --- a/code/game/gamemodes/events/wormholes.dm +++ b/code/game/gamemodes/events/wormholes.dm @@ -3,7 +3,7 @@ var/list/pick_turfs = list() var/list/Z_choices = list() Z_choices |= using_map.get_map_levels(1, FALSE) - for(var/turf/simulated/floor/T in turfs) + for(var/turf/simulated/floor/T in world) if(T.z in Z_choices) if(!T.block_tele) pick_turfs += T diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/air_alarm.dm similarity index 69% rename from code/game/machinery/alarm.dm rename to code/game/machinery/air_alarm.dm index 648c68cf95..f422441050 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/air_alarm.dm @@ -1,7 +1,3 @@ -//////////////////////////////////////// -//CONTAINS: Air Alarms and Fire Alarms// -//////////////////////////////////////// - #define AALARM_MODE_SCRUBBING 1 #define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster. #define AALARM_MODE_PANIC 3 //constantly sucks all air @@ -17,10 +13,6 @@ #define AALARM_REPORT_TIMEOUT 100 -#define RCON_NO 1 -#define RCON_AUTO 2 -#define RCON_YES 3 - #define MAX_TEMPERATURE 90 #define MIN_TEMPERATURE -40 @@ -98,8 +90,8 @@ /obj/machinery/alarm/alarms_hidden alarms_hidden = TRUE -/obj/machinery/alarm/server/New() - ..() +/obj/machinery/alarm/server/Initialize(mapload) + . = ..() req_access = list(access_rd, access_atmospherics, access_engine_equip) TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa @@ -109,6 +101,10 @@ TLV["temperature"] = list(20, 40, 140, 160) // K target_temperature = 90 +/obj/machinery/alarm/Initialize(mapload) + . = ..() + first_run() + /obj/machinery/alarm/Destroy() unregister_radio(src, frequency) qdel(wires) @@ -118,10 +114,6 @@ elect_master(exclude_self = TRUE) return ..() -/obj/machinery/alarm/New() - ..() - first_run() - /obj/machinery/alarm/proc/first_run() alarm_area = get_area(src) area_uid = alarm_area.uid @@ -312,7 +304,7 @@ return var/icon_level = danger_level - if(alarm_area.atmosalm) + if(alarm_area?.atmosalm) icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow var/new_color = null @@ -792,342 +784,3 @@ ..() spawn(rand(0,15)) update_icon() - -/obj/machinery/alarm/examine(mob/user) - ..(user) -/* -AIR ALARM CIRCUIT -Just a object used in constructing air alarms - -/obj/item/weapon/airalarm_electronics - name = "air alarm electronics" - icon = 'icons/obj/doors/door_assembly.dmi' - icon_state = "door_electronics" - desc = "Looks like a circuit. Probably is." - w_class = ITEMSIZE_SMALL - matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50) -*/ -/* -FIRE ALARM -*/ -/obj/machinery/firealarm - name = "fire alarm" - desc = "\"Pull this in case of emergency\". Thus, keep pulling it forever." - icon = 'icons/obj/monitors.dmi' - icon_state = "fire0" - plane = TURF_PLANE - layer = ABOVE_TURF_LAYER - var/detecting = 1.0 - var/working = 1.0 - var/time = 10.0 - var/timing = 0.0 - var/lockdownbyai = 0 - anchored = 1.0 - use_power = USE_POWER_IDLE - idle_power_usage = 2 - active_power_usage = 6 - power_channel = ENVIRON - var/last_process = 0 - panel_open = 0 - var/seclevel - circuit = /obj/item/weapon/circuitboard/firealarm - var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles - -/obj/machinery/firealarm/alarms_hidden - alarms_hidden = TRUE - -/obj/machinery/firealarm/update_icon() - cut_overlays() - - if(panel_open) - set_light(0) - return - - if(stat & BROKEN) - icon_state = "firex" - set_light(0) - else if(stat & NOPOWER) - icon_state = "firep" - set_light(0) - else - if(!detecting) - icon_state = "fire1" - set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000") - else - icon_state = "fire0" - switch(seclevel) - if("green") set_light(l_range = 2, l_power = 0.25, l_color = "#00ff00") - if("yellow") set_light(l_range = 2, l_power = 0.25, l_color = "#ffff00") - if("violet") set_light(l_range = 2, l_power = 0.25, l_color = "#9933ff") - if("orange") set_light(l_range = 2, l_power = 0.25, l_color = "#ff9900") - if("blue") set_light(l_range = 2, l_power = 0.25, l_color = "#1024A9") - if("red") set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000") - if("delta") set_light(l_range = 4, l_power = 0.9, l_color = "#FF6633") - add_overlay("overlay_[seclevel]") - -/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume) - if(detecting) - if(temperature > T0C + 200) - alarm() // added check of detector status here - return - -/obj/machinery/firealarm/attack_ai(mob/user as mob) - return attack_hand(user) - -/obj/machinery/firealarm/bullet_act() - return alarm() - -/obj/machinery/firealarm/emp_act(severity) - if(prob(50 / severity)) - alarm(rand(30 / severity, 60 / severity)) - ..() - -/obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob) - add_fingerprint(user) - - if(alarm_deconstruction_screwdriver(user, W)) - return - if(alarm_deconstruction_wirecutters(user, W)) - return - - if(panel_open) - if(istype(W, /obj/item/device/multitool)) - detecting = !(detecting) - if(detecting) - user.visible_message("\The [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") - else - user.visible_message("\The [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") - return - - alarm() - return - -/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed - if(stat & (NOPOWER|BROKEN)) - return - - if(timing) - if(time > 0) - time = time - ((world.timeofday - last_process) / 10) - else - alarm() - time = 0 - timing = 0 - STOP_PROCESSING(SSobj, src) - updateDialog() - last_process = world.timeofday - - if(locate(/obj/fire) in src.loc) - alarm() - - return - -/obj/machinery/firealarm/power_change() - ..() - spawn(rand(0,15)) - update_icon() - -/obj/machinery/firealarm/attack_hand(mob/user as mob) - if(user.stat || stat & (NOPOWER | BROKEN)) - return - - user.set_machine(src) - var/area/A = src.loc - var/d1 - var/d2 - if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon)) - A = A.loc - - if(A.fire) - d1 = text("Reset - Lockdown", src) - else - d1 = text("Alarm - Lockdown", src) - if(timing) - d2 = text("Stop Time Lock", src) - else - d2 = text("Initiate Time Lock", src) - var/second = round(time) % 60 - var/minute = (round(time) - second) / 60 - var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]

\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n
" - user << browse(dat, "window=firealarm") - onclose(user, "firealarm") - else - A = A.loc - if(A.fire) - d1 = text("[]", src, stars("Reset - Lockdown")) - else - d1 = text("[]", src, stars("Alarm - Lockdown")) - if(timing) - d2 = text("[]", src, stars("Stop Time Lock")) - else - d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = round(time) % 60 - var/minute = (round(time) - second) / 60 - var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]

\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n
" - user << browse(dat, "window=firealarm") - onclose(user, "firealarm") - return - -/obj/machinery/firealarm/Topic(href, href_list) - ..() - if(usr.stat || stat & (BROKEN | NOPOWER)) - return - - if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) - usr.set_machine(src) - if(href_list["reset"]) - reset() - else if(href_list["alarm"]) - alarm() - else if(href_list["time"]) - timing = text2num(href_list["time"]) - last_process = world.timeofday - START_PROCESSING(SSobj, src) - else if(href_list["tp"]) - var/tp = text2num(href_list["tp"]) - time += tp - time = min(max(round(time), 0), 120) - - updateUsrDialog() - - add_fingerprint(usr) - else - usr << browse(null, "window=firealarm") - return - return - -/obj/machinery/firealarm/proc/reset() - if(!(working)) - return - var/area/area = get_area(src) - for(var/obj/machinery/firealarm/FA in area) - fire_alarm.clearAlarm(src.loc, FA) - update_icon() - return - -/obj/machinery/firealarm/proc/alarm(var/duration = 0) - if(!(working)) - return - var/area/area = get_area(src) - for(var/obj/machinery/firealarm/FA in area) - fire_alarm.triggerAlarm(loc, FA, duration, hidden = alarms_hidden) - update_icon() - //playsound(src.loc, 'sound/ambience/signal.ogg', 75, 0) - return - -/obj/machinery/firealarm/proc/set_security_level(var/newlevel) - if(seclevel != newlevel) - seclevel = newlevel - update_icon() - -/obj/machinery/firealarm/Initialize() - . = ..() - if(z in using_map.contact_levels) - set_security_level(security_level? get_security_level() : "green") - -/* -FIRE ALARM CIRCUIT -Just a object used in constructing fire alarms - -/obj/item/weapon/firealarm_electronics - name = "fire alarm electronics" - icon = 'icons/obj/doors/door_assembly.dmi' - icon_state = "door_electronics" - desc = "A circuit. It has a label on it, it says \"Can handle heat levels up to 40 degrees celsius!\"" - w_class = ITEMSIZE_SMALL - matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50) -*/ -/obj/machinery/partyalarm - name = "\improper PARTY BUTTON" - desc = "Cuban Pete is in the house!" - icon = 'icons/obj/monitors.dmi' - icon_state = "fire0" - var/detecting = 1.0 - var/working = 1.0 - var/time = 10.0 - var/timing = 0.0 - var/lockdownbyai = 0 - anchored = 1.0 - use_power = USE_POWER_IDLE - idle_power_usage = 2 - active_power_usage = 6 - -/obj/machinery/partyalarm/attack_hand(mob/user as mob) - if(user.stat || stat & (NOPOWER|BROKEN)) - return - - user.machine = src - var/area/A = get_area(src) - ASSERT(isarea(A)) - var/d1 - var/d2 - if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) - - if(A.party) - d1 = text("No Party :(", src) - else - d1 = text("PARTY!!!", src) - if(timing) - d2 = text("Stop Time Lock", src) - else - d2 = text("Initiate Time Lock", src) - var/second = time % 60 - var/minute = (time - second) / 60 - var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) - user << browse(dat, "window=partyalarm") - onclose(user, "partyalarm") - else - if(A.fire) - d1 = text("[]", src, stars("No Party :(")) - else - d1 = text("[]", src, stars("PARTY!!!")) - if(timing) - d2 = text("[]", src, stars("Stop Time Lock")) - else - d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = time % 60 - var/minute = (time - second) / 60 - var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) - user << browse(dat, "window=partyalarm") - onclose(user, "partyalarm") - return - -/obj/machinery/partyalarm/proc/reset() - if(!(working)) - return - var/area/A = get_area(src) - ASSERT(isarea(A)) - A.partyreset() - return - -/obj/machinery/partyalarm/proc/alarm() - if(!(working)) - return - var/area/A = get_area(src) - ASSERT(isarea(A)) - A.partyalert() - return - -/obj/machinery/partyalarm/Topic(href, href_list) - ..() - if(usr.stat || stat & (BROKEN|NOPOWER)) - return - if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) - usr.machine = src - if(href_list["reset"]) - reset() - else if(href_list["alarm"]) - alarm() - else if(href_list["time"]) - timing = text2num(href_list["time"]) - else if(href_list["tp"]) - var/tp = text2num(href_list["tp"]) - time += tp - time = min(max(round(time), 0), 120) - updateUsrDialog() - - add_fingerprint(usr) - else - usr << browse(null, "window=partyalarm") - return - return diff --git a/code/game/machinery/fire_alarm.dm b/code/game/machinery/fire_alarm.dm new file mode 100644 index 0000000000..a9b4a0705e --- /dev/null +++ b/code/game/machinery/fire_alarm.dm @@ -0,0 +1,324 @@ +/* +FIRE ALARM +*/ +/obj/machinery/firealarm + name = "fire alarm" + desc = "\"Pull this in case of emergency\". Thus, keep pulling it forever." + icon = 'icons/obj/monitors.dmi' + icon_state = "fire0" + plane = TURF_PLANE + layer = ABOVE_TURF_LAYER + var/detecting = 1.0 + var/working = 1.0 + var/time = 10.0 + var/timing = 0.0 + var/lockdownbyai = 0 + anchored = 1.0 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 6 + power_channel = ENVIRON + var/last_process = 0 + panel_open = 0 + var/seclevel + circuit = /obj/item/weapon/circuitboard/firealarm + var/alarms_hidden = FALSE //If the alarms from this machine are visible on consoles + +/obj/machinery/firealarm/alarms_hidden + alarms_hidden = TRUE + +/obj/machinery/firealarm/Initialize() + . = ..() + if(z in using_map.contact_levels) + set_security_level(security_level ? get_security_level() : "green") + +/obj/machinery/firealarm/update_icon() + cut_overlays() + + if(panel_open) + set_light(0) + return + + if(stat & BROKEN) + icon_state = "firex" + set_light(0) + else if(stat & NOPOWER) + icon_state = "firep" + set_light(0) + else + if(!detecting) + icon_state = "fire1" + set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000") + else + icon_state = "fire0" + switch(seclevel) + if("green") set_light(l_range = 2, l_power = 0.25, l_color = "#00ff00") + if("yellow") set_light(l_range = 2, l_power = 0.25, l_color = "#ffff00") + if("violet") set_light(l_range = 2, l_power = 0.25, l_color = "#9933ff") + if("orange") set_light(l_range = 2, l_power = 0.25, l_color = "#ff9900") + if("blue") set_light(l_range = 2, l_power = 0.25, l_color = "#1024A9") + if("red") set_light(l_range = 4, l_power = 0.9, l_color = "#ff0000") + if("delta") set_light(l_range = 4, l_power = 0.9, l_color = "#FF6633") + add_overlay("overlay_[seclevel]") + +/obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume) + if(detecting) + if(temperature > T0C + 200) + alarm() // added check of detector status here + return + +/obj/machinery/firealarm/attack_ai(mob/user as mob) + return attack_hand(user) + +/obj/machinery/firealarm/bullet_act() + return alarm() + +/obj/machinery/firealarm/emp_act(severity) + if(prob(50 / severity)) + alarm(rand(30 / severity, 60 / severity)) + ..() + +/obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob) + add_fingerprint(user) + + if(alarm_deconstruction_screwdriver(user, W)) + return + if(alarm_deconstruction_wirecutters(user, W)) + return + + if(panel_open) + if(istype(W, /obj/item/device/multitool)) + detecting = !(detecting) + if(detecting) + user.visible_message("\The [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") + else + user.visible_message("\The [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") + return + + alarm() + return + +/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed + if(stat & (NOPOWER|BROKEN)) + return + + if(timing) + if(time > 0) + time = time - ((world.timeofday - last_process) / 10) + else + alarm() + time = 0 + timing = 0 + STOP_PROCESSING(SSobj, src) + updateDialog() + last_process = world.timeofday + + if(locate(/obj/fire) in src.loc) + alarm() + + return + +/obj/machinery/firealarm/power_change() + ..() + spawn(rand(0,15)) + update_icon() + +/obj/machinery/firealarm/attack_hand(mob/user as mob) + if(user.stat || stat & (NOPOWER | BROKEN)) + return + + user.set_machine(src) + var/area/A = src.loc + var/d1 + var/d2 + if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon)) + A = A.loc + + if(A.fire) + d1 = text("Reset - Lockdown", src) + else + d1 = text("Alarm - Lockdown", src) + if(timing) + d2 = text("Stop Time Lock", src) + else + d2 = text("Initiate Time Lock", src) + var/second = round(time) % 60 + var/minute = (round(time) - second) / 60 + var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]

\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n
" + user << browse(dat, "window=firealarm") + onclose(user, "firealarm") + else + A = A.loc + if(A.fire) + d1 = text("[]", src, stars("Reset - Lockdown")) + else + d1 = text("[]", src, stars("Alarm - Lockdown")) + if(timing) + d2 = text("[]", src, stars("Stop Time Lock")) + else + d2 = text("[]", src, stars("Initiate Time Lock")) + var/second = round(time) % 60 + var/minute = (round(time) - second) / 60 + var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]

\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n
" + user << browse(dat, "window=firealarm") + onclose(user, "firealarm") + return + +/obj/machinery/firealarm/Topic(href, href_list) + ..() + if(usr.stat || stat & (BROKEN | NOPOWER)) + return + + if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) + usr.set_machine(src) + if(href_list["reset"]) + reset() + else if(href_list["alarm"]) + alarm() + else if(href_list["time"]) + timing = text2num(href_list["time"]) + last_process = world.timeofday + START_PROCESSING(SSobj, src) + else if(href_list["tp"]) + var/tp = text2num(href_list["tp"]) + time += tp + time = min(max(round(time), 0), 120) + + updateUsrDialog() + + add_fingerprint(usr) + else + usr << browse(null, "window=firealarm") + return + return + +/obj/machinery/firealarm/proc/reset() + if(!(working)) + return + var/area/area = get_area(src) + for(var/obj/machinery/firealarm/FA in area) + fire_alarm.clearAlarm(src.loc, FA) + update_icon() + return + +/obj/machinery/firealarm/proc/alarm(var/duration = 0) + if(!(working)) + return + var/area/area = get_area(src) + for(var/obj/machinery/firealarm/FA in area) + fire_alarm.triggerAlarm(loc, FA, duration, hidden = alarms_hidden) + update_icon() + playsound(src.loc, 'sound/machines/airalarm.ogg', 25, 0, 4) + return + +/obj/machinery/firealarm/proc/set_security_level(var/newlevel) + if(seclevel != newlevel) + seclevel = newlevel + update_icon() + +/* +FIRE ALARM CIRCUIT +Just a object used in constructing fire alarms + +/obj/item/weapon/firealarm_electronics + name = "fire alarm electronics" + icon = 'icons/obj/doors/door_assembly.dmi' + icon_state = "door_electronics" + desc = "A circuit. It has a label on it, it says \"Can handle heat levels up to 40 degrees celsius!\"" + w_class = ITEMSIZE_SMALL + matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50) +*/ +/obj/machinery/partyalarm + name = "\improper PARTY BUTTON" + desc = "Cuban Pete is in the house!" + icon = 'icons/obj/monitors.dmi' + icon_state = "fire0" + var/detecting = 1.0 + var/working = 1.0 + var/time = 10.0 + var/timing = 0.0 + var/lockdownbyai = 0 + anchored = 1.0 + use_power = 1 + idle_power_usage = 2 + active_power_usage = 6 + +/obj/machinery/partyalarm/attack_hand(mob/user as mob) + if(user.stat || stat & (NOPOWER|BROKEN)) + return + + user.machine = src + var/area/A = get_area(src) + ASSERT(isarea(A)) + var/d1 + var/d2 + if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) + + if(A.party) + d1 = text("No Party :(", src) + else + d1 = text("PARTY!!!", src) + if(timing) + d2 = text("Stop Time Lock", src) + else + d2 = text("Initiate Time Lock", src) + var/second = time % 60 + var/minute = (time - second) / 60 + var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) + user << browse(dat, "window=partyalarm") + onclose(user, "partyalarm") + else + if(A.fire) + d1 = text("[]", src, stars("No Party :(")) + else + d1 = text("[]", src, stars("PARTY!!!")) + if(timing) + d2 = text("[]", src, stars("Stop Time Lock")) + else + d2 = text("[]", src, stars("Initiate Time Lock")) + var/second = time % 60 + var/minute = (time - second) / 60 + var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) + user << browse(dat, "window=partyalarm") + onclose(user, "partyalarm") + return + +/obj/machinery/partyalarm/proc/reset() + if(!(working)) + return + var/area/A = get_area(src) + ASSERT(isarea(A)) + A.partyreset() + return + +/obj/machinery/partyalarm/proc/alarm() + if(!(working)) + return + var/area/A = get_area(src) + ASSERT(isarea(A)) + A.partyalert() + return + +/obj/machinery/partyalarm/Topic(href, href_list) + ..() + if(usr.stat || stat & (BROKEN|NOPOWER)) + return + if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) + usr.machine = src + if(href_list["reset"]) + reset() + else if(href_list["alarm"]) + alarm() + else if(href_list["time"]) + timing = text2num(href_list["time"]) + else if(href_list["tp"]) + var/tp = text2num(href_list["tp"]) + time += tp + time = min(max(round(time), 0), 120) + updateUsrDialog() + + add_fingerprint(usr) + else + usr << browse(null, "window=partyalarm") + return + return diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 21488e5f26..9e48b3777c 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -55,8 +55,8 @@ B.clean_blood() ..() -/turf/simulated/New() - ..() +/turf/simulated/Initialize(mapload) + . = ..() if(istype(loc, /area/chapel)) holy = 1 levelupdate() diff --git a/code/game/turfs/simulated/dungeon/wall.dm b/code/game/turfs/simulated/dungeon/wall.dm index 3bae19db69..2bfc23145e 100644 --- a/code/game/turfs/simulated/dungeon/wall.dm +++ b/code/game/turfs/simulated/dungeon/wall.dm @@ -3,8 +3,8 @@ /turf/simulated/wall/dungeon block_tele = TRUE // Anti-cheese. -/turf/simulated/wall/dungeon/New(var/newloc) - ..(newloc,"dungeonium") +/turf/simulated/wall/dungeon/Initialize(mapload) + . = ..(mapload, "dungeonium") /turf/simulated/wall/dungeon/attackby() return @@ -20,8 +20,8 @@ var/rock_side = "rock_side" block_tele = TRUE -/turf/simulated/wall/solidrock/New(var/newloc) - ..(newloc,"bedrock") +/turf/simulated/wall/solidrock/Initialize(mapload) + . = ..(mapload, "bedrock") /turf/simulated/wall/solidrock/Initialize() . = ..() @@ -81,8 +81,8 @@ desc = "An old, yet impressively durably rock wall." var/mossyrock_side = "mossyrock_side" -/turf/simulated/wall/solidrock/New(var/newloc) - ..(newloc,"mossyrock") +/turf/simulated/wall/solidrock/Initialize(mapload) + . = ..(mapload, "mossyrock") /turf/simulated/wall/solidrock/mossyrockpoi/update_icon(var/update_neighbors) if(density) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 2c7f8ff12e..866103376a 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -20,6 +20,8 @@ 'sound/effects/footstep/plating4.ogg', 'sound/effects/footstep/plating5.ogg')) + var/list/old_decals = null + // Flooring data. var/flooring_override var/initial_flooring @@ -33,12 +35,12 @@ /turf/simulated/floor/is_plating() return !flooring -/turf/simulated/floor/New(var/newloc, var/floortype) - ..(newloc) +/turf/simulated/floor/Initialize(mapload, floortype) + . = ..() if(!floortype && initial_flooring) floortype = initial_flooring if(floortype) - set_flooring(get_flooring_data(floortype)) + set_flooring(get_flooring_data(floortype), TRUE) else footstep_sounds = base_footstep_sounds if(can_dirty && can_start_dirty) @@ -46,8 +48,15 @@ dirt += rand(50,100) update_dirt() //5% chance to start with dirt on a floor tile- give the janitor something to do -/turf/simulated/floor/proc/set_flooring(var/decl/flooring/newflooring) +/turf/simulated/floor/proc/swap_decals() + var/current_decals = decals + decals = old_decals + old_decals = current_decals + +/turf/simulated/floor/proc/set_flooring(var/decl/flooring/newflooring, var/initializing) make_plating(defer_icon_update = 1) + if(!flooring && !initializing) // Plating -> Flooring + swap_decals() flooring = newflooring footstep_sounds = newflooring.footstep_sounds update_icon(1) @@ -56,11 +65,7 @@ //This proc will set floor_type to null and the update_icon() proc will then change the icon_state of the turf //This proc auto corrects the grass tiles' siding. /turf/simulated/floor/proc/make_plating(var/place_product, var/defer_icon_update) - cut_overlays() - if(islist(decals)) - decals.Cut() - decals = null name = base_name desc = base_desc @@ -68,7 +73,8 @@ icon_state = base_icon_state footstep_sounds = base_footstep_sounds - if(flooring) + if(flooring) // Flooring -> Plating + swap_decals() if(flooring.build_type && place_product) new flooring.build_type(src) flooring = null diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm index a91b5decc9..151efd819c 100644 --- a/code/game/turfs/simulated/floor_types.dm +++ b/code/game/turfs/simulated/floor_types.dm @@ -85,7 +85,7 @@ var/join_group = "shuttle" //A tag for what other walls to join with. Null if you don't want them to. var/static/list/antilight_cache -/turf/simulated/shuttle/New() +/turf/simulated/shuttle/Initialize(mapload) ..() if(!antilight_cache) antilight_cache = list() diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm index 9e9929305e..42016e8081 100644 --- a/code/game/turfs/simulated/outdoors/outdoors.dm +++ b/code/game/turfs/simulated/outdoors/outdoors.dm @@ -24,10 +24,10 @@ var/list/turf_edge_cache = list() update_icon() . = ..() -/turf/simulated/floor/New() +/turf/simulated/floor/Initialize(mapload) if(outdoors) SSplanets.addTurf(src) - ..() + . = ..() /turf/simulated/floor/Destroy() if(outdoors) diff --git a/code/game/turfs/simulated/wall_types.dm b/code/game/turfs/simulated/wall_types.dm index bff82d6e0e..96979c8452 100644 --- a/code/game/turfs/simulated/wall_types.dm +++ b/code/game/turfs/simulated/wall_types.dm @@ -1,89 +1,89 @@ /turf/simulated/wall/r_wall icon_state = "rgeneric" -/turf/simulated/wall/r_wall/New(var/newloc) - ..(newloc, "plasteel","plasteel") //3strong +/turf/simulated/wall/r_wall/Initialize(mapload) + . = ..(mapload, "plasteel","plasteel") //3strong -/turf/simulated/wall/shull/New(var/newloc) //Spaaaace ship. - ..(newloc, MAT_STEELHULL, null, MAT_STEELHULL) -/turf/simulated/wall/rshull/New(var/newloc) - ..(newloc, MAT_STEELHULL, MAT_STEELHULL, MAT_STEELHULL) -/turf/simulated/wall/pshull/New(var/newloc) //Spaaaace-er ship. - ..(newloc, MAT_PLASTEELHULL, null, MAT_PLASTEELHULL) -/turf/simulated/wall/rpshull/New(var/newloc) - ..(newloc, MAT_PLASTEELHULL, MAT_PLASTEELHULL, MAT_PLASTEELHULL) -/turf/simulated/wall/dshull/New(var/newloc) //Spaaaace-est ship. - ..(newloc, MAT_DURASTEELHULL, null, MAT_DURASTEELHULL) -/turf/simulated/wall/rdshull/New(var/newloc) - ..(newloc, MAT_DURASTEELHULL, MAT_DURASTEELHULL, MAT_DURASTEELHULL) -/turf/simulated/wall/thull/New(var/newloc) - ..(newloc, MAT_TITANIUMHULL, null, MAT_TITANIUMHULL) -/turf/simulated/wall/rthull/New(var/newloc) - ..(newloc, MAT_TITANIUMHULL, MAT_TITANIUMHULL, MAT_TITANIUMHULL) +/turf/simulated/wall/shull/Initialize(mapload) //Spaaaace ship. + . = ..(mapload, MAT_STEELHULL, null, MAT_STEELHULL) +/turf/simulated/wall/rshull/Initialize(mapload) + . = ..(mapload, MAT_STEELHULL, MAT_STEELHULL, MAT_STEELHULL) +/turf/simulated/wall/pshull/Initialize(mapload) //Spaaaace-er ship. + . = ..(mapload, MAT_PLASTEELHULL, null, MAT_PLASTEELHULL) +/turf/simulated/wall/rpshull/Initialize(mapload) + . = ..(mapload, MAT_PLASTEELHULL, MAT_PLASTEELHULL, MAT_PLASTEELHULL) +/turf/simulated/wall/dshull/Initialize(mapload) //Spaaaace-est ship. + . = ..(mapload, MAT_DURASTEELHULL, null, MAT_DURASTEELHULL) +/turf/simulated/wall/rdshull/Initialize(mapload) + . = ..(mapload, MAT_DURASTEELHULL, MAT_DURASTEELHULL, MAT_DURASTEELHULL) +/turf/simulated/wall/thull/Initialize(mapload) + . = ..(mapload, MAT_TITANIUMHULL, null, MAT_TITANIUMHULL) +/turf/simulated/wall/rthull/Initialize(mapload) + . = ..(mapload, MAT_TITANIUMHULL, MAT_TITANIUMHULL, MAT_TITANIUMHULL) /turf/simulated/wall/cult icon_state = "cult" -/turf/simulated/wall/cult/New(var/newloc) - ..(newloc,"cult","cult2","cult") +/turf/simulated/wall/cult/Initialize(mapload) + . = ..(mapload, "cult","cult2","cult") /turf/unsimulated/wall/cult name = "cult wall" desc = "Hideous images dance beneath the surface." icon = 'icons/turf/wall_masks.dmi' icon_state = "cult" -/turf/simulated/wall/iron/New(var/newloc) - ..(newloc,"iron") -/turf/simulated/wall/uranium/New(var/newloc) - ..(newloc,"uranium") -/turf/simulated/wall/diamond/New(var/newloc) - ..(newloc,"diamond") -/turf/simulated/wall/gold/New(var/newloc) - ..(newloc,"gold") -/turf/simulated/wall/silver/New(var/newloc) - ..(newloc,"silver") -/turf/simulated/wall/lead/New(var/newloc) - ..(newloc,"lead") -/turf/simulated/wall/r_lead/New(var/newloc) - ..(newloc,"lead", "lead") -/turf/simulated/wall/phoron/New(var/newloc) - ..(newloc,"phoron") -/turf/simulated/wall/sandstone/New(var/newloc) - ..(newloc,"sandstone") -/turf/simulated/wall/ironphoron/New(var/newloc) - ..(newloc,"iron","phoron") -/turf/simulated/wall/golddiamond/New(var/newloc) - ..(newloc,"gold","diamond") -/turf/simulated/wall/silvergold/New(var/newloc) - ..(newloc,"silver","gold") -/turf/simulated/wall/sandstonediamond/New(var/newloc) - ..(newloc,"sandstone","diamond") -/turf/simulated/wall/snowbrick/New(var/newloc) - ..(newloc,"packed snow") +/turf/simulated/wall/iron/Initialize(mapload) + . = ..(mapload, "iron") +/turf/simulated/wall/uranium/Initialize(mapload) + . = ..(mapload, "uranium") +/turf/simulated/wall/diamond/Initialize(mapload) + . = ..(mapload, "diamond") +/turf/simulated/wall/gold/Initialize(mapload) + . = ..(mapload, "gold") +/turf/simulated/wall/silver/Initialize(mapload) + . = ..(mapload, "silver") +/turf/simulated/wall/lead/Initialize(mapload) + . = ..(mapload, "lead") +/turf/simulated/wall/r_lead/Initialize(mapload) + . = ..(mapload, "lead", "lead") +/turf/simulated/wall/phoron/Initialize(mapload) + . = ..(mapload, "phoron") +/turf/simulated/wall/sandstone/Initialize(mapload) + . = ..(mapload, "sandstone") +/turf/simulated/wall/ironphoron/Initialize(mapload) + . = ..(mapload, "iron","phoron") +/turf/simulated/wall/golddiamond/Initialize(mapload) + . = ..(mapload, "gold","diamond") +/turf/simulated/wall/silvergold/Initialize(mapload) + . = ..(mapload, "silver","gold") +/turf/simulated/wall/sandstonediamond/Initialize(mapload) + . = ..(mapload, "sandstone","diamond") +/turf/simulated/wall/snowbrick/Initialize(mapload) + . = ..(mapload, "packed snow") -/turf/simulated/wall/resin/New(var/newloc) - ..(newloc,"resin",null,"resin") +/turf/simulated/wall/resin/Initialize(mapload) + . = ..(mapload, "resin",null,"resin") // Kind of wondering if this is going to bite me in the butt. -/turf/simulated/wall/skipjack/New(var/newloc) - ..(newloc,"alienalloy") +/turf/simulated/wall/skipjack/Initialize(mapload) + . = ..(mapload, "alienalloy") /turf/simulated/wall/skipjack/attackby() return -/turf/simulated/wall/titanium/New(var/newloc) - ..(newloc,"titanium") +/turf/simulated/wall/titanium/Initialize(mapload) + . = ..(mapload, "titanium") -/turf/simulated/wall/durasteel/New(var/newloc) - ..(newloc,"durasteel", "durasteel") +/turf/simulated/wall/durasteel/Initialize(mapload) + . = ..(mapload, "durasteel", "durasteel") -/turf/simulated/wall/wood/New(var/newloc) - ..(newloc, MAT_WOOD) +/turf/simulated/wall/wood/Initialize(mapload) + . = ..(mapload, MAT_WOOD) -/turf/simulated/wall/sifwood/New(var/newloc) - ..(newloc, MAT_SIFWOOD) +/turf/simulated/wall/sifwood/Initialize(mapload) + . = ..(mapload, MAT_SIFWOOD) -/turf/simulated/wall/log/New(var/newloc) - ..(newloc, MAT_LOG) +/turf/simulated/wall/log/Initialize(mapload) + . = ..(mapload, MAT_LOG) -/turf/simulated/wall/log_sif/New(var/newloc) - ..(newloc, MAT_SIFLOG) +/turf/simulated/wall/log_sif/Initialize(mapload) + . = ..(mapload, MAT_SIFLOG) // Shuttle Walls /turf/simulated/shuttle/wall @@ -152,16 +152,14 @@ icon_state = "alien-nj" join_group = null -/turf/simulated/shuttle/wall/New() - ..() - //To allow mappers to rename shuttle walls to like "redfloor interior" or whatever for ease of use. - name = true_name - /turf/simulated/shuttle/wall/Initialize() . = ..() + //To allow mappers to rename shuttle walls to like "redfloor interior" or whatever for ease of use. + name = true_name + if(join_group) - src.auto_join() + auto_join() else icon_state = base_state diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index bf5f711b20..d72beb290c 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -27,8 +27,8 @@ for(var/obj/O in src) O.hide(1) -/turf/simulated/wall/New(var/newloc, var/materialtype, var/rmaterialtype, var/girdertype) - ..(newloc) +/turf/simulated/wall/Initialize(mapload, materialtype, rmaterialtype, girdertype) + . = ..() icon_state = "blank" if(!materialtype) materialtype = DEFAULT_WALL_MATERIAL diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index afdaab404b..6c658992f4 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -9,82 +9,38 @@ thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT can_build_into_floor = TRUE var/keep_sprite = FALSE -// heat_capacity = 700000 No. - var/static/list/dust_cache - var/static/list/speedspace_cache - var/static/list/phase_shift_by_x - var/static/list/phase_shift_by_y - -/turf/space/proc/build_dust_cache() - //Static - LAZYINITLIST(dust_cache) - for (var/i in 0 to 25) - var/image/im = image('icons/turf/space_dust.dmi', "[i]") - im.plane = DUST_PLANE - im.alpha = 128 //80 - im.blend_mode = BLEND_ADD - dust_cache["[i]"] = im - //Moving - LAZYINITLIST(speedspace_cache) - for (var/i in 0 to 14) - // NORTH/SOUTH - var/image/im = image('icons/turf/space_dust_transit.dmi', "speedspace_ns_[i]") - im.plane = DUST_PLANE - im.blend_mode = BLEND_ADD - speedspace_cache["NS_[i]"] = im - // EAST/WEST - im = image('icons/turf/space_dust_transit.dmi', "speedspace_ew_[i]") - im.plane = DUST_PLANE - im.blend_mode = BLEND_ADD - speedspace_cache["EW_[i]"] = im /turf/space/Initialize() . = ..() + if(!keep_sprite) icon_state = "white" - update_starlight() - if (!dust_cache) - build_dust_cache() - toggle_transit() //add static dust + + if(config.starlight) + update_starlight() + + toggle_transit() //Add static dust (not passing a dir) /turf/space/proc/toggle_transit(var/direction) cut_overlays() if(!direction) - add_overlay(dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"]) + add_overlay(SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"]) return if(direction & (NORTH|SOUTH)) - if(!phase_shift_by_x) - phase_shift_by_x = get_cross_shift_list(15) - var/x_shift = phase_shift_by_x[src.x % (phase_shift_by_x.len - 1) + 1] + var/x_shift = SSskybox.phase_shift_by_x[src.x % (SSskybox.phase_shift_by_x.len - 1) + 1] var/transit_state = ((direction & SOUTH ? world.maxy - src.y : src.y) + x_shift)%15 - add_overlay(speedspace_cache["NS_[transit_state]"]) + add_overlay(SSskybox.speedspace_cache["NS_[transit_state]"]) else if(direction & (EAST|WEST)) - if(!phase_shift_by_y) - phase_shift_by_y = get_cross_shift_list(15) - var/y_shift = phase_shift_by_y[src.y % (phase_shift_by_y.len - 1) + 1] + var/y_shift = SSskybox.phase_shift_by_y[src.y % (SSskybox.phase_shift_by_y.len - 1) + 1] var/transit_state = ((direction & WEST ? world.maxx - src.x : src.x) + y_shift)%15 - add_overlay(speedspace_cache["EW_[transit_state]"]) + add_overlay(SSskybox.speedspace_cache["EW_[transit_state]"]) for(var/atom/movable/AM in src) if (AM.simulated && !AM.anchored) AM.throw_at(get_step(src,reverse_direction(direction)), 5, 1) -//generates a list used to randomize transit animations so they aren't in lockstep -/turf/space/proc/get_cross_shift_list(var/size) - var/list/result = list() - - result += rand(0, 14) - for(var/i in 2 to size) - var/shifts = list(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) - shifts -= result[i - 1] //consecutive shifts should not be equal - if(i == size) - shifts -= result[1] //because shift list is a ring buffer - result += pick(shifts) - - return result - /turf/space/is_space() return 1 @@ -97,8 +53,6 @@ return locate(/obj/structure/lattice, src) //counts as solid structure if it has a lattice /turf/space/proc/update_starlight() - if(!config.starlight) - return if(locate(/turf/simulated) in orange(src,1)) set_light(config.starlight) else diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 8abd2f44fa..2aa5e763df 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -34,26 +34,22 @@ var/can_build_into_floor = FALSE // Used for things like RCDs (and maybe lattices/floor tiles in the future), to see if a floor should replace it. var/list/dangerous_objects // List of 'dangerous' objs that the turf holds that can cause something bad to happen when stepped on, used for AI mobs. -/turf/New() - ..() - for(var/atom/movable/AM as mob|obj in src) - spawn( 0 ) - src.Entered(AM) - return - turfs |= src - - if(dynamic_lighting) - luminosity = 0 - else - luminosity = 1 +/turf/Initialize(mapload) + . = ..() + for(var/atom/movable/AM in src) + Entered(AM) + //Lighting related + luminosity = !(dynamic_lighting) + has_opaque_atom |= (opacity) + + //Pathfinding related if(movement_cost && pathweight == 1) // This updates pathweight automatically. pathweight = movement_cost /turf/Destroy() - turfs -= src + . = QDEL_HINT_IWILLGC ..() - return QDEL_HINT_IWILLGC /turf/ex_act(severity) return 0 diff --git a/code/game/turfs/unsimulated/beach.dm b/code/game/turfs/unsimulated/beach.dm index 82206926cf..52c2618a79 100644 --- a/code/game/turfs/unsimulated/beach.dm +++ b/code/game/turfs/unsimulated/beach.dm @@ -14,9 +14,10 @@ /turf/unsimulated/beach/water name = "Water" icon_state = "water" + initialized = FALSE -/turf/unsimulated/beach/water/New() - ..() +/turf/unsimulated/beach/water/Initialize() + . = ..() add_overlay(image("icon"='icons/misc/beach.dmi',"icon_state"="water2","layer"=MOB_LAYER+0.1)) /turf/simulated/floor/beach @@ -42,6 +43,6 @@ /turf/simulated/floor/beach/water/ocean icon_state = "seadeep" -/turf/simulated/floor/beach/water/New() - ..() +/turf/simulated/floor/beach/water/Initialize() + . = ..() add_overlay(image("icon"='icons/misc/beach.dmi',"icon_state"="water5","layer"=MOB_LAYER+0.1)) diff --git a/code/game/turfs/unsimulated/planetary.dm b/code/game/turfs/unsimulated/planetary.dm index 35cd7aa4a8..4fb26f16b6 100644 --- a/code/game/turfs/unsimulated/planetary.dm +++ b/code/game/turfs/unsimulated/planetary.dm @@ -9,6 +9,7 @@ density = 1 alpha = 0 blocks_air = 0 + initialized = FALSE // Set these to get your desired planetary atmosphere. oxygen = 0 @@ -17,8 +18,8 @@ phoron = 0 temperature = T20C -/turf/unsimulated/wall/planetary/New() - ..() +/turf/unsimulated/wall/planetary/Initialize() + . = ..() SSplanets.addTurf(src) /turf/unsimulated/wall/planetary/Destroy() diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 90964820d9..9fd596acea 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -21,7 +21,7 @@ else alert("Admin jumping disabled") -/client/proc/jumptoturf(var/turf/T in turfs) +/client/proc/jumptoturf(var/turf/T in world) set name = "Jump to Turf" set category = "Admin" if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index 653b62ddee..2f7d65db05 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -28,7 +28,7 @@ to_chat(usr, "Checking for overlapping pipes...") next_turf: - for(var/turf/T in turfs) + for(var/turf/T in world) for(var/dir in cardinal) var/list/connect_types = list(1 = 0, 2 = 0, 3 = 0) for(var/obj/machinery/atmospherics/pipe in T) diff --git a/code/modules/admin/verbs/grief_fixers.dm b/code/modules/admin/verbs/grief_fixers.dm index 00e5ee1e05..b8815876b2 100644 --- a/code/modules/admin/verbs/grief_fixers.dm +++ b/code/modules/admin/verbs/grief_fixers.dm @@ -38,7 +38,7 @@ unsorted_overlays |= gas_data.tile_overlay[id] - for(var/turf/simulated/T in turfs) + for(var/turf/simulated/T in world) T.air = null T.overlays.Remove(unsorted_overlays) T.zone = null diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 743a0d8e2b..bc3c099091 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -9,12 +9,6 @@ var/tmp/list/datum/lighting_corner/corners var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile. -/turf/New() - . = ..() - - if(opacity) - has_opaque_atom = TRUE - // Causes any affecting light sources to be queued for a visibility update, for example a door got opened. /turf/proc/reconsider_lights() for(var/datum/light_source/L in affecting_lights) diff --git a/code/modules/mob/freelook/update_triggers.dm b/code/modules/mob/freelook/update_triggers.dm index 0b31e24cce..e6d1976fad 100644 --- a/code/modules/mob/freelook/update_triggers.dm +++ b/code/modules/mob/freelook/update_triggers.dm @@ -17,8 +17,8 @@ updateVisibility(src) return ..() -/turf/simulated/New() - ..() +/turf/simulated/Initialize() + . = ..() updateVisibility(src) diff --git a/code/modules/overmap/_defines.dm b/code/modules/overmap/_defines.dm index bf967eb3b9..6cfde46793 100644 --- a/code/modules/overmap/_defines.dm +++ b/code/modules/overmap/_defines.dm @@ -33,8 +33,8 @@ var/global/list/map_sectors = list() opacity = 1 density = 1 -/turf/unsimulated/map/New() - ..() +/turf/unsimulated/map/Initialize() + . = ..() name = "[x]-[y]" var/list/numbers = list() diff --git a/code/modules/random_map/automata/diona.dm b/code/modules/random_map/automata/diona.dm index e9e58a03a4..d6bee1c0ff 100644 --- a/code/modules/random_map/automata/diona.dm +++ b/code/modules/random_map/automata/diona.dm @@ -1,5 +1,5 @@ -/turf/simulated/wall/diona/New(var/newloc) - ..(newloc,"biomass") +/turf/simulated/wall/diona/Initialize(mapload) + ..(mapload, "biomass") /turf/simulated/wall/diona/attack_generic(var/mob/user, var/damage, var/attack_message) if(istype(user, /mob/living/carbon/alien/diona)) diff --git a/code/modules/turbolift/turbolift_turfs.dm b/code/modules/turbolift/turbolift_turfs.dm index 632160efaa..8949f71448 100644 --- a/code/modules/turbolift/turbolift_turfs.dm +++ b/code/modules/turbolift/turbolift_turfs.dm @@ -1,2 +1,2 @@ -/turf/simulated/wall/elevator/New(var/newloc) - ..(newloc,"elevatorium") +/turf/simulated/wall/elevator/Initialize(mapload) + ..(mapload, "elevatorium") diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index 107271df09..a48af689d3 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -126,17 +126,6 @@ var/list/all_maps = list() /datum/map/proc/perform_map_generation() return -// Used to apply various post-compile procedural effects to the map. -/datum/map/proc/refresh_mining_turfs() - - set background = 1 - set waitfor = 0 - - // Update all turfs to ensure everything looks good post-generation. Yes, - // it's brute-forcey, but frankly the alternative is a mine turf rewrite. - for(var/turf/simulated/mineral/M in turfs) // Ugh. - M.update_icon() - /datum/map/proc/get_network_access(var/network) return 0 diff --git a/polaris.dme b/polaris.dme index 87636329a6..9f4ede5706 100644 --- a/polaris.dme +++ b/polaris.dme @@ -653,7 +653,7 @@ #include "code\game\jobs\job\silicon.dm" #include "code\game\machinery\adv_med.dm" #include "code\game\machinery\ai_slipper.dm" -#include "code\game\machinery\alarm.dm" +#include "code\game\machinery\air_alarm.dm" #include "code\game\machinery\atmo_control.dm" #include "code\game\machinery\autolathe.dm" #include "code\game\machinery\Beacon.dm" @@ -669,6 +669,7 @@ #include "code\game\machinery\door_control.dm" #include "code\game\machinery\doppler_array.dm" #include "code\game\machinery\exonet_node.dm" +#include "code\game\machinery\fire_alarm.dm" #include "code\game\machinery\flasher.dm" #include "code\game\machinery\floodlight.dm" #include "code\game\machinery\floor_light.dm"