mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 03:51:49 +01:00
This is part 1 of a project to, eventually, bring the render planes system from /tg/ and bay into Aurora. This is a prerequisite and blocker for many things the development team and community want to have, and this was long overdue. Many objects have been re-assigned layers, which are now thoroughly defined. Maps have had their custom layer defines purged, as we should be moving away from this in favor of saner definitions in the base items. This should be a test-merge due to the sheer amount of layers changed, which will very likely create issues that I cannot possibly discover and debug in a reasonable amount of time myself. --------- Co-authored-by: Cody Brittain <cbrittain10@live.com>
141 lines
4.6 KiB
Plaintext
141 lines
4.6 KiB
Plaintext
/*
|
|
Quick overview:
|
|
|
|
Pipes combine to form pipelines
|
|
Pipelines and other atmospheric objects combine to form pipe_networks
|
|
Note: A single pipe_network represents a completely open space
|
|
|
|
Pipes -> Pipelines
|
|
Pipelines + Other Objects -> Pipe network
|
|
|
|
*/
|
|
/obj/machinery/atmospherics
|
|
anchored = 1
|
|
idle_power_usage = 0
|
|
active_power_usage = 0
|
|
power_channel = ENVIRON
|
|
var/nodealert = 0
|
|
var/power_rating //the maximum amount of power the machine can use to do work, affects how powerful the machine is, in Watts
|
|
|
|
layer = EXPOSED_PIPE_LAYER
|
|
|
|
var/connect_types = CONNECT_TYPE_REGULAR
|
|
var/icon_connect_type = "" //"-supply" or "-scrubbers"
|
|
|
|
var/initialize_directions = 0
|
|
var/pipe_color
|
|
|
|
var/global/datum/pipe_icon_manager/icon_manager
|
|
var/obj/machinery/atmospherics/node1
|
|
var/obj/machinery/atmospherics/node2
|
|
var/atmos_initialised = FALSE
|
|
gfi_layer_rotation = GFI_ROTATION_OVERDIR
|
|
|
|
/obj/machinery/atmospherics/Initialize(mapload)
|
|
. = ..()
|
|
if(!icon_manager)
|
|
icon_manager = new()
|
|
|
|
if(!pipe_color)
|
|
pipe_color = color
|
|
color = null
|
|
|
|
if(!pipe_color_check(pipe_color))
|
|
pipe_color = null
|
|
|
|
if (mapload)
|
|
return INITIALIZE_HINT_LATELOAD
|
|
|
|
/obj/machinery/atmospherics/proc/atmos_init()
|
|
atmos_initialised = TRUE
|
|
|
|
// atmos_init() and Initialize() must be separate, as atmos_init() can be called multiple times after the machine has been initialized.
|
|
|
|
/obj/machinery/atmospherics/LateInitialize()
|
|
atmos_init()
|
|
|
|
/obj/machinery/atmospherics/attackby(obj/item/attacking_item, mob/user)
|
|
if(istype(attacking_item, /obj/item/device/pipe_painter))
|
|
return FALSE
|
|
..()
|
|
|
|
/obj/machinery/atmospherics/proc/add_underlay(var/turf/T, var/obj/machinery/atmospherics/node, var/direction, var/icon_connect_type)
|
|
if(node)
|
|
if(!T.is_plating() && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
|
//underlays += icon_manager.get_atmos_icon("underlay_down", direction, color_cache_name(node))
|
|
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "down" + icon_connect_type)
|
|
else
|
|
//underlays += icon_manager.get_atmos_icon("underlay_intact", direction, color_cache_name(node))
|
|
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "intact" + icon_connect_type)
|
|
else
|
|
//underlays += icon_manager.get_atmos_icon("underlay_exposed", direction, pipe_color)
|
|
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "exposed" + icon_connect_type)
|
|
|
|
/obj/machinery/atmospherics/proc/update_underlays()
|
|
if(check_icon_cache())
|
|
return 1
|
|
else
|
|
return 0
|
|
|
|
/obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/atmos1, obj/machinery/atmospherics/atmos2)
|
|
return (atmos1.connect_types & atmos2.connect_types)
|
|
|
|
/obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/atmospherics/atmos1, obj/item/pipe/pipe2)
|
|
return (atmos1.connect_types & pipe2.connect_types)
|
|
|
|
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
|
|
if(!istype(icon_manager))
|
|
if(!safety) //to prevent infinite loops
|
|
icon_manager = new()
|
|
check_icon_cache(1)
|
|
return 0
|
|
|
|
return 1
|
|
|
|
/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node)
|
|
//Don't use this for standard pipes
|
|
if(!istype(node))
|
|
return null
|
|
|
|
return node.pipe_color
|
|
|
|
/obj/machinery/atmospherics/process(seconds_per_tick)
|
|
last_flow_rate = 0
|
|
last_power_draw = 0
|
|
|
|
build_network()
|
|
|
|
/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
|
// Check to see if should be added to network. Add self if so and adjust variables appropriately.
|
|
// Note don't forget to have neighbors look as well!
|
|
|
|
return null
|
|
|
|
/obj/machinery/atmospherics/proc/build_network()
|
|
// Called to build a network from this node
|
|
|
|
return null
|
|
|
|
/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
|
|
// Returns pipe_network associated with connection to reference
|
|
// Notes: should create network if necessary
|
|
// Should never return null
|
|
|
|
return null
|
|
|
|
/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
|
// Used when two pipe_networks are combining
|
|
|
|
/obj/machinery/atmospherics/proc/remove_network(datum/pipe_network/network)
|
|
reassign_network(network, null)
|
|
|
|
/obj/machinery/atmospherics/proc/return_network_air(datum/pipe_network/reference)
|
|
// Return a list of gas_mixture(s) in the object
|
|
// associated with reference pipe_network for use in rebuilding the networks gases list
|
|
// Is permitted to return null
|
|
|
|
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
|
|
|
|
/obj/machinery/atmospherics/update_icon()
|
|
return null
|