From 07c00e75a4d077af5c3a90523ce1de4ac2b608df Mon Sep 17 00:00:00 2001 From: JixS4v <61665800+JixS4v@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:18:28 +0200 Subject: [PATCH] smartpipes tried to sneak in, begone! This reverts commit 9a4e8565bf6471c29923e31452a6f7a4f8b4c034. --- code/__DEFINES/atmospherics/atmos_helpers.dm | 2 +- code/controllers/subsystem/air.dm | 9 +- .../effects/effect_system/effects_foam.dm | 2 +- .../effects/effect_system/effects_smoke.dm | 2 +- code/game/objects/effects/portals.dm | 2 - .../objects/effects/spawners/bombspawner.dm | 8 +- code/game/objects/items/flamethrower.dm | 4 +- code/game/objects/structures/aliens.dm | 4 +- code/game/objects/structures/holosign.dm | 3 - .../objects/structures/windoor_assembly.dm | 8 +- code/game/objects/structures/window.dm | 5 +- code/game/shuttle_engines.dm | 3 +- code/game/turfs/open/floor/reinf_floor.dm | 2 +- code/game/turfs/open/openspace.dm | 2 +- code/modules/art/statues.dm | 579 ------------------ .../environmental/LINDA_system.dm | 135 ++-- .../environmental/LINDA_turf_tile.dm | 249 ++++---- .../atmospherics/machinery/atmosmachinery.dm | 155 +---- .../components/binary_devices/circulator.dm | 7 +- .../components/binary_devices/dp_vent_pump.dm | 10 +- .../components/binary_devices/passive_gate.dm | 8 - .../binary_devices/pressure_valve.dm | 10 - .../components/binary_devices/pump.dm | 9 +- .../binary_devices/thermomachine.dm | 515 ---------------- .../components/binary_devices/valve.dm | 10 - .../components/binary_devices/volume_pump.dm | 8 +- .../machinery/components/components_base.dm | 42 +- .../machinery/components/fusion/hfr_parts.dm | 503 --------------- .../gas_recipe_machines/crystallizer.dm | 339 ---------- .../atmospherics/machinery/components/tank.dm | 553 ----------------- .../components/trinary_devices/filter.dm | 21 +- .../components/trinary_devices/mixer.dm | 22 +- .../trinary_devices/trinary_devices.dm | 1 - .../unary_devices/bluespace_sender.dm | 178 ------ .../components/unary_devices/cryo.dm | 4 +- .../unary_devices/heat_exchanger.dm | 15 +- .../unary_devices/outlet_injector.dm | 13 +- .../components/unary_devices/passive_vent.dm | 2 +- .../unary_devices/portables_connector.dm | 12 +- .../components/unary_devices/unary_devices.dm | 2 - .../components/unary_devices/vent_pump.dm | 25 +- .../components/unary_devices/vent_scrubber.dm | 45 +- .../atmospherics/machinery/datum_pipeline.dm | 19 +- .../atmospherics/machinery/other/meter.dm | 21 +- .../machinery/pipes/bridge_pipe.dm | 29 - .../machinery/pipes/color_adapter.dm | 63 -- .../machinery/pipes/heat_exchange/he_pipes.dm | 48 +- .../machinery/pipes/heat_exchange/manifold.dm | 4 +- .../pipes/heat_exchange/manifold4w.dm | 3 +- .../machinery/pipes/heat_exchange/simple.dm | 2 +- .../machinery/pipes/layermanifold.dm | 43 +- .../atmospherics/machinery/pipes/multiz.dm | 21 +- .../atmospherics/machinery/pipes/pipes.dm | 42 +- .../atmospherics/machinery/pipes/smart.dm | 89 --- .../portable/portable_atmospherics.dm | 87 ++- .../atmospherics/machinery/portable/pump.dm | 20 +- .../machinery/portable/scrubber.dm | 2 +- .../mob/living/simple_animal/bot/bot.dm | 6 +- .../simple_animal/hostile/retaliate/clown.dm | 2 +- .../power/singularity/containment_field.dm | 1 - .../power/singularity/field_generator.dm | 2 - code/modules/reagents/chem_splash.dm | 2 +- code/modules/shuttle/on_move.dm | 4 +- 63 files changed, 479 insertions(+), 3559 deletions(-) delete mode 100644 code/modules/art/statues.dm delete mode 100644 code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm delete mode 100644 code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm delete mode 100644 code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm delete mode 100644 code/modules/atmospherics/machinery/components/tank.dm delete mode 100644 code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm delete mode 100644 code/modules/atmospherics/machinery/pipes/bridge_pipe.dm delete mode 100644 code/modules/atmospherics/machinery/pipes/color_adapter.dm delete mode 100644 code/modules/atmospherics/machinery/pipes/smart.dm diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm index 887021476467c..c546c9d745111 100644 --- a/code/__DEFINES/atmospherics/atmos_helpers.dm +++ b/code/__DEFINES/atmospherics/atmos_helpers.dm @@ -2,7 +2,7 @@ ///Check if the turfs allows gas passage based on density, do not use. #define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) ) ///Check if the turfs allows gas passage on a z level, do not use. -#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_pass_vertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_pass_vertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass_vertical ) ) +#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_passVertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_passVertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_passVertical ) ) //Helpers ///Moves the icon of the device based on the piping layer and on the direction diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 34d9e8fc7576e..aa5ae4e5e562b 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -623,12 +623,9 @@ GLOBAL_LIST_EMPTY(colored_images) if(!pipe_init_dirs_cache[type]) pipe_init_dirs_cache[type] = list() - if(!pipe_init_dirs_cache[type]["[init_dir]"]) - pipe_init_dirs_cache[type]["[init_dir]"] = list() - - if(!pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"]) - var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir, init_dir) - pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"] = temp.get_init_directions() + if(!pipe_init_dirs_cache[type]["[dir]"]) + var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir) + pipe_init_dirs_cache[type]["[dir]"] = temp.get_init_directions() qdel(temp) return pipe_init_dirs_cache[type]["[dir]"] diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 8f55cf1023ce3..23994b07202ea 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -193,7 +193,7 @@ /obj/effect/particle_effect/foam/proc/spread_foam() var/turf/t_loc = get_turf(src) - for(var/turf/T in t_loc.get_atmos_adjacent_turfs()) + for(var/turf/T in t_loc.GetAtmosAdjacentTurfs()) var/obj/effect/particle_effect/foam/foundfoam = locate() in T //Don't spread foam where there's already foam! if(foundfoam) continue diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 4eea8f4d46c19..a969544c09669 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -91,7 +91,7 @@ if(!t_loc) return var/list/newsmokes = list() - for(var/turf/T in t_loc.get_atmos_adjacent_turfs()) + for(var/turf/T in t_loc.GetAtmosAdjacentTurfs(!circle)) var/obj/effect/particle_effect/smoke/foundsmoke = locate() in T //Don't spread smoke where there's already smoke! if(foundsmoke) continue diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index f509df340dccb..6e276151487f0 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -143,12 +143,10 @@ if(istype(atmos_source)) if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source)) LAZYREMOVE(atmos_source.atmos_adjacent_turfs, atmos_destination) - atmos_source.immediate_calculate_adjacent_turfs() //Just in case they were next to each other atmos_source = null if(istype(atmos_destination)) if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination)) LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source) - atmos_destination.immediate_calculate_adjacent_turfs() atmos_destination = null /obj/effect/portal/Destroy(force) //Calls on_portal_destroy(destroyed portal, location of destroyed portal) on creator if creator has such call. diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm index 63dbe14b0e027..6dd0fd43fadb3 100644 --- a/code/game/objects/effects/spawners/bombspawner.dm +++ b/code/game/objects/effects/spawners/bombspawner.dm @@ -30,10 +30,10 @@ oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)) oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o) - V.tank_one = plasma_tank - V.tank_two = oxygen_tank - plasma_tank.master = V - oxygen_tank.master = V + V.tank_one = PT + V.tank_two = OT + PT.master = V + OT.master = V if(assembly_type) var/obj/item/assembly/A = new assembly_type(V) diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index 9e0a51f5b1f68..a82b7a9dd0292 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -198,8 +198,8 @@ var/turf/previousturf = get_turf(src) for(var/turf/T in turflist) if(T == previousturf) - continue //so we don't burn the tile we be standin on - var/list/turfs_sharing_with_prev = previousturf.get_atmos_adjacent_turfs(alldir=1) + continue //so we don't burn the tile we be standin on + var/list/turfs_sharing_with_prev = previousturf.GetAtmosAdjacentTurfs(alldir=1) if(!(T in turfs_sharing_with_prev)) break if(igniter) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 40ae9681508e9..40cfb310587b1 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -185,8 +185,8 @@ qdel(src) return FALSE - for(var/turf/T in U.get_atmos_adjacent_turfs()) - if(locate(/obj/structure/alien/weeds) in T) + for(var/turf/T in U.GetAtmosAdjacentTurfs()) + if((locate(/obj/structure/alien/weeds) in T)) continue if(is_type_in_typecache(T, blacklisted_turfs)) diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index ef22a437e98ff..4db9d35f37002 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -109,9 +109,6 @@ ADD_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC) air_update_turf(TRUE, TRUE) -/obj/structure/holosign/barrier/atmos/block_superconductivity() //Didn't used to do this, but it's "normal", and will help ease heat flow transitions with the players. - return TRUE - /obj/structure/holosign/barrier/atmos/Destroy() var/turf/local = get_turf(loc) REMOVE_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 010a72bc49312..0286d36e70594 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -26,10 +26,10 @@ var/created_name = null //Vars to help with the icon's name - var/facing = "l" //Does the windoor open to the left or right? - var/secure = FALSE //Whether or not this creates a secure windoor - var/state = "01" //How far the door assembly has progressed - can_atmos_pass = ATMOS_PASS_PROC + var/facing = "l" //Does the windoor open to the left or right? + var/secure = FALSE //Whether or not this creates a secure windoor + var/state = "01" //How far the door assembly has progressed + /obj/structure/windoor_assembly/Initialize(mapload, loc, set_dir) . = ..() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 7b7e0084ec0e6..deead8ca24343 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -467,10 +467,7 @@ explosion_block = 2 glass_type = /obj/item/stack/sheet/plasmarglass -/obj/structure/window/reinforced/plasma/block_superconductivity() - return TRUE - -/obj/structure/window/reinforced/plasma/spawner/east +/obj/structure/window/plasma/reinforced/spawner/east dir = EAST /obj/structure/window/plasma/reinforced/spawner/west diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm index caa813fd7f35c..7fc2d2d0b5eba 100644 --- a/code/game/shuttle_engines.dm +++ b/code/game/shuttle_engines.dm @@ -8,8 +8,7 @@ icon = 'icons/turf/shuttle.dmi' resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF max_integrity = 500 - armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70) //default + ignores melee - can_atmos_pass = ATMOS_PASS_DENSITY + armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0) //default + ignores melee /obj/structure/shuttle/engine name = "engine" diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm index 65000cf9f13e5..0b154861f03f8 100644 --- a/code/game/turfs/open/floor/reinf_floor.dm +++ b/code/game/turfs/open/floor/reinf_floor.dm @@ -131,7 +131,7 @@ floor_tile = null var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance can_atmos_pass = ATMOS_PASS_NO - can_atmos_pass_vertical = ATMOS_PASS_NO + can_atmos_passVertical = ATMOS_PASS_NO /turf/open/floor/engine/cult/Initialize(mapload) diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index b603ddff1c12f..e3ffe3e53743c 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -3,7 +3,7 @@ desc = "Watch your step!" icon_state = "invisible" baseturfs = /turf/open/openspace - can_atmos_pass_vertical = ATMOS_PASS_YES + can_atmos_passVertical = ATMOS_PASS_YES overfloor_placed = FALSE underfloor_accessibility = UNDERFLOOR_INTERACTABLE allow_z_travel = TRUE diff --git a/code/modules/art/statues.dm b/code/modules/art/statues.dm deleted file mode 100644 index de9ecb770d67b..0000000000000 --- a/code/modules/art/statues.dm +++ /dev/null @@ -1,579 +0,0 @@ -/obj/structure/statue - name = "statue" - desc = "Placeholder. Yell at Firecage if you SOMEHOW see this." - icon = 'icons/obj/statue.dmi' - icon_state = "" - density = TRUE - anchored = FALSE - max_integrity = 100 - can_atmos_pass = ATMOS_PASS_DENSITY - material_modifier = 0.5 - material_flags = MATERIAL_EFFECTS | MATERIAL_AFFECT_STATISTICS - blocks_emissive = EMISSIVE_BLOCK_UNIQUE - /// Beauty component mood modifier - var/impressiveness = 15 - /// Art component subtype added to this statue - var/art_type = /datum/element/art - /// Abstract root type - var/abstract_type = /obj/structure/statue - -/obj/structure/statue/Initialize(mapload) - . = ..() - AddElement(art_type, impressiveness) - AddElement(/datum/element/beauty, impressiveness * 75) - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null) - -/obj/structure/statue/proc/can_be_rotated(mob/user) - if(!anchored) - return TRUE - to_chat(user, span_warning("It's bolted to the floor, you'll need to unwrench it first.")) - -/obj/structure/statue/proc/can_user_rotate(mob/user) - return user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)) - -/obj/structure/statue/attackby(obj/item/W, mob/living/user, params) - add_fingerprint(user) - if(!(flags_1 & NODECONSTRUCT_1)) - if(default_unfasten_wrench(user, W)) - return - if(W.tool_behaviour == TOOL_WELDER) - if(!W.tool_start_check(user, amount=0)) - return FALSE - - user.visible_message(span_notice("[user] is slicing apart the [name]."), \ - span_notice("You are slicing apart the [name]...")) - if(W.use_tool(src, user, 40, volume=50)) - user.visible_message(span_notice("[user] slices apart the [name]."), \ - span_notice("You slice apart the [name]!")) - deconstruct(TRUE) - return - return ..() - -/obj/structure/statue/deconstruct(disassembled = TRUE) - if(!(flags_1 & NODECONSTRUCT_1)) - var/amount_mod = disassembled ? 0 : -2 - for(var/mat in custom_materials) - var/datum/material/custom_material = GET_MATERIAL_REF(mat) - var/amount = max(0,round(custom_materials[mat]/MINERAL_MATERIAL_AMOUNT) + amount_mod) - if(amount > 0) - new custom_material.sheet_type(drop_location(),amount) - qdel(src) - -//////////////////////////////////////STATUES///////////////////////////////////////////////////////////// -////////////////////////uranium/////////////////////////////////// - -/obj/structure/statue/uranium - max_integrity = 300 - light_range = 2 - custom_materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT*5) - impressiveness = 25 // radiation makes an impression - abstract_type = /obj/structure/statue/uranium - -/obj/structure/statue/uranium/nuke - name = "statue of a nuclear fission explosive" - desc = "This is a grand statue of a Nuclear Explosive. It has a sickening green colour." - icon_state = "nuke" - -/obj/structure/statue/uranium/eng - name = "Statue of an engineer" - desc = "This statue has a sickening green colour." - icon_state = "eng" - -////////////////////////////plasma/////////////////////////////////////////////////////////////////////// - -/obj/structure/statue/plasma - max_integrity = 200 - impressiveness = 20 - desc = "This statue is suitably made from plasma." - custom_materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/plasma - -/obj/structure/statue/plasma/scientist - name = "statue of a scientist" - icon_state = "sci" - -/obj/structure/statue/plasma/xeno - name = "statue of a xenomorph" - icon_state = "xeno" - -/obj/structure/statue/plasma/Initialize(mapload) - . = ..() - AddElement(/datum/element/atmos_sensitive, mapload) - -/obj/structure/statue/plasma/bullet_act(obj/projectile/Proj) - var/burn = FALSE - if(!(Proj.nodamage) && Proj.damage_type == BURN && !QDELETED(src)) - burn = TRUE - if(burn) - var/turf/T = get_turf(src) - if(Proj.firer) - message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(Proj.firer)] in [ADMIN_VERBOSEJMP(T)]") - log_game("Plasma statue ignited by [key_name(Proj.firer)] in [AREACOORD(T)]") - else - message_admins("Plasma statue ignited by [Proj]. No known firer, in [ADMIN_VERBOSEJMP(T)]") - log_game("Plasma statue ignited by [Proj] in [AREACOORD(T)]. No known firer.") - PlasmaBurn(2500) - . = ..() - -/obj/structure/statue/plasma/attackby(obj/item/W, mob/user, params) - if(W.get_temperature() > 300 && !QDELETED(src))//If the temperature of the object is over 300, then ignite - var/turf/T = get_turf(src) - message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(T)]") - log_game("Plasma statue ignited by [key_name(user)] in [AREACOORD(T)]") - ignite(W.get_temperature()) - else - return ..() - -/obj/structure/statue/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature) - return exposed_temperature > 300 - -/obj/structure/statue/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature) - PlasmaBurn(exposed_temperature) - -/obj/structure/statue/plasma/proc/PlasmaBurn(temperature) - if(QDELETED(src)) - return - if(custom_materials[/datum/material/plasma]) - var/plasma_amount = round(custom_materials[/datum/material/plasma]/MINERAL_MATERIAL_AMOUNT) - atmos_spawn_air("plasma=[plasma_amount*10];TEMP=[temperature]") - deconstruct(FALSE) - -/obj/structure/statue/plasma/proc/ignite(exposed_temperature) - if(exposed_temperature > 300) - PlasmaBurn(exposed_temperature) - -//////////////////////gold/////////////////////////////////////// - -/obj/structure/statue/gold - max_integrity = 300 - impressiveness = 25 - desc = "This is a highly valuable statue made from gold." - custom_materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/gold - -/obj/structure/statue/gold/hos - name = "statue of the head of security" - icon_state = "hos" - -/obj/structure/statue/gold/hop - name = "statue of the head of personnel" - icon_state = "hop" - -/obj/structure/statue/gold/cmo - name = "statue of the chief medical officer" - icon_state = "cmo" - -/obj/structure/statue/gold/ce - name = "statue of the chief engineer" - icon_state = "ce" - -/obj/structure/statue/gold/rd - name = "statue of the research director" - icon_state = "rd" - -//////////////////////////silver/////////////////////////////////////// - -/obj/structure/statue/silver - max_integrity = 300 - impressiveness = 25 - desc = "This is a valuable statue made from silver." - custom_materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/silver - -/obj/structure/statue/silver/md - name = "statue of a medical officer" - icon_state = "md" - -/obj/structure/statue/silver/janitor - name = "statue of a janitor" - icon_state = "jani" - -/obj/structure/statue/silver/sec - name = "statue of a security officer" - icon_state = "sec" - -/obj/structure/statue/silver/secborg - name = "statue of a security cyborg" - icon_state = "secborg" - -/obj/structure/statue/silver/medborg - name = "statue of a medical cyborg" - icon_state = "medborg" - -/////////////////////////diamond///////////////////////////////////////// - -/obj/structure/statue/diamond - max_integrity = 1000 - impressiveness = 50 - desc = "This is a very expensive diamond statue." - custom_materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/diamond - -/obj/structure/statue/diamond/captain - name = "statue of THE captain." - icon_state = "cap" - -/obj/structure/statue/diamond/ai1 - name = "statue of the AI hologram." - icon_state = "ai1" - -/obj/structure/statue/diamond/ai2 - name = "statue of the AI core." - icon_state = "ai2" - -////////////////////////bananium/////////////////////////////////////// - -/obj/structure/statue/bananium - max_integrity = 300 - impressiveness = 50 - desc = "A bananium statue with a small engraving:'HOOOOOOONK'." - custom_materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/bananium - -/obj/structure/statue/bananium/clown - name = "statue of a clown" - icon_state = "clown" - -/////////////////////sandstone///////////////////////////////////////// - -/obj/structure/statue/sandstone - max_integrity = 50 - impressiveness = 15 - custom_materials = list(/datum/material/sandstone=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/sandstone - -/obj/structure/statue/sandstone/assistant - name = "statue of an assistant" - desc = "A cheap statue of sandstone for a greyshirt." - icon_state = "assist" - - -/obj/structure/statue/sandstone/venus //call me when we add marble i guess - name = "statue of a pure maiden" - desc = "An ancient marble statue. The subject is depicted with a floor-length braid and is wielding a toolbox. By Jove, it's easily the most gorgeous depiction of a woman you've ever seen. The artist must truly be a master of his craft. Shame about the broken arm, though." - icon = 'icons/obj/statuelarge.dmi' - icon_state = "venus" - -/////////////////////snow///////////////////////////////////////// - -/obj/structure/statue/snow - max_integrity = 50 - custom_materials = list(/datum/material/snow=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/snow - -/obj/structure/statue/snow/snowman - name = "snowman" - desc = "Several lumps of snow put together to form a snowman." - icon_state = "snowman" - -/obj/structure/statue/snow/snowlegion - name = "snowlegion" - desc = "Looks like that weird kid with the tiger plushie has been round here again." - icon_state = "snowlegion" - -///////////////////////////////bronze/////////////////////////////////// - -/obj/structure/statue/bronze - custom_materials = list(/datum/material/bronze=MINERAL_MATERIAL_AMOUNT*5) - abstract_type = /obj/structure/statue/bronze - -/obj/structure/statue/bronze/marx - name = "\improper Karl Marx bust" - desc = "A bust depicting a certain 19th century economist. You get the feeling a specter is haunting the station." - icon_state = "marx" - art_type = /datum/element/art/rev - -///////////Elder Atmosian/////////////////////////////////////////// - -/obj/structure/statue/elder_atmosian - name = "Elder Atmosian" - desc = "A statue of an Elder Atmosian, capable of bending the laws of thermodynamics to their will." - icon_state = "eng" - custom_materials = list(/datum/material/metalhydrogen = MINERAL_MATERIAL_AMOUNT*10) - max_integrity = 1000 - impressiveness = 100 - abstract_type = /obj/structure/statue/elder_atmosian //This one is uncarvable - -/obj/item/chisel - name = "chisel" - desc = "Breaking and making art since 4000 BC. This one uses advanced technology to allow the creation of lifelike moving statues." - icon = 'icons/obj/statue.dmi' - icon_state = "chisel" - inhand_icon_state = "screwdriver_nuke" - lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' - righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' - flags_1 = CONDUCT_1 - slot_flags = ITEM_SLOT_BELT - force = 5 - w_class = WEIGHT_CLASS_TINY - throwforce = 5 - throw_speed = 3 - throw_range = 5 - custom_materials = list(/datum/material/iron=75) - attack_verb_continuous = list("stabs") - attack_verb_simple = list("stab") - hitsound = 'sound/weapons/bladeslice.ogg' - usesound = list('sound/items/screwdriver.ogg', 'sound/items/screwdriver2.ogg') - drop_sound = 'sound/items/handling/screwdriver_drop.ogg' - pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg' - sharpness = SHARP_POINTY - tool_behaviour = TOOL_RUSTSCRAPER - toolspeed = 3 // You're gonna have a bad time - - /// Block we're currently carving in - var/obj/structure/carving_block/prepared_block - /// If tracked user moves we stop sculpting - var/mob/living/tracked_user - /// Currently sculpting - var/sculpting = FALSE - -/obj/item/chisel/Initialize(mapload) - . = ..() - AddElement(/datum/element/eyestab) - AddElement(/datum/element/wall_engraver) - -/obj/item/chisel/Destroy() - prepared_block = null - tracked_user = null - return ..() - -/* -Hit the block to start -Point with the chisel at the target to choose what to sculpt or hit block to choose from preset statue types. -Hit block again to start sculpting. -Moving interrupts -*/ -/obj/item/chisel/pre_attack(atom/A, mob/living/user, params) - . = ..() - if(sculpting) - return - if(istype(A,/obj/structure/carving_block)) - if(A == prepared_block && (prepared_block.current_target || prepared_block.current_preset_type)) - start_sculpting(user) - else if(!prepared_block) - set_block(A,user) - else if(A == prepared_block) - show_generic_statues_prompt(user) - return TRUE - else if(prepared_block) //We're aiming at something next to us with block prepared - prepared_block.set_target(A,user) - return TRUE - -// We aim at something distant. -/obj/item/chisel/afterattack(atom/target, mob/user, proximity_flag, click_parameters) - . = ..() - if(!proximity_flag && !sculpting && prepared_block && ismovable(target) && prepared_block.completion == 0) - prepared_block.set_target(target,user) - -/obj/item/chisel/proc/start_sculpting(mob/living/user) - to_chat(user,span_notice("You start sculpting [prepared_block]."),type=MESSAGE_TYPE_INFO) - sculpting = TRUE - //How long whole process takes - var/sculpting_time = 30 SECONDS - //Single interruptible progress period - var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each. - var/interrupted = FALSE - var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time) - - var/datum/progressbar/total_progress_bar = new(user, sculpting_time, prepared_block ) - while(remaining_time > 0 && !interrupted) - if(do_after(user,sculpting_period, target = prepared_block, progress = FALSE)) - remaining_time -= sculpting_period - prepared_block.set_completion((sculpting_time - remaining_time)/sculpting_time) - total_progress_bar.update(sculpting_time - remaining_time) - else - interrupted = TRUE - total_progress_bar.end_progress() - if(!interrupted && !QDELETED(prepared_block)) - prepared_block.create_statue() - to_chat(user,span_notice("The statue is finished!"),type=MESSAGE_TYPE_INFO) - break_sculpting() - -/obj/item/chisel/proc/set_block(obj/structure/carving_block/B,mob/living/user) - prepared_block = B - tracked_user = user - RegisterSignal(tracked_user,COMSIG_MOVABLE_MOVED,.proc/break_sculpting) - to_chat(user,span_notice("You prepare to work on [B]."),type=MESSAGE_TYPE_INFO) - -/obj/item/chisel/dropped(mob/user, silent) - . = ..() - break_sculpting() - -/obj/item/chisel/proc/break_sculpting() - SIGNAL_HANDLER - sculpting = FALSE - if(prepared_block && prepared_block.completion == 0) - prepared_block.reset_target() - prepared_block = null - if(tracked_user) - UnregisterSignal(tracked_user,COMSIG_MOVABLE_MOVED) - tracked_user = null - -/obj/item/chisel/proc/show_generic_statues_prompt(mob/living/user) - var/list/choices = list() - for(var/statue_path in prepared_block.get_possible_statues()) - var/obj/structure/statue/S = statue_path - choices[statue_path] = image(icon=initial(S.icon),icon_state=initial(S.icon_state)) - var/choice = show_radial_menu(user, prepared_block , choices, require_near = TRUE) - if(choice) - prepared_block.current_preset_type = choice - var/image/chosen_looks = choices[choice] - prepared_block.current_target = chosen_looks.appearance - var/obj/structure/statue/S = choice - to_chat(user,span_notice("You decide to sculpt [prepared_block] into [initial(S.name)]."),type=MESSAGE_TYPE_INFO) - - -/obj/structure/carving_block - name = "block" - desc = "ready for sculpting." - icon = 'icons/obj/statue.dmi' - icon_state = "block" - material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS | MATERIAL_ADD_PREFIX - density = TRUE - material_modifier = 0.5 //50% effectiveness of materials - - /// The thing it will look like - Unmodified resulting statue appearance - var/current_target - /// Currently chosen preset statue type - var/current_preset_type - //Table of required materials for each non-abstract statue type - var/static/list/statue_costs - /// statue completion from 0 to 1.0 - var/completion = 0 - /// Greyscaled target with cutout filter - var/mutable_appearance/target_appearance_with_filters - /// HSV color filters parameters - var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05) - -/obj/structure/carving_block/Destroy() - current_target = null - target_appearance_with_filters = null - return ..() - -/obj/structure/carving_block/proc/set_target(atom/movable/target,mob/living/user) - if(!is_viable_target(target)) - to_chat(user,"You won't be able to carve that.") - return - if(istype(target,/obj/structure/statue/custom)) - var/obj/structure/statue/custom/original = target - current_target = original.content_ma - else - current_target = target.appearance - var/mutable_appearance/ma = current_target - to_chat(user,span_notice("You decide to sculpt [src] into [ma.name]."),type=MESSAGE_TYPE_INFO) - -/obj/structure/carving_block/proc/reset_target() - current_target = null - current_preset_type = null - target_appearance_with_filters = null - -/obj/structure/carving_block/update_overlays() - . = ..() - if(!target_appearance_with_filters) - return - //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues - var/mutable_appearance/clone = new(target_appearance_with_filters) - . += clone - -/obj/structure/carving_block/proc/is_viable_target(atom/movable/target) - //Only things on turfs - if(!isturf(target.loc)) - return FALSE - //No big icon things - var/icon/thing_icon = icon(target.icon, target.icon_state) - if(thing_icon.Height() != world.icon_size || thing_icon.Width() != world.icon_size) - return FALSE - return TRUE - -/obj/structure/carving_block/proc/create_statue() - if(current_preset_type) - var/obj/structure/statue/preset_statue = new current_preset_type(get_turf(src)) - preset_statue.set_custom_materials(custom_materials) - qdel(src) - else if(current_target) - var/obj/structure/statue/custom/new_statue = new(get_turf(src)) - new_statue.set_visuals(current_target) - new_statue.set_custom_materials(custom_materials) - var/mutable_appearance/ma = current_target - new_statue.name = "statue of [ma.name]" - new_statue.desc = "statue depicting [ma.name]" - qdel(src) - -/obj/structure/carving_block/proc/set_completion(value) - if(!current_target) - return - if(!target_appearance_with_filters) - target_appearance_with_filters = new(current_target) - // KEEP_APART in case carving block gets KEEP_TOGETHER from somewhere like material texture filters. - target_appearance_with_filters.appearance_flags |= KEEP_TOGETHER | KEEP_APART - //Doesn't use filter helpers because MAs aren't atoms - target_appearance_with_filters.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) - completion = value - var/static/icon/white = icon('icons/effects/alphacolors.dmi', "white") - switch(value) - if(0) - //delete uncovered and reset filters - remove_filter("partial_uncover") - target_appearance_with_filters = null - else - var/mask_offset = min(world.icon_size,round(completion * world.icon_size)) - remove_filter("partial_uncover") - add_filter("partial_uncover", 1, alpha_mask_filter(icon = white, y = -mask_offset)) - target_appearance_with_filters.filters = filter(type="alpha",icon=white,y=-mask_offset,flags=MASK_INVERSE) - update_appearance() - - -/// Returns a list of preset statues carvable from this block depending on the custom materials -/obj/structure/carving_block/proc/get_possible_statues() - . = list() - if(!statue_costs) - statue_costs = build_statue_cost_table() - for(var/statue_path in statue_costs) - var/list/carving_cost = statue_costs[statue_path] - var/enough_materials = TRUE - for(var/required_material in carving_cost) - if(!has_material_type(required_material, TRUE, carving_cost[required_material])) - enough_materials = FALSE - break - if(enough_materials) - . += statue_path - -/obj/structure/carving_block/proc/build_statue_cost_table() - . = list() - for(var/statue_type in subtypesof(/obj/structure/statue) - /obj/structure/statue/custom) - var/obj/structure/statue/S = new statue_type() - if(!S.icon_state || S.abstract_type == S.type || !S.custom_materials) - continue - .[S.type] = S.custom_materials - qdel(S) - -/obj/structure/statue/custom - name = "custom statue" - icon_state = "base" - obj_flags = CAN_BE_HIT | UNIQUE_RENAME - appearance_flags = TILE_BOUND | PIXEL_SCALE | KEEP_TOGETHER //Added keep together in case targets has weird layering - material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS - /// primary statue overlay - var/mutable_appearance/content_ma - var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05) - -/obj/structure/statue/custom/Destroy() - content_ma = null - return ..() - -/obj/structure/statue/custom/proc/set_visuals(model_appearance) - if(content_ma) - QDEL_NULL(content_ma) - content_ma = new - content_ma.appearance = model_appearance - content_ma.pixel_x = 0 - content_ma.pixel_y = 0 - content_ma.alpha = 255 - content_ma.appearance_flags &= ~KEEP_APART //Don't want this - content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) - update_appearance() - -/obj/structure/statue/custom/update_overlays() - . = ..() - if(content_ma) - . += content_ma diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm index 88eeb654e4165..c3943a5406587 100644 --- a/code/modules/atmospherics/environmental/LINDA_system.dm +++ b/code/modules/atmospherics/environmental/LINDA_system.dm @@ -1,10 +1,7 @@ -/atom - ///Check if atmos can pass in this atom (ATMOS_PASS_YES, ATMOS_PASS_NO, ATMOS_PASS_DENSITY, ATMOS_PASS_PROC) - var/can_atmos_pass = ATMOS_PASS_YES - ///Zlevel check for can_atmos_pass - var/can_atmos_pass_vertical = ATMOS_PASS_YES +/atom/var/can_atmos_pass = ATMOS_PASS_YES +/atom/var/can_atmos_passVertical = ATMOS_PASS_YES -/atom/proc/can_atmos_pass(turf/target_turf) +/atom/proc/can_atmos_pass(turf/T) switch (can_atmos_pass) if (ATMOS_PASS_PROC) return ATMOS_PASS_YES @@ -13,69 +10,65 @@ else return can_atmos_pass -/turf - can_atmos_pass = ATMOS_PASS_NO - can_atmos_pass_vertical = ATMOS_PASS_NO +/turf/can_atmos_pass = ATMOS_PASS_NO +/turf/can_atmos_passVertical = ATMOS_PASS_NO -/turf/open - can_atmos_pass = ATMOS_PASS_PROC - can_atmos_pass_vertical = ATMOS_PASS_PROC +/turf/open/can_atmos_pass = ATMOS_PASS_PROC +/turf/open/can_atmos_passVertical = ATMOS_PASS_PROC //Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase -/turf/open/can_atmos_pass(turf/target_turf, vertical = FALSE) - var/direction = vertical ? get_dir_multiz(src, target_turf) : get_dir(src, target_turf) - var/opposite_direction = REVERSE_DIR(direction) - var/can_pass = FALSE - if(vertical && !(zAirOut(direction, target_turf) && target_turf.zAirIn(direction, src))) - can_pass = TRUE - if(blocks_air || target_turf.blocks_air) - can_pass = TRUE - if (target_turf == src) - return !can_pass - for(var/obj/checked_object in contents + target_turf.contents) - var/turf/other = (checked_object.loc == src ? target_turf : src) - if(!(vertical? (CANVERTICALATMOSPASS(checked_object, other)) : (CANATMOSPASS(checked_object, other)))) - can_pass = TRUE - if(checked_object.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments - atmos_supeconductivity |= direction - target_turf.atmos_supeconductivity |= opposite_direction - return FALSE //no need to keep going, we got all we asked - - atmos_supeconductivity &= ~direction - target_turf.atmos_supeconductivity &= ~opposite_direction - - return !can_pass - -/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act +/turf/open/can_atmos_pass(turf/T, vertical = FALSE) + var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T) + var/opp = REVERSE_DIR(dir) + var/R = FALSE + if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src))) + R = TRUE + if(blocks_air || T.blocks_air) + R = TRUE + if (T == src) + return !R + for(var/obj/O in contents+T.contents) + var/turf/other = (O.loc == src ? T : src) + if(!(vertical? (CANVERTICALATMOSPASS(O, other)) : (CANATMOSPASS(O, other)))) + R = TRUE + if(O.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments + atmos_supeconductivity |= dir + T.atmos_supeconductivity |= opp + return FALSE //no need to keep going, we got all we asked + + atmos_supeconductivity &= ~dir + T.atmos_supeconductivity &= ~opp + + return !R + +/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm. return FALSE /turf/proc/immediate_calculate_adjacent_turfs() var/canpass = CANATMOSPASS(src, src) var/canvpass = CANVERTICALATMOSPASS(src, src) for(var/direction in GLOB.cardinals_multiz) - var/turf/current_turf = get_step_multiz(src, direction) - if(!isopenturf(current_turf)) + var/turf/T = get_step_multiz(src, direction) + if(!isopenturf(T)) continue - if(!(blocks_air || current_turf.blocks_air) && ((direction & (UP|DOWN)) ? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src))) ) + if(!(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) ) LAZYINITLIST(atmos_adjacent_turfs) - LAZYINITLIST(current_turf.atmos_adjacent_turfs) - atmos_adjacent_turfs[current_turf] = TRUE - current_turf.atmos_adjacent_turfs[src] = TRUE + LAZYINITLIST(T.atmos_adjacent_turfs) + atmos_adjacent_turfs[T] = TRUE + T.atmos_adjacent_turfs[src] = TRUE else if (atmos_adjacent_turfs) - atmos_adjacent_turfs -= current_turf - if (current_turf.atmos_adjacent_turfs) - current_turf.atmos_adjacent_turfs -= src - UNSETEMPTY(current_turf.atmos_adjacent_turfs) + atmos_adjacent_turfs -= T + if (T.atmos_adjacent_turfs) + T.atmos_adjacent_turfs -= src + UNSETEMPTY(T.atmos_adjacent_turfs) UNSETEMPTY(atmos_adjacent_turfs) src.atmos_adjacent_turfs = atmos_adjacent_turfs -/** - * returns a list of adjacent turfs that can share air with this one. - * alldir includes adjacent diagonal tiles that can share - * air with both of the related adjacent cardinal tiles -**/ -/turf/proc/get_atmos_adjacent_turfs(alldir = 0) +//returns a list of adjacent turfs that can share air with this one. +//alldir includes adjacent diagonal tiles that can share +// air with both of the related adjacent cardinal tiles +/turf/proc/GetAtmosAdjacentTurfs(alldir = 0) var/adjacent_turfs if (atmos_adjacent_turfs) adjacent_turfs = atmos_adjacent_turfs.Copy() @@ -89,29 +82,27 @@ for (var/direction in GLOB.diagonals_multiz) var/matching_directions = 0 - var/turf/checked_turf = get_step_multiz(current_location, direction) - if(!checked_turf) + var/turf/S = get_step_multiz(current_location, direction) + if(!S) continue for (var/check_direction in GLOB.cardinals_multiz) - var/turf/secondary_turf = get_step(checked_turf, check_direction) - if(!checked_turf.atmos_adjacent_turfs || !checked_turf.atmos_adjacent_turfs[secondary_turf]) + var/turf/checkTurf = get_step(S, check_direction) + if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf]) continue - if (adjacent_turfs[secondary_turf]) + if (adjacent_turfs[checkTurf]) matching_directions++ if (matching_directions >= 2) - adjacent_turfs += checked_turf + adjacent_turfs += S break return adjacent_turfs /atom/proc/air_update_turf(update = FALSE, remove = FALSE) - var/turf/local_turf = get_turf(loc) - if(!local_turf) - return - local_turf.air_update_turf(update, remove) + var/turf/T = get_turf(loc) + T.air_update_turf(update, remove) /** * A helper proc for dealing with atmos changes @@ -130,24 +121,24 @@ else SSair.add_to_active(src) -/atom/movable/proc/move_update_air(turf/target_turf) - if(isturf(target_turf)) - target_turf.air_update_turf(TRUE, FALSE) //You're empty now +/atom/movable/proc/move_update_air(turf/T) + if(isturf(T)) + T.air_update_turf(TRUE, FALSE) //You're empty now air_update_turf(TRUE, TRUE) //You aren't /atom/proc/atmos_spawn_air(text) //because a lot of people loves to copy paste awful code lets just make an easy proc to spawn your plasma fires - var/turf/open/local_turf = get_turf(src) - if(!istype(local_turf)) + var/turf/open/T = get_turf(src) + if(!istype(T)) return - local_turf.atmos_spawn_air(text) + T.atmos_spawn_air(text) /turf/open/atmos_spawn_air(text) if(!text || !air) return - var/datum/gas_mixture/turf_mixture = new - turf_mixture.parse_gas_string(text) + var/datum/gas_mixture/G = new + G.parse_gas_string(text) - air.merge(turf_mixture) + air.merge(G) archive() SSair.add_to_active(src) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index 5bce3594540e8..e501ef607a4d4 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -1,9 +1,7 @@ /turf - ///used for temperature calculations in superconduction + //used for temperature calculations var/thermal_conductivity = 0.05 - ///Amount of heat necessary to activate some atmos processes (there is a weird usage of this var because is compared directly to the temperature instead of heat energy) var/heat_capacity = INFINITY //This should be opt in rather then opt out - ///Archived version of the temperature on a turf var/temperature_archived ///list of turfs adjacent to us that air can flow onto @@ -11,39 +9,29 @@ ///bitfield of dirs in which we are superconducitng var/atmos_supeconductivity = NONE - ///used to determine whether we should archive + //used to determine whether we should archive var/archived_cycle = 0 var/current_cycle = 0 - /** - * used for mapping and for breathing while in walls (because that's a thing that needs to be accounted for...) - * string parsed by /datum/gas/proc/copy_from_turf - * approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings - * If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that. - **/ + //used for mapping and for breathing while in walls (because that's a thing that needs to be accounted for...) + //string parsed by /datum/gas/proc/copy_from_turf var/initial_gas_mix = OPENTURF_DEFAULT_ATMOS + //approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings + // If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that. /turf/open //used for spacewind - ///Pressure difference between two turfs var/pressure_difference = 0 - ///Where the difference come from (from higher pressure to lower pressure) var/pressure_direction = 0 - ///Excited group we are part of var/datum/excited_group/excited_group - ///Are we active? var/excited = FALSE - ///Our gas mix var/datum/gas_mixture/turf/air - ///If there is an active hotspot on us store a reference to it here var/obj/effect/hotspot/active_hotspot - ///Whether or not we are a planetary turf var/planetary_atmos = FALSE //air will revert to initial_gas_mix - ///gas IDs of current active gas overlays - var/list/atmos_overlay_types + var/list/atmos_overlay_types //gas IDs of current active gas overlays var/significant_share_ticker = 0 #ifdef TRACK_MAX_SHARE var/max_share = 0 @@ -64,8 +52,8 @@ if(active_hotspot) QDEL_NULL(active_hotspot) // Adds the adjacent turfs to the current atmos processing - for(var/near_turf in atmos_adjacent_turfs) - SSair.add_to_active(near_turf) + for(var/T in atmos_adjacent_turfs) + SSair.add_to_active(T) return ..() /////////////////GAS MIXTURE PROCS/////////////////// @@ -83,9 +71,9 @@ update_visuals() return removed -/turf/open/proc/copy_air_with_tile(turf/open/target_turf) - if(istype(target_turf)) - air.copy_from(target_turf.air) +/turf/open/proc/copy_air_with_tile(turf/open/T) + if(istype(T)) + air.copy_from(T.air) /turf/open/proc/copy_air(datum/gas_mixture/copy) if(copy) @@ -93,9 +81,9 @@ /turf/return_air() RETURN_TYPE(/datum/gas_mixture) - var/datum/gas_mixture/copied_mixture = new - copied_mixture.copy_from_turf(src) - return copied_mixture + var/datum/gas_mixture/GM = new + GM.copy_from_turf(src) + return GM /turf/open/return_air() RETURN_TYPE(/datum/gas_mixture) @@ -293,11 +281,11 @@ should_share_air = TRUE else if(our_air.compare(enemy_air)) //Lets see if you're up for it SSair.add_to_active(enemy_tile) //Add yourself young man - var/datum/excited_group/existing_group = our_excited_group || enemy_excited_group || new + var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new if(!our_excited_group) - existing_group.add_turf(src) + EG.add_turf(src) if(!enemy_excited_group) - existing_group.add_turf(enemy_tile) + EG.add_turf(enemy_tile) our_excited_group = excited_group should_share_air = TRUE @@ -316,19 +304,19 @@ /******************* GROUP HANDLING FINISH *********************************************************************/ if (planetary_atmos) //share our air with the "atmosphere" "above" the turf - var/datum/gas_mixture/planetary_mix = SSair.planetary[initial_gas_mix] + var/datum/gas_mixture/G = SSair.planetary[initial_gas_mix] // archive ourself again so we don't accidentally share more gas than we currently have archive() - if(our_air.compare(planetary_mix)) + if(our_air.compare(G)) if(!our_excited_group) - var/datum/excited_group/new_group = new - new_group.add_turf(src) + var/datum/excited_group/EG = new + EG.add_turf(src) our_excited_group = excited_group // shares 4/5 of our difference in moles with the atmosphere - our_air.share(planetary_mix, 0.25) + our_air.share(G, 0.25) // temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere - our_air.temperature_share(planetary_mix, OPEN_HEAT_TRANSFER_COEFFICIENT, planetary_mix.temperature_archived, planetary_mix.heat_capacity() * 5) - planetary_mix.garbage_collect() + our_air.temperature_share(G, OPEN_HEAT_TRANSFER_COEFFICIENT, G.temperature_archived, G.heat_capacity() * 5) + G.garbage_collect() PLANET_SHARE_CHECK our_air.react(src) @@ -345,32 +333,30 @@ //////////////////////////SPACEWIND///////////////////////////// -/turf/open/proc/consider_pressure_difference(turf/target_turf, difference) +/turf/open/proc/consider_pressure_difference(turf/T, difference) SSair.high_pressure_delta |= src if(difference > pressure_difference) - pressure_direction = get_dir(src, target_turf) + pressure_direction = get_dir(src, T) pressure_difference = difference /turf/open/proc/high_pressure_movements() - var/atom/movable/moving_atom + var/atom/movable/M for(var/thing in src) - moving_atom = thing - if (!moving_atom.anchored && !moving_atom.pulledby && moving_atom.last_high_pressure_movement_air_cycle < SSair.times_fired) - moving_atom.experience_pressure_difference(pressure_difference, pressure_direction) + M = thing + if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired) + M.experience_pressure_difference(pressure_difference, pressure_direction) -/atom/movable - ///How much delta pressure is needed for us to move - var/pressure_resistance = 10 - var/last_high_pressure_movement_air_cycle = 0 +/atom/movable/var/pressure_resistance = 10 +/atom/movable/var/last_high_pressure_movement_air_cycle = 0 /atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0) var/const/PROBABILITY_OFFSET = 25 var/const/PROBABILITY_BASE_PRECENT = 75 - var/max_force = sqrt(pressure_difference) * (MOVE_FORCE_DEFAULT / 5) + var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5) set waitfor = FALSE var/move_prob = 100 if (pressure_resistance > 0) - move_prob = (pressure_difference / pressure_resistance * PROBABILITY_BASE_PRECENT) - PROBABILITY_OFFSET + move_prob = (pressure_difference/pressure_resistance*PROBABILITY_BASE_PRECENT)-PROBABILITY_OFFSET move_prob += pressure_resistance_prob_delta if (move_prob > PROBABILITY_OFFSET && prob(move_prob) && (move_resist != INFINITY) && (!anchored && (max_force >= (move_resist * MOVE_FORCE_PUSH_RATIO))) || (anchored && (max_force >= (move_resist * MOVE_FORCE_FORCEPUSH_RATIO)))) step(src, direction) @@ -388,75 +374,72 @@ We solve this with excited group cleanup. See the documentation for more details. */ /datum/excited_group - ///Stores a reference to the turfs we are controlling var/list/turf_list = list() - ///If this is over EXCITED_GROUP_BREAKDOWN_CYCLES we call self_breakdown() var/breakdown_cooldown = 0 - ///If this is over EXCITED_GROUP_DISMANTLE_CYCLES we call dismantle() var/dismantle_cooldown = 0 - ///Used for debug to show the excited groups active and their turfs var/should_display = FALSE - ///Id of the index color of the displayed group var/display_id = 0 - ///Wrapping loop of the index colors var/static/wrapping_id = 0 /datum/excited_group/New() SSair.excited_groups += src -/datum/excited_group/proc/add_turf(turf/open/target_turf) - turf_list += target_turf - target_turf.excited_group = src +/datum/excited_group/proc/add_turf(turf/open/T) + turf_list += T + T.excited_group = src dismantle_cooldown = 0 if(should_display || SSair.display_all_groups) - display_turf(target_turf) - -/datum/excited_group/proc/merge_groups(datum/excited_group/target_group) - if(turf_list.len > target_group.turf_list.len) - SSair.excited_groups -= target_group - for(var/turf/open/group_member as anything in target_group.turf_list) - group_member.excited_group = src - turf_list += group_member - should_display = target_group.should_display | should_display + display_turf(T) + +/datum/excited_group/proc/merge_groups(datum/excited_group/E) + if(turf_list.len > E.turf_list.len) + SSair.excited_groups -= E + for(var/t in E.turf_list) + var/turf/open/T = t + T.excited_group = src + turf_list += T + should_display = E.should_display | should_display if(should_display || SSair.display_all_groups) - target_group.hide_turfs() + E.hide_turfs() display_turfs() - breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown) //Take the smaller of the two options + breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) //Take the smaller of the two options dismantle_cooldown = 0 else SSair.excited_groups -= src - for(var/turf/open/group_member as anything in turf_list) - group_member.excited_group = target_group - target_group.turf_list += group_member - target_group.should_display = target_group.should_display | should_display - if(target_group.should_display || SSair.display_all_groups) + for(var/t in turf_list) + var/turf/open/T = t + T.excited_group = E + E.turf_list += T + E.should_display = E.should_display | should_display + if(E.should_display || SSair.display_all_groups) hide_turfs() - target_group.display_turfs() - target_group.breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown) - target_group.dismantle_cooldown = 0 + E.display_turfs() + E.breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) + E.dismantle_cooldown = 0 /datum/excited_group/proc/reset_cooldowns() breakdown_cooldown = 0 dismantle_cooldown = 0 /datum/excited_group/proc/self_breakdown(roundstart = FALSE, poke_turfs = FALSE) - var/datum/gas_mixture/shared_mix = new + var/datum/gas_mixture/A = new //make local for sanic speed - var/list/shared_gases = shared_mix.gases + var/list/A_gases = A.gases var/list/turf_list = src.turf_list var/turflen = turf_list.len var/imumutable_in_group = FALSE var/energy = 0 var/heat_cap = 0 - for(var/turf/open/group_member as anything in turf_list) + for(var/t in turf_list) + var/turf/open/T = t //Cache? - var/datum/gas_mixture/turf/mix = group_member.air - if (roundstart && istype(group_member.air, /datum/gas_mixture/immutable)) + var/datum/gas_mixture/turf/mix = T.air + if (roundstart && istype(T.air, /datum/gas_mixture/immutable)) imumutable_in_group = TRUE - shared_mix.copy_from(group_member.air) //This had better be immutable young man - shared_gases = shared_mix.gases //update the cache + A.copy_from(T.air) //This had better be immutable young man + A_gases = A.gases //update the cache break //"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out //temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity @@ -466,35 +449,37 @@ var/list/giver_gases = mix.gases for(var/giver_id in giver_gases) - ASSERT_GAS(giver_id, shared_mix) - shared_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES] + ASSERT_GAS(giver_id, A) + A_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES] if(!imumutable_in_group) - shared_mix.temperature = energy / heat_cap - for(var/id in shared_gases) - shared_gases[id][MOLES] /= turflen - shared_mix.garbage_collect() - - for(var/turf/open/group_member as anything in turf_list) - if(group_member.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs - group_member.air.copy_from(SSair.planetary[group_member.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it + A.temperature = energy / heat_cap + for(var/id in A_gases) + A_gases[id][MOLES] /= turflen + A.garbage_collect() + + for(var/t in turf_list) + var/turf/open/T = t + if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs + T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it else - group_member.air.copy_from(shared_mix) //Otherwise just set the mix to a copy of our equalized mix - group_member.update_visuals() + T.air.copy_from(A) //Otherwise just set the mix to a copy of our equalized mix + T.update_visuals() if(poke_turfs) //Because we only activate all these once every breakdown, in event of lag due to this code and slow space + vent things, increase the wait time for breakdowns - SSair.add_to_active(group_member) - group_member.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em + SSair.add_to_active(T) + T.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em breakdown_cooldown = 0 ///Dismantles the excited group, puts allll the turfs to sleep /datum/excited_group/proc/dismantle() - for(var/turf/open/current_turf as anything in turf_list) - current_turf.excited = FALSE - current_turf.significant_share_ticker = 0 - SSair.active_turfs -= current_turf + for(var/t in turf_list) + var/turf/open/T = t + T.excited = FALSE + T.significant_share_ticker = 0 + SSair.active_turfs -= T #ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation - current_turf.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME) + T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME) #endif garbage_collect() @@ -502,8 +487,9 @@ /datum/excited_group/proc/garbage_collect() if(display_id) //If we ever did make those changes hide_turfs() - for(var/turf/open/current_turf as anything in turf_list) - current_turf.excited_group = null + for(var/t in turf_list) + var/turf/open/T = t + T.excited_group = null turf_list.Cut() SSair.excited_groups -= src if(SSair.currentpart == SSAIR_EXCITEDGROUPS) @@ -556,8 +542,8 @@ Then we space some of our heat, and think about if we should stop conducting. if(blocks_air) return ..() for(var/direction in GLOB.cardinals) - var/turf/checked_turf = get_step(src, direction) - if(!(checked_turf in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction)) + var/turf/T = get_step(src, direction) + if(!(T in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction)) . |= direction ///These two procs are a bit of a web, I belive in you @@ -570,11 +556,12 @@ Then we space some of our heat, and think about if we should stop conducting. /turf/open/neighbor_conduct_with_src(turf/other) if(blocks_air) - return ..() + ..() + return if(!other.blocks_air) //Both tiles are open - var/turf/open/open_other = other - open_other.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + var/turf/open/T = other + T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT) else //Open but neighbor is solid temperature_share_open_to_solid(other) SSair.add_to_active(src) @@ -585,19 +572,18 @@ Then we space some of our heat, and think about if we should stop conducting. if(conductivity_directions) //Conduct with tiles around me for(var/direction in GLOB.cardinals) - if(!(conductivity_directions & direction)) - continue - var/turf/neighbor = get_step(src, direction) + if(conductivity_directions & direction) + var/turf/neighbor = get_step(src,direction) - if(!neighbor.thermal_conductivity) - continue + if(!neighbor.thermal_conductivity) + continue - if(neighbor.archived_cycle < SSair.times_fired) - neighbor.archive() + if(neighbor.archived_cycle < SSair.times_fired) + neighbor.archive() - neighbor.neighbor_conduct_with_src(src) + neighbor.neighbor_conduct_with_src(src) - neighbor.consider_superconductivity() + neighbor.consider_superconductivity() radiate_to_spess() @@ -636,14 +622,13 @@ Then we space some of our heat, and think about if we should stop conducting. return ..() /turf/proc/radiate_to_spess() //Radiate excess tile heat to space - if(temperature <= T0C) //Considering 0 degC as te break even point for radiation in and out - return - var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature - if(heat_capacity <= 0 || abs(delta_temperature) <= MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - return - var/heat = thermal_conductivity * delta_temperature * \ - (heat_capacity * HEAT_CAPACITY_VACUUM / (heat_capacity + HEAT_CAPACITY_VACUUM)) - temperature -= heat/heat_capacity + if(temperature > T0C) //Considering 0 degC as te break even point for radiation in and out + var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature + if((heat_capacity > 0) && (abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)) + + var/heat = thermal_conductivity*delta_temperature* \ + (heat_capacity*HEAT_CAPACITY_VACUUM/(heat_capacity+HEAT_CAPACITY_VACUUM)) + temperature -= heat/heat_capacity /turf/open/proc/temperature_share_open_to_solid(turf/sharer) sharer.temperature = air.temperature_share(null, sharer.thermal_conductivity, sharer.temperature, sharer.heat_capacity) @@ -651,7 +636,9 @@ Then we space some of our heat, and think about if we should stop conducting. /turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //This is all just heat sharing, don't get freaked out var/delta_temperature = (temperature_archived - sharer.temperature_archived) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER && heat_capacity && sharer.heat_capacity) - var/heat = conduction_coefficient * delta_temperature * \ - (heat_capacity * sharer.heat_capacity / (heat_capacity + sharer.heat_capacity)) //The larger the combined capacity the less is shared - temperature -= heat / heat_capacity //The higher your own heat cap the less heat you get from this arrangement - sharer.temperature += heat / sharer.heat_capacity + + var/heat = conduction_coefficient*delta_temperature* \ + (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) //The larger the combined capacity the less is shared + + temperature -= heat/heat_capacity //The higher your own heat cap the less heat you get from this arrangement + sharer.temperature += heat/sharer.heat_capacity diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 19ee92b44d433..21dd8785959a7 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -64,7 +64,7 @@ ..() if(process) SSair.start_processing_machine(src) - set_init_directions(init_dir) + set_init_directions() /obj/machinery/atmospherics/Destroy() for(var/i in 1 to device_type) @@ -96,31 +96,19 @@ /obj/machinery/atmospherics/proc/get_rebuild_targets() return -/** - * Called on destroy(mostly deconstruction) and when moving nodes around, disconnect the nodes from the network - * Arguments: - * * i - is the current iteration of the node, based on the device_type (from 1 to 4) - */ /obj/machinery/atmospherics/proc/nullify_node(i) - if(!nodes[i]) - return - var/obj/machinery/atmospherics/node_machine = nodes[i] - node_machine.disconnect(src) - nodes[i] = null + if(nodes[i]) + var/obj/machinery/atmospherics/N = nodes[i] + N.disconnect(src) + nodes[i] = null -/** - * Getter for node_connects - * - * Return a list of the nodes that can connect to other machines, get called by atmos_init() - */ /obj/machinery/atmospherics/proc/get_node_connects() var/list/node_connects = list() node_connects.len = device_type - var/init_directions = get_init_directions() for(var/i in 1 to device_type) for(var/D in GLOB.cardinals) - if(D & init_directions) + if(D & get_init_directions()) if(D in node_connects) continue node_connects[i] = D @@ -134,13 +122,7 @@ if(WEST) setDir(EAST) -/** - * Initialize for atmos devices - * - * initialize the nodes for each pipe/device, this is called just after the air controller sets up turfs - * Arguments: - * * list/node_connects - a list of the nodes on the device that can make a connection to other machines - */ +//this is called just after the air controller sets up turfs /obj/machinery/atmospherics/proc/atmos_init(list/node_connects) if(!node_connects) //for pipes where order of nodes doesn't matter node_connects = get_node_connects() @@ -152,76 +134,25 @@ break update_icon() -/** - * setter for pipe layers - * - * Set the layer of the pipe that the device has to a new_layer - * Arguments: - * * new_layer - the layer at which we want the piping_layer to be (1 to 5) - */ /obj/machinery/atmospherics/proc/set_piping_layer(new_layer) piping_layer = (pipe_flags & PIPING_DEFAULT_LAYER_ONLY) ? PIPING_LAYER_DEFAULT : new_layer update_icon() -/obj/machinery/atmospherics/update_icon() - layer = initial(layer) + piping_layer / 1000 - return ..() - -/** - * Check if a node can actually exists by connecting to another machine - * called on atmos_init() - * Arguments: - * * obj/machinery/atmospherics/target - the machine we are connecting to - * * iteration - the current node we are checking (from 1 to 4) - */ /obj/machinery/atmospherics/proc/can_be_node(obj/machinery/atmospherics/target, iteration) return connection_check(target, piping_layer) -/** - * Find a connecting /obj/machinery/atmospherics in specified direction, called by relaymove() - * used by ventcrawling mobs to check if they can move inside a pipe in a specific direction - * Arguments: - * * direction - the direction we are checking against - * * prompted_layer - the piping_layer we are inside - */ +//Find a connecting /obj/machinery/atmospherics in specified direction /obj/machinery/atmospherics/proc/find_connecting(direction, prompted_layer) for(var/obj/machinery/atmospherics/target in get_step_multiz(src, direction)) if(target.initialize_directions & get_dir(target,src) && !istype(target, /obj/machinery/atmospherics/pipe/multiz)) if(connection_check(target, prompted_layer)) return target -/** - * Check the connection between two nodes - * - * Check if our machine and the target machine are connectable by both calling isConnectable and by checking that the directions and piping_layer are compatible - * called by can_be_node() (for building a network) and find_connecting() (for ventcrawling) - * Arguments: - * * obj/machinery/atmospherics/target - the machinery we want to connect to - * * given_layer - the piping_layer we are checking - */ /obj/machinery/atmospherics/proc/connection_check(obj/machinery/atmospherics/target, given_layer) - if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && check_init_directions(target)) + if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && (target.initialize_directions & get_dir(target,src) || istype(target, /obj/machinery/atmospherics/pipe/multiz))) return TRUE return FALSE -/** - * check if the initialized direction are the same on both sides (or if is a multiz adapter) - * returns TRUE or FALSE if the connection is possible or not - * Arguments: - * * obj/machinery/atmospherics/target - the machinery we want to connect to - */ -/obj/machinery/atmospherics/proc/check_init_directions(obj/machinery/atmospherics/target) - if((initialize_directions & get_dir(src, target) && target.initialize_directions & get_dir(target,src)) || istype(target, /obj/machinery/atmospherics/pipe/multiz)) - return TRUE - return FALSE - -/** - * check if the piping layer and color are the same on both sides (grey can connect to all colors) - * returns TRUE or FALSE if the connection is possible or not - * Arguments: - * * obj/machinery/atmospherics/target - the machinery we want to connect to - * * given_layer - the piping_layer we are connecting to - */ /obj/machinery/atmospherics/proc/is_connectable(obj/machinery/atmospherics/target, given_layer) if(isnull(given_layer)) given_layer = piping_layer @@ -229,55 +160,27 @@ return TRUE return FALSE -/** - * Called on construction and when expanding the datum_pipeline, returns the nodes of the device - */ /obj/machinery/atmospherics/proc/pipeline_expansion() return nodes -/** - * Set the initial directions of the device (NORTH || SOUTH || EAST || WEST), called on New() - */ -/obj/machinery/atmospherics/proc/set_init_directions(init_dir) +/obj/machinery/atmospherics/proc/set_init_directions() return -/** - * Getter of initial directions - */ /obj/machinery/atmospherics/proc/get_init_directions() return initialize_directions -/** - * Called by add_member() in datum_pipeline.dm, returns the parent network the device is connected to - */ /obj/machinery/atmospherics/proc/return_pipenet() return -/** - * Called by add_machinery_member() in datum_pipeline.dm, returns a list of gas_mixtures and assigns them into other_airs (by addMachineryMember) to allow pressure redistribution for the machineries. - */ -/obj/machinery/atmospherics/proc/return_pipenet_airs() +/obj/machinery/atmospherics/proc/return_pipenetAir() return -/** - * Called by build_pipeline() and add_member() in datum_pipeline.dm, set the network the device is connected to, to the datum pipeline it has reference - */ /obj/machinery/atmospherics/proc/set_pipenet() return -/** - * Similar to set_pipenet() but instead of setting a network to a pipeline, it replaces the old pipeline with a new one, called by Merge() in datum_pipeline.dm - */ /obj/machinery/atmospherics/proc/replace_pipenet() return -/** - * Disconnects the nodes - * - * Called by nullify_node(), it disconnects two nodes by removing the reference id from the node itself that called this proc - * Arguments: - * * obj/machinery/atmospherics/reference - the machinery we are removing from the node connection - */ /obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) if(istype(reference, /obj/machinery/atmospherics/pipe)) var/obj/machinery/atmospherics/pipe/P = reference @@ -364,31 +267,27 @@ . = stored ..() -/** - * Getter for piping layer shifted, pipe colored overlays - * - * Creates the image for the pipe underlay that all components use, called by get_pipe_underlay() in components_base.dm - * Arguments: - * * iconfile - path of the iconstate we are using (ex: 'icons/obj/atmospherics/components/thermomachine.dmi') - * * iconstate - the image we are using inside the file - * * direction - the direction of our device - * * color - the color (in hex value, like #559900) that the pipe should have - * * piping_layer - the piping_layer the device is in, used inside PIPING_LAYER_SHIFT - * * trinary - if TRUE we also use PIPING_FORWARD_SHIFT on layer 1 and 5 for trinary devices (filters and mixers) - */ -/obj/machinery/atmospherics/proc/get_pipe_image(iconfile, iconstate, direction, color = COLOR_VERY_LIGHT_GRAY, piping_layer = 3, trinary = FALSE) - var/image/pipe_overlay = image(iconfile, iconstate, dir = direction) - pipe_overlay.color = color - PIPING_LAYER_SHIFT(pipe_overlay, piping_layer) - if(trinary == TRUE && (piping_layer == 1 || piping_layer == 5)) - PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2) - return pipe_overlay +/obj/machinery/atmospherics/proc/get_pipe_image(iconset, iconstate, direction, col=rgb(255,255,255), piping_layer=3, trinary = FALSE) + + //Add identifiers for the iconset + if(iconsetids[iconset] == null) + iconsetids[iconset] = num2text(iconsetids.len + 1) + + //Generate a unique identifier for this image combination + var/identifier = iconsetids[iconset] + "_[iconstate]_[direction]_[col]_[piping_layer]" + + if((!(. = pipeimages[identifier]))) + var/image/pipe_overlay + pipe_overlay = . = pipeimages[identifier] = image(iconset, iconstate, dir = direction) + pipe_overlay.color = col + PIPING_LAYER_SHIFT(pipe_overlay, piping_layer) + if(trinary && (piping_layer == 1 || piping_layer == 5)) + PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2) /obj/machinery/atmospherics/on_construction(obj_color, set_layer) if(can_unwrench) add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY) pipe_color = obj_color - update_name() set_piping_layer(set_layer) atmos_init() var/list/nodes = pipeline_expansion() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 5388683552d7d..7adc98419a59f 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -96,14 +96,11 @@ if(node1) node1.disconnect(src) nodes[1] = null - if(parents[1]) - nullify_pipenet(parents[1]) - + nullifyPipenet(parents[1]) if(node2) node2.disconnect(src) nodes[2] = null - if(parents[2]) - nullify_pipenet(parents[2]) + nullifyPipenet(parents[2]) if(anchored) set_init_directions() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index f6cb9bdc9910f..3868afd9099ec 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -47,7 +47,7 @@ /obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, pipe_color, piping_layer = piping_layer) + var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, piping_layer = piping_layer) add_overlay(cap) if(welded) @@ -108,20 +108,12 @@ //Radio remote control -/** - * Called in atmos_init(), used to change or remove the radio frequency from the component - * Arguments: - * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio - */ /obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) -/** - * Called in atmos_init(), send the component status to the radio device connected - */ /obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status() if(!radio_connection) return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index d9ce0b2510217..9b7f616ad9336 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -67,20 +67,12 @@ Passive gate is similar to the regular pump except: //Radio remote control -/** - * Called in atmos_init(), used to change or remove the radio frequency from the component - * Arguments: - * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio - */ /obj/machinery/atmospherics/components/binary/passive_gate/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) -/** - * Called in atmos_init(), send the component status to the radio device connected - */ /obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status() if(!radio_connection) return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm index 72d3571ef8c59..b659fd39c72df 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -66,22 +66,12 @@ is_gas_flowing = FALSE update_icon_nopipes() -//Radio remote control - -/** - * Called in atmos_init(), used to change or remove the radio frequency from the component - * Arguments: - * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio - */ /obj/machinery/atmospherics/components/binary/pressure_valve/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) -/** - * Called in atmos_init(), send the component status to the radio device connected - */ /obj/machinery/atmospherics/components/binary/pressure_valve/proc/broadcast_status() if(!radio_connection) return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 5312987fcc767..3a0782e947471 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -72,20 +72,13 @@ on = active SEND_SIGNAL(src, COMSIG_PUMP_SET_ON, on) -/** - * Called in atmos_init(), used to change or remove the radio frequency from the component - * Arguments: - * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio - */ +//Radio remote control /obj/machinery/atmospherics/components/binary/pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency if(frequency) radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA) -/** - * Called in atmos_init(), send the component status to the radio device connected - */ /obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status() if(!radio_connection) return diff --git a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm deleted file mode 100644 index ad4aaf777cba0..0000000000000 --- a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm +++ /dev/null @@ -1,515 +0,0 @@ -#define THERMOMACHINE_SAFE_TEMPERATURE 500000 -#define THERMOMACHINE_POWER_CONVERSION 0.01 - -/obj/machinery/atmospherics/components/binary/thermomachine - icon = 'icons/obj/atmospherics/components/thermomachine.dmi' - icon_state = "thermo_base" - - name = "Temperature control unit" - desc = "Heats or cools gas in connected pipes." - - density = TRUE - max_integrity = 300 - armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30) - layer = OBJ_LAYER - circuit = /obj/item/circuitboard/machine/thermomachine - - hide = TRUE - - move_resist = MOVE_RESIST_DEFAULT - vent_movement = NONE - pipe_flags = PIPING_ONE_PER_TURF - - greyscale_config = /datum/greyscale_config/thermomachine - greyscale_colors = COLOR_VIBRANT_LIME - - set_dir_on_move = FALSE - - var/min_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var - var/max_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var - var/target_temperature = T20C - var/heat_capacity = 0 - var/interactive = TRUE // So mapmakers can disable interaction. - var/cooling = TRUE - var/base_heating = 140 - var/base_cooling = 170 - var/use_enviroment_heat = FALSE - var/skipping_work = FALSE - var/safeties = TRUE - var/lastwarning - var/color_index = 1 - - // Efficiency dictates how much we throttle the heat exchange process. - var/efficiency = 1 - ///Efficiency minimum amount, min 0.25, max 1 (works best on higher laser tiers) - var/parts_efficiency = 1 - -/obj/machinery/atmospherics/components/binary/thermomachine/Initialize(mapload) - . = ..() - RefreshParts() - update_appearance() - -/obj/machinery/atmospherics/components/binary/thermomachine/is_connectable() - if(!anchored || panel_open) - return FALSE - . = ..() - -/obj/machinery/atmospherics/components/binary/thermomachine/get_node_connects() - return list(dir, turn(dir, 180)) - -/obj/machinery/atmospherics/components/binary/thermomachine/on_construction(obj_color, set_layer) - var/obj/item/circuitboard/machine/thermomachine/board = circuit - if(board) - piping_layer = board.pipe_layer - set_layer = piping_layer - - if(check_pipe_on_turf()) - deconstruct(TRUE) - return - return..() - -/obj/machinery/atmospherics/components/binary/thermomachine/RefreshParts() - var/calculated_bin_rating - for(var/obj/item/stock_parts/matter_bin/bin in component_parts) - calculated_bin_rating += bin.rating - heat_capacity = 7500 * ((calculated_bin_rating - 1) ** 2) - min_temperature = T20C - max_temperature = T20C - var/calculated_laser_rating - for(var/obj/item/stock_parts/micro_laser/laser in component_parts) - calculated_laser_rating += laser.rating - min_temperature = max(T0C - (base_cooling + calculated_laser_rating * 15), TCMB) //73.15K with T1 stock parts - max_temperature = T20C + (base_heating * calculated_laser_rating) //573.15K with T1 stock parts - parts_efficiency = min(calculated_laser_rating * 0.125, 1) - -/obj/machinery/atmospherics/components/binary/thermomachine/update_icon_state() - switch(target_temperature) - if(BODYTEMP_HEAT_WARNING_3 to INFINITY) - greyscale_colors = COLOR_RED - if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3) - greyscale_colors = COLOR_ORANGE - if(BODYTEMP_HEAT_WARNING_1 to BODYTEMP_HEAT_WARNING_2) - greyscale_colors = COLOR_YELLOW - if(BODYTEMP_COLD_WARNING_1 to BODYTEMP_HEAT_WARNING_1) - greyscale_colors = COLOR_VIBRANT_LIME - if(BODYTEMP_COLD_WARNING_2 to BODYTEMP_COLD_WARNING_1) - greyscale_colors = COLOR_CYAN - if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2) - greyscale_colors = COLOR_BLUE - else - greyscale_colors = COLOR_VIOLET - - set_greyscale(colors=greyscale_colors) - - if(panel_open) - icon_state = "thermo-open" - return ..() - if(on && is_operational) - if(skipping_work) - icon_state = "thermo_1_blinking" - else - icon_state = "thermo_1" - return ..() - icon_state = "thermo_base" - return ..() - -/obj/machinery/atmospherics/components/binary/thermomachine/update_overlays() - . = ..() - if(!initial(icon)) - return - var/mutable_appearance/thermo_overlay = new(initial(icon)) - . += get_pipe_image(thermo_overlay, "pipe", dir, COLOR_LIME, piping_layer) - . += get_pipe_image(thermo_overlay, "pipe", turn(dir, 180), COLOR_MOSTLY_PURE_RED, piping_layer) - -/obj/machinery/atmospherics/components/binary/thermomachine/examine(mob/user) - . = ..() - if(obj_flags & EMAGGED) - . += span_notice("Something seems wrong with [src]'s thermal safeties.") - . += span_notice("With the panel open:") - . += span_notice("-use a wrench with left-click to rotate [src] and right-click to unanchor it.") - . += span_notice("-use a multitool with left-click to change the piping layer and right-click to change the piping color.") - . += span_notice("The thermostat is set to [target_temperature]K ([(T0C-target_temperature)*-1]C).") - if(in_range(user, src) || isobserver(user)) - . += span_notice("Heat capacity at [heat_capacity] Joules per Kelvin.") - . += span_notice("Temperature range [min_temperature]K - [max_temperature]K ([(T0C-min_temperature)*-1]C - [(T0C-max_temperature)*-1]C).") - -/obj/machinery/atmospherics/components/binary/thermomachine/AltClick(mob/living/user) - if(!can_interact(user)) - return - target_temperature = T20C - investigate_log("was set to [target_temperature] K by [key_name(user)]", INVESTIGATE_ATMOS) - balloon_alert(user, "temperature reset to [target_temperature] K") - -/** Performs heat calculation for the freezer. The full equation for this whole process is: - * T3 = (C1*T1 + (C1*C2)/(C1+C2)*(T2-T1)*E) / C1. - * T4 = (C1*T1 - (C1*C2)/(C1+C2)*(T2-T1)*E + M) / C1. - * C1 is main port heat capacity, T1 is the temp. - * C2 and T2 is for the heat capacity of the freezer and temperature that we desire respectively. - * T3 is the temperature we get, T4 is the exchange target (heat reservoir). - * M is the motor heat. - * E is the efficiency variable. At E=1 and M=0 it works out to be ((C1*T1)+(C2*T2))/(C1+C2). - */ -/obj/machinery/atmospherics/components/binary/thermomachine/process_atmos() - if(!is_operational || !on) //if it has no power or its switched off, dont process atmos - on = FALSE - update_appearance() - return - - var/turf/local_turf = get_turf(src) - if(!local_turf) - on = FALSE - update_appearance() - return - - // The gas we want to cool/heat - var/datum/gas_mixture/main_port = airs[1] - var/datum/gas_mixture/exchange_target = airs[2] - - // The difference between target and what we need to heat/cool. Positive if heating, negative if cooling. - var/temperature_target_delta = target_temperature - main_port.temperature - - // This variable holds the (C1*C2)/(C1+C2)*(T2-T1) part of the equation. - var/heat_amount = temperature_target_delta * (main_port.heat_capacity() * heat_capacity / (main_port.heat_capacity() + heat_capacity)) - - // Motor heat is the heat added to both ports of the thermomachine at every tick. - var/motor_heat = 5000 - if(abs(temperature_target_delta) < 5) //Allow the machine to work more finely on lower temperature differences. - motor_heat = 0 - - // Automatic Switching. Longer if check to prevent unecessary update_appearances. - if ((cooling && temperature_target_delta > 0) || (!cooling && temperature_target_delta < 0)) - cooling = temperature_target_delta <= 0 // Thermomachines that reached the target will default to cooling. - update_appearance() - - skipping_work = FALSE - - if (main_port.total_moles() < 0.01) - skipping_work = TRUE - return - - // Efficiency should be a proc level variable, but we need it for the ui. - // This is to reset the value when we are heating. - efficiency = 1 - - var/mole_efficiency = 1 - var/mole_eff_main_port = 1 - var/mole_eff_thermal_port = 1 - if(cooling) - // Exchange target is the thing we are paired with, be it enviroment or the red port. - if(use_enviroment_heat) - exchange_target = local_turf.return_air() - else - exchange_target = airs[2] - - if(exchange_target.total_moles() < 5) - mole_eff_thermal_port = 0.1 - else - mole_eff_thermal_port = max(1 - (1 / (exchange_target.total_moles() + 1)) * 5, 0.1) - - if(main_port.total_moles() < 5) - mole_eff_main_port = 0.1 - else - mole_eff_main_port = max(1 - (1 / (main_port.total_moles() + 1)) * 5, 0.1) - - mole_efficiency = min(mole_eff_main_port, mole_eff_thermal_port) - - if(cooling) - if (exchange_target.total_moles() < 0.01) - skipping_work = TRUE - return - - // The hotter the heat reservoir is, the larger the malus. - var/temperature_exchange_delta = exchange_target.temperature - main_port.temperature - // Log 1 is already 0, going any lower will result in a negative number. - efficiency = clamp(1 - log(10, max(1, temperature_exchange_delta)) * 0.08, 0.65, 1) - // We take an extra efficiency malus for enviroments where the mol is too low. - // Cases of log(0) will be caught by the early return above. - if (use_enviroment_heat) - efficiency *= clamp(log(1.55, exchange_target.total_moles()) * 0.15, 0.65, 1) - - efficiency *= mole_efficiency - efficiency = max(efficiency, parts_efficiency) - - if (exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && safeties) - on = FALSE - visible_message(span_warning("The heat reservoir has reached critical levels, shutting down...")) - update_appearance() - return - - else if(exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && !safeties) - if((REALTIMEOFDAY - lastwarning) / 5 >= WARNING_DELAY) - lastwarning = REALTIMEOFDAY - visible_message(span_warning("The heat reservoir has reached critical levels!")) - if(check_explosion(exchange_target.temperature)) - explode() - return PROCESS_KILL //We're dying anyway, so let's stop processing - - exchange_target.temperature = max((THERMAL_ENERGY(exchange_target) - (heat_amount * efficiency) + motor_heat) / exchange_target.heat_capacity(), TCMB) - - if(!cooling) - efficiency *= mole_efficiency - efficiency = max(efficiency, parts_efficiency) - - main_port.temperature = max((THERMAL_ENERGY(main_port) + (heat_amount * efficiency)) / main_port.heat_capacity(), TCMB) - - heat_amount = min(abs(heat_amount), 1e8) * THERMOMACHINE_POWER_CONVERSION - var/power_usage = 0 - var/power_efficiency = max(efficiency, 0.4) - if(abs(temperature_target_delta) > 1) - power_usage = (heat_amount * 0.05 + idle_power_usage) ** (1.05 - (5e7 * power_efficiency) / (max(5e7, heat_amount))) - else - power_usage = idle_power_usage - - use_power(power_usage) - update_appearance() - update_parents() - -/obj/machinery/atmospherics/components/binary/thermomachine/attackby(obj/item/item, mob/user, params) - if(!on && item.tool_behaviour == TOOL_SCREWDRIVER) - if(!anchored) - to_chat(user, span_notice("Anchor [src] first!")) - return - if(default_deconstruction_screwdriver(user, "thermo-open", "thermo-0", item)) - change_pipe_connection(panel_open) - return - if(default_change_direction_wrench(user, item)) - return - if(default_deconstruction_crowbar(item)) - return - - if(panel_open && item.tool_behaviour == TOOL_MULTITOOL) - piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1) - to_chat(user, span_notice("You change the circuitboard to layer [piping_layer].")) - update_appearance() - return - return ..() - -/obj/machinery/atmospherics/components/binary/thermomachine/default_change_direction_wrench(mob/user, obj/item/I) - if(!..()) - return FALSE - set_init_directions() - update_appearance() - return TRUE - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/change_pipe_connection(disconnect) - if(disconnect) - disconnect_pipes() - return - connect_pipes() - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/connect_pipes() - var/obj/machinery/atmospherics/node1 = nodes[1] - var/obj/machinery/atmospherics/node2 = nodes[2] - atmos_init() - node1 = nodes[1] - if(node1) - node1.atmos_init() - node1.add_member(src) - node2 = nodes[2] - if(node2) - node2.atmos_init() - node2.add_member(src) - SSair.add_to_rebuild_queue(src) - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/disconnect_pipes() - var/obj/machinery/atmospherics/node1 = nodes[1] - var/obj/machinery/atmospherics/node2 = nodes[2] - if(node1) - if(src in node1.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node1.disconnect(src) - nodes[1] = null - if(node2) - if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node2.disconnect(src) - nodes[2] = null - if(parents[1]) - nullify_pipenet(parents[1]) - if(parents[2]) - nullify_pipenet(parents[2]) - -/obj/machinery/atmospherics/components/binary/thermomachine/attackby_secondary(obj/item/item, mob/user, params) - . = ..() - if(panel_open && item.tool_behaviour == TOOL_WRENCH && !check_pipe_on_turf()) - if(default_unfasten_wrench(user, item)) - return SECONDARY_ATTACK_CONTINUE_CHAIN - if(panel_open && item.tool_behaviour == TOOL_MULTITOOL) - color_index = (color_index >= GLOB.pipe_paint_colors.len) ? (color_index = 1) : (color_index = 1 + color_index) - pipe_color = GLOB.pipe_paint_colors[GLOB.pipe_paint_colors[color_index]] - visible_message("You set [src] pipe color to [GLOB.pipe_color_name[pipe_color]].") - update_appearance() - return SECONDARY_ATTACK_CONTINUE_CHAIN - return SECONDARY_ATTACK_CONTINUE_CHAIN - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_pipe_on_turf() - for(var/obj/machinery/atmospherics/device in get_turf(src)) - if(device == src) - continue - if(device.piping_layer == piping_layer) - visible_message(span_warning("A pipe is hogging the ports, remove the obstruction or change the machine piping layer.")) - return TRUE - return FALSE - -/obj/machinery/atmospherics/components/binary/thermomachine/multitool_act(mob/living/user, obj/item/multitool/multitool) - if(!istype(multitool)) - return - if(panel_open && !anchored) - piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1) - to_chat(user, span_notice("You change the circuitboard to layer [piping_layer].")) - update_appearance() - -/obj/machinery/atmospherics/components/binary/thermomachine/emag_act(mob/user) - . = ..() - if(!(obj_flags & EMAGGED)) - if(!do_after(user, 1 SECONDS, src)) - return - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(5, 0, src) - sparks.attach(src) - sparks.start() - obj_flags |= EMAGGED - user.visible_message(span_warning("You emag [src], overwriting thermal safety restrictions.")) - log_game("[key_name(user)] emagged [src] at [AREACOORD(src)], overwriting thermal safety restrictions.") - -/obj/machinery/atmospherics/components/binary/thermomachine/emp_act() - . = ..() - if(!(obj_flags & EMAGGED)) - var/datum/effect_system/spark_spread/sparks = new - sparks.set_up(5, 0, src) - sparks.attach(src) - sparks.start() - obj_flags |= EMAGGED - safeties = FALSE - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_explosion(temperature) - if(temperature < THERMOMACHINE_SAFE_TEMPERATURE + 2000) - return FALSE - if(prob(log(6, temperature) * 10)) //75% at 500000, 100% at 1e8 - return TRUE - -/obj/machinery/atmospherics/components/binary/thermomachine/proc/explode() - explosion(loc, 0, 0, 3, 3, TRUE, explosion_cause = src) - var/datum/gas_mixture/main_port = airs[1] - var/datum/gas_mixture/exchange_target = airs[2] - if(main_port) - loc.assume_air(main_port.remove_ratio(1)) - if(exchange_target) - loc.assume_air(exchange_target.remove_ratio(1)) - qdel(src) - -/obj/machinery/atmospherics/components/binary/thermomachine/ui_status(mob/user) - if(interactive) - return ..() - return UI_CLOSE - -/obj/machinery/atmospherics/components/binary/thermomachine/ui_interact(mob/user, datum/tgui/ui) - if(panel_open) - return - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "ThermoMachine", name) - ui.open() - -/obj/machinery/atmospherics/components/binary/thermomachine/ui_data(mob/user) - var/list/data = list() - data["on"] = on - data["cooling"] = cooling - - data["min"] = min_temperature - data["max"] = max_temperature - data["target"] = target_temperature - data["initial"] = initial(target_temperature) - - var/datum/gas_mixture/air1 = airs[1] - data["temperature"] = air1.temperature - data["pressure"] = air1.return_pressure() - data["efficiency"] = efficiency - - data["use_env_heat"] = use_enviroment_heat - data["skipping_work"] = skipping_work - data["safeties"] = safeties - var/hacked = (obj_flags & EMAGGED) ? TRUE : FALSE - data["hacked"] = hacked - return data - -/obj/machinery/atmospherics/components/binary/thermomachine/ui_act(action, params) - . = ..() - if(.) - return - - switch(action) - if("power") - on = !on - update_use_power(on ? ACTIVE_POWER_USE : IDLE_POWER_USE) - investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) - . = TRUE - if("cooling") - cooling = !cooling - investigate_log("was changed to [cooling ? "cooling" : "heating"] by [key_name(usr)]", INVESTIGATE_ATMOS) - . = TRUE - if("target") - var/target = params["target"] - var/adjust = text2num(params["adjust"]) - if(target == "input") - target = input("Set new target ([min_temperature]-[max_temperature] K):", name, target_temperature) as num|null - if(!isnull(target)) - . = TRUE - else if(adjust) - target = target_temperature + adjust - . = TRUE - else if(text2num(target) != null) - target = text2num(target) - . = TRUE - if(.) - target_temperature = clamp(target, min_temperature, max_temperature) - investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS) - if("use_env_heat") - use_enviroment_heat = !use_enviroment_heat - . = TRUE - if("safeties") - safeties = !safeties - investigate_log("[key_name(usr)] turned off the [src] safeties", INVESTIGATE_ATMOS) - . = TRUE - - update_appearance() - -/obj/machinery/atmospherics/components/binary/thermomachine/CtrlClick(mob/living/user) - if(!panel_open) - if(!can_interact(user)) - return - on = !on - investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_appearance() - return - . = ..() - -/obj/machinery/atmospherics/components/binary/thermomachine/freezer - cooling = TRUE - -/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on - on = TRUE - icon_state = "thermo_base_1" - -/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/Initialize(mapload) - . = ..() - if(target_temperature == initial(target_temperature)) - target_temperature = min_temperature - -/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom - name = "Cold room temperature control unit" - icon_state = "thermo_base_1" - greyscale_colors = COLOR_CYAN - cooling = TRUE - -/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom/Initialize(mapload) - . = ..() - target_temperature = COLD_ROOM_TEMP - -/obj/machinery/atmospherics/components/binary/thermomachine/heater - cooling = FALSE - -/obj/machinery/atmospherics/components/binary/thermomachine/heater/on - on = TRUE - icon_state = "thermo_base_1" - -#undef THERMOMACHINE_SAFE_TEMPERATURE -#undef THERMOMACHINE_POWER_CONVERSION diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index 7465d3b5cb5e9..ba1d7403ea844 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -52,16 +52,6 @@ It's like a regular ol' straight pipe, but you can turn it on and off. update_icon_nopipes() investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", INVESTIGATE_ATMOS) - -// This is what handles the actual functionality of combining 2 pipenets when the valve is open -// Basically when a pipenet updates it will consider both sides to be the same for the purpose of the gas update -/obj/machinery/atmospherics/components/binary/valve/return_pipenets_for_reconcilation(datum/pipeline/requester) - . = ..() - if(!on) - return - . += parents[1] - . += parents[2] - /obj/machinery/atmospherics/components/binary/valve/interact(mob/user) add_fingerprint(usr) if(switching) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 61d7198b395c5..84c0a789aa97c 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -95,11 +95,6 @@ if(overclocked) . += "Its warning light is on[on ? " and it's spewing gas!" : "."]" -/** - * Called in atmos_init(), used to change or remove the radio frequency from the component - * Arguments: - * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio - */ /obj/machinery/atmospherics/components/binary/volume_pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency @@ -108,6 +103,7 @@ /obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status() if(!radio_connection) + return var/datum/signal/signal = new(list( "tag" = id, @@ -136,7 +132,7 @@ return data /obj/machinery/atmospherics/components/binary/volume_pump/atmos_init() - . = ..() + ..() set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 7f683b8b210c8..b3ee7f4893b7e 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -23,11 +23,9 @@ ..() for(var/i in 1 to device_type) - if(airs[i]) - continue - var/datum/gas_mixture/component_mixture = new - component_mixture.volume = 200 - airs[i] = component_mixture + var/datum/gas_mixture/A = new + A.volume = 200 + airs[i] = A /obj/machinery/atmospherics/components/Initialize() . = ..() @@ -95,8 +93,8 @@ /obj/machinery/atmospherics/components/nullify_node(i) if(parents[i]) - nullify_pipenet(parents[i]) - airs[i] = null + nullifyPipenet(parents[i]) + QDEL_NULL(airs[i]) return ..() /obj/machinery/atmospherics/components/on_construction() @@ -122,9 +120,9 @@ * Arguments: * * -reference: the pipeline the component is attached to */ -/obj/machinery/atmospherics/components/proc/nullify_pipenet(datum/pipeline/reference) +/obj/machinery/atmospherics/components/proc/nullifyPipenet(datum/pipeline/reference) if(!reference) - CRASH("nullify_pipenet(null) called by [type] on [COORD(src)]") + CRASH("nullifyPipenet(null) called by [type] on [COORD(src)]") for (var/i in 1 to parents.len) if (parents[i] == reference) @@ -143,10 +141,10 @@ if(!length(reference.other_atmos_machines) && !length(reference.members)) if(QDESTROYING(reference)) - CRASH("nullify_pipenet() called on qdeleting [reference]") + CRASH("nullifyPipenet() called on qdeleting [reference]") qdel(reference) -/obj/machinery/atmospherics/components/return_pipenet_airs(datum/pipeline/reference) +/obj/machinery/atmospherics/components/return_pipenetAirs(datum/pipeline/reference) var/list/returned_air = list() for (var/i in 1 to parents.len) @@ -159,11 +157,11 @@ return list(nodes[parents.Find(reference)]) return ..() -/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/target_component) - parents[nodes.Find(target_component)] = reference +/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/A) + parents[nodes.Find(A)] = reference -/obj/machinery/atmospherics/components/return_pipenet(obj/machinery/atmospherics/target_component = nodes[1]) //returns parents[1] if called without argument - return parents[nodes.Find(target_component)] +/obj/machinery/atmospherics/components/return_pipenet(obj/machinery/atmospherics/A = nodes[1]) //returns parents[1] if called without argument + return parents[nodes.Find(A)] /obj/machinery/atmospherics/components/replace_pipenet(datum/pipeline/Old, datum/pipeline/New) parents[parents.Find(Old)] = New @@ -171,11 +169,11 @@ /obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures) . = ..() - var/turf/current_turf = get_turf(src) - if(!current_turf) + var/turf/T = get_turf(src) + if(!T) return //Remove the gas from airs and assume it - var/datum/gas_mixture/environment = current_turf.return_air() + var/datum/gas_mixture/environment = T.return_air() var/lost = null var/times_lost = 0 for(var/i in 1 to device_type) @@ -191,7 +189,8 @@ to_release = air.remove(shared_loss) continue to_release.merge(air.remove(shared_loss)) - current_turf.assume_air(to_release) + T.assume_air(to_release) + air_update_turf(FALSE, FALSE) // Helpers @@ -218,11 +217,6 @@ for(var/i in 1 to device_type) . += return_pipenet(nodes[i]) -/// When this machine is in a pipenet that is reconciling airs, this proc can add airs to the calculation. -/// Can be either a list of airs or a single air mix. -/obj/machinery/atmospherics/components/proc/return_airs_for_reconcilation(datum/pipeline/requester) - return list() - // UI Stuff /obj/machinery/atmospherics/components/ui_status(mob/user) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm deleted file mode 100644 index 5ea71e5933a38..0000000000000 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ /dev/null @@ -1,503 +0,0 @@ -/** - * This file contain the eight parts surrounding the main core, those are: fuel input, moderator input, waste output, interface and the corners - * The file also contain the guicode of the machine - */ -/obj/machinery/atmospherics/components/unary/hypertorus - icon = 'icons/obj/atmospherics/components/hypertorus.dmi' - icon_state = "core" - - name = "thermomachine" - desc = "Heats or cools gas in connected pipes." - anchored = TRUE - density = TRUE - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF - layer = OBJ_LAYER - pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY - circuit = /obj/item/circuitboard/machine/thermomachine - ///Vars for the state of the icon of the object (open, off, active) - var/icon_state_open - var/icon_state_off - var/icon_state_active - ///Check if the machine has been activated - var/active = FALSE - ///Check if fusion has started - var/fusion_started = FALSE - ///Check if the machine is cracked open - var/cracked = FALSE - -/obj/machinery/atmospherics/components/unary/hypertorus/Initialize(mapload) - . = ..() - initialize_directions = dir - -/obj/machinery/atmospherics/components/unary/hypertorus/examine(mob/user) - . = ..() - . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.") - -/obj/machinery/atmospherics/components/unary/hypertorus/attackby(obj/item/I, mob/user, params) - if(!fusion_started) - if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I)) - return - if(default_change_direction_wrench(user, I)) - return - if(default_deconstruction_crowbar(I)) - return - return ..() - -/obj/machinery/atmospherics/components/unary/hypertorus/welder_act(mob/living/user, obj/item/tool) - if(!cracked) - return FALSE - if(user.combat_mode) - return FALSE - balloon_alert(user, "You start repairing the crack...") - if(tool.use_tool(src, user, 10 SECONDS, volume=30, amount=5)) - balloon_alert(user, "You repaired the crack.") - cracked = FALSE - update_appearance() - -/obj/machinery/atmospherics/components/unary/hypertorus/default_change_direction_wrench(mob/user, obj/item/I) - . = ..() - if(.) - set_init_directions() - var/obj/machinery/atmospherics/node = nodes[1] - if(node) - node.disconnect(src) - nodes[1] = null - if(parents[1]) - nullify_pipenet(parents[1]) - atmos_init() - node = nodes[1] - if(node) - node.atmos_init() - node.add_member(src) - SSair.add_to_rebuild_queue(src) - -/obj/machinery/atmospherics/components/unary/hypertorus/update_icon_state() - if(panel_open) - icon_state = icon_state_open - return ..() - if(active) - icon_state = icon_state_active - return ..() - icon_state = icon_state_off - return ..() - -/obj/machinery/atmospherics/components/unary/hypertorus/update_overlays() - . = ..() - if(!cracked) - return - var/image/crack = image(icon, icon_state = "crack") - crack.dir = dir - . += crack - -/obj/machinery/atmospherics/components/unary/hypertorus/fuel_input - name = "HFR fuel input port" - desc = "Input port for the Hypertorus Fusion Reactor, designed to take in only Hydrogen and Tritium in gas forms." - icon_state = "fuel_input_off" - icon_state_open = "fuel_input_open" - icon_state_off = "fuel_input_off" - icon_state_active = "fuel_input_active" - circuit = /obj/item/circuitboard/machine/HFR_fuel_input - -/obj/machinery/atmospherics/components/unary/hypertorus/waste_output - name = "HFR waste output port" - desc = "Waste port for the Hypertorus Fusion Reactor, designed to output the hot waste gases coming from the core of the machine." - icon_state = "waste_output_off" - icon_state_open = "waste_output_open" - icon_state_off = "waste_output_off" - icon_state_active = "waste_output_active" - circuit = /obj/item/circuitboard/machine/HFR_waste_output - -/obj/machinery/atmospherics/components/unary/hypertorus/moderator_input - name = "HFR moderator input port" - desc = "Moderator port for the Hypertorus Fusion Reactor, designed to move gases inside the machine to cool and control the flow of the reaction." - icon_state = "moderator_input_off" - icon_state_open = "moderator_input_open" - icon_state_off = "moderator_input_off" - icon_state_active = "moderator_input_active" - circuit = /obj/item/circuitboard/machine/HFR_moderator_input - -/* -* Interface and corners -*/ -/obj/machinery/hypertorus - name = "hypertorus_core" - desc = "hypertorus_core" - icon = 'icons/obj/atmospherics/components/hypertorus.dmi' - icon_state = "core" - move_resist = INFINITY - anchored = TRUE - density = TRUE - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF - power_channel = AREA_USAGE_ENVIRON - var/active = FALSE - var/icon_state_open - var/icon_state_off - var/icon_state_active - var/fusion_started = FALSE - -/obj/machinery/hypertorus/examine(mob/user) - . = ..() - . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.") - -/obj/machinery/hypertorus/attackby(obj/item/I, mob/user, params) - if(!fusion_started) - if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I)) - return - if(default_change_direction_wrench(user, I)) - return - if(default_deconstruction_crowbar(I)) - return - return ..() - -/obj/machinery/hypertorus/update_icon_state() - if(panel_open) - icon_state = icon_state_open - return ..() - if(active) - icon_state = icon_state_active - return ..() - icon_state = icon_state_off - return ..() - -/obj/machinery/hypertorus/interface - name = "HFR interface" - desc = "Interface for the HFR to control the flow of the reaction." - icon_state = "interface_off" - circuit = /obj/item/circuitboard/machine/HFR_interface - var/obj/machinery/atmospherics/components/unary/hypertorus/core/connected_core - icon_state_off = "interface_off" - icon_state_open = "interface_open" - icon_state_active = "interface_active" - -/obj/machinery/hypertorus/interface/Destroy() - if(connected_core) - connected_core = null - return..() - -/obj/machinery/hypertorus/interface/multitool_act(mob/living/user, obj/item/I) - . = ..() - var/turf/T = get_step(src,turn(dir,180)) - var/obj/machinery/atmospherics/components/unary/hypertorus/core/centre = locate() in T - - if(!centre || !centre.check_part_connectivity()) - to_chat(user, span_notice("Check all parts and then try again.")) - return TRUE - new/obj/item/paper/guides/jobs/atmos/hypertorus(loc) - connected_core = centre - - connected_core.activate(user) - return TRUE - -/obj/machinery/hypertorus/interface/ui_interact(mob/user, datum/tgui/ui) - if(active) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "Hypertorus", name) - ui.open() - else - to_chat(user, span_notice("Activate the machine first by using a multitool on the interface.")) - -/obj/machinery/hypertorus/interface/ui_static_data() - var/data = list() - data["selected_fuel"] = list(list("name" = "Nothing", "id" = null)) - for(var/path in GLOB.hfr_fuels_list) - var/datum/hfr_fuel/recipe = GLOB.hfr_fuels_list[path] - data["selected_fuel"] += list(list("name" = recipe.name, "id" = recipe.id)) - return data - -/obj/machinery/hypertorus/interface/ui_data() - var/data = list() - - if(connected_core.selected_fuel) - data["selected"] = connected_core.selected_fuel.id - else - data["selected"] = "" - - var/list/product_gases - if(!connected_core.selected_fuel) - product_gases = list("Select a fuel mix to see the output") - else - product_gases = list("The [connected_core.selected_fuel.name] mix will produce the following gases:") - for(var/gas_type in connected_core.selected_fuel.secondary_products) - var/datum/gas/gas_produced = gas_type - product_gases += "-[initial(gas_produced.name)]" - var/minimum_temp = connected_core.selected_fuel.negative_temperature_multiplier < 1 ? "Decrease" : "Increase" - var/maximum_temp = connected_core.selected_fuel.positive_temperature_multiplier < 1 ? "Decrease" : "Increase" - var/energy = connected_core.selected_fuel.energy_concentration_multiplier > 1 ? "Decrease" : "Increase" - var/fuel_consumption = connected_core.selected_fuel.fuel_consumption_multiplier < 1 ? "Decrease" : "Increase" - var/fuel_production = connected_core.selected_fuel.gas_production_multiplier < 1 ? "Decrease" : "Increase" - product_gases += "The fuel mix will" - product_gases += "-[minimum_temp] the maximum cooling by a factor of [connected_core.selected_fuel.negative_temperature_multiplier]" - product_gases += "-[maximum_temp] the maximum heating by a factor of [connected_core.selected_fuel.positive_temperature_multiplier]" - product_gases += "-[energy] the energy output consumption by a factor of [1 / connected_core.selected_fuel.energy_concentration_multiplier]" - product_gases += "-[fuel_consumption] the fuel consumption by a factor of [connected_core.selected_fuel.fuel_consumption_multiplier]" - product_gases += "-[fuel_production] the gas production by a factor of [connected_core.selected_fuel.gas_production_multiplier]" - product_gases += "-Maximum fusion temperature with this mix: [FUSION_MAXIMUM_TEMPERATURE * connected_core.selected_fuel.temperature_change_multiplier] K." - - data["product_gases"] = product_gases.Join("\n") - - //Internal Fusion gases - var/list/fusion_gasdata = list() - if(connected_core.internal_fusion.total_moles()) - for(var/gasid in connected_core.internal_fusion.gases) - fusion_gasdata.Add(list(list( - "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = round(connected_core.internal_fusion.gases[gasid][MOLES], 0.01), - ))) - else - for(var/gasid in connected_core.internal_fusion.gases) - fusion_gasdata.Add(list(list( - "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = 0, - ))) - //Moderator gases - var/list/moderator_gasdata = list() - if(connected_core.moderator_internal.total_moles()) - for(var/gasid in connected_core.moderator_internal.gases) - moderator_gasdata.Add(list(list( - "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = round(connected_core.moderator_internal.gases[gasid][MOLES], 0.01), - ))) - else - for(var/gasid in connected_core.moderator_internal.gases) - moderator_gasdata.Add(list(list( - "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = 0, - ))) - - data["fusion_gases"] = fusion_gasdata - data["moderator_gases"] = moderator_gasdata - - data["energy_level"] = connected_core.energy - data["heat_limiter_modifier"] = connected_core.heat_limiter_modifier - data["heat_output"] = abs(connected_core.heat_output) - data["heat_output_bool"] = connected_core.heat_output >= 0 ? "" : "-" - - data["heating_conductor"] = connected_core.heating_conductor - data["magnetic_constrictor"] = connected_core.magnetic_constrictor - data["fuel_injection_rate"] = connected_core.fuel_injection_rate - data["moderator_injection_rate"] = connected_core.moderator_injection_rate - data["current_damper"] = connected_core.current_damper - - data["power_level"] = connected_core.power_level - data["iron_content"] = connected_core.iron_content - data["integrity"] = connected_core.get_integrity_percent() - - data["start_power"] = connected_core.start_power - data["start_cooling"] = connected_core.start_cooling - data["start_fuel"] = connected_core.start_fuel - data["start_moderator"] = connected_core.start_moderator - - data["internal_fusion_temperature"] = connected_core.fusion_temperature - data["moderator_internal_temperature"] = connected_core.moderator_temperature - data["internal_output_temperature"] = connected_core.output_temperature - data["internal_coolant_temperature"] = connected_core.coolant_temperature - - data["waste_remove"] = connected_core.waste_remove - data["filter_types"] = list() - for(var/path in GLOB.meta_gas_info) - var/list/gas = GLOB.meta_gas_info[path] - data["filter_types"] += list(list("gas_id" = gas[META_GAS_ID], "gas_name" = gas[META_GAS_NAME], "enabled" = (path in connected_core.moderator_scrubbing))) - - data["cooling_volume"] = connected_core.airs[1].volume - data["mod_filtering_rate"] = connected_core.moderator_filtering_rate - - return data - -/obj/machinery/hypertorus/interface/ui_act(action, params) - . = ..() - if(.) - return - switch(action) - if("start_power") - connected_core.start_power = !connected_core.start_power - connected_core.update_use_power(connected_core.start_power ? ACTIVE_POWER_USE : IDLE_POWER_USE) - . = TRUE - if("start_cooling") - connected_core.start_cooling = !connected_core.start_cooling - . = TRUE - if("start_fuel") - connected_core.start_fuel = !connected_core.start_fuel - . = TRUE - if("start_moderator") - connected_core.start_moderator = !connected_core.start_moderator - . = TRUE - if("heating_conductor") - var/heating_conductor = text2num(params["heating_conductor"]) - if(heating_conductor != null) - connected_core.heating_conductor = clamp(heating_conductor, 50, 500) - . = TRUE - if("magnetic_constrictor") - var/magnetic_constrictor = text2num(params["magnetic_constrictor"]) - if(magnetic_constrictor != null) - connected_core.magnetic_constrictor = clamp(magnetic_constrictor, 50, 1000) - . = TRUE - if("fuel_injection_rate") - var/fuel_injection_rate = text2num(params["fuel_injection_rate"]) - if(fuel_injection_rate != null) - connected_core.fuel_injection_rate = clamp(fuel_injection_rate, 0.5, 150) - . = TRUE - if("moderator_injection_rate") - var/moderator_injection_rate = text2num(params["moderator_injection_rate"]) - if(moderator_injection_rate != null) - connected_core.moderator_injection_rate = clamp(moderator_injection_rate, 0.5, 150) - . = TRUE - if("current_damper") - var/current_damper = text2num(params["current_damper"]) - if(current_damper != null) - connected_core.current_damper = clamp(current_damper, 0, 1000) - . = TRUE - if("waste_remove") - connected_core.waste_remove = !connected_core.waste_remove - . = TRUE - if("filter") - connected_core.moderator_scrubbing ^= gas_id2path(params["mode"]) - . = TRUE - if("mod_filtering_rate") - var/mod_filtering_rate = text2num(params["mod_filtering_rate"]) - if(mod_filtering_rate != null) - connected_core.moderator_filtering_rate = clamp(mod_filtering_rate, 5, 200) - . = TRUE - if("fuel") - connected_core.selected_fuel = null - var/fuel_mix = "nothing" - var/datum/hfr_fuel/fuel = null - if(params["mode"] != "") - fuel = GLOB.hfr_fuels_list[params["mode"]] - if(fuel) - connected_core.selected_fuel = fuel - fuel_mix = fuel.name - if(connected_core.internal_fusion.total_moles()) - connected_core.dump_gases() - connected_core.update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating - connected_core.linked_input.update_parents() - connected_core.linked_output.update_parents() - connected_core.linked_moderator.update_parents() - investigate_log("was set to recipe [fuel_mix ? fuel_mix : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS) - . = TRUE - if("cooling_volume") - var/cooling_volume = text2num(params["cooling_volume"]) - if(cooling_volume != null) - connected_core.airs[1].volume = clamp(cooling_volume, 50, 2000) - . = TRUE - -/obj/machinery/hypertorus/corner - name = "HFR corner" - desc = "Structural piece of the machine." - icon_state = "corner_off" - circuit = /obj/item/circuitboard/machine/HFR_corner - icon_state_off = "corner_off" - icon_state_open = "corner_open" - icon_state_active = "corner_active" - dir = SOUTHEAST - -/obj/item/paper/guides/jobs/atmos/hypertorus - name = "paper- 'Quick guide to safe handling of the HFR'" - info = "How to safely(TM) operate the Hypertorus
\ - -Build the machine as it�s shown in the main guide.
\ - -Make a 50/50 gasmix of tritium and hydrogen totalling around 2000 moles.
\ - -Start the machine, fill up the cooling loop with plasma/hypernoblium and use space or freezers to cool it.
\ - -Connect the fuel mix into the fuel injector port, allow only 1000 moles into the machine to ease the kickstart of the reaction
\ - -Set the Heat conductor to 500 when starting the reaction, reset it to 100 when power level is higher than 1
\ - -In the event of a meltdown, set the heat conductor to max and set the current damper to max. Set the fuel injection to min. \ - If the heat output doesn�t go negative, try changing the magnetic costrictors untill heat output goes negative. \ - Make the cooling stronger, put high heat capacity gases inside the moderator (hypernoblium will help dealing with the problem)

\ - Warnings:
\ - -You cannot dismantle the machine if the power level is over 0
\ - -You cannot power of the machine if the power level is over 0
\ - -You cannot dispose of waste gases if power level is over 5
\ - -You cannot remove gases from the fusion mix if they are not helium and antinoblium
\ - -Hypernoblium will decrease the power of the mix by a lot
\ - -Antinoblium will INCREASE the power of the mix by a lot more
\ - -High heat capacity gases are harder to heat/cool
\ - -Low heat capacity gases are easier to heat/cool
\ - -The machine consumes 50 KW per power level, reaching 350 KW at power level 6 so prepare the SM accordingly
\ - -In case of a power shortage, the fusion reaction will CONTINUE but the cooling will STOP

\ - The writer of the quick guide will not be held responsible for misuses and meltdown caused by the use of the guide, \ - use more advanced guides to understando how the various gases will act as moderators." - -/obj/item/hfr_box - name = "HFR box" - desc = "If you see this, call the police." - icon = 'icons/obj/atmospherics/components/hypertorus.dmi' - icon_state = "box" - ///What kind of box are we handling? - var/box_type = "impossible" - ///What's the path of the machine we making - var/part_path - -/obj/item/hfr_box/corner - name = "HFR box corner" - desc = "Place this as the corner of your 3x3 multiblock fusion reactor" - icon_state = "box_corner" - box_type = "corner" - part_path = /obj/machinery/hypertorus/corner - -/obj/item/hfr_box/body - name = "HFR box body" - desc = "Place this on the sides of the core box of your 3x3 multiblock fusion reactor" - box_type = "body" - icon_state = "box_body" - -/obj/item/hfr_box/body/fuel_input - name = "HFR box fuel input" - part_path = /obj/machinery/atmospherics/components/unary/hypertorus/fuel_input - -/obj/item/hfr_box/body/moderator_input - name = "HFR box moderator input" - part_path = /obj/machinery/atmospherics/components/unary/hypertorus/moderator_input - -/obj/item/hfr_box/body/waste_output - name = "HFR box waste output" - part_path = /obj/machinery/atmospherics/components/unary/hypertorus/waste_output - -/obj/item/hfr_box/body/interface - name = "HFR box interface" - part_path = /obj/machinery/hypertorus/interface - -/obj/item/hfr_box/core - name = "HFR box core" - desc = "Activate this with a multitool to deploy the full machine after setting up the other boxes" - icon_state = "box_core" - box_type = "core" - part_path = /obj/machinery/atmospherics/components/unary/hypertorus/core - -/obj/item/hfr_box/core/multitool_act(mob/living/user, obj/item/I) - . = ..() - var/list/parts = list() - for(var/obj/item/hfr_box/box in orange(1,src)) - var/direction = get_dir(src, box) - if(box.box_type == "corner") - if(ISDIAGONALDIR(direction)) - box.dir = direction - parts |= box - continue - if(box.box_type == "body") - if(direction in GLOB.cardinals) - box.dir = direction - parts |= box - continue - if(parts.len == 8) - build_reactor(parts) - return - -/obj/item/hfr_box/core/proc/build_reactor(list/parts) - for(var/obj/item/hfr_box/box in parts) - if(box.box_type == "corner") - var/obj/machinery/hypertorus/corner/corner = new box.part_path(box.loc) - corner.dir = box.dir - qdel(box) - continue - if(box.box_type == "body") - var/location = get_turf(box) - if(box.part_path != /obj/machinery/hypertorus/interface) - var/obj/machinery/atmospherics/components/unary/hypertorus/part = new box.part_path(location, TRUE, box.dir) - part.dir = box.dir - else - var/obj/machinery/hypertorus/interface/part = new box.part_path(location) - part.dir = box.dir - qdel(box) - continue - - new/obj/machinery/atmospherics/components/unary/hypertorus/core(loc, TRUE) - qdel(src) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm deleted file mode 100644 index 2fb7a673631da..0000000000000 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ /dev/null @@ -1,339 +0,0 @@ -#define MIN_PROGRESS_AMOUNT 3 -#define MIN_DEVIATION_RATE 0.90 -#define MAX_DEVIATION_RATE 1.1 -#define HIGH_CONDUCTIVITY_RATIO 0.95 - -/obj/machinery/atmospherics/components/binary/crystallizer - icon = 'icons/obj/atmospherics/components/machines.dmi' - icon_state = "crystallizer-off" - name = "crystallizer" - desc = "Used to crystallize or solidify gases." - layer = ABOVE_MOB_LAYER - density = TRUE - max_integrity = 300 - armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30) - circuit = /obj/item/circuitboard/machine/crystallizer - pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY - vent_movement = NONE - - ///Base icon state for the machine to be used in update_icon() - var/base_icon = "crystallizer" - ///Internal Gas mix used for processing the gases that have been put in - var/datum/gas_mixture/internal - ///Var that controls how much gas gets injected in moles per tick - var/gas_input = 0 - ///Saves the progress during the processing of the items - var/progress_bar = 0 - ///Stores the amount of lost quality - var/quality_loss = 0 - ///Stores the recipe selected by the user in the GUI - var/datum/gas_recipe/selected_recipe = null - ///Stores the total amount of moles needed for the current recipe - var/total_recipe_moles = 0 - -/obj/machinery/atmospherics/components/binary/crystallizer/Initialize(mapload) - . = ..() - internal = new - -/obj/machinery/atmospherics/components/binary/crystallizer/attackby(obj/item/I, mob/user, params) - if(!on) - if(default_deconstruction_screwdriver(user, "[base_icon]-open", "[base_icon]-off", I)) - return - if(default_change_direction_wrench(user, I)) - return - if(default_deconstruction_crowbar(I)) - return - return ..() - -/obj/machinery/atmospherics/components/binary/crystallizer/default_change_direction_wrench(mob/user, obj/item/I) - . = ..() - if(!.) - return FALSE - set_init_directions() - var/obj/machinery/atmospherics/node1 = nodes[1] - var/obj/machinery/atmospherics/node2 = nodes[2] - if(node1) - if(src in node1.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node1.disconnect(src) - nodes[1] = null - if(node2) - if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node2.disconnect(src) - nodes[2] = null - - if(parents[1]) - nullify_pipenet(parents[1]) - if(parents[2]) - nullify_pipenet(parents[2]) - - atmos_init() - node1 = nodes[1] - if(node1) - node1.atmos_init() - node1.add_member(src) - node2 = nodes[2] - if(node2) - node2.atmos_init() - node2.add_member(src) - SSair.add_to_rebuild_queue(src) - return TRUE - -/obj/machinery/atmospherics/components/binary/crystallizer/update_overlays() - . = ..() - cut_overlays() - var/mutable_appearance/pipe_appearance1 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[dir]_[piping_layer]", layer = GAS_SCRUBBER_LAYER) - pipe_appearance1.color = COLOR_LIME - var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[turn(dir, 180)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER) - pipe_appearance2.color = COLOR_MOSTLY_PURE_RED - . += pipe_appearance1 - . += pipe_appearance2 - -/obj/machinery/atmospherics/components/binary/crystallizer/update_icon_state() - . = ..() - if(panel_open) - icon_state = "[base_icon]-open" - else if(on && is_operational) - icon_state = "[base_icon]-on" - else - icon_state = "[base_icon]-off" - -/obj/machinery/atmospherics/components/binary/crystallizer/attackby_secondary(mob/user) - if(!can_interact(user)) - return - on = !on - investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() - -///Checks if the reaction temperature is inside the range of temperature + a little deviation -/obj/machinery/atmospherics/components/binary/crystallizer/proc/check_temp_requirements() - if(internal.temperature >= selected_recipe.min_temp * MIN_DEVIATION_RATE && internal.temperature <= selected_recipe.max_temp * MAX_DEVIATION_RATE) - return TRUE - return FALSE - -///Injects the gases from the input inside the internal gasmix, the amount is dependant on the gas_input var -/obj/machinery/atmospherics/components/binary/crystallizer/proc/inject_gases() - var/datum/gas_mixture/contents = airs[2] - for(var/gas_type in selected_recipe.requirements) - if(!contents.gases[gas_type] || !contents.gases[gas_type][MOLES]) - continue - if(internal.gases[gas_type] && internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type] * 2) - continue - internal.merge(contents.remove_specific(gas_type, contents.gases[gas_type][MOLES] * gas_input)) - -///Checks if the gases required are all inside -/obj/machinery/atmospherics/components/binary/crystallizer/proc/internal_check() - var/gas_check = 0 - for(var/gas_type in selected_recipe.requirements) - if(!internal.gases[gas_type] || !internal.gases[gas_type][MOLES]) - return FALSE - if(internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type]) - gas_check++ - if(gas_check == selected_recipe.requirements.len) - return TRUE - return FALSE - -///Calculation for the heat of the various gas mixes and controls the quality of the item -/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_calculations() - if( (internal.temperature >= (selected_recipe.min_temp * MIN_DEVIATION_RATE) && internal.temperature <= selected_recipe.min_temp) || \ - (internal.temperature >= selected_recipe.max_temp && internal.temperature <= (selected_recipe.max_temp * MAX_DEVIATION_RATE))) - quality_loss = min(quality_loss + 1.5, 100) - - var/median_temperature = (selected_recipe.max_temp - selected_recipe.min_temp) * 0.5 - if(internal.temperature >= (median_temperature * MIN_DEVIATION_RATE) && internal.temperature <= (median_temperature * MAX_DEVIATION_RATE)) - quality_loss = max(quality_loss - 5.5, -100) - - if(selected_recipe.reaction_type == "endothermic") - internal.temperature = max(internal.temperature - (selected_recipe.energy_release / internal.heat_capacity()), TCMB) - update_parents() - else if(selected_recipe.reaction_type == "exothermic") - internal.temperature = max(internal.temperature + (selected_recipe.energy_release / internal.heat_capacity()), TCMB) - update_parents() - -///Conduction between the internal gasmix and the moderating (cooling/heating) gasmix. -/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_conduction() - var/datum/gas_mixture/cooling_port = airs[1] - if(cooling_port.total_moles() > MINIMUM_MOLE_COUNT) - if(internal.total_moles() > 0) - var/coolant_temperature_delta = cooling_port.temperature - internal.temperature - var/cooling_heat_capacity = cooling_port.heat_capacity() - var/internal_heat_capacity = internal.heat_capacity() - var/cooling_heat_amount = HIGH_CONDUCTIVITY_RATIO * coolant_temperature_delta * (cooling_heat_capacity * internal_heat_capacity / (cooling_heat_capacity + internal_heat_capacity)) - cooling_port.temperature = max(cooling_port.temperature - cooling_heat_amount / cooling_heat_capacity, TCMB) - internal.temperature = max(internal.temperature + cooling_heat_amount / internal_heat_capacity, TCMB) - update_parents() - -///Calculate the total moles needed for the recipe -/obj/machinery/atmospherics/components/binary/crystallizer/proc/moles_calculations() - var/amounts = 0 - for(var/gas_type in selected_recipe.requirements) - amounts += selected_recipe.requirements[gas_type] - total_recipe_moles = amounts - -///Removes the gases from the internal gasmix when the recipe is changed -/obj/machinery/atmospherics/components/binary/crystallizer/proc/dump_gases() - var/datum/gas_mixture/remove = internal.remove(internal.total_moles()) - airs[2].merge(remove) - internal.garbage_collect() - -/obj/machinery/atmospherics/components/binary/crystallizer/process_atmos() - if(!on || !is_operational || selected_recipe == null) - return - - inject_gases() - - if(!internal.total_moles()) - return - - heat_conduction() - - if(internal_check()) - if(check_temp_requirements()) - heat_calculations() - progress_bar = min(progress_bar + (MIN_PROGRESS_AMOUNT * 5 / (round(log(10, total_recipe_moles * 0.1), 0.01))), 100) - else - quality_loss = min(quality_loss + 0.5, 100) - progress_bar = max(progress_bar - 1, 0) - if(progress_bar != 100) - update_parents() - return - progress_bar = 0 - - for(var/gas_type in selected_recipe.requirements) - var/amount_consumed = selected_recipe.requirements[gas_type] + quality_loss * 5 - if(internal.gases[gas_type][MOLES] < amount_consumed) - quality_loss = min(quality_loss + 10, 100) - internal.remove_specific(gas_type, amount_consumed) - - var/total_quality = clamp(50 - quality_loss, 0, 100) - var/quality_control - switch(total_quality) - if(100) - quality_control = "Masterwork" - if(95 to 99) - quality_control = "Supreme" - if(75 to 94) - quality_control = "Good" - if(65 to 74) - quality_control = "Decent" - if(55 to 64) - quality_control = "Average" - if(35 to 54) - quality_control = "Ok" - if(15 to 34) - quality_control = "Poor" - if(5 to 14) - quality_control = "Ugly" - if(1 to 4) - quality_control = "Cracked" - if(0) - quality_control = "Oh God why" - - for(var/path in selected_recipe.products) - var/amount_produced = selected_recipe.products[path] - for(var/i in 1 to amount_produced) - var/obj/creation = new path(get_step(src, SOUTH)) - creation.name = "[quality_control] [creation.name]" - if(selected_recipe.dangerous) - investigate_log("has been created in the crystallizer.", INVESTIGATE_SUPERMATTER) - message_admins("[src] has been created in the crystallizer [ADMIN_JMP(src)].") - - - quality_loss = 0 - update_parents() - -/obj/machinery/atmospherics/components/binary/crystallizer/ui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "Crystallizer", name) - ui.open() - -/obj/machinery/atmospherics/components/binary/crystallizer/ui_static_data() - var/data = list() - data["selected_recipes"] = list(list("name" = "Nothing", "id" = "")) - for(var/path in GLOB.gas_recipe_meta) - var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[path] - if(recipe.machine_type != "Crystallizer") - continue - data["selected_recipes"] += list(list("name" = recipe.name, "id" = recipe.id)) - return data - -/obj/machinery/atmospherics/components/binary/crystallizer/ui_data() - var/data = list() - data["on"] = on - - if(selected_recipe) - data["selected"] = selected_recipe.id - else - data["selected"] = "" - - var/list/internal_gas_data = list() - if(internal.total_moles()) - for(var/gasid in internal.gases) - internal_gas_data.Add(list(list( - "name"= internal.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = round(internal.gases[gasid][MOLES], 0.01), - ))) - else - for(var/gasid in internal.gases) - internal_gas_data.Add(list(list( - "name"= internal.gases[gasid][GAS_META][META_GAS_NAME], - "amount" = 0, - ))) - data["internal_gas_data"] = internal_gas_data - - var/list/requirements - if(!selected_recipe) - requirements = list("Select a recipe to see the requirements") - else - requirements = list("To create [selected_recipe.name] you will need:") - for(var/gas_type in selected_recipe.requirements) - var/datum/gas/gas_required = gas_type - var/amount_consumed = selected_recipe.requirements[gas_type] - requirements += "-[amount_consumed] moles of [initial(gas_required.name)]" - requirements += "In a temperature range between [selected_recipe.min_temp] K and [selected_recipe.max_temp] K" - requirements += "The crystallization reaction will be [selected_recipe.reaction_type]" - data["requirements"] = requirements.Join("\n") - - var/temperature - if(internal.total_moles()) - temperature = internal.temperature - else - temperature = 0 - data["internal_temperature"] = temperature - data["progress_bar"] = progress_bar - data["gas_input"] = gas_input - return data - -/obj/machinery/atmospherics/components/binary/crystallizer/ui_act(action, params) - . = ..() - if(.) - return - switch(action) - if("power") - on = !on - investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) - . = TRUE - if("recipe") - selected_recipe = null - var/recipe_name = "nothing" - var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[params["mode"]] - if(internal.total_moles()) - dump_gases() - quality_loss = 0 - progress_bar = 0 - if(recipe && recipe.id != "") - selected_recipe = recipe - recipe_name = recipe.name - update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating - moles_calculations() - investigate_log("was set to recipe [recipe_name ? recipe_name : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS) - . = TRUE - if("gas_input") - var/_gas_input = params["gas_input"] - gas_input = clamp(_gas_input, 0, 250) - update_icon() - -#undef MIN_PROGRESS_AMOUNT -#undef MIN_DEVIATION_RATE -#undef MAX_DEVIATION_RATE -#undef HIGH_CONDUCTIVITY_RATIO diff --git a/code/modules/atmospherics/machinery/components/tank.dm b/code/modules/atmospherics/machinery/components/tank.dm deleted file mode 100644 index 51bb68b9489c4..0000000000000 --- a/code/modules/atmospherics/machinery/components/tank.dm +++ /dev/null @@ -1,553 +0,0 @@ -/obj/machinery/atmospherics/components/tank - icon = 'icons/obj/atmospherics/stationary_canisters.dmi' - icon_state = "smooth" - - name = "pressure tank" - desc = "A large vessel containing pressurized gas." - - max_integrity = 800 - integrity_failure = 0.2 - density = TRUE - layer = ABOVE_WINDOW_LAYER - - custom_materials = list(/datum/material/iron = 20000) // plasteel is not a material to prevent two bugs: one where the default pressure is 1.5 times higher as plasteel's material modifier is added, and a second one where the tank names could be "plasteel plasteel" tanks - material_flags = MATERIAL_EFFECTS | MATERIAL_GREYSCALE | MATERIAL_ADD_PREFIX | MATERIAL_AFFECT_STATISTICS - - pipe_flags = PIPING_ONE_PER_TURF - device_type = QUATERNARY - initialize_directions = NONE - custom_reconcilation = TRUE - - smoothing_flags = SMOOTH_CORNERS | SMOOTH_OBJ - smoothing_groups = list(SMOOTH_GROUP_GAS_TANK) - canSmoothWith = list(SMOOTH_GROUP_GAS_TANK) - appearance_flags = KEEP_TOGETHER - - greyscale_config = /datum/greyscale_config/stationary_canister - greyscale_colors = "#ffffff" - - ///The image showing the gases inside of the tank - var/image/window - - /// The volume of the gas mixture - var/volume = 2500 //in liters - /// The max pressure of the gas mixture before damaging the tank - var/max_pressure = 20000 - /// The typepath of the gas this tank should be filled with. - var/gas_type = null - - ///Reference to the gas mix inside the tank - var/datum/gas_mixture/air_contents - - /// The sounds that play when the tank is breaking from overpressure - var/static/list/breaking_sounds = list( - 'sound/effects/structure_stress/pop1.ogg', - 'sound/effects/structure_stress/pop2.ogg', - 'sound/effects/structure_stress/pop3.ogg', - ) - - /// Shared images for the knob overlay representing a side of the tank that is open to connections - var/static/list/knob_overlays - - /// Number of crack states to fill the list with. This exists because I'm lazy and didn't want to keeping adding more things manually to the below list. - var/crack_states_count = 10 - /// The icon states for the cracks in the tank dmi - var/static/list/crack_states - - /// The merger id used to create/get the merger group in charge of handling tanks that share an internal gas storage - var/merger_id = "stationary_tanks" - /// The typecache of types which are allowed to merge internal storage - var/static/list/merger_typecache - -/obj/machinery/atmospherics/components/tank/Initialize(mapload) - . = ..() - - if(!knob_overlays) - knob_overlays = list() - for(var/dir in GLOB.cardinals) - knob_overlays["[dir]"] = image('icons/obj/atmospherics/stationary_canisters.dmi', icon_state = "knob", dir = dir, layer = FLOAT_LAYER) - - if(!crack_states) - crack_states = list() - for(var/i in 1 to crack_states_count) - crack_states += "crack[i]" - - if(!merger_typecache) - merger_typecache = typecacheof(/obj/machinery/atmospherics/components/tank) - - AddComponent(/datum/component/gas_leaker, leak_rate = 0.05) - AddElement(/datum/element/volatile_gas_storage) - AddElement(/datum/element/crackable, 'icons/obj/atmospherics/stationary_canisters.dmi', crack_states) - - RegisterSignal(src, COMSIG_MERGER_ADDING, .proc/merger_adding) - RegisterSignal(src, COMSIG_MERGER_REMOVING, .proc/merger_removing) - RegisterSignal(src, COMSIG_ATOM_SMOOTHED_ICON, .proc/smoothed) - - air_contents = new - air_contents.temperature = T20C - air_contents.volume = volume - refresh_pressure_limit() - - if(gas_type) - fill_to_pressure(gas_type) - - QUEUE_SMOOTH(src) - QUEUE_SMOOTH_NEIGHBORS(src) - - // Mapped in tanks should automatically connect to adjacent pipenets in the direction set in dir - if(mapload) - initialize_directions = dir - - return INITIALIZE_HINT_LATELOAD - -// We late initialize here so all stationary tanks have time to set up their -// initial gas mixes and signal registrations. -/obj/machinery/atmospherics/components/tank/LateInitialize() - . = ..() - GetMergeGroup(merger_id, merger_typecache) - -/obj/machinery/atmospherics/components/tank/Destroy() - QUEUE_SMOOTH_NEIGHBORS(src) - return ..() - -/obj/machinery/atmospherics/components/tank/examine(mob/user, thats) - . = ..() - var/wrench_hint = EXAMINE_HINT("wrench") - if(!initialize_directions) - . += span_notice("A pipe port can be opened with a [wrench_hint].") - else - . += span_notice("The pipe port can be moved or closed with a [wrench_hint].") - . += span_notice("A holographic sticker on it says that its maximum safe pressure is: [siunit_pressure(max_pressure, 0)].") - -/obj/machinery/atmospherics/components/tank/set_custom_materials(list/materials, multiplier) - . = ..() - refresh_pressure_limit() - -/// Recalculates pressure based on the current max integrity compared to original -/obj/machinery/atmospherics/components/tank/proc/refresh_pressure_limit() - var/max_pressure_multiplier = max_integrity / initial(max_integrity) - max_pressure = max_pressure_multiplier * initial(max_pressure) - -/// Fills the tank to the maximum safe pressure. -/// Safety margin is a multiplier for the cap for the purpose of this proc so it doesn't have to be filled completely. -/obj/machinery/atmospherics/components/tank/proc/fill_to_pressure(gastype, safety_margin = 0.5) - var/pressure_limit = max_pressure * safety_margin - - var/moles_to_add = (pressure_limit * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature) - air_contents.assert_gas(gastype) - air_contents.gases[gastype][MOLES] += moles_to_add - air_contents.archive() - -/obj/machinery/atmospherics/components/tank/process_atmos() - if(air_contents.react(src)) - update_parents() - - if(air_contents.return_pressure() > max_pressure) - take_damage(0.1, BRUTE, sound_effect = FALSE) - if(prob(40)) - playsound(src, pick(breaking_sounds), 30, vary = TRUE) - - refresh_window() - -/////////////////////////////////////////////////////////////////// -// Pipenet stuff - -/obj/machinery/atmospherics/components/tank/return_analyzable_air() - return air_contents - -/obj/machinery/atmospherics/components/tank/return_airs_for_reconcilation(datum/pipeline/requester) - . = ..() - if(!air_contents) - return - . += air_contents - -/obj/machinery/atmospherics/components/tank/return_pipenets_for_reconcilation(datum/pipeline/requester) - . = ..() - var/datum/merger/merge_group = GetMergeGroup(merger_id, merger_typecache) - for(var/obj/machinery/atmospherics/components/tank/tank as anything in merge_group.members) - . += tank.parents - -/obj/machinery/atmospherics/components/tank/proc/toggle_side_port(new_dir) - if(initialize_directions & new_dir) - initialize_directions &= ~new_dir - else - initialize_directions |= new_dir - - for(var/i in 1 to length(nodes)) - var/obj/machinery/atmospherics/components/node = nodes[i] - if(!node) - continue - if(src in node.nodes) - node.disconnect(src) - nodes[i] = null - if(parents[i]) - nullify_pipenet(parents[i]) - - atmos_init() - - for(var/obj/machinery/atmospherics/components/node as anything in nodes) - if(!node) - continue - node.atmos_init() - node.add_member(src) - SSair.add_to_rebuild_queue(src) - - update_parents() - -/////////////////////////////////////////////////////////////////// -// Merger handling - -/obj/machinery/atmospherics/components/tank/proc/merger_adding(obj/machinery/atmospherics/components/tank/us, datum/merger/new_merger) - SIGNAL_HANDLER - if(new_merger.id != merger_id) - return - RegisterSignal(new_merger, COMSIG_MERGER_REFRESH_COMPLETE, .proc/merger_refresh_complete) - -/obj/machinery/atmospherics/components/tank/proc/merger_removing(obj/machinery/atmospherics/components/tank/us, datum/merger/old_merger) - SIGNAL_HANDLER - if(old_merger.id != merger_id) - return - UnregisterSignal(old_merger, COMSIG_MERGER_REFRESH_COMPLETE) - -/// Handles the combined gas tank for the entire merger group, only the origin tank actualy runs this. -/obj/machinery/atmospherics/components/tank/proc/merger_refresh_complete(datum/merger/merger, list/leaving_members, list/joining_members) - SIGNAL_HANDLER - if(merger.origin != src) - return - var/shares = length(merger.members) + length(leaving_members) - length(joining_members) - for(var/obj/machinery/atmospherics/components/tank/leaver as anything in leaving_members) - var/datum/gas_mixture/gas_share = air_contents.remove_ratio(1 / shares--) - air_contents.volume -= leaver.volume - leaver.air_contents = gas_share - leaver.update_appearance() - - for(var/obj/machinery/atmospherics/components/tank/joiner as anything in joining_members) - if(joiner == src) - continue - var/datum/gas_mixture/joiner_share = joiner.air_contents - if(joiner_share) - air_contents.merge(joiner_share) - joiner.air_contents = air_contents - air_contents.volume += joiner.volume - joiner.update_appearance() - - for(var/dir in GLOB.cardinals) - if(dir & initialize_directions & merger.members[src]) - toggle_side_port(dir) - -/////////////////////////////////////////////////////////////////// -// Appearance stuff - -/obj/machinery/atmospherics/components/tank/proc/smoothed() - SIGNAL_HANDLER - refresh_window() - -/obj/machinery/atmospherics/components/tank/update_appearance() - . = ..() - refresh_window() - -/obj/machinery/atmospherics/components/tank/update_overlays() - . = ..() - if(!initialize_directions) - return - for(var/dir in GLOB.cardinals) - if(initialize_directions & dir) - . += knob_overlays["[dir]"] - -/obj/machinery/atmospherics/components/tank/update_greyscale() - . = ..() - refresh_window() - -/obj/machinery/atmospherics/components/tank/proc/refresh_window() - cut_overlay(window) - - if(!air_contents) - window = null - return - - window = image(icon, icon_state = "window-bg", layer = FLOAT_LAYER) - - var/list/new_underlays = list() - for(var/obj/effect/overlay/gas/gas as anything in air_contents.return_visuals()) - var/image/new_underlay = image(gas.icon, icon_state = gas.icon_state, layer = FLOAT_LAYER) - new_underlay.filters = alpha_mask_filter(icon = icon(icon, icon_state = "window-bg")) - new_underlays += new_underlay - - var/image/foreground = image(icon, icon_state = "window-fg", layer = FLOAT_LAYER) - foreground.underlays = new_underlays - window.overlays = list(foreground) - - add_overlay(window) - -/////////////////////////////////////////////////////////////////// -// Tool interactions - -/obj/machinery/atmospherics/components/tank/wrench_act(mob/living/user, obj/item/item) - . = TRUE - var/new_dir = get_dir(src, user) - - if(new_dir in GLOB.diagonals) - return - - item.play_tool_sound(src, 10) - if(!item.use_tool(src, user, 3 SECONDS)) - return - - toggle_side_port(new_dir) - - item.play_tool_sound(src, 50) - -/obj/machinery/atmospherics/components/tank/welder_act(mob/living/user, obj/item/tool) - . = ..() - . = TRUE - if(atom_integrity >= max_integrity) - return - if(!tool.tool_start_check(user, amount = 0)) - return - to_chat(user, span_notice("You begin to repair the cracks in the gas tank...")) - var/repair_amount = max_integrity / 10 - do - if(!tool.use_tool(src, user, 2.5 SECONDS, volume = 40)) - return - while(repair_damage(repair_amount)) - to_chat(user, span_notice("The gas tank has been fully repaired and all cracks sealed.")) - -/obj/machinery/atmospherics/components/tank/welder_act_secondary(mob/living/user, obj/item/tool) - . = ..() - . = TRUE - to_chat(user, span_notice("You begin cutting open the gas tank...")) - var/turf/current_location = get_turf(src) - var/datum/gas_mixture/airmix = current_location.return_air() - - var/time_taken = 4 SECONDS - - if(air_contents.return_pressure() > airmix.return_pressure()) - time_taken *= 2 - to_chat(user, span_warning("The tank seems to be pressurized, are you sure this is a good idea?")) - - if(!tool.use_tool(src, user, time_taken, volume = 60)) - return - - deconstruct(disassembled=TRUE) - to_chat(user, span_notice("You finish cutting open the sealed gas tank, revealing the innards.")) - -/obj/machinery/atmospherics/components/tank/deconstruct(disassembled) - var/turf/location = drop_location() - . = ..() - if(!disassembled) - return - var/obj/structure/tank_frame/frame = new(location) - frame.construction_state = TANK_PLATING_UNSECURED - frame.material_end_product = custom_materials[2].type - frame.update_appearance() - -/////////////////////////////////////////////////////////////////// -// Gas tank variants - -/obj/machinery/atmospherics/components/tank/air - name = "pressure tank (Air)" - -/obj/machinery/atmospherics/components/tank/air/Initialize(mapload) - . = ..() - fill_to_pressure(/datum/gas/oxygen, safety_margin = (O2STANDARD * 0.5)) - fill_to_pressure(/datum/gas/nitrogen, safety_margin = (N2STANDARD * 0.5)) - -/obj/machinery/atmospherics/components/tank/carbon_dioxide - gas_type = /datum/gas/carbon_dioxide - -/obj/machinery/atmospherics/components/tank/plasma - gas_type = /datum/gas/plasma - -/obj/machinery/atmospherics/components/tank/nitrogen - gas_type = /datum/gas/nitrogen - -/obj/machinery/atmospherics/components/tank/oxygen - gas_type = /datum/gas/oxygen - -/obj/machinery/atmospherics/components/tank/nitrous - gas_type = /datum/gas/nitrous_oxide - -/obj/machinery/atmospherics/components/tank/bz - gas_type = /datum/gas/bz - -/obj/machinery/atmospherics/components/tank/freon - gas_type = /datum/gas/freon - -/obj/machinery/atmospherics/components/tank/halon - gas_type = /datum/gas/halon - -/obj/machinery/atmospherics/components/tank/healium - gas_type = /datum/gas/healium - -/obj/machinery/atmospherics/components/tank/hydrogen - gas_type = /datum/gas/hydrogen - -/obj/machinery/atmospherics/components/tank/hypernoblium - gas_type = /datum/gas/hypernoblium - -/obj/machinery/atmospherics/components/tank/miasma - gas_type = /datum/gas/miasma - -/obj/machinery/atmospherics/components/tank/nitryl - gas_type = /datum/gas/nitryl - -/obj/machinery/atmospherics/components/tank/pluoxium - gas_type = /datum/gas/pluoxium - -/obj/machinery/atmospherics/components/tank/proto_nitrate - gas_type = /datum/gas/proto_nitrate - -/obj/machinery/atmospherics/components/tank/stimulum - gas_type = /datum/gas/stimulum - -/obj/machinery/atmospherics/components/tank/tritium - gas_type = /datum/gas/tritium - -/obj/machinery/atmospherics/components/tank/water_vapor - gas_type = /datum/gas/water_vapor - -/obj/machinery/atmospherics/components/tank/zauker - gas_type = /datum/gas/zauker - -/obj/machinery/atmospherics/components/tank/helium - gas_type = /datum/gas/helium - -/obj/machinery/atmospherics/components/tank/antinoblium - gas_type = /datum/gas/antinoblium - -/////////////////////////////////////////////////////////////////// -// Tank Frame Structure - -/obj/structure/tank_frame - icon = 'icons/obj/atmospherics/stationary_canisters.dmi' - icon_state = "frame" - anchored = FALSE - density = TRUE - custom_materials = list(/datum/material/alloy/plasteel = 4000) - var/construction_state = TANK_FRAME - var/datum/material/material_end_product - -/obj/structure/tank_frame/examine(mob/user) - . = ..() - var/wrenched_hint = EXAMINE_HINT("wrenched") - - if(!anchored) - . += span_notice("[src] has not been [wrenched_hint] to the floor yet.") - else - . += span_notice("[src] is [wrenched_hint] to the floor.") - - switch(construction_state) - if(TANK_FRAME) - var/screwed_hint = EXAMINE_HINT("screwed") - var/plating_hint = EXAMINE_HINT("metal plating") - . += span_notice("[src] is [screwed_hint] together and now just needs some [plating_hint].") - if(TANK_PLATING_UNSECURED) - var/crowbar_hint = EXAMINE_HINT("crowbar") - var/welder_hint = EXAMINE_HINT("welder") - . += span_notice("The plating has been firmly attached and would need a [crowbar_hint] to detach, but still needs to be sealed by a [welder_hint].") - -/obj/structure/tank_frame/deconstruct(disassembled) - if(disassembled) - for(var/datum/material/mat as anything in custom_materials) - new mat.sheet_type(drop_location()) - return ..() - -/obj/structure/tank_frame/update_icon(updates) - . = ..() - switch(construction_state) - if(TANK_FRAME) - icon_state = "frame" - if(TANK_PLATING_UNSECURED) - icon_state = "plated_frame" - -/obj/structure/tank_frame/attackby(obj/item/item, mob/living/user, params) - if(construction_state == TANK_FRAME && istype(item, /obj/item/stack) && add_plating(user, item)) - return - return ..() - -/obj/structure/tank_frame/wrench_act(mob/living/user, obj/item/tool) - . = ..() - return default_unfasten_wrench(user, tool, 0.5 SECONDS) - -/obj/structure/tank_frame/screwdriver_act_secondary(mob/living/user, obj/item/tool) - . = ..() - if(construction_state != TANK_FRAME) - return - . = TRUE - to_chat(user, span_notice("You begin taking apart [src].")) - if(!tool.use_tool(src, user, 1 SECONDS)) - return - deconstruct(TRUE) - to_chat(user, span_notice("[src] has been taken apart.")) - -/obj/structure/tank_frame/proc/add_plating(mob/living/user, obj/item/stack/stack) - . = FALSE - var/datum/material/stack_mat = GET_MATERIAL_REF(stack.material_type) - if(!(MAT_CATEGORY_RIGID in stack_mat.categories)) - to_chat(user, span_notice("This material doesn't seem rigid enough to hold the shape of a tank...")) - return - - . = TRUE - to_chat(user, span_notice("You begin adding [stack] to [src]...")) - if(!stack.use_tool(src, user, 3 SECONDS)) - return - if(!stack.use(20)) - var/amount_more - switch(stack.amount) - if(0) // Wat? - amount_more = "any at all" - if(1 to 4) - amount_more = "a lot more" - if(5 to 9) - amount_more = "about four times as much" - if(10 to 15) - amount_more = "about twice as much" - if(16 to 20) - amount_more = "just a bit more" - else - amount_more = "an indeterminate amount more" - to_chat(user, span_notice("You don't have enough [stack] to add all the plating. Maybe [amount_more].")) - return - - material_end_product = stack_mat - construction_state = TANK_PLATING_UNSECURED - update_appearance() - to_chat(user, span_notice("You finish attaching [stack] to [src].")) - -/obj/structure/tank_frame/crowbar_act_secondary(mob/living/user, obj/item/tool) - . = ..() - if(construction_state != TANK_PLATING_UNSECURED) - return - . = TRUE - to_chat(user, span_notice("You start prying off the outer plating...")) - if(!tool.use_tool(src, user, 2 SECONDS)) - return - construction_state = TANK_FRAME - new material_end_product.sheet_type(drop_location(), 20) - material_end_product = null - update_appearance() - -/obj/structure/tank_frame/welder_act(mob/living/user, obj/item/tool) - . = ..() - if(construction_state != TANK_PLATING_UNSECURED) - return - . = TRUE - if(!anchored) - to_chat(user, span_notice("You need to wrench [src] to the floor before finishing.")) - return - if(!tool.tool_start_check(user, amount = 0)) - return - to_chat(user, span_notice("You begin sealing the outer plating with the welder...")) - if(!tool.use_tool(src, user, 2 SECONDS, volume = 60)) - return - - var/turf/build_location = drop_location() - if(!isturf(build_location)) - return - var/obj/machinery/atmospherics/components/tank/new_tank = new(build_location) - var/list/new_custom_materials = list() - new_custom_materials[material_end_product] = 20000 - new_tank.set_custom_materials(new_custom_materials) - new_tank.on_construction(new_tank.pipe_color, new_tank.piping_layer) - to_chat(user, span_notice("[new_tank] has been sealed and is ready to accept gases.")) - qdel(src) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index ade69b0de301c..f703a90024ddd 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -6,18 +6,15 @@ desc = "Very useful for filtering gasses." can_unwrench = TRUE - construction_type = /obj/item/pipe/trinary/flippable - pipe_state = "filter" - - ///Rate of transfer of the gases to the outputs var/transfer_rate = MAX_TRANSFER_RATE - ///What gas are we filtering var/filter_type = null - ///Frequency id for connecting to the NTNet var/frequency = 0 - ///Reference to the radio datum var/datum/radio_frequency/radio_connection + construction_type = /obj/item/pipe/trinary/flippable + pipe_state = "filter" + + /obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user) if(can_interact(user)) on = !on @@ -50,7 +47,15 @@ continue var/obj/machinery/atmospherics/node = find_connecting(direction) - . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE) + var/image/cap + if(node) + cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) + else + cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) + + add_overlay(cap) + + return ..() /obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes() var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index e8c0f05e0e77b..ae1e1c63d25f8 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -6,15 +6,17 @@ desc = "Very useful for mixing gasses." can_unwrench = TRUE - construction_type = /obj/item/pipe/trinary/flippable - pipe_state = "mixer" - ///Output pressure target var/target_pressure = ONE_ATMOSPHERE - ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1 var/node1_concentration = 0.5 - ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1 var/node2_concentration = 0.5 + + construction_type = /obj/item/pipe/trinary/flippable + pipe_state = "mixer" + + + + //node 3 is the outlet, nodes 1 & 2 are intakes /obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user) @@ -39,7 +41,15 @@ continue var/obj/machinery/atmospherics/node = find_connecting(direction) - . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE) + var/image/cap + if(node) + cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) + else + cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) + + add_overlay(cap) + + return ..() /obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes() var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm index 35afd91778fec..d96b7244eb47d 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm @@ -7,7 +7,6 @@ layer = GAS_FILTER_LAYER pipe_flags = PIPING_ONE_PER_TURF - ///Flips the node connections so that the first and third ports are swapped var/flipped = FALSE /obj/machinery/atmospherics/components/trinary/set_init_directions() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm deleted file mode 100644 index ba88a1edc4c8d..0000000000000 --- a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm +++ /dev/null @@ -1,178 +0,0 @@ -/obj/machinery/atmospherics/components/unary/bluespace_sender - icon = 'icons/obj/atmospherics/components/bluespace_gas_selling.dmi' - icon_state = "bluespace_sender_off" - name = "Bluespace Gas Sender" - desc = "Sends gases to the bluespace network to be shared with the connected vendors, who knows what's beyond!" - - density = TRUE - max_integrity = 300 - armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30) - layer = OBJ_LAYER - circuit = /obj/item/circuitboard/machine/bluespace_sender - pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY - - ///Base icon name for updating the appearance - var/base_icon = "bluespace_sender" - ///Gas mixture containing the inserted gases and that is connected to the vendors - var/datum/gas_mixture/bluespace_network - ///Rate of gas transfer inside the network (from 0 to 1) - var/gas_transfer_rate = 0.5 - ///A base price for each and every gases, in case you don't want to change them - var/list/base_prices = list() - ///List storing all the vendors connected to the machine - var/list/vendors - ///Amount of credits gained from each vendor - var/credits_gained = 0 - -/obj/machinery/atmospherics/components/unary/bluespace_sender/Initialize(mapload) - . = ..() - initialize_directions = dir - bluespace_network = new - for(var/gas_id in GLOB.meta_gas_info) - bluespace_network.assert_gas(gas_id) - for(var/gas_id in GLOB.meta_gas_info) - var/datum/gas/gas = gas_id - base_prices[gas_id] = initial(gas.base_value) - - update_appearance() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/Destroy() - if(bluespace_network.total_moles()) - var/turf/local_turf = get_turf(src) - local_turf.assume_air(bluespace_network) - return ..() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/update_icon_state() - if(panel_open) - icon_state = "[base_icon]_open" - return ..() - if(on && is_operational) - icon_state = "[base_icon]_on" - return ..() - icon_state = "[base_icon]_off" - return ..() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/update_overlays() - . = ..() - . += get_pipe_image(icon, "pipe", dir, , piping_layer) - if(showpipe) - . += get_pipe_image(icon, "pipe", initialize_directions) - -/obj/machinery/atmospherics/components/unary/bluespace_sender/process_atmos() - if(!is_operational || !on || !nodes[1]) //if it has no power or its switched off, dont process atmos - return - - var/datum/gas_mixture/content = airs[1] - var/datum/gas_mixture/remove = content.remove_ratio(gas_transfer_rate) - bluespace_network.merge(remove) - bluespace_network.temperature = T20C - update_parents() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/attackby(obj/item/item, mob/user, params) - if(!on) - if(default_deconstruction_screwdriver(user, "[base_icon]_open", "[base_icon]_off", item)) - update_appearance() - return - if(default_change_direction_wrench(user, item)) - return - if(item.tool_behaviour == TOOL_CROWBAR && panel_open && bluespace_network.total_moles() > 0) - say("WARNING - Bluespace network can contain hazardous gases, deconstruct with caution!") - if(!do_after(user, 3 SECONDS, src)) - return - if(default_deconstruction_crowbar(item)) - return - return ..() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/default_change_direction_wrench(mob/user, obj/item/item) - if(!..()) - return FALSE - set_init_directions() - var/obj/machinery/atmospherics/node = nodes[1] - if(node) - if(src in node.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node.disconnect(src) - nodes[1] = null - if(parents[1]) - nullify_pipenet(parents[1]) - - atmos_init() - node = nodes[1] - if(node) - node.atmos_init() - node.add_member(src) - SSair.add_to_rebuild_queue(src) - return TRUE - -/obj/machinery/atmospherics/components/unary/bluespace_sender/multitool_act(mob/living/user, obj/item/item) - var/obj/item/multitool/multitool = item - multitool.buffer = src - to_chat(user, span_notice("You store linkage information in [item]'s buffer.")) - return TRUE - -/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "BluespaceSender", name) - ui.open() - -/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_data(mob/user) - var/list/data = list() - data["on"] = on - data["gas_transfer_rate"] = gas_transfer_rate - var/list/bluespace_gasdata = list() - if(bluespace_network.total_moles()) - for(var/gas_id in bluespace_network.gases) - bluespace_gasdata.Add(list(list( - "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME], - "id" = bluespace_network.gases[gas_id][GAS_META][META_GAS_ID], - "amount" = round(bluespace_network.gases[gas_id][MOLES], 0.01), - "price" = base_prices[gas_id], - ))) - else - for(var/gas_id in bluespace_network.gases) - bluespace_gasdata.Add(list(list( - "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME], - "id" = "", - "amount" = 0, - "price" = 0, - ))) - data["bluespace_network_gases"] = bluespace_gasdata - var/list/vendors_list = list() - if(vendors) - for(var/obj/machinery/bluespace_vendor/vendor in vendors) - vendors_list.Add(list(list( - "name" = vendor.name, - "area" = get_area(vendor), - ))) - data["vendors_list"] = vendors_list - data["credits"] = credits_gained - return data - -/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_act(action, params) - . = ..() - if(.) - return - - switch(action) - if("power") - on = !on - investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) - update_appearance() - . = TRUE - - if("rate") - gas_transfer_rate = clamp(params["rate"], 0, 1) - . = TRUE - - if("price") - var/gas_type = gas_id2path(params["gas_type"]) - base_prices[gas_type] = clamp(params["gas_price"], 0, 100) - . = TRUE - - if("retrieve") - if(bluespace_network.total_moles() > 0) - var/datum/gas_mixture/remove = bluespace_network.remove(bluespace_network.total_moles()) - airs[1].merge(remove) - update_parents() - bluespace_network.garbage_collect() - . = TRUE diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 131a77a7be70d..da1af112e4539 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -473,9 +473,7 @@ if(node) node.disconnect(src) nodes[1] = null - if(parents[1]) - nullify_pipenet(parents[1]) - + nullifyPipenet(parents[1]) atmos_init() node = nodes[1] if(node) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index 3e74715fb3399..5068730358e5d 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -44,9 +44,10 @@ target.partner_ref = WEAKREF(src) break - . = ..() + ..() /obj/machinery/atmospherics/components/unary/heat_exchanger/process_atmos() + ..() var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = partner_ref?.resolve() if(!partner) partner_ref = null @@ -68,14 +69,14 @@ var/other_old_temperature = partner_air_contents.return_temperature() if(combined_heat_capacity > 0) - var/combined_energy = partnerair_contents.temperature * other_air_heat_capacity + air_heat_capacity * air_contents.temperature + var/combined_energy = partner_air_contents.return_temperature()*other_air_heat_capacity + air_heat_capacity*air_contents.return_temperature() - var/new_temperature = combined_energy / combined_heat_capacity - air_contents.temperature = new_temperature - partnerair_contents.temperature = new_temperature + var/new_temperature = combined_energy/combined_heat_capacity + air_contents.temperature = (new_temperature) + partner_air_contents.temperature = (new_temperature) - if(abs(old_temperature - air_contents.temperature) > 1) + if(abs(old_temperature-air_contents.return_temperature()) > 1) update_parents() - if(abs(other_old_temperature - partnerair_contents.temperature) > 1) + if(abs(other_old_temperature-partner_air_contents.return_temperature()) > 1) partner.update_parents() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 712876b51c992..b17de0ebc83b1 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -8,18 +8,15 @@ can_unwrench = TRUE shift_underlay_only = FALSE hide = TRUE - layer = GAS_SCRUBBER_LAYER - pipe_state = "injector" + resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs - ///Variable used for radio frequency injection - var/injecting = FALSE - ///Rate of operation of the device + var/injecting = 0 + var/volume_rate = 50 - ///Frequency id for connecting to the NTNet var/frequency = 0 - ///Reference to the radio datum + var/id = null var/datum/radio_frequency/radio_connection interacts_with_air = TRUE @@ -53,7 +50,7 @@ cut_overlays() if(showpipe) // everything is already shifted so don't shift the cap - add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions, pipe_color)) + add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions)) if(!nodes[1] || !on || !is_operational) icon_state = "inje_off" diff --git a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm index 3853d3f46e2c3..a07c6b078d8a9 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm @@ -15,7 +15,7 @@ /obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions, pipe_color) + var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions) add_overlay(cap) icon_state = "passive_vent" diff --git a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm index 5241577d7ab9d..3a49035d50cc9 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm @@ -14,13 +14,12 @@ pipe_flags = PIPING_ONE_PER_TURF pipe_state = "connector" - ///Reference to the connected device var/obj/machinery/portable_atmospherics/connected_device var/obj/machinery/atmospherics/components/unary/portables_connector/connect_to /obj/machinery/atmospherics/components/unary/portables_connector/New() - . = ..() + ..() var/datum/gas_mixture/air_contents = airs[1] air_contents.volume = 0 @@ -32,8 +31,7 @@ /obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes() icon_state = "connector" if(showpipe) - cut_overlays() - var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions, pipe_color) + var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions) add_overlay(cap) /obj/machinery/atmospherics/components/unary/portables_connector/process_atmos() @@ -41,12 +39,6 @@ return update_parents() -/obj/machinery/atmospherics/components/unary/portables_connector/return_airs_for_reconcilation(datum/pipeline/requester) - . = ..() - if(!connected_device) - return - . += connected_device.return_air() - /obj/machinery/atmospherics/components/unary/portables_connector/can_unwrench(mob/user) . = ..() if(. && connected_device) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm index 51c5ef23f1157..b2956b70067ba 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm @@ -5,9 +5,7 @@ device_type = UNARY pipe_flags = PIPING_ONE_PER_TURF construction_type = /obj/item/pipe/directional - ///Unique id of the device var/uid - ///Increases to prevent duplicated Ids var/static/gl_uid = 1 FASTDMM_PROP(\ pipe_type = PIPE_TYPE_NODE,\ diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index 8d3efbeebeac5..c32fd4d7cafa3 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -21,27 +21,22 @@ interacts_with_air = TRUE - ///Direction of pumping the gas (RELEASING or SIPHONING) var/pump_direction = RELEASING - ///Should we check internal pressure, external pressure, both or none? (EXT_BOUND, INT_BOUND, NO_BOUND) + var/pressure_checks = EXT_BOUND - ///The external pressure threshold (default 101 kPa) var/external_pressure_bound = ONE_ATMOSPHERE - ///The internal pressure threshold (default 0 kPa) var/internal_pressure_bound = 0 // EXT_BOUND: Do not pass external_pressure_bound // INT_BOUND: Do not pass internal_pressure_bound // NO_BOUND: Do not pass either - ///Frequency id for connecting to the NTNet var/frequency = FREQ_ATMOS_CONTROL - ///Reference to the radio datum var/datum/radio_frequency/radio_connection - ///Radio connection to the air alarm var/radio_filter_out - ///Radio connection from the air alarm var/radio_filter_in + var/obj/machinery/advanced_airlock_controller/aac = null + /obj/machinery/atmospherics/components/unary/vent_pump/New() if(!id_tag) id_tag = id_tag = SSnetworks.assign_random_name() @@ -122,9 +117,8 @@ pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound)) if(pressure_delta > 0) - if(air_contents.temperature > 0) - var/transfer_moles = (pressure_delta * environment.volume) / (air_contents.temperature * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + if(air_contents.return_temperature() > 0 && air_contents.return_volume() > 0) + var/transfer_moles = (pressure_delta*environment.return_volume())/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION) loc.assume_air_moles(air_contents, transfer_moles) air_update_turf(FALSE, FALSE) @@ -258,12 +252,11 @@ broadcast_status() update_icon() -/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/welder) - ..() - if(!welder.tool_start_check(user, amount=0)) +/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I) + if(!I.tool_start_check(user, amount=0)) return TRUE - to_chat(user, span_notice("You begin welding the vent...")) - if(welder.use_tool(src, user, 20, volume=50)) + to_chat(user, "You begin welding the vent...") + if(I.use_tool(src, user, 20, volume=50)) if(!welded) user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.") welded = TRUE diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 958561010087c..d9ac9e9dd75a9 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -31,26 +31,6 @@ pipe_state = "scrubber" - ///The mode of the scrubber (SCRUBBING or SIPHONING) - var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing - ///The list of gases we are filtering - var/filter_types = list(/datum/gas/carbon_dioxide) - ///Rate of the scrubber to remove gases from the air - var/volume_rate = 200 - ///is this scrubber acting on the 3x3 area around it. - var/widenet = FALSE - ///List of the turfs near the scrubber, used for widenet - var/list/turf/adjacent_turfs = list() - - ///Frequency id for connecting to the NTNet - var/frequency = FREQ_ATMOS_CONTROL - ///Reference to the radio datum - var/datum/radio_frequency/radio_connection - ///Radio connection to the air alarm - var/radio_filter_out - ///Radio connection from the air alarm - var/radio_filter_in - /obj/machinery/atmospherics/components/unary/vent_scrubber/New() if(!id_tag) id_tag = SSnetworks.assign_random_name() @@ -142,19 +122,14 @@ return TRUE -/obj/machinery/atmospherics/components/unary/vent_scrubber/update_name() - . = ..() - var/area/scrub_area = get_area(src) - name = "\proper [scrub_area.name] [name] [id_tag]" - /obj/machinery/atmospherics/components/unary/vent_scrubber/atmos_init() - radio_filter_in = frequency == initial(frequency) ? RADIO_FROM_AIRALARM : null - radio_filter_out = frequency == initial(frequency) ? RADIO_TO_AIRALARM : null + radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null + radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null if(frequency) set_frequency(frequency) broadcast_status() check_turfs() - . = ..() + ..() /obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos() ..() @@ -201,8 +176,9 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/check_turfs() adjacent_turfs.Cut() - var/turf/local_turf = get_turf(src) - adjacent_turfs = local_turf.get_atmos_adjacent_turfs(alldir = TRUE) + var/turf/T = get_turf(src) + if(istype(T)) + adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1) /obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal) if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) @@ -252,12 +228,11 @@ . = ..() update_icon_nopipes() -/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/welder) - ..() - if(!welder.tool_start_check(user, amount=0)) +/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/I) + if(!I.tool_start_check(user, amount=0)) return TRUE - to_chat(user, ("Now welding the scrubber.")) - if(welder.use_tool(src, user, 20, volume=50)) + to_chat(user, "Now welding the scrubber.") + if(I.use_tool(src, user, 20, volume=50)) if(!welded) user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.") welded = TRUE diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 47730e1a1460b..0eee42ffbc314 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -28,7 +28,7 @@ continue SSair.add_to_rebuild_queue(considered_pipe) for(var/obj/machinery/atmospherics/components/considered_component in other_atmos_machines) - considered_component.nullify_pipenet(src) + considered_component.nullifyPipenet(src) return ..() /datum/pipeline/process() @@ -121,7 +121,7 @@ /datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component) other_atmos_machines |= considered_component - var/list/returned_airs = considered_component.return_pipenet_airs(src) + var/list/returned_airs = considered_component.return_pipenetAirs(src) if (!length(returned_airs) || (null in returned_airs)) stack_trace("add_machinery_member: Nonexistent (empty list) or null machinery gasmix added to pipeline datum from [considered_component] \ which is of type [considered_component.type]. Nearby: ([considered_component.x], [considered_component.y], [considered_component.z])") @@ -256,11 +256,16 @@ continue gas_mixture_list += pipeline.other_airs gas_mixture_list += pipeline.air - for(var/obj/machinery/atmospherics/components/atmos_machine as anything in pipeline.other_atmos_machines) - if(!atmos_machine.custom_reconcilation) - continue - pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src) - gas_mixture_list |= atmos_machine.return_airs_for_reconcilation(src) + for(var/atmosmch in pipeline.other_atmos_machines) + if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve)) + var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch + if(considered_valve.on) + pipeline_list |= considered_valve.parents[1] + pipeline_list |= considered_valve.parents[2] + else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector)) + var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch + if(considered_connector.connected_device) + gas_mixture_list += considered_connector.connected_device.return_air() var/total_thermal_energy = 0 var/total_heat_capacity = 0 diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 077d373bbe733..9781ad4a96a64 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -68,16 +68,16 @@ return 0 var/env_pressure = environment.return_pressure() - if(env_pressure <= 0.15 * ONE_ATMOSPHERE) + if(env_pressure <= 0.15*ONE_ATMOSPHERE) icon_state = "meter0" - else if(env_pressure <= 1.8 * ONE_ATMOSPHERE) - var/val = round(env_pressure / (ONE_ATMOSPHERE * 0.3) + 0.5) + else if(env_pressure <= 1.8*ONE_ATMOSPHERE) + var/val = round(env_pressure/(ONE_ATMOSPHERE*0.3) + 0.5) icon_state = "meter1_[val]" - else if(env_pressure <= 30 * ONE_ATMOSPHERE) - var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 0.35) + 1 + else if(env_pressure <= 30*ONE_ATMOSPHERE) + var/val = round(env_pressure/(ONE_ATMOSPHERE*5)-0.35) + 1 icon_state = "meter2_[val]" - else if(env_pressure <= 59 * ONE_ATMOSPHERE) - var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 6) + 1 + else if(env_pressure <= 59*ONE_ATMOSPHERE) + var/val = round(env_pressure/(ONE_ATMOSPHERE*5) - 6) + 1 icon_state = "meter3_[val]" else icon_state = "meter4" @@ -110,10 +110,9 @@ . = ..() . += status() -/obj/machinery/meter/wrench_act(mob/user, obj/item/wrench) - ..() - to_chat(user, ("You begin to unfasten \the [src]...")) - if (wrench.use_tool(src, user, 40, volume=50)) +/obj/machinery/meter/wrench_act(mob/user, obj/item/I) + to_chat(user, "You begin to unfasten \the [src]...") + if (I.use_tool(src, user, 40, volume=50)) user.visible_message( "[user] unfastens \the [src].", "You unfasten \the [src].", diff --git a/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm b/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm deleted file mode 100644 index d4adfdb0d3a3d..0000000000000 --- a/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm +++ /dev/null @@ -1,29 +0,0 @@ -/obj/machinery/atmospherics/pipe/bridge_pipe - icon = 'icons/obj/atmospherics/pipes/bridge_pipe.dmi' - icon_state = "bridge_center" - - name = "bridge pipe" - desc = "A one meter section of regular pipe used to connect pipenets over pipes." - - dir = SOUTH - initialize_directions = NORTH | SOUTH - pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_BRIDGE - device_type = BINARY - - construction_type = /obj/item/pipe/binary - pipe_state = "bridge_center" - -/obj/machinery/atmospherics/pipe/bridge_pipe/set_init_directions() - switch(dir) - if(NORTH, SOUTH) - initialize_directions = SOUTH|NORTH - if(EAST, WEST) - initialize_directions = EAST|WEST - -/obj/machinery/atmospherics/pipe/bridge_pipe/update_overlays() - . = ..() - var/mutable_appearance/center = mutable_appearance('icons/obj/atmospherics/pipes/bridge_pipe.dmi', "bridge_center") - PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - . += center - - layer = HIGH_PIPE_LAYER //to stay above all sorts of pipes diff --git a/code/modules/atmospherics/machinery/pipes/color_adapter.dm b/code/modules/atmospherics/machinery/pipes/color_adapter.dm deleted file mode 100644 index 2468b3f943e3f..0000000000000 --- a/code/modules/atmospherics/machinery/pipes/color_adapter.dm +++ /dev/null @@ -1,63 +0,0 @@ -/obj/machinery/atmospherics/pipe/color_adapter - icon = 'icons/obj/atmospherics/pipes/color_adapter.dmi' - icon_state = "adapter_map-3" - - name = "color adapter" - desc = "A one meter section of regular pipe used to connect different colored pipes." - - dir = SOUTH - initialize_directions = NORTH | SOUTH - pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_ALL_COLORS | PIPING_BRIDGE - device_type = BINARY - - construction_type = /obj/item/pipe/binary - pipe_state = "adapter_center" - - paintable = FALSE - hide = FALSE - - ///cache for the icons - var/static/list/mutable_appearance/center_cache = list() - -/obj/machinery/atmospherics/pipe/color_adapter/Initialize(mapload) - icon_state = "" - . = ..() - -/obj/machinery/atmospherics/pipe/color_adapter/set_init_directions() - switch(dir) - if(NORTH, SOUTH) - initialize_directions = SOUTH|NORTH - if(EAST, WEST) - initialize_directions = EAST|WEST - -/obj/machinery/atmospherics/pipe/color_adapter/update_overlays() - . = ..() - var/mutable_appearance/center = center_cache["[piping_layer]"] - if(!center) - center = mutable_appearance(icon, "adapter_center") - PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - center_cache["[piping_layer]"] = center - . += center - - update_layer() - - //Add non-broken pieces - for(var/i in 1 to device_type) - if(!nodes[i]) - continue - var/image/pipe = get_pipe_image('icons/obj/atmospherics/pipes/manifold.dmi', "pipe-3", get_dir(src, nodes[i]), nodes[i].pipe_color) - PIPING_LAYER_DOUBLE_SHIFT(pipe, piping_layer) - pipe.layer = layer + 0.01 - . += pipe - -/obj/machinery/atmospherics/pipe/color_adapter/layer1 - icon_state = "adapter_map-1" - -/obj/machinery/atmospherics/pipe/color_adapter/layer2 - icon_state = "adapter_map-2" - -/obj/machinery/atmospherics/pipe/color_adapter/layer4 - icon_state = "adapter_map-4" - -/obj/machinery/atmospherics/pipe/color_adapter/layer5 - icon_state = "adapter_map-5" diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm index 18e2e63d1c3ff..df9e5cf3d2f87 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm @@ -23,19 +23,19 @@ var/environment_temperature = 0 var/datum/gas_mixture/pipe_air = return_air() - var/turf/local_turf = loc - if(istype(local_turf)) - if(islava(local_turf)) - environment_temperature = 5000 //Yuck - else if(local_turf.blocks_air) - environment_temperature = local_turf.temperature + var/turf/T = loc + if(istype(T)) + if(T.blocks_air) + environment_temperature = T.return_temperature() else - var/turf/open/open_local = local_turf - environment_temperature = open_local.GetTemperature() - else - environment_temperature = local_turf.temperature - if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference) - parent.temperature_interact(local_turf, volume, thermal_conductivity) + var/turf/open/OT = T + environment_temperature = OT.GetTemperature() + else if(T != null) + environment_temperature = T.return_temperature() + + if(pipe_air != null) + if(abs(environment_temperature-pipe_air.return_temperature()) > minimum_temperature_difference) + parent.temperature_interact(T, volume, thermal_conductivity) //heatup/cooldown any mobs buckled to ourselves based on our temperature @@ -43,10 +43,11 @@ var/hc = pipe_air.heat_capacity() var/mob/living/heat_source = buckled_mobs[1] //Best guess-estimate of the total bodytemperature of all the mobs, since they share the same environment it's ~ok~ to guess like this - var/avg_temp = (pipe_air.temperature * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0)) - for(var/mob/living/buckled_mob as anything in buckled_mobs) - buckled_mob.bodytemperature = avg_temp - pipe_air.temperature = avg_temp + var/avg_temp = (pipe_air.return_temperature() * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0)) + for(var/m in buckled_mobs) + var/mob/living/L = m + L.bodytemperature = avg_temp + pipe_air.temperature = (avg_temp) /obj/machinery/atmospherics/pipe/heat_exchanging/process(delta_time) if(!parent) @@ -72,12 +73,9 @@ animate(src, color = rgb(h_r, h_g, h_b), time = 20, easing = SINE_EASING) //burn any mobs buckled based on temperature - if(!has_buckled_mobs()) - return - var/heat_limit = 1000 - if(pipe_air.temperature > heat_limit + 1) - for(var/mob/living/buckled_mob as anything in buckled_mobs) - buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST) - -/obj/machinery/atmospherics/pipe/heat_exchanging/update_pipe_icon() - return + if(has_buckled_mobs()) + var/heat_limit = 1000 + if(pipe_air.return_temperature() > heat_limit + 1) + for(var/m in buckled_mobs) + var/mob/living/buckled_mob = m + buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.return_temperature() - heat_limit), BURN, BODY_ZONE_CHEST) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm index c3012562a2e59..c59c3c743312f 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm @@ -35,7 +35,9 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) ) + + update_layer() /obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm index 4ac90338b907e..a321f7967e464 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm @@ -33,7 +33,8 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) ) + update_layer() /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/layer2 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm index 3266979ca8282..7c43cd771af20 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm @@ -15,7 +15,7 @@ pipe_state = "he" /obj/machinery/atmospherics/pipe/heat_exchanging/simple/set_init_directions() - if(ISDIAGONALDIR(dir)) + if(dir in GLOB.diagonals) initialize_directions = dir return switch(dir) diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index f6e5cfb226997..23221c20045db 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -30,16 +30,11 @@ return ..() /obj/machinery/atmospherics/pipe/layer_manifold/Destroy() - nullify_all_nodes() + nullifyAllNodes() return ..() -/obj/machinery/atmospherics/pipe/layer_manifold/update_pipe_icon() - return - -/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullify_all_nodes() - for(var/obj/machinery/atmospherics/node in nodes) - node.disconnect(src) - SSair.add_to_rebuild_queue(node) +/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullifyAllNodes() + var/list/obj/machinery/atmospherics/needs_nullifying = get_all_connected_nodes() front_nodes = null back_nodes = null nodes = list() @@ -60,17 +55,14 @@ for(var/node in back_nodes) add_attached_images(node) -/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_images(obj/machinery/atmospherics/machine_check) - if(!machine_check) +/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A) + if(!A) return - - . = list() - - if(istype(machine_check, /obj/machinery/atmospherics/pipe/layer_manifold)) + if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold)) for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX) - . += get_attached_image(get_dir(src, machine_check), i, COLOR_VERY_LIGHT_GRAY) - return - . += get_attached_image(get_dir(src, machine_check), machine_check.piping_layer, machine_check.pipe_color) + add_attached_image(get_dir(src, A), i) + return + add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color) /obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null) var/image/I @@ -113,7 +105,7 @@ /obj/machinery/atmospherics/pipe/layer_manifold/atmos_init() normalize_cardinal_directions() - find_all_connections() + findAllConnections() /obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer() piping_layer = PIPING_LAYER_DEFAULT @@ -123,13 +115,14 @@ /obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference) if(istype(reference, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/pipe_reference = reference - pipe_reference.destroy_network() - while(reference in nodes) - var/i = nodes.Find(reference) - nodes[i] = null - i = front_nodes.Find(reference) - if(i) + var/obj/machinery/atmospherics/pipe/P = reference + P.destroy_network() + while(reference in get_all_connected_nodes()) + if(reference in nodes) + var/i = nodes.Find(reference) + nodes[i] = null + if(reference in front_nodes) + var/i = front_nodes.Find(reference) front_nodes[i] = null if(reference in back_nodes) var/i = back_nodes.Find(reference) diff --git a/code/modules/atmospherics/machinery/pipes/multiz.dm b/code/modules/atmospherics/machinery/pipes/multiz.dm index 39a9a6d87457d..3c0aeb6e915a0 100644 --- a/code/modules/atmospherics/machinery/pipes/multiz.dm +++ b/code/modules/atmospherics/machinery/pipes/multiz.dm @@ -16,11 +16,8 @@ construction_type = /obj/item/pipe/directional pipe_state = "multiz" - ///Our central icon var/mutable_appearance/center = null - ///The pipe icon var/mutable_appearance/pipe = null - ///Reference to the node var/obj/machinery/atmospherics/front_node = null @@ -48,16 +45,14 @@ /// Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet /obj/machinery/atmospherics/pipe/multiz/pipeline_expansion() - var/turf/local_turf = get_turf(src) - for(var/obj/machinery/atmospherics/pipe/multiz/above in SSmapping.get_turf_above(local_turf)) - if(!is_connectable(above, piping_layer)) - continue - nodes += above - above.nodes += src //Two way travel :) - for(var/obj/machinery/atmospherics/pipe/multiz/below in SSmapping.get_turf_below(local_turf)) - if(!is_connectable(below, piping_layer)) - continue - below.pipeline_expansion() //If we've got one below us, force it to add us on facebook + var/turf/T = get_turf(src) + for(var/obj/machinery/atmospherics/pipe/multiz/above in GET_TURF_ABOVE(T)) + if(above.piping_layer == piping_layer) + nodes += above + above.nodes += src // Two way travel :) + for(var/obj/machinery/atmospherics/pipe/multiz/below in GET_TURF_BELOW(T)) + if(below.piping_layer == piping_layer) + below.pipeline_expansion() // If we've got one below us, force it to add us on facebook return ..() // MAPPING diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 277db30f24cc8..bc62bfb3faa1d 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -17,7 +17,7 @@ /obj/machinery/atmospherics/pipe/New() add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY) volume = 35 * device_type - . = ..() + ..() ///I have no idea why there's a new and at this point I'm too afraid to ask /obj/machinery/atmospherics/pipe/Initialize(mapload) @@ -27,10 +27,10 @@ AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works /obj/machinery/atmospherics/pipe/nullify_node(i) - var/obj/machinery/atmospherics/old_node = nodes[i] - . = ..() - if(old_node) - SSair.add_to_rebuild_queue(old_node) + var/obj/machinery/atmospherics/oldN = nodes[i] + ..() + if(oldN) + SSair.add_to_rebuild_queue(oldN) /obj/machinery/atmospherics/pipe/destroy_network() QDEL_NULL(parent) @@ -62,9 +62,9 @@ return air_temporary.remove(amount) return parent.air.remove(amount) -/obj/machinery/atmospherics/pipe/attackby(obj/item/item, mob/user, params) - if(istype(item, /obj/item/pipe_meter)) - var/obj/item/pipe_meter/meter = item +/obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/pipe_meter)) + var/obj/item/pipe_meter/meter = W user.dropItemToGround(meter) meter.setAttachLayer(piping_layer) else @@ -73,8 +73,8 @@ /obj/machinery/atmospherics/pipe/return_pipenet() return parent -/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/pipenet_to_set) - parent = pipenet_to_set +/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/P) + parent = P /obj/machinery/atmospherics/pipe/Destroy() QDEL_NULL(parent) @@ -82,14 +82,13 @@ releaseAirToTurf() QDEL_NULL(air_temporary) - var/turf/local_turf = loc - for(var/obj/machinery/meter/meter in local_turf) - if(meter.target != src) - continue - var/obj/item/pipe_meter/meter_object = new (local_turf) - meter.transfer_fingerprints_to(meter_object) - qdel(meter) - return ..() + var/turf/T = loc + for(var/obj/machinery/meter/meter in T) + if(meter.target == src) + var/obj/item/pipe_meter/PM = new (T) + meter.transfer_fingerprints_to(PM) + qdel(meter) + . = ..() /obj/machinery/atmospherics/pipe/update_icon() . = ..() @@ -97,10 +96,9 @@ /obj/machinery/atmospherics/pipe/proc/update_node_icon() for(var/i in 1 to device_type) - if(!nodes[i]) - continue - var/obj/machinery/atmospherics/current_node = nodes[i] - current_node.update_icon() + if(nodes[i]) + var/obj/machinery/atmospherics/N = nodes[i] + N.update_icon() /obj/machinery/atmospherics/pipe/return_pipenets() . = list(parent) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm deleted file mode 100644 index 5099aeefc7ba5..0000000000000 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ /dev/null @@ -1,89 +0,0 @@ -GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics))) -//Smart pipes... or are they? -/obj/machinery/atmospherics/pipe/smart - icon = 'icons/obj/atmospherics/pipes/simple.dmi' - icon_state = "pipe11-3" - - name = "pipe" - desc = "A one meter section of regular pipe." - - device_type = QUATERNARY - construction_type = /obj/item/pipe/quaternary - pipe_state = "manifold4w" - ///Current active connections - var/connections = NONE - -/obj/machinery/atmospherics/pipe/smart/update_pipe_icon() - icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi' - connections = NONE - - for(var/i in 1 to device_type) - if(!nodes[i]) - continue - var/obj/machinery/atmospherics/node = nodes[i] - var/connected_dir = get_dir(src, node) - connections |= connected_dir - var/bitfield = CARDINAL_TO_FULLPIPES(connections) - dir = check_binary_direction(connections) - - // If we dont have enough bits to make a proper sprite, add some shortpipe bits - - // Smart pipe icons differ from classic pipe icons in that we stop adding - // short pipe directions as soon as we find a valid sprite, rather than - // adding in all connectable directions. - // This prevents a lot of visual clutter, though it does make it harder to - // notice completely disconnected pipes. - if(ISSTUB(connections)) - var/bits_to_add = NONE - if(connections != NONE) - bits_to_add |= REVERSE_DIR(connections) & initialize_directions - var/candidates = initialize_directions - var/shift = 0 - // Note that candidates "should" never reach 0, as stub pipes are not allowed and break things - while (ISSTUB(connections | bits_to_add) && (candidates >> shift) != 0) - bits_to_add |= candidates & (1 << shift) - shift += 1 - bitfield |= CARDINAL_TO_SHORTPIPES(bits_to_add) - - icon_state = "[bitfield]_[piping_layer]" - -/obj/machinery/atmospherics/pipe/smart/set_init_directions(init_dir) - if(init_dir) - initialize_directions = init_dir - else - initialize_directions = ALL_CARDINALS - -/obj/machinery/atmospherics/pipe/smart/proc/check_binary_direction(direction) - switch(direction) - if(EAST|WEST) - return EAST - if(SOUTH|NORTH) - return SOUTH - else - return direction - -/obj/machinery/atmospherics/pipe/smart/proc/check_manifold_direction(direction) - switch(direction) - if(NORTH|SOUTH|EAST) - return WEST - if(NORTH|SOUTH|WEST) - return EAST - if(NORTH|WEST|EAST) - return SOUTH - if(SOUTH|WEST|EAST) - return NORTH - else - return null - -//mapping helpers -/obj/machinery/atmospherics/pipe/smart/simple - icon = 'icons/obj/atmospherics/pipes/simple.dmi' - icon_state = "pipe11-3" - -/obj/machinery/atmospherics/pipe/smart/manifold - icon = 'icons/obj/atmospherics/pipes/manifold.dmi' - icon_state = "manifold-3" - -/obj/machinery/atmospherics/pipe/smart/manifold4w - icon = 'icons/obj/atmospherics/pipes/manifold.dmi' - icon_state = "manifold4w-3" diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 46f6af572f588..d63373de7ddef 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -37,8 +37,9 @@ return //Indestructable cans shouldn't release air //This explosion will destroy the can, release its air. - var/turf/local_turf = get_turf(src) - local_turf.assume_air(air_contents) + var/turf/T = get_turf(src) + T.assume_air(air_contents) + T.air_update_turf(FALSE, FALSE) return ..() @@ -131,50 +132,48 @@ update_appearance() return TRUE -/obj/machinery/portable_atmospherics/attackby(obj/item/item, mob/user, params) - if(!istype(item, /obj/item/tank)) +/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/tank)) + if(!(machine_stat & BROKEN)) + var/obj/item/tank/T = W + if(!user.transferItemToLoc(T, src)) + return + to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].") + investigate_log("had its internal [holding] swapped with [T] by [key_name(user)].", INVESTIGATE_ATMOS) + replace_tank(user, FALSE, T) + update_appearance() + else if(W.tool_behaviour == TOOL_WRENCH) + if(!(machine_stat & BROKEN)) + if(connected_port) + investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS) + disconnect() + W.play_tool_sound(src) + user.visible_message( \ + "[user] disconnects [src].", \ + "You unfasten [src] from the port.", \ + "You hear a ratchet.") + update_appearance() + return + else + var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc + if(!possible_port) + to_chat(user, "Nothing happens.") + return + if(!connect(possible_port)) + to_chat(user, "[name] failed to connect to the port.") + return + W.play_tool_sound(src) + user.visible_message( \ + "[user] connects [src].", \ + "You fasten [src] to the port.", \ + "You hear a ratchet.") + update_appearance() + investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS) + else return ..() - if(machine_stat & BROKEN) - return FALSE - var/obj/item/tank/insert_tank = item - if(!user.transferItemToLoc(insert_tank, src)) - return FALSE - to_chat(user, span_notice("[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [insert_tank]" : "You insert [insert_tank] into [src]"].")) - investigate_log("had its internal [holding] swapped with [insert_tank] by [key_name(user)].", INVESTIGATE_ATMOS) - replace_tank(user, FALSE, insert_tank) - update_appearance() - -/obj/machinery/portable_atmospherics/wrench_act(mob/living/user, obj/item/wrench) - if(machine_stat & BROKEN) - return FALSE - if(connected_port) - investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS) - disconnect() - wrench.play_tool_sound(src) - user.visible_message( \ - "[user] disconnects [src].", \ - span_notice("You unfasten [src] from the port."), \ - span_hear("You hear a ratchet.")) - update_appearance() - return TRUE - var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc - if(!possible_port) - to_chat(user, span_notice("Nothing happens.")) - return FALSE - if(!connect(possible_port)) - to_chat(user, span_notice("[name] failed to connect to the port.")) - return FALSE - wrench.play_tool_sound(src) - user.visible_message( \ - "[user] connects [src].", \ - span_notice("You fasten [src] to the port."), \ - span_hear("You hear a ratchet.")) - update_appearance() - investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS) - return TRUE -/obj/machinery/portable_atmospherics/attacked_by(obj/item/item, mob/user) - if(item.force < 10 && !(machine_stat & BROKEN)) +/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user) + if(I.force < 10 && !(machine_stat & BROKEN)) take_damage(0) else investigate_log("was smacked with \a [I] by [key_name(user)].", INVESTIGATE_ATMOS) diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index 3bf122b83a345..1031492e4aea8 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -84,8 +84,10 @@ investigate_log("a portable pump was set to [attached_pump.target_pressure] kPa by [parent.get_creator()].", INVESTIGATE_ATMOS) /obj/machinery/portable_atmospherics/pump/Destroy() - var/turf/local_turf = get_turf(src) - local_turf.assume_air(air_contents) + var/turf/T = get_turf(src) + T.assume_air(air_contents) + air_update_turf(FALSE, FALSE) + QDEL_NULL(pump) return ..() /obj/machinery/portable_atmospherics/pump/update_icon() @@ -103,15 +105,15 @@ pump.airs[2] = null return - var/turf/local_turf = get_turf(src) - var/datum/gas_mixture/sending - var/datum/gas_mixture/receiving + var/turf/T = get_turf(src) + var/datum/gas_mixture/temp_air_contents = return_air() + var/datum/gas_mixture/temp_holding_air_contents = holding_return_air() if(direction == PUMP_OUT) // Hook up the internal pump. - sending = (holding ? holding.return_air() : air_contents) - receiving = (holding ? air_contents : local_turf.return_air()) + pump.airs[1] = holding ? temp_holding_air_contents : temp_air_contents + pump.airs[2] = holding ? temp_air_contents : T.return_air() else - sending = (holding ? air_contents : local_turf.return_air()) - receiving = (holding ? holding.return_air() : air_contents) + pump.airs[1] = holding ? temp_air_contents : T.return_air() + pump.airs[2] = holding ? temp_holding_air_contents : temp_air_contents pump.process_atmos() // Pump gas. if(!holding) diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index 9f89a8fa2c99c..d4f4dcbf805af 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -151,7 +151,7 @@ if(!holding) var/turf/T = get_turf(src) - for(var/turf/AT in T.get_atmos_adjacent_turfs(alldir = TRUE)) + for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE)) scrub(AT.return_air()) return ..() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index a56078ce18d75..cdc7c63d497ff 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -463,8 +463,10 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r var/turf/T = get_turf(src) if(!T) return - var/list/adjacent = T.get_atmos_adjacent_turfs(1) - if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way + var/list/adjacent = T.GetAtmosAdjacentTurfs(1) + var/atom/final_result + var/static/list/turf_typecache = typecacheof(/turf) + if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way adjacent = shuffle(adjacent) shuffle = FALSE for(var/turf/scan as() in adjacent)//Let's see if there's something right next to us first! diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm index 6c5be8f80e919..d36021d7a6fec 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm @@ -57,7 +57,7 @@ . = ..() if(banana_time && banana_time < world.time) var/turf/T = get_turf(src) - var/list/adjacent = T.get_atmos_adjacent_turfs(1) + var/list/adjacent = T.GetAtmosAdjacentTurfs(1) new banana_type(pick(adjacent)) banana_time = world.time + rand(30,60) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 773afb9538b43..bf8b25f1295b5 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -11,7 +11,6 @@ use_power = NO_POWER_USE interaction_flags_atom = NONE interaction_flags_machine = NONE - can_atmos_pass = ATMOS_PASS_NO light_range = 4 layer = ABOVE_OBJ_LAYER var/obj/machinery/field/generator/FG1 = null diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 0b997177818b7..0af3d05f9b767 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -32,7 +32,6 @@ field_generator power level display density = TRUE use_power = NO_POWER_USE max_integrity = 500 - can_atmos_pass = ATMOS_PASS_YES //100% immune to lasers and energy projectiles since it absorbs their energy. armor = list(MELEE = 25, BULLET = 10, LASER = 100, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0) var/power_level = 0 @@ -183,7 +182,6 @@ field_generator power level display /obj/machinery/field/generator/proc/turn_off() active = FG_OFFLINE - can_atmos_pass = ATMOS_PASS_YES air_update_turf(TRUE, FALSE) can_atmos_pass = ATMOS_PASS_YES spawn(1) diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm index 13f36942604eb..431754b4fce67 100644 --- a/code/modules/reagents/chem_splash.dm +++ b/code/modules/reagents/chem_splash.dm @@ -45,7 +45,7 @@ for(var/turf/T as() in turflist) if(accessible[T]) continue - for(var/thing in T.get_atmos_adjacent_turfs(alldir = TRUE)) + for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE)) var/turf/NT = thing if(!(NT in accessible)) continue diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 0afa12ed91a37..b87db205e14be 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -279,8 +279,8 @@ All ShuttleMove procs go here A.add_member(src) SSair.add_to_rebuild_queue(src) else - // atmos_init() calls update_appearance(), so we don't need to call it - update_appearance() + // atmos_init() calls update_icon(), so we don't need to call it + update_icon() /obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock) . = ..()