This commit is contained in:
Ghommie
2020-05-12 20:06:59 +02:00
557 changed files with 283936 additions and 4436 deletions
@@ -9,7 +9,7 @@
return
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh = FALSE, holo = FALSE)
var/datum/gas_mixture/air_contents = return_air()
if(!air_contents)
return 0
@@ -35,7 +35,7 @@
if(oxy < 0.5)
return 0
active_hotspot = new /obj/effect/hotspot(src)
active_hotspot = new /obj/effect/hotspot(src, holo)
active_hotspot.temperature = exposed_temperature*50
active_hotspot.volume = exposed_volume*25
@@ -67,8 +67,10 @@
var/bypassing = FALSE
var/visual_update_tick = 0
/obj/effect/hotspot/Initialize()
/obj/effect/hotspot/Initialize(mapload, holo = FALSE)
. = ..()
if(holo)
flags_1 |= HOLOGRAM_1
SSair.hotspots += src
perform_exposure()
setDir(pick(GLOB.cardinals))
@@ -192,7 +194,8 @@
if(bypassing)
icon_state = "3"
location.burn_tile()
if(!(flags_1 & HOLOGRAM_1))
location.burn_tile()
//Possible spread due to radiated heat
if(location.air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD)
@@ -200,7 +203,7 @@
for(var/t in location.atmos_adjacent_turfs)
var/turf/open/T = t
if(!T.active_hotspot)
T.hotspot_expose(radiated_temperature, CELL_VOLUME/4)
T.hotspot_expose(radiated_temperature, CELL_VOLUME/4, flags_1 & HOLOGRAM_1)
else
if(volume > CELL_VOLUME*0.4)
@@ -224,7 +227,8 @@
var/turf/open/T = loc
if(istype(T) && T.active_hotspot == src)
T.active_hotspot = null
DestroyTurf()
if(!(flags_1 & HOLOGRAM_1))
DestroyTurf()
return ..()
/obj/effect/hotspot/proc/DestroyTurf()
@@ -89,7 +89,7 @@
temperature_archived = temperature
/turf/open/archive()
ARCHIVE_TEMPERATURE(air)
ARCHIVE(air)
archived_cycle = SSair.times_fired
temperature_archived = temperature
@@ -215,7 +215,7 @@
if (planet_atmos) //share our air with the "atmosphere" "above" the turf
var/datum/gas_mixture/G = new
G.copy_from_turf(src)
ARCHIVE_TEMPERATURE(G)
ARCHIVE(G)
if(our_air.compare(G))
if(!our_excited_group)
var/datum/excited_group/EG = new
@@ -17,6 +17,7 @@ GLOBAL_LIST_INIT(meta_gas_ids, meta_gas_id_list())
GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
/datum/gas_mixture
var/list/gases = list()
var/list/gas_archive = list()
var/temperature = 0 //kelvins
var/tmp/temperature_archived = 0
var/volume = CELL_VOLUME //liters
@@ -31,13 +32,25 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
//PV = nRT
/datum/gas_mixture/proc/heat_capacity() //joules per kelvin
/datum/gas_mixture/proc/heat_capacity()
/datum/gas_mixture/proc/archived_heat_capacity()
/datum/gas_mixture/heat_capacity() //joules per kelvin
var/list/cached_gases = gases
var/list/cached_gasheats = GLOB.meta_gas_specific_heats
. = 0
for(var/id in cached_gases)
. += cached_gases[id] * cached_gasheats[id]
/datum/gas_mixture/archived_heat_capacity()
// lots of copypasta but heat_capacity is the single proc called the most in a regular round, bar none, so performance loss adds up
var/list/cached_gases = gas_archive
var/list/cached_gasheats = GLOB.meta_gas_specific_heats
. = 0
for(var/id in cached_gases)
. += cached_gases[id] * cached_gasheats[id]
/datum/gas_mixture/turf/heat_capacity() // Same as above except vacuums return HEAT_CAPACITY_VACUUM
var/list/cached_gases = gases
var/list/cached_gasheats = GLOB.meta_gas_specific_heats
@@ -46,6 +59,14 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
if(!.)
. += HEAT_CAPACITY_VACUUM //we want vacuums in turfs to have the same heat capacity as space
/datum/gas_mixture/turf/archived_heat_capacity() // Same as above except vacuums return HEAT_CAPACITY_VACUUM
var/list/cached_gases = gas_archive
var/list/cached_gasheats = GLOB.meta_gas_specific_heats
for(var/id in cached_gases)
. += cached_gases[id] * cached_gasheats[id]
if(!.)
. += HEAT_CAPACITY_VACUUM //we want vacuums in turfs to have the same heat capacity as space
/datum/gas_mixture/proc/total_moles()
var/cached_gases = gases
TOTAL_MOLES(cached_gases, .)
@@ -67,6 +88,10 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
/datum/gas_mixture/proc/thermal_energy() //joules
return THERMAL_ENERGY(src) //see code/__DEFINES/atmospherics.dm; use the define in performance critical areas
/datum/gas_mixture/proc/archive()
//Update archived versions of variables
//Returns: 1 in all cases
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver)
//Merges all air from giver into self. Deletes giver.
//Returns: 1 if we are mutable, 0 otherwise
@@ -111,6 +136,10 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
//Performs various reactions such as combustion or fusion (LOL)
//Returns: 1 if any reaction took place; 0 otherwise
/datum/gas_mixture/archive()
temperature_archived = temperature
gas_archive = gases.Copy()
return 1
/datum/gas_mixture/merge(datum/gas_mixture/giver)
if(!giver)
@@ -245,7 +274,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
//GAS TRANSFER
for(var/id in cached_gases | sharer_gases) // transfer gases
delta = QUANTIZE(cached_gases[id] - sharer_gases[id])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
delta = QUANTIZE(gas_archive[id] - sharer.gas_archive[id])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
if(delta && abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
gas_heat_capacity = delta * cached_gasheats[id]
@@ -293,8 +322,8 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
sharer_temperature = sharer.temperature_archived
var/temperature_delta = temperature_archived - sharer_temperature
if(abs(temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/self_heat_capacity = heat_capacity()
sharer_heat_capacity = sharer_heat_capacity || sharer.heat_capacity()
var/self_heat_capacity = archived_heat_capacity()
sharer_heat_capacity = sharer_heat_capacity || sharer.archived_heat_capacity()
if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
var/heat = conduction_coefficient*temperature_delta* \
@@ -787,9 +787,8 @@
return
user.visible_message("[user.name] wires the air alarm.", \
"<span class='notice'>You start wiring the air alarm...</span>")
if (do_after(user, 20, target = src))
if (cable.get_amount() >= 5 && buildstage == 1)
cable.use(5)
if (W.use_tool(src, user, 20, 5))
if (buildstage == 1)
to_chat(user, "<span class='notice'>You wire the air alarm.</span>")
wires.repair()
aidisabled = 0
@@ -64,6 +64,7 @@
nullifyNode(i)
SSair.atmos_machinery -= src
SSair.pipenets_needing_rebuilt -= src
dropContents()
if(pipe_vision_img)
@@ -116,7 +116,7 @@
if(node2)
node2.atmosinit()
node2.addMember(src)
build_network()
SSair.add_to_rebuild_queue(src)
return TRUE
@@ -144,7 +144,7 @@
var/datum/pipeline/parent = parents[i]
if(!parent)
stack_trace("Component is missing a pipenet! Rebuilding...")
build_network()
SSair.add_to_rebuild_queue(src)
parent.update = 1
/obj/machinery/atmospherics/components/returnPipenets()
@@ -454,6 +454,6 @@
if(node)
node.atmosinit()
node.addMember(src)
build_network()
SSair.add_to_rebuild_queue(src)
#undef CRYOMOBS
@@ -116,7 +116,7 @@
if(node)
node.atmosinit()
node.addMember(src)
build_network()
SSair.add_to_rebuild_queue(src)
return TRUE
/obj/machinery/atmospherics/components/unary/thermomachine/ui_status(mob/user)
@@ -31,7 +31,7 @@
nodes = list()
for(var/obj/machinery/atmospherics/A in needs_nullifying)
A.disconnect(src)
A.build_network()
SSair.add_to_rebuild_queue(A)
/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_all_connected_nodes()
return front_nodes + back_nodes + nodes
@@ -28,6 +28,8 @@
/obj/machinery/atmospherics/pipe/manifold/update_icon()
cut_overlays()
if(!center)
center = mutable_appearance(icon, "manifold_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
add_overlay(center)
@@ -26,6 +26,8 @@
/obj/machinery/atmospherics/pipe/manifold4w/update_icon()
cut_overlays()
if(!center)
center = mutable_appearance(icon, "manifold_center")
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
add_overlay(center)
@@ -22,7 +22,7 @@
var/obj/machinery/atmospherics/oldN = nodes[i]
..()
if(oldN)
oldN.build_network()
SSair.add_to_rebuild_queue(oldN)
/obj/machinery/atmospherics/pipe/destroy_network()
QDEL_NULL(parent)
@@ -159,7 +159,6 @@
/obj/machinery/portable_atmospherics/canister/proto
name = "prototype canister"
/obj/machinery/portable_atmospherics/canister/proto/default
name = "prototype canister"
desc = "The best way to fix an atmospheric emergency... or the best way to introduce one."
@@ -172,7 +171,6 @@
can_min_release_pressure = (ONE_ATMOSPHERE / 30)
prototype = TRUE
/obj/machinery/portable_atmospherics/canister/proto/default/oxygen
name = "prototype canister"
desc = "A prototype canister for a prototype bike, what could go wrong?"
@@ -181,8 +179,6 @@
filled = 1
release_pressure = ONE_ATMOSPHERE*2
/obj/machinery/portable_atmospherics/canister/New(loc, datum/gas_mixture/existing_mixture)
..()
if(existing_mixture)
@@ -192,7 +188,7 @@
pump = new(src, FALSE)
pump.on = TRUE
pump.stat = 0
pump.build_network()
SSair.add_to_rebuild_queue(pump)
update_icon()
@@ -208,6 +204,7 @@
air_contents.gases[gas_type] = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
if(starter_temp)
air_contents.temperature = starter_temp
/obj/machinery/portable_atmospherics/canister/air/create_gas()
air_contents.gases[/datum/gas/oxygen] = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
air_contents.gases[/datum/gas/nitrogen] = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
@@ -20,7 +20,7 @@
pump = new(src, FALSE)
pump.on = TRUE
pump.stat = 0
pump.build_network()
SSair.add_to_rebuild_queue(pump)
/obj/machinery/portable_atmospherics/pump/Destroy()
var/turf/T = get_turf(src)