From 0ce01d1583d2000322a8a61a90d64a787dbc3409 Mon Sep 17 00:00:00 2001 From: Aranclanos Date: Sat, 10 Aug 2013 06:15:14 -0300 Subject: [PATCH] Adding Linda. --- .../components/unary/outlet_injector.dm | 1 + .../components/unary/vent_pump.dm | 2 + .../components/unary/vent_scrubber.dm | 2 + code/ATMOSPHERICS/datum_pipeline.dm | 53 +- code/FEA/FEA_gas_mixture.dm | 38 +- code/LINDA/LINDA_fire.dm | 177 +++++++ code/LINDA/LINDA_system.dm | 235 +++++++++ code/LINDA/LINDA_turf_tile.dm | 470 ++++++++++++++++++ code/__DEFINES.dm | 1 - code/__HELPERS/unsorted.dm | 37 +- code/game/atoms.dm | 2 +- code/game/machinery/atmoalter/canister.dm | 2 + code/game/machinery/atmoalter/pump.dm | 2 + code/game/machinery/atmoalter/zvent.dm | 4 +- code/game/machinery/doors/airlock.dm | 21 +- code/game/machinery/doors/door.dm | 74 +-- code/game/machinery/doors/firedoor.dm | 27 +- code/game/machinery/doors/poddoor.dm | 6 +- code/game/machinery/doors/windowdoor.dm | 37 +- code/game/machinery/shieldgen.dm | 56 +-- code/game/machinery/spaceheater.dm | 2 + code/game/objects/effects/aliens.dm | 12 - code/game/objects/effects/effect_system.dm | 57 +-- code/game/objects/effects/mines.dm | 31 +- code/game/objects/items/devices/PDA/PDA.dm | 17 +- .../game/objects/items/stacks/sheets/glass.dm | 2 + .../objects/items/weapons/flamethrower.dm | 5 +- code/game/objects/objs.dm | 2 +- code/game/objects/structures/mineral_doors.dm | 73 +-- .../objects/structures/windoor_assembly.dm | 46 +- code/game/objects/structures/window.dm | 44 +- code/game/turfs/simulated/walls_mineral.dm | 19 +- code/game/turfs/turf.dm | 68 ++- code/modules/admin/admin_verbs.dm | 5 - code/modules/admin/verbs/diagnostics.dm | 84 ---- code/modules/admin/verbs/mapping.dm | 24 - code/modules/mining/mine_turfs.dm | 2 +- .../mob/living/carbon/alien/humanoid/life.dm | 2 +- .../mob/living/carbon/alien/larva/life.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 2 +- code/modules/mob/living/carbon/monkey/life.dm | 2 +- .../silicon/ai/freelook/update_triggers.dm | 3 +- code/modules/mob/mob.dm | 3 +- code/modules/reagents/Chemistry-Reagents.dm | 17 +- code/modules/reagents/Chemistry-Recipes.dm | 30 +- code/modules/recycling/disposal.dm | 1 + code/modules/research/server.dm | 1 + tgstation.dme | 45 +- 48 files changed, 1152 insertions(+), 696 deletions(-) create mode 100644 code/LINDA/LINDA_fire.dm create mode 100644 code/LINDA/LINDA_system.dm create mode 100644 code/LINDA/LINDA_turf_tile.dm diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index 9bff0a6d72b..5ba60b66ca9 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -49,6 +49,7 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) loc.assume_air(removed) + air_update_turf() if(network) network.update = 1 diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 451832c06e0..13a8c2294ac 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -107,6 +107,7 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) loc.assume_air(removed) + air_update_turf() if(network) network.update = 1 @@ -127,6 +128,7 @@ return air_contents.merge(removed) + air_update_turf() if(network) network.update = 1 diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 346ed958a36..67386b9630d 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -137,6 +137,7 @@ air_contents.merge(filtered_out) loc.assume_air(removed) + air_update_turf() if(network) network.update = 1 @@ -150,6 +151,7 @@ var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) air_contents.merge(removed) + air_update_turf() if(network) network.update = 1 diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index 56cb9898013..b9eb1d29a89 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -127,37 +127,13 @@ datum/pipeline var/datum/gas_mixture/air_sample = air.remove_ratio(mingle_volume/air.volume) air_sample.volume = mingle_volume - if(istype(target) && target.parent && target.parent.group_processing) - //Have to consider preservation of group statuses - var/datum/gas_mixture/turf_copy = new + var/datum/gas_mixture/turf_air = target.return_air() - turf_copy.copy_from(target.parent.air) - turf_copy.volume = target.parent.air.volume //Copy a good representation of the turf from parent group + equalize_gases(list(air_sample, turf_air)) + air.merge(air_sample) + //turf_air already modified by equalize_gases() - equalize_gases(list(air_sample, turf_copy)) - air.merge(air_sample) - - if(target.parent.air.compare(turf_copy)) - //The new turf would be an acceptable group member so permit the integration - - turf_copy.subtract(target.parent.air) - - target.parent.air.merge(turf_copy) - - else - //Comparison failure so dissemble group and copy turf - - target.parent.suspend_group_processing() - target.air.copy_from(turf_copy) - - else - var/datum/gas_mixture/turf_air = target.return_air() - - equalize_gases(list(air_sample, turf_air)) - air.merge(air_sample) - //turf_air already modified by equalize_gases() - - if(istype(target) && !target.processing) + if(istype(target)) if(target.air) if(target.air.check_tile_graphic()) target.update_visuals(target.air) @@ -186,12 +162,8 @@ datum/pipeline var/delta_temperature = 0 var/sharer_heat_capacity = 0 - if(modeled_location.parent && modeled_location.parent.group_processing) - delta_temperature = (air.temperature - modeled_location.parent.air.temperature) - sharer_heat_capacity = modeled_location.parent.air.heat_capacity() - else - delta_temperature = (air.temperature - modeled_location.air.temperature) - sharer_heat_capacity = modeled_location.air.heat_capacity() + delta_temperature = (air.temperature - modeled_location.air.temperature) + sharer_heat_capacity = modeled_location.air.heat_capacity() var/self_temperature_delta = 0 var/sharer_temperature_delta = 0 @@ -207,16 +179,7 @@ datum/pipeline air.temperature += self_temperature_delta - if(modeled_location.parent && modeled_location.parent.group_processing) - if((abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && (abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*modeled_location.parent.air.temperature)) - modeled_location.parent.suspend_group_processing() - - modeled_location.air.temperature += sharer_temperature_delta - - else - modeled_location.parent.air.temperature += sharer_temperature_delta/modeled_location.parent.air.group_multiplier - else - modeled_location.air.temperature += sharer_temperature_delta + modeled_location.air.temperature += sharer_temperature_delta else diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 6beeffc1870..e3f0d62e8f6 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -1,4 +1,4 @@ -/* + /* What are the archived variables for? Calculations are done using the archived variables with the results merged into the regular variables. This prevents race conditions that arise based on the order of tile processing. @@ -39,6 +39,8 @@ What are the archived variables for? var/temperature = 0 //in Kelvin, use calculate_temperature() to modify + var/last_share + var/group_multiplier = 1 //Size of the group this gas_mixture is representing. //=1 for singletons @@ -533,12 +535,12 @@ What are the archived variables for? return 1 - share(datum/gas_mixture/sharer) + share(datum/gas_mixture/sharer, var/atmos_adjacent_turfs = 4) if(!sharer) return 0 - var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/5 - var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 - var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/5 - var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/5 + var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/(atmos_adjacent_turfs+1) + var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/(atmos_adjacent_turfs+1) + var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/(atmos_adjacent_turfs+1) + var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/(atmos_adjacent_turfs+1) var/delta_temperature = (temperature_archived - sharer.temperature_archived) @@ -588,6 +590,7 @@ What are the archived variables for? sharer.toxins += delta_toxins/sharer.group_multiplier var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) + last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) var/list/trace_types_considered = list() @@ -598,12 +601,12 @@ What are the archived variables for? var/delta = 0 if(corresponding) - delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/5 + delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/(atmos_adjacent_turfs+1) else corresponding = new trace_gas.type() sharer.trace_gases += corresponding - delta = trace_gas.moles_archived/5 + delta = trace_gas.moles_archived/(atmos_adjacent_turfs+1) trace_gas.moles -= delta/group_multiplier corresponding.moles += delta/sharer.group_multiplier @@ -616,6 +619,7 @@ What are the archived variables for? heat_capacity_sharer_to_self -= individual_heat_capacity moved_moles += delta + last_share += abs(delta) trace_types_considered += trace_gas.type @@ -640,6 +644,7 @@ What are the archived variables for? heat_capacity_sharer_to_self += individual_heat_capacity moved_moles += -delta + last_share += abs(delta) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer @@ -659,14 +664,11 @@ What are the archived variables for? var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - sharer.temperature_archived*(sharer.total_moles() - moved_moles) return delta_pressure*R_IDEAL_GAS_EQUATION/volume - else - return 0 - - mimic(turf/model, border_multiplier) - var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/5 - var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/5 - var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/5 - var/delta_toxins = QUANTIZE(toxins_archived - model.toxins)/5 + mimic(turf/model, border_multiplier, var/atmos_adjacent_turfs = 4) + var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/(atmos_adjacent_turfs+1) + var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/(atmos_adjacent_turfs+1) + var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/(atmos_adjacent_turfs+1) + var/delta_toxins = QUANTIZE(toxins_archived - model.toxins)/(atmos_adjacent_turfs+1) var/delta_temperature = (temperature_archived - model.temperature) @@ -706,12 +708,13 @@ What are the archived variables for? toxins -= delta_toxins/group_multiplier var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) + last_share = abs(delta_oxygen) + abs(delta_carbon_dioxide) + abs(delta_nitrogen) + abs(delta_toxins) if(trace_gases.len) for(var/datum/gas/trace_gas in trace_gases) var/delta = 0 - delta = trace_gas.moles_archived/5 + delta = trace_gas.moles_archived/(atmos_adjacent_turfs+1) if(border_multiplier) trace_gas.moles -= delta*border_multiplier/group_multiplier @@ -722,6 +725,7 @@ What are the archived variables for? heat_transferred += heat_cap_transferred*temperature_archived heat_capacity_transferred += heat_cap_transferred moved_moles += delta + moved_moles += abs(delta) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm new file mode 100644 index 00000000000..318239ec94f --- /dev/null +++ b/code/LINDA/LINDA_fire.dm @@ -0,0 +1,177 @@ + +/atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) + return null + + + +/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0) + return + + +/turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) + var/datum/gas_mixture/air_contents = return_air() + if(!air_contents) + return 0 + if(active_hotspot) + if(soh) + if(air_contents.toxins > 0.5 && air_contents.oxygen > 0.5) + if(active_hotspot.temperature < exposed_temperature) + active_hotspot.temperature = exposed_temperature + if(active_hotspot.volume < exposed_volume) + active_hotspot.volume = exposed_volume + return 1 + + var/igniting = 0 + + if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && air_contents.toxins > 0.5) + igniting = 1 + + if(igniting) + if(air_contents.oxygen < 0.5 || air_contents.toxins < 0.5) + return 0 + + active_hotspot = new(src) + active_hotspot.temperature = exposed_temperature + active_hotspot.volume = exposed_volume + + active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) + //remove just_spawned protection if no longer processing this cell + air_master.add_to_active(src, 0) + return igniting + +//This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile +/obj/effect/hotspot + anchored = 1 + mouse_opacity = 0 + unacidable = 1//So you can't melt fire with acid. + icon = 'icons/effects/fire.dmi' + icon_state = "1" + layer = TURF_LAYER + luminosity = 3 + + var/volume = 125 + var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + var/just_spawned = 1 + var/bypassing = 0 + +/obj/effect/hotspot/New() + ..() + air_master.hotspots += src + +/obj/effect/hotspot/proc/perform_exposure() + var/turf/simulated/floor/location = loc + if(!istype(location)) return 0 + + if(volume > CELL_VOLUME*0.95) bypassing = 1 + else bypassing = 0 + + if(bypassing) + if(!just_spawned) + volume = location.air.fuel_burnt*FIRE_GROWTH_RATE + temperature = location.air.temperature + else + var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume) + affected.temperature = temperature + affected.react() + temperature = affected.temperature + volume = affected.fuel_burnt*FIRE_GROWTH_RATE + location.assume_air(affected) + + for(var/atom/item in loc) + if(item) // It's possible that the item is deleted in temperature_expose + item.fire_act(null, temperature, volume) + + return 0 + + +/obj/effect/hotspot/process() + if(just_spawned) + just_spawned = 0 + return 0 + + var/turf/simulated/floor/location = loc + if(!istype(location)) + Kill() + return + + if(location.excited_group) + location.excited_group.breakdown = 0 + + if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1)) + Kill() + return + + if(location.air.toxins < 0.5 || location.air.oxygen < 0.5) + Kill() + return + + perform_exposure() + + if(location.wet) location.wet = 0 + + if(bypassing) + icon_state = "3" + location.burn_tile() + + //Possible spread due to radiated heat + if(location.air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD) + var/radiated_temperature = location.air.temperature*FIRE_SPREAD_RADIOSITY_SCALE + for(var/direction in cardinal) + if(!(location.atmos_adjacent_turfs & direction)) + continue + var/turf/simulated/T = get_step(src, direction) + if(istype(T) && T.active_hotspot) + T.hotspot_expose(radiated_temperature, CELL_VOLUME/4) + + else + if(volume > CELL_VOLUME*0.4) + icon_state = "2" + else + icon_state = "1" + + if(temperature > location.max_fire_temperature_sustained) + location.max_fire_temperature_sustained = temperature + + if(location.heat_capacity && temperature > location.heat_capacity) + location.to_be_destroyed = 1 + /*if(prob(25)) + location.ReplaceWithSpace() + return 0*/ + return 1 + +// Garbage collect itself by nulling reference to it + +/obj/effect/hotspot/proc/Kill() + air_master.hotspots -= src + DestroyTurf() + garbage_collect() + +/obj/effect/hotspot/proc/garbage_collect() + if(istype(loc, /turf/simulated)) + var/turf/simulated/T = loc + if(T.active_hotspot == src) + T.active_hotspot = null + loc = null + +/obj/effect/hotspot/proc/DestroyTurf() + + if(istype(loc, /turf/simulated)) + var/turf/simulated/T = loc + if(T.to_be_destroyed) + var/chance_of_deletion + if (T.heat_capacity) //beware of division by zero + chance_of_deletion = T.max_fire_temperature_sustained / T.heat_capacity * 8 //there is no problem with prob(23456), min() was redundant --rastaf0 + else + chance_of_deletion = 100 + if(prob(chance_of_deletion)) + T.ChangeTurf(/turf/space) + else + T.to_be_destroyed = 0 + T.max_fire_temperature_sustained = 0 + +/obj/effect/hotspot/New() + ..() + dir = pick(cardinal) + air_update_turf() + return + diff --git a/code/LINDA/LINDA_system.dm b/code/LINDA/LINDA_system.dm new file mode 100644 index 00000000000..613bc45f3a7 --- /dev/null +++ b/code/LINDA/LINDA_system.dm @@ -0,0 +1,235 @@ +var/kill_air = 0 + +var/global/datum/controller/air_system/air_master + +datum/controller/air_system + var/list/excited_groups = list() + var/list/active_turfs = list() + var/list/hotspots = list() + var/speed = 1 + + //Special functions lists + var/list/turf/simulated/active_super_conductivity = list() + var/list/turf/simulated/high_pressure_delta = list() + + var/current_cycle = 0 + + +/datum/controller/air_system/proc/setup() + set background = 1 + world << "\red \b Processing Geometry..." + sleep(1) + + var/start_time = world.timeofday + + setup_allturfs() + + world << "\red \b Geometry processed in [(world.timeofday-start_time)/10] seconds!" + +/datum/controller/air_system/proc/process() + if(kill_air) + return 1 + + for(var/i=0,i 10) + if(EG.self_compare()) + EG.dismantle() + if(EG.breakdown_cooldown == 10) + if(!EG.self_compare()) + EG.reset_cooldowns() + EG.self_breakdown() + EG.breakdown = 1 + +/turf/proc/CanAtmosPass(var/turf/T) + if(!istype(T)) return 0 + var/R + if(blocks_air || T.blocks_air) + R = 1 + + for(var/obj/O in contents) + if(!O.CanAtmosPass(T)) + R = 1 + if(O.BlockSuperconductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments + var/D = get_dir(src, T) + atmos_supeconductivity |= D + D = get_dir(T, src) + T.atmos_supeconductivity |= D + return 0 //no need to keep going, we got all we asked + + for(var/obj/O in T.contents) + if(!O.CanAtmosPass(src)) + R = 1 + if(O.BlockSuperconductivity()) + var/D = get_dir(src, T) + atmos_supeconductivity |= D + D = get_dir(T, src) + T.atmos_supeconductivity |= D + return 0 + + var/D = get_dir(src, T) + atmos_supeconductivity &= ~D + D = get_dir(T, src) + T.atmos_supeconductivity &= ~D + + if(!R) + return 1 + +atom/movable/proc/CanAtmosPass() + return 1 + +atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) + return (!density || !height || air_group) + +turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0) + if(!target) return 0 + + if(istype(mover)) // turf/Enter(...) will perform more advanced checks + return !density + + else // Now, doing more detailed checks for air movement and air group formation + if(target.blocks_air||blocks_air) + return 0 + + for(var/obj/obstacle in src) + if(!obstacle.CanPass(mover, target, height, air_group)) + return 0 + for(var/obj/obstacle in target) + if(!obstacle.CanPass(mover, src, height, air_group)) + return 0 + + return 1 + +/atom/movable/proc/BlockSuperconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm. + return 0 + +/turf/proc/CalculateAdjacentTurfs() + atmos_adjacent_turfs_amount = 0 + for(var/direction in cardinal) + var/turf/T = get_step(src, direction) + if(!istype(T)) + continue + var/counterdir = get_dir(T, src) + if(CanAtmosPass(T)) + atmos_adjacent_turfs_amount += 1 + atmos_adjacent_turfs |= direction + if(!(T.atmos_adjacent_turfs & counterdir)) + T.atmos_adjacent_turfs_amount += 1 + T.atmos_adjacent_turfs |= counterdir + else + atmos_adjacent_turfs &= ~direction + if(T.atmos_adjacent_turfs & counterdir) + T.atmos_adjacent_turfs_amount -= 1 + T.atmos_adjacent_turfs &= ~counterdir + +/atom/movable/proc/air_update_turf(var/command = 0) + if(istype(loc,/turf)) + var/turf/T = loc + if(command) + T.CalculateAdjacentTurfs() + if(air_master) + air_master.add_to_active(T,command) + + + +/atom/movable/proc/atmos_spawn_air(var/text, var/amount) //because a lot of people loves to copy paste awful code lets just make a easy proc to spawn your plasma fires + var/turf/simulated/T = get_turf(src) + if(!istype(T)) + return + T.atmos_spawn_air(text, amount) + +/turf/simulated/proc/atmos_spawn_air(var/text, var/amount) + if(!text || !amount || !air) + return + + var/datum/gas_mixture/G = new + + if(text == "fire") + G.toxins = amount + G.temperature = 1000 + else if(text == "n2o") + var/datum/gas/sleeping_agent/T = new + T.moles = amount + G += T + else if(text == "fuel") + var/datum/gas/volatile_fuel/T + T.moles = amount + G += T + + air.merge(G) + air_master.add_to_active(src, 0) \ No newline at end of file diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm new file mode 100644 index 00000000000..545f904ffa9 --- /dev/null +++ b/code/LINDA/LINDA_turf_tile.dm @@ -0,0 +1,470 @@ + + +turf + var/pressure_difference = 0 + var/pressure_direction = 0 + var/atmos_adjacent_turfs = 0 + var/atmos_adjacent_turfs_amount = 0 + var/atmos_supeconductivity = 0 + +turf/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air + del(giver) + return 0 + +turf/return_air() + //Create gas mixture to hold data for passing + var/datum/gas_mixture/GM = new + + GM.oxygen = oxygen + GM.carbon_dioxide = carbon_dioxide + GM.nitrogen = nitrogen + GM.toxins = toxins + + GM.temperature = temperature + + return GM + +turf/remove_air(amount as num) + var/datum/gas_mixture/GM = new + + var/sum = oxygen + carbon_dioxide + nitrogen + toxins + if(sum>0) + GM.oxygen = (oxygen/sum)*amount + GM.carbon_dioxide = (carbon_dioxide/sum)*amount + GM.nitrogen = (nitrogen/sum)*amount + GM.toxins = (toxins/sum)*amount + + GM.temperature = temperature + + return GM + + +turf/simulated + var/datum/excited_group/excited_group + var/excited = 0 + var/recently_active = 0 + var/datum/gas_mixture/air + var/archived_cycle = 0 + var/current_cycle = 0 + + var/obj/effect/hotspot/active_hotspot + + var/temperature_archived //USED ONLY FOR SOLIDS + +turf/simulated/New() + ..() + + if(!blocks_air) + air = new + + air.oxygen = oxygen + air.carbon_dioxide = carbon_dioxide + air.nitrogen = nitrogen + air.toxins = toxins + + air.temperature = temperature + +turf/simulated/Del() + if(active_hotspot) + active_hotspot.garbage_collect() + ..() + +turf/simulated/assume_air(datum/gas_mixture/giver) + if(!giver) return 0 + var/datum/gas_mixture/receiver = air + if(istype(receiver)) + + air.merge(giver) + + if(air.check_tile_graphic()) + update_visuals(air) + + return 1 + + else return ..() + +turf/simulated/proc/copy_air_with_tile(turf/simulated/T) + if(istype(T) && T.air && air) + air.copy_from(T.air) + +turf/simulated/proc/copy_air(datum/gas_mixture/copy) + if(air && copy) + air.copy_from(copy) + +turf/simulated/return_air() + if(air) + return air + + else + return ..() + +turf/simulated/remove_air(amount as num) + if(air) + var/datum/gas_mixture/removed = null + + removed = air.remove(amount) + + if(air.check_tile_graphic()) + update_visuals(air) + + return removed + + else + return ..() + +turf/simulated/proc/mimic_temperature_solid(turf/model, conduction_coefficient) + var/delta_temperature = (temperature_archived - model.temperature) + if((heat_capacity > 0) && (abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)) + + var/heat = conduction_coefficient*delta_temperature* \ + (heat_capacity*model.heat_capacity/(heat_capacity+model.heat_capacity)) + temperature -= heat/heat_capacity + +turf/simulated/proc/share_temperature_mutual_solid(turf/simulated/sharer, conduction_coefficient) + 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)) + + temperature -= heat/heat_capacity + sharer.temperature += heat/sharer.heat_capacity + + + + + + + + +/turf/simulated/proc/process_cell() + + var/image/Aran = image('icons/mob/hud.dmi', "hud_imp_chem") + overlays += Aran + spawn(9) + overlays -= Aran + + if(archived_cycle < air_master.current_cycle) //archive self if not already done + archive() + current_cycle = air_master.current_cycle + + var/remove = 1 //set by non simulated turfs who are sharing with this turf + + for(var/direction in cardinal) + if(!(atmos_adjacent_turfs & direction)) + continue + + var/turf/enemy_tile = get_step(src, direction) + + if(istype(enemy_tile,/turf/simulated)) + var/turf/simulated/enemy_simulated = enemy_tile + + if(current_cycle > enemy_simulated.current_cycle) + enemy_simulated.archive() + + /******************* GROUP HANDLING START *****************************************************************/ + + if(enemy_simulated.excited) + if(excited_group) + if(enemy_simulated.excited_group) + if(excited_group != enemy_simulated.excited_group) + excited_group.merge_groups(enemy_simulated.excited_group) //combine groups + share_air(enemy_simulated) //share + else + if((recently_active == 1 && enemy_simulated.recently_active == 1) || !air.compare(enemy_simulated.air)) + excited_group.add_turf(enemy_simulated) //add enemy to our group + share_air(enemy_simulated) //share + else + if(enemy_simulated.excited_group) + if((recently_active == 1 && enemy_simulated.recently_active == 1) || !air.compare(enemy_simulated.air)) + enemy_simulated.excited_group.add_turf(src) //join self to enemy group + share_air(enemy_simulated) //share + else + if((recently_active == 1 && enemy_simulated.recently_active == 1) || !air.compare(enemy_simulated.air)) + var/datum/excited_group/EG = new //generate new group + EG.add_turf(src) + EG.add_turf(enemy_simulated) + share_air(enemy_simulated) //share + else + if(!air.compare(enemy_simulated.air)) //compare if + air_master.add_to_active(enemy_simulated) //excite enemy + if(excited_group) + excited_group.add_turf(enemy_simulated) //add enemy to group + else + var/datum/excited_group/EG = new //generate new group + EG.add_turf(src) + EG.add_turf(enemy_simulated) + share_air(enemy_simulated) //share + + /******************* GROUP HANDLING FINISH *********************************************************************/ + + else + if(!air.check_turf(enemy_tile)) + var/difference = air.mimic(enemy_tile,,atmos_adjacent_turfs_amount) + if(difference) + if(difference > 0) + consider_pressure_difference(enemy_tile, difference) + else + enemy_tile.consider_pressure_difference(src, difference) + remove = 0 + if(excited_group) + last_share_check() + + air.react() + + if(air.check_tile_graphic()) + update_visuals(air) + + if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + hotspot_expose(air.temperature, CELL_VOLUME) + for(var/atom/movable/item in src) + item.temperature_expose(air, air.temperature, CELL_VOLUME) + temperature_expose(air, air.temperature, CELL_VOLUME) + + if(air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) + if(consider_superconductivity(starting = 1)) + remove = 0 + + if(!excited_group && remove == 1) + air_master.remove_from_active(src) + + var/image/Aran5 + if(excited_group) + Aran5 = image('icons/mob/hud.dmi', "[excited_group.colour]") + else + Aran5 = image('icons/mob/hud.dmi', "hud_imp_chem") + overlays += Aran5 + spawn(15) + overlays -= Aran5 + + +/turf/simulated/proc/archive() + if(air) //For open space like floors + air.archive() + temperature_archived = temperature + archived_cycle = air_master.current_cycle + +/turf/simulated/proc/update_visuals(datum/gas_mixture/model) + overlays.Cut() + var/siding_icon_state = return_siding_icon_state() + if(siding_icon_state) + overlays += image('icons/turf/floors.dmi',siding_icon_state) + switch(model.graphic) + if("plasma") + overlays.Add(plmaster) + if("sleeping_agent") + overlays.Add(slmaster) + +/turf/simulated/proc/share_air(var/turf/simulated/T) + if(T.current_cycle < current_cycle) + var/difference + difference = air.share(T.air, atmos_adjacent_turfs_amount) + if(difference) + if(difference > 0) + consider_pressure_difference(T, difference) + else + T.consider_pressure_difference(src, difference) + last_share_check() + +/turf/proc/consider_pressure_difference(var/turf/simulated/T, var/difference) + air_master.high_pressure_delta |= src + if(difference > pressure_difference) + pressure_direction = get_dir(src, T) + pressure_difference = difference + +/turf/simulated/proc/last_share_check() + if(air.last_share > MINIMUM_AIR_TO_SUSPEND) + excited_group.breakdown = 0 + +/turf/proc/high_pressure_movements() + for(var/atom/movable/M in src) + M.experience_pressure_difference(pressure_difference, pressure_direction) + + + + +atom/movable/var/pressure_resistance = 5 +atom/movable/var/last_forced_movement = 0 + +atom/movable/proc/experience_pressure_difference(pressure_difference, direction) + if(last_forced_movement >= air_master.current_cycle) + return 0 + else if(!anchored) + if(pressure_difference > pressure_resistance) + last_forced_movement = air_master.current_cycle + spawn step(src, direction) + return 1 + + + + +/datum/excited_group + var/list/turf_list = list() + var/colour + var/breakdown = 0 + var/breakdown_cooldown = 0 + +/datum/excited_group/New() + colour = pick("hudhealthy","hudill","huddead","hudxeno","hudwanted","hudprisioner","hudcaptain","hudheadofpersonal","hudchiefengineer","hudresearchdirector","hudchiefmedicalofficer","hudquartermaster","hudheadofsecurity","hudchemist","hudscientist","hudroboticist","hudvirologist","hudgeneticist","hudmedicaldoctor","hudatmospherictechnician","hudstationengineer","hudshaftminer","hudsecurityofficer","huddetective","hudwarden","hudbotanist","hudlibrarian","hudlawyer","hudchaplain","hudbartender","hudchef","hudjanitor","hudclown","hudmime","hudcargotechnician","hudassistant","hudunknown","hudninja","hudalien","hudchangeling","huddeathsquad","hudoperative","hudwizard","hudmalborg","hudmalai","hudcultist","hudtraitor","hudrevolutionary") + if(air_master) + air_master.excited_groups += src + +/datum/excited_group/proc/add_turf(var/turf/simulated/T) + turf_list += T + T.excited_group = src + T.recently_active = 1 + reset_cooldowns() + +/datum/excited_group/proc/merge_groups(var/datum/excited_group/E) + if(turf_list.len > E.turf_list.len) + air_master.excited_groups -= E + for(var/turf/simulated/T in E.turf_list) + T.excited_group = src + turf_list += T + reset_cooldowns() + else + air_master.excited_groups -= src + for(var/turf/simulated/T in turf_list) + T.excited_group = E + E.turf_list += T + E.reset_cooldowns() + +/datum/excited_group/proc/reset_cooldowns() + breakdown_cooldown = 0 + +/datum/excited_group/proc/self_compare() + var/restore = 1 + var/turf/simulated/sample = pick(turf_list) + for(var/turf/simulated/T in turf_list) + if(!T.air.compare(sample.air)) + restore = 0 + break + if(restore) + return 1 + +/datum/excited_group/proc/self_breakdown() + var/datum/gas_mixture/A = new + for(var/turf/simulated/T in turf_list) + A.oxygen += T.air.oxygen + A.carbon_dioxide+= T.air.carbon_dioxide + A.nitrogen += T.air.nitrogen + A.toxins += T.air.toxins + for(var/turf/simulated/T in turf_list) + T.air.oxygen = A.oxygen/turf_list.len + T.air.carbon_dioxide= A.carbon_dioxide/turf_list.len + T.air.nitrogen = A.nitrogen/turf_list.len + T.air.toxins = A.toxins/turf_list.len + + +/datum/excited_group/proc/dismantle() + for(var/turf/simulated/T in turf_list) + T.excited = 0 + T.recently_active = 0 + air_master.active_turfs -= T + air_master.excited_groups -= src + +/datum/excited_group/proc/garbage_collect() + for(var/turf/simulated/T in turf_list) + T.excited_group = null + turf_list.Cut() + air_master.excited_groups -= src + + + + + + + + + + +turf/simulated/proc/super_conduct() + var/conductivity_directions = 0 + if(blocks_air) + //Does not participate in air exchange, so will conduct heat across all four borders at this time + conductivity_directions = NORTH|SOUTH|EAST|WEST + + if(archived_cycle < air_master.current_cycle) + archive() + else + //Does particate in air exchange so only consider directions not considered during process_cell() + for(var/direction in cardinal) + if(!(atmos_adjacent_turfs & direction) && !(atmos_supeconductivity & direction)) + conductivity_directions += direction + + if(conductivity_directions>0) + //Conduct with tiles around me + for(var/direction in cardinal) + if(conductivity_directions&direction) + var/turf/neighbor = get_step(src,direction) + + if(!neighbor.thermal_conductivity) + continue + + if(istype(neighbor, /turf/simulated)) //anything under this subtype will share in the exchange + var/turf/simulated/T = neighbor + + if(T.archived_cycle < air_master.current_cycle) + T.archive() + + if(T.air) + if(air) //Both tiles are open + air.temperature_share(T.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + else //Solid but neighbor is open + T.air.temperature_turf_share(src, T.thermal_conductivity) + air_master.add_to_active(T, 0) + else + if(air) //Open but neighbor is solid + air.temperature_turf_share(T, T.thermal_conductivity) + else //Both tiles are solid + share_temperature_mutual_solid(T, T.thermal_conductivity) + T.temperature_expose(null, T.temperature, null) + + T.consider_superconductivity() + + else + if(air) //Open + air.temperature_mimic(neighbor, neighbor.thermal_conductivity) + else + mimic_temperature_solid(neighbor, neighbor.thermal_conductivity) + + radiate_to_spess() + + //Conduct with air on my tile if I have it + if(air) + air.temperature_turf_share(src, thermal_conductivity) + + //Make sure still hot enough to continue conducting heat + if(air.temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) + air_master.active_super_conductivity -= src + return 0 + + else + if(temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) + air_master.active_super_conductivity -= src + return 0 + +turf/simulated/proc/consider_superconductivity(starting) + if(!thermal_conductivity) + return 0 + + if(air) + if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + return 0 + if(air.heat_capacity() < M_CELL_WITH_RATIO) // Was: MOLES_CELLSTANDARD*0.1*0.05 Since there are no variables here we can make this a constant. + return 0 + else + if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + return 0 + + air_master.active_super_conductivity |= src + return 1 + +turf/simulated/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 + var/delta_temperature = (temperature_archived - 2.7) //hardcoded space temperature + if((heat_capacity > 0) && (abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)) + + var/heat = thermal_conductivity*delta_temperature* \ + (heat_capacity*700000/(heat_capacity+700000)) //700000 is the heat_capacity from a space turf, hardcoded here + temperature -= heat/heat_capacity \ No newline at end of file diff --git a/code/__DEFINES.dm b/code/__DEFINES.dm index b5f7a43b1c3..fee3b7b951c 100644 --- a/code/__DEFINES.dm +++ b/code/__DEFINES.dm @@ -26,7 +26,6 @@ #define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD) // N2 standard value (79%) -var/turf/space/Space_Tile = locate(/turf/space) // A space tile to reference when atmos wants to remove excess heat. //ITEM INVENTORY SLOT BITMASKS diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 31bbd631c65..743bff756b8 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -893,28 +893,16 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl refined_trg -= B continue moving - var/list/doors = new/list() if(toupdate.len) for(var/turf/simulated/T1 in toupdate) - for(var/obj/machinery/door/D2 in T1) - doors += D2 - if(T1.parent) - air_master.groups_to_rebuild += T1.parent - else - air_master.tiles_to_update += T1 + T1.CalculateAdjacentTurfs() + air_master.add_to_active(T1,1) if(fromupdate.len) for(var/turf/simulated/T2 in fromupdate) - for(var/obj/machinery/door/D2 in T2) - doors += D2 - if(T2.parent) - air_master.groups_to_rebuild += T2.parent - else - air_master.tiles_to_update += T2 - - for(var/obj/O in doors) - O:update_nearby_tiles(1) + T2.CalculateAdjacentTurfs() + air_master.add_to_active(T2,1) @@ -1056,23 +1044,10 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0) continue moving - - - var/list/doors = new/list() - if(toupdate.len) for(var/turf/simulated/T1 in toupdate) - for(var/obj/machinery/door/D2 in T1) - doors += D2 - if(T1.parent) - air_master.groups_to_rebuild += T1.parent - else - air_master.tiles_to_update += T1 - - for(var/obj/O in doors) - O:update_nearby_tiles(1) - - + T1.CalculateAdjacentTurfs() + air_master.add_to_active(T1,1) return copiedobjs diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 34712f14759..50052e964f7 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -42,7 +42,7 @@ -/atom/proc/assume_air(datum/air_group/giver) +/atom/proc/assume_air(datum/gas_mixture/giver) del(giver) return null diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 836389a00eb..9438bfeaec7 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -129,8 +129,10 @@ environment.merge(removed) else loc.assume_air(removed) + air_update_turf() src.update_icon() + if(air_contents.return_pressure() < 1) can_label = 1 else diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index 00aedd93636..e3cc3efb1e3 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -66,6 +66,7 @@ environment.merge(removed) else loc.assume_air(removed) + air_update_turf() else var/pressure_delta = target_pressure - air_contents.return_pressure() //Can not have a pressure delta that would cause environment pressure > tank pressure @@ -80,6 +81,7 @@ removed = environment.remove(transfer_moles) else removed = loc.remove_air(transfer_moles) + air_update_turf() air_contents.merge(removed) //src.update_icon() diff --git a/code/game/machinery/atmoalter/zvent.dm b/code/game/machinery/atmoalter/zvent.dm index f15be283c23..2e7ce0ac9b7 100644 --- a/code/game/machinery/atmoalter/zvent.dm +++ b/code/game/machinery/atmoalter/zvent.dm @@ -23,7 +23,5 @@ var/datum/gas_mixture/conn_air = zturf_conn.air //TODO: pop culture reference var/datum/gas_mixture/my_air = myturf.air if (istype(conn_air) && istype(my_air)) - if (!my_air.compare(conn_air)) - myturf.reset_delay() - zturf_conn.reset_delay() my_air.share(conn_air) + air_update_turf() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 79ef6aee872..39a77b6ec2a 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -234,26 +234,13 @@ PlasmaBurn(exposed_temperature) /obj/machinery/door/airlock/plasma/proc/PlasmaBurn(temperature) - for(var/turf/simulated/floor/target_tile in range(2,loc)) - if(target_tile.parent && target_tile.parent.group_processing) - target_tile.parent.suspend_group_processing() - var/datum/gas_mixture/napalm = new - var/toxinsToDeduce = 35 - napalm.toxins = toxinsToDeduce - napalm.temperature = 400+T0C - target_tile.assume_air(napalm) - spawn (0) target_tile.hotspot_expose(temperature, 400) - for(var/obj/structure/falsewall/plasma/F in range(3,src))//Hackish as fuck, but until temperature_expose works, there is nothing I can do -Sieve - var/turf/T = get_turf(F) - T.ChangeTurf(/turf/simulated/wall/mineral/plasma/) - del (F) - for(var/turf/simulated/wall/mineral/plasma/W in range(3,src)) - W.ignite((temperature/4))//Added so that you can't set off a massive chain reaction with a small flame - for(var/obj/machinery/door/airlock/plasma/D in range(3,src)) - D.ignite(temperature/4) + atmos_spawn_air("fire", 500) new/obj/structure/door_assembly/door_assembly_0( src.loc ) del (src) +/obj/machinery/door/airlock/plasma/BlockSuperconductivity() //we don't stop the heat~ + return 0 + /obj/machinery/door/airlock/clown name = "bananium airlock" desc = "Honkhonkhonk" diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 318bd818132..40f01898536 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -21,17 +21,18 @@ if(density) layer = 3.1 //Above most items if closed explosion_resistance = initial(explosion_resistance) - update_heat_protection(get_turf(src)) else layer = 2.7 //Under all objects if opened. 2.7 due to tables being at 2.6 explosion_resistance = 0 - update_nearby_tiles(need_rebuild=1) + update_freelok_sight() + air_update_turf(1) return /obj/machinery/door/Del() density = 0 - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() ..() return @@ -65,6 +66,10 @@ return return +/obj/machinery/door/Move() + air_update_turf(1) + ..() + air_update_turf(1) /obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group) return 0 @@ -72,6 +77,8 @@ return !opacity return !density +/obj/machinery/door/CanAtmosPass() + return !density /obj/machinery/door/proc/bumpopen(mob/user as mob) if(operating) return @@ -197,7 +204,8 @@ explosion_resistance = 0 update_icon() SetOpacity(0) - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() if(operating) operating = 0 @@ -218,63 +226,17 @@ if(visible && !glass) SetOpacity(1) //caaaaarn! operating = 0 - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() return /obj/machinery/door/proc/requiresID() return 1 -/obj/machinery/door/proc/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/north = get_step(source,NORTH) - var/turf/simulated/south = get_step(source,SOUTH) - var/turf/simulated/east = get_step(source,EAST) - var/turf/simulated/west = get_step(source,WEST) - - update_heat_protection(loc) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(north)) - if(north.parent) - air_master.groups_to_rebuild += north.parent - else - air_master.tiles_to_update += north - if(istype(south)) - if(south.parent) - air_master.groups_to_rebuild += south.parent - else - air_master.tiles_to_update += south - if(istype(east)) - if(east.parent) - air_master.groups_to_rebuild += east.parent - else - air_master.tiles_to_update += east - if(istype(west)) - if(west.parent) - air_master.groups_to_rebuild += west.parent - else - air_master.tiles_to_update += west - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(north)) air_master.tiles_to_update += north - if(istype(south)) air_master.tiles_to_update += south - if(istype(east)) air_master.tiles_to_update += east - if(istype(west)) air_master.tiles_to_update += west - return 1 - -/obj/machinery/door/proc/update_heat_protection(var/turf/simulated/source) - if(istype(source)) - if(src.density && (src.opacity || src.heat_proof)) - source.thermal_conductivity = DOOR_HEAT_TRANSFER_COEFFICIENT - else - source.thermal_conductivity = initial(source.thermal_conductivity) +/obj/machinery/door/BlockSuperconductivity() + if(opacity || heat_proof) + return 1 + return 0 /obj/machinery/door/morgue icon = 'icons/obj/doors/doormorgue.dmi' \ No newline at end of file diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 75b3b195e33..5628900ab88 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -128,27 +128,8 @@ else return 1 - -/obj/machinery/door/firedoor/border_only/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/destination = get_step(source,dir) - - update_heat_protection(loc) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(destination)) - if(destination.parent) - air_master.groups_to_rebuild += destination.parent - else - air_master.tiles_to_update += destination +/obj/machinery/door/firedoor/border_only/CanAtmosPass(var/turf/T) + if(get_dir(loc, T) == dir) + return !density else - if(istype(source)) air_master.tiles_to_update += source - if(istype(destination)) air_master.tiles_to_update += destination - return 1 \ No newline at end of file + return 1 \ No newline at end of file diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index 6dac3ffc67c..48ea78154fb 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -49,7 +49,8 @@ density = 0 explosion_resistance = 0 - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() operating = 0 return 1 @@ -69,7 +70,8 @@ density = 1 explosion_resistance = initial(explosion_resistance) SetOpacity(1) - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() sleep(10) operating = 0 diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 5497b39ad3e..31917770b5f 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -12,30 +12,6 @@ var/obj/item/weapon/airlock_electronics/electronics = null explosion_resistance = 5 - -/obj/machinery/door/window/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/target = get_step(source,dir) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(target)) - if(target.parent) - air_master.groups_to_rebuild += target.parent - else - air_master.tiles_to_update += target - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(target)) air_master.tiles_to_update += target - - return 1 - /obj/machinery/door/window/New() ..() @@ -87,6 +63,12 @@ else return 1 +/obj/machinery/door/window/CanAtmosPass(var/turf/T) + if(get_dir(loc, T) == dir) + return !density + else + return 1 + /obj/machinery/door/window/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 @@ -110,7 +92,8 @@ explosion_resistance = 0 src.density = 0 // src.sd_SetOpacity(0) //TODO: why is this here? Opaque windoors? ~Carn - update_nearby_tiles() + air_update_turf(1) + update_freelok_sight() if(operating == 1) //emag again src.operating = 0 @@ -128,8 +111,8 @@ explosion_resistance = initial(explosion_resistance) // if(src.visible) // SetOpacity(1) //TODO: why is this here? Opaque windoors? ~Carn - update_nearby_tiles() - + air_update_turf(1) + update_freelok_sight() sleep(10) src.operating = 0 diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 01d8a565c49..8b77348e8c8 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -13,63 +13,25 @@ /obj/machinery/shield/New() src.dir = pick(1,2,3,4) ..() - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) /obj/machinery/shield/Del() opacity = 0 density = 0 - update_nearby_tiles() + air_update_turf(1) ..() +/obj/machinery/shield/Move() + air_update_turf(1) + ..() + air_update_turf(1) + /obj/machinery/shield/CanPass(atom/movable/mover, turf/target, height, air_group) if(!height || air_group) return 0 else return ..() -//Looks like copy/pasted code... I doubt 'need_rebuild' is even used here - Nodrak -/obj/machinery/shield/proc/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/north = get_step(source,NORTH) - var/turf/simulated/south = get_step(source,SOUTH) - var/turf/simulated/east = get_step(source,EAST) - var/turf/simulated/west = get_step(source,WEST) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(north)) - if(north.parent) - air_master.groups_to_rebuild += north.parent - else - air_master.tiles_to_update += north - if(istype(south)) - if(south.parent) - air_master.groups_to_rebuild += south.parent - else - air_master.tiles_to_update += south - if(istype(east)) - if(east.parent) - air_master.groups_to_rebuild += east.parent - else - air_master.tiles_to_update += east - if(istype(west)) - if(west.parent) - air_master.groups_to_rebuild += west.parent - else - air_master.tiles_to_update += west - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(north)) air_master.tiles_to_update += north - if(istype(south)) air_master.tiles_to_update += south - if(istype(east)) air_master.tiles_to_update += east - if(istype(west)) air_master.tiles_to_update += west - - return 1 - +/obj/machinery/shield/CanAtmosPass(var/turf/T) + return !density /obj/machinery/shield/attackby(obj/item/weapon/W as obj, mob/user as mob) if(!istype(W)) return diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 37ff4693371..ae8aa8c8a1f 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -178,6 +178,7 @@ //world << "now at [removed.temperature]" env.merge(removed) + air_update_turf() //world << "turf now at [env.temperature]" @@ -187,4 +188,5 @@ update_icon() + return \ No newline at end of file diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index cd813983222..6d684e602fe 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -36,18 +36,6 @@ health = 120 -/obj/structure/alien/resin/New() - ..() - var/turf/T = get_turf(src) - T.thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT - - -/obj/structure/alien/resin/Del() - var/turf/T = get_turf(src) - T.thermal_conductivity = initial(T.thermal_conductivity) - ..() - - /obj/structure/alien/resin/proc/healthcheck() if(health <=0) del(src) diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index f3d6b78a609..7206919d1a0 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -915,16 +915,21 @@ steam.start() -- spawns the effect New() ..() - update_nearby_tiles(1) + air_update_turf(1) Del() density = 0 - update_nearby_tiles(1) + air_update_turf(1) ..() + Move() + air_update_turf(1) + ..() + air_update_turf(1) + proc/updateicon() if(metal == 1) icon_state = "metalfoam" @@ -985,52 +990,8 @@ steam.start() -- spawns the effect if(air_group) return 0 return !density - - // shouldn't this be a general procedure? - // not sure if this neccessary or overkill - proc/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/north = get_step(source,NORTH) - var/turf/simulated/south = get_step(source,SOUTH) - var/turf/simulated/east = get_step(source,EAST) - var/turf/simulated/west = get_step(source,WEST) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(north)) - if(north.parent) - air_master.groups_to_rebuild += north.parent - else - air_master.tiles_to_update += north - if(istype(south)) - if(south.parent) - air_master.groups_to_rebuild += south.parent - else - air_master.tiles_to_update += south - if(istype(east)) - if(east.parent) - air_master.groups_to_rebuild += east.parent - else - air_master.tiles_to_update += east - if(istype(west)) - if(west.parent) - air_master.groups_to_rebuild += west.parent - else - air_master.tiles_to_update += west - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(north)) air_master.tiles_to_update += north - if(istype(south)) air_master.tiles_to_update += south - if(istype(east)) air_master.tiles_to_update += east - if(istype(west)) air_master.tiles_to_update += west - - return 1 + CanAtmosPass() + return !density /datum/effect/effect/system/reagents_explosion var/amount // TNT equivalent diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index 31d9afeefca..6820ce62464 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -46,39 +46,12 @@ del(src) /obj/effect/mine/proc/triggern2o(obj) - //example: n2o triggerproc - //note: im lazy - - for (var/turf/simulated/floor/target in range(1,src)) - if(!target.blocks_air) - if(target.parent) - target.parent.suspend_group_processing() - - var/datum/gas_mixture/payload = new - var/datum/gas/sleeping_agent/trace_gas = new - - trace_gas.moles = 30 - payload += trace_gas - - target.air.merge(payload) - + atmos_spawn_air("n2o", 360) spawn(0) del(src) /obj/effect/mine/proc/triggerplasma(obj) - for (var/turf/simulated/floor/target in range(1,src)) - if(!target.blocks_air) - if(target.parent) - target.parent.suspend_group_processing() - - var/datum/gas_mixture/payload = new - - payload.toxins = 30 - - target.air.merge(payload) - - target.hotspot_expose(1000, CELL_VOLUME) - + atmos_spawn_air("fire", 360) spawn(0) del(src) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 7cb46a33d89..8eebb331e00 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -952,18 +952,19 @@ var/global/list/obj/item/device/pda/PDAs = list() if (istype(A, /obj/machinery/atmospherics/pipe/tank)) var/obj/icon = A + var/obj/machinery/atmospherics/pipe/tank/T = A for (var/mob/O in viewers(user, null)) - O << "\red [user] has used [src] on \icon[icon] [A]" + O << "\red [user] has used [src] on \icon[icon] [T]" - var/pressure = A:parent.air.return_pressure() - var/total_moles = A:parent.air.total_moles() + var/pressure = T.parent.air.return_pressure() + var/total_moles = T.parent.air.total_moles() user << "\blue Results of analysis of \icon[icon]" if (total_moles>0) - var/o2_concentration = A:parent.air.oxygen/total_moles - var/n2_concentration = A:parent.air.nitrogen/total_moles - var/co2_concentration = A:parent.air.carbon_dioxide/total_moles - var/plasma_concentration = A:parent.air.toxins/total_moles + var/o2_concentration = T.parent.air.oxygen/total_moles + var/n2_concentration = T.parent.air.nitrogen/total_moles + var/co2_concentration = T.parent.air.carbon_dioxide/total_moles + var/plasma_concentration = T.parent.air.toxins/total_moles var/unknown_concentration = 1-(o2_concentration+n2_concentration+co2_concentration+plasma_concentration) @@ -974,7 +975,7 @@ var/global/list/obj/item/device/pda/PDAs = list() user << "\blue Plasma: [round(plasma_concentration*100)]%" if(unknown_concentration>0.01) user << "\red Unknown: [round(unknown_concentration*100)]%" - user << "\blue Temperature: [round(A:parent.air.temperature-T0C)]°C" + user << "\blue Temperature: [round(T.parent.air.temperature-T0C)]°C" else user << "\blue Tank is empty!" diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 309b94adead..20069c324a0 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -87,6 +87,7 @@ W.dir = dir_to_set W.ini_dir = W.dir W.anchored = 0 + W.air_update_turf(1) src.use(1) if("Full Window") if(!src) return 1 @@ -102,6 +103,7 @@ W.dir = SOUTHWEST W.ini_dir = SOUTHWEST W.anchored = 0 + W.air_update_turf(1) src.use(2) return 0 diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 9eaf50fc810..9c0dd273c52 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -187,8 +187,8 @@ /obj/item/weapon/flamethrower/proc/flame_turf(turflist) if(!lit || operating) return operating = 1 - for(var/turf/T in turflist) - if(T.density || istype(T, /turf/space)) + for(var/turf/simulated/T in turflist) + if(!T.air) break if(!previousturf && length(turflist)>1) previousturf = get_turf(src) @@ -214,6 +214,7 @@ //Burn it based on transfered gas target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500) // -- More of my "how do I shot fire?" dickery. -- TLE //location.hotspot_expose(1000,500,1) + air_master.add_to_active(target, 0) return diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 7a94823d82d..4c9ab47e7e3 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -19,7 +19,7 @@ processing_objects.Remove(src) return 0 -/obj/assume_air(datum/air_group/giver) +/obj/assume_air(datum/gas_mixture/giver) if(loc) return loc.assume_air(giver) else diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 92635f7f30c..bc67e9582b9 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -20,12 +20,17 @@ ..() icon_state = mineralType name = "[mineralType] door" - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) Del() - update_nearby_tiles() + air_update_turf(1) ..() + Move() + air_update_turf(1) + ..() + air_update_turf(1) + Bumped(atom/user) ..() if(!state) @@ -51,6 +56,9 @@ return !opacity return !density + CanAtmosPass() + return !density + proc/TryToSwitchState(atom/user) if(isSwitchingStates) return if(ismob(user)) @@ -163,49 +171,7 @@ CheckHardness() return - proc/update_nearby_tiles(need_rebuild) //Copypasta from airlock code - if(!air_master) return 0 - var/turf/simulated/source = loc - var/turf/simulated/north = get_step(source,NORTH) - var/turf/simulated/south = get_step(source,SOUTH) - var/turf/simulated/east = get_step(source,EAST) - var/turf/simulated/west = get_step(source,WEST) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(north)) - if(north.parent) - air_master.groups_to_rebuild += north.parent - else - air_master.tiles_to_update += north - if(istype(south)) - if(south.parent) - air_master.groups_to_rebuild += south.parent - else - air_master.tiles_to_update += south - if(istype(east)) - if(east.parent) - air_master.groups_to_rebuild += east.parent - else - air_master.tiles_to_update += east - if(istype(west)) - if(west.parent) - air_master.groups_to_rebuild += west.parent - else - air_master.tiles_to_update += west - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(north)) air_master.tiles_to_update += north - if(istype(south)) air_master.tiles_to_update += south - if(istype(east)) air_master.tiles_to_update += east - if(istype(west)) air_master.tiles_to_update += west - - return 1 /obj/structure/mineral_door/iron mineralType = "metal" @@ -249,22 +215,9 @@ TemperatureAct(exposed_temperature) proc/TemperatureAct(temperature) - for(var/turf/simulated/floor/target_tile in range(2,loc)) - if(target_tile.parent && target_tile.parent.group_processing) - target_tile.parent.suspend_group_processing() - - var/datum/gas_mixture/napalm = new - - var/toxinsToDeduce = temperature/10 - - napalm.toxins = toxinsToDeduce - napalm.temperature = 200+T0C - - target_tile.assume_air(napalm) - spawn (0) target_tile.hotspot_expose(temperature, 400) - - hardness -= toxinsToDeduce/100 - CheckHardness() + atmos_spawn_air("fire", 500) + hardness = 0 + CheckHardness() /obj/structure/mineral_door/transparent/diamond mineralType = "diamond" diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 316e8b89bc2..983e808ab85 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -29,13 +29,18 @@ obj/structure/windoor_assembly obj/structure/windoor_assembly/New(dir=NORTH) ..() src.ini_dir = src.dir - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) obj/structure/windoor_assembly/Del() density = 0 - update_nearby_tiles() + air_update_turf(1) ..() +/obj/structure/windoor_assembly/Move() + air_update_turf(1) + ..() + air_update_turf(1) + /obj/structure/windoor_assembly/update_icon() icon_state = "[facing]_[secure]windoor_assembly[state]" @@ -48,6 +53,12 @@ obj/structure/windoor_assembly/Del() else return 1 +/obj/structure/windoor_assembly/CanAtmosPass(var/turf/T) + if(get_dir(loc, T) == dir) + return !density + else + return 1 + /obj/structure/windoor_assembly/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 @@ -263,13 +274,13 @@ obj/structure/windoor_assembly/Del() if (src.anchored) usr << "It is fastened to the floor; therefore, you can't rotate it!" return 0 - if(src.state != "01") - update_nearby_tiles(need_rebuild=1) //Compel updates before + //if(src.state != "01") + //update_nearby_tiles(need_rebuild=1) //Compel updates before src.dir = turn(src.dir, 270) - if(src.state != "01") - update_nearby_tiles(need_rebuild=1) + //if(src.state != "01") + //update_nearby_tiles(need_rebuild=1) src.ini_dir = src.dir update_icon() @@ -290,26 +301,3 @@ obj/structure/windoor_assembly/Del() update_icon() return - -/obj/structure/windoor_assembly/proc/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/target = get_step(source,dir) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(target)) - if(target.parent) - air_master.groups_to_rebuild += target.parent - else - air_master.tiles_to_update += target - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(target)) air_master.tiles_to_update += target - - return 1 \ No newline at end of file diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 61e863bd604..6177c16b934 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -216,10 +216,9 @@ usr << "It is fastened to the floor therefore you can't rotate it!" return 0 - update_nearby_tiles(need_rebuild=1) //Compel updates before dir = turn(dir, 90) // updateSilicate() - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) ini_dir = dir return @@ -233,10 +232,9 @@ usr << "It is fastened to the floor therefore you can't rotate it!" return 0 - update_nearby_tiles(need_rebuild=1) //Compel updates before dir = turn(dir, 270) // updateSilicate() - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) ini_dir = dir return @@ -274,7 +272,7 @@ else icon_state = "window" - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) update_nearby_icons() return @@ -282,41 +280,23 @@ /obj/structure/window/Del() density = 0 - update_nearby_tiles() + air_update_turf(1) playsound(src, "shatter", 70, 1) update_nearby_icons() ..() /obj/structure/window/Move() - update_nearby_tiles(need_rebuild=1) + air_update_turf(1) ..() dir = ini_dir - update_nearby_tiles(need_rebuild=1) - - -//This proc has to do with airgroups and atmos, it has nothing to do with smoothwindows, that's update_nearby_tiles(). -/obj/structure/window/proc/update_nearby_tiles(need_rebuild) - if(!air_master) return 0 - - var/turf/simulated/source = loc - var/turf/simulated/target = get_step(source,dir) - - if(need_rebuild) - if(istype(source)) //Rebuild/update nearby group geometry - if(source.parent) - air_master.groups_to_rebuild += source.parent - else - air_master.tiles_to_update += source - if(istype(target)) - if(target.parent) - air_master.groups_to_rebuild += target.parent - else - air_master.tiles_to_update += target - else - if(istype(source)) air_master.tiles_to_update += source - if(istype(target)) air_master.tiles_to_update += target + air_update_turf(1) +/obj/structure/window/CanAtmosPass(turf/T) + if(get_dir(loc, T) == dir) + return !density + if(dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST) + return !density return 1 //checks if this window is full-tile one @@ -325,7 +305,7 @@ return 1 return 0 -//This proc is used to update the icons of nearby windows. It should not be confused with update_nearby_tiles(), which is an atmos proc! +//This proc is used to update the icons of nearby windows. /obj/structure/window/proc/update_nearby_icons() update_icon() for(var/direction in cardinal) diff --git a/code/game/turfs/simulated/walls_mineral.dm b/code/game/turfs/simulated/walls_mineral.dm index 60666a67a07..fd063b899aa 100644 --- a/code/game/turfs/simulated/walls_mineral.dm +++ b/code/game/turfs/simulated/walls_mineral.dm @@ -82,6 +82,7 @@ icon_state = "plasma0" walltype = "plasma" mineral = "plasma" + thermal_conductivity = 0.04 /turf/simulated/wall/mineral/plasma/attackby(obj/item/weapon/W as obj, mob/user as mob) if(is_hot(W) > 300)//If the temperature of the object is over 300, then ignite @@ -93,23 +94,7 @@ spawn(2) new /obj/structure/girder(src) src.ChangeTurf(/turf/simulated/floor) - for(var/turf/simulated/floor/target_tile in range(0,src)) - if(target_tile.parent && target_tile.parent.group_processing) - target_tile.parent.suspend_group_processing() - var/datum/gas_mixture/napalm = new - var/toxinsToDeduce = 20 - napalm.toxins = toxinsToDeduce - napalm.temperature = 400+T0C - target_tile.assume_air(napalm) - spawn (0) target_tile.hotspot_expose(temperature, 400) - for(var/obj/structure/falsewall/plasma/F in range(3,src))//Hackish as fuck, but until temperature_expose works, there is nothing I can do -Sieve - var/turf/T = get_turf(F) - T.ChangeTurf(/turf/simulated/wall/mineral/plasma/) - del (F) - for(var/turf/simulated/wall/mineral/plasma/W in range(3,src)) - W.ignite((temperature/4))//Added so that you can't set off a massive chain reaction with a small flame - for(var/obj/machinery/door/airlock/plasma/D in range(3,src)) - D.ignite(temperature/4) + atmos_spawn_air("fire", 400) /turf/simulated/wall/mineral/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)//Doesn't fucking work because walls don't interact with air :( if(exposed_temperature > 300) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 27ffd14c860..50b5cee9c0c 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -30,6 +30,16 @@ return return +// Adds the adjacent turfs to the current atmos processing +/turf/Del() + if(air_master) + for(var/direction in cardinal) + if(atmos_adjacent_turfs & direction) + var/turf/simulated/T = get_step(src, direction) + if(istype(T)) + air_master.add_to_active(T) + ..() + /turf/DblClick() if(istype(usr, /mob/living/silicon/ai)) return move_camera_by_click() @@ -202,10 +212,12 @@ if(path == type) return src var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/old_opacity = opacity + if(air_master) + air_master.remove_from_active(src) var/turf/W = new path(src) - if(istype(W, /turf/simulated/floor)) + if(istype(W, /turf/simulated)) W:Assimilate_Air() W.RemoveLattice() @@ -219,36 +231,40 @@ W.UpdateAffectingLights() W.levelupdate() + W.CalculateAdjacentTurfs() return W //////Assimilate Air////// /turf/simulated/proc/Assimilate_Air() - var/aoxy = 0//Holders to assimilate air from nearby turfs - var/anitro = 0 - var/aco = 0 - var/atox = 0 - var/atemp = 0 - var/turf_count = 0 + if(air) + var/aoxy = 0//Holders to assimilate air from nearby turfs + var/anitro = 0 + var/aco = 0 + var/atox = 0 + var/atemp = 0 + var/turf_count = 0 - for(var/direction in cardinal)//Only use cardinals to cut down on lag - var/turf/T = get_step(src,direction) - if(istype(T,/turf/space))//Counted as no air - turf_count++//Considered a valid turf for air calcs - continue - else if(istype(T,/turf/simulated/floor)) - var/turf/simulated/S = T - if(S.air)//Add the air's contents to the holders - aoxy += S.air.oxygen - anitro += S.air.nitrogen - aco += S.air.carbon_dioxide - atox += S.air.toxins - atemp += S.air.temperature - turf_count ++ - air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like - air.nitrogen = (anitro/max(turf_count,1)) - air.carbon_dioxide = (aco/max(turf_count,1)) - air.toxins = (atox/max(turf_count,1)) - air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant + for(var/direction in cardinal)//Only use cardinals to cut down on lag + var/turf/T = get_step(src,direction) + if(istype(T,/turf/space))//Counted as no air + turf_count++//Considered a valid turf for air calcs + continue + else if(istype(T,/turf/simulated/floor)) + var/turf/simulated/S = T + if(S.air)//Add the air's contents to the holders + aoxy += S.air.oxygen + anitro += S.air.nitrogen + aco += S.air.carbon_dioxide + atox += S.air.toxins + atemp += S.air.temperature + turf_count ++ + air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like + air.nitrogen = (anitro/max(turf_count,1)) + air.carbon_dioxide = (aco/max(turf_count,1)) + air.toxins = (atox/max(turf_count,1)) + air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant + if(air_master) + air_master.add_to_active(src) /turf/proc/ReplaceWithLattice() src.ChangeTurf(/turf/space) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index c8848ddba8b..b5b31aff2a1 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -107,12 +107,10 @@ var/list/admin_verbs_debug = list( /client/proc/Debug2, /client/proc/kill_air, /client/proc/cmd_debug_make_powernets, - /client/proc/kill_airgroup, /client/proc/debug_controller, /client/proc/cmd_debug_mob_lists, /client/proc/cmd_admin_delete, /client/proc/cmd_debug_del_all, - /client/proc/air_report, /client/proc/reload_admins, /client/proc/restart_controller, /client/proc/enable_debug_verbs, @@ -185,12 +183,10 @@ var/list/admin_verbs_hideable = list( /client/proc/reload_admins, /client/proc/kill_air, /client/proc/cmd_debug_make_powernets, - /client/proc/kill_airgroup, /client/proc/debug_controller, /client/proc/startSinglo, /client/proc/cmd_debug_mob_lists, /client/proc/cmd_debug_del_all, - /client/proc/air_report, /client/proc/enable_debug_verbs, /proc/possess, /proc/release @@ -239,7 +235,6 @@ var/list/admin_verbs_hideable = list( /client/proc/count_objects_on_z_level, /client/proc/count_objects_all, /client/proc/cmd_assume_direct_control, - /client/proc/jump_to_dead_group, /client/proc/startSinglo, /client/proc/ticklag, /client/proc/cmd_admin_grantfullaccess, diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index ecd5c7febf8..e87bf74e2d5 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -1,46 +1,3 @@ -/client/proc/air_report() - set category = "Debug" - set name = "Show Air Report" - - if(!master_controller || !air_master) - alert(usr,"Master_controller or air_master not found.","Air Report") - return 0 - - var/active_groups = 0 - var/inactive_groups = 0 - var/active_tiles = 0 - for(var/datum/air_group/group in air_master.air_groups) - if(group.group_processing) - active_groups++ - else - inactive_groups++ - active_tiles += group.members.len - - var/hotspots = 0 - for(var/obj/effect/hotspot/hotspot in world) - hotspots++ - - var/output = {"AIR SYSTEMS REPORT
-General Processing Data
-# of Groups: [air_master.air_groups.len]
----- Active: [active_groups]
----- Inactive: [inactive_groups]
--------- Tiles: [active_tiles]
-# of Active Singletons: [air_master.active_singletons.len]
-
-Special Processing Data
-Hotspot Processing: [hotspots]
-High Temperature Processing: [air_master.active_super_conductivity.len]
-High Pressure Processing: [air_master.high_pressure_delta.len] (not yet implemented)
-
-Geometry Processing Data
-Group Rebuild: [air_master.groups_to_rebuild.len]
-Tile Update: [air_master.tiles_to_update.len]
-"} - - usr << browse(output,"window=airreport") - feedback_add_details("admin_verb","SAR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - /client/proc/air_status(turf/target as turf) set category = "Debug" set name = "Display Air Status" @@ -138,47 +95,6 @@ load_admins() feedback_add_details("admin_verb","RLDA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - -/client/proc/jump_to_dead_group() - set name = "Jump to dead group" - set category = "Debug" - if(!holder) - src << "Only administrators may use this command." - return - - if(!air_master) - usr << "Cannot find air_system" - return - var/datum/air_group/dead_groups = list() - for(var/datum/air_group/group in air_master.air_groups) - if (!group.group_processing) - dead_groups += group - var/datum/air_group/dest_group = pick(dead_groups) - usr.loc = pick(dest_group.members) - feedback_add_details("admin_verb","JDAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return - -/client/proc/kill_airgroup() - set name = "Kill Local Airgroup" - set desc = "Use this to allow manual manupliation of atmospherics." - set category = "Debug" - if(!holder) - src << "Only administrators may use this command." - return - - if(!air_master) - usr << "Cannot find air_system" - return - - var/turf/T = get_turf(usr) - if(istype(T, /turf/simulated)) - var/datum/air_group/AG = T:parent - AG.next_check = 30 - AG.group_processing = 0 - else - usr << "Local airgroup is unsimulated!" - feedback_add_details("admin_verb","KLAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - /client/proc/print_jobban_old() set name = "Print Jobban Log" set desc = "This spams all the active jobban entries for the current round to standard output." diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index ed3954fd698..8ac539f6c79 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -131,7 +131,6 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/count_objects_on_z_level src.verbs += /client/proc/count_objects_all src.verbs += /client/proc/cmd_assume_direct_control //-errorage - src.verbs += /client/proc/jump_to_dead_group src.verbs += /client/proc/startSinglo src.verbs += /client/proc/ticklag //allows you to set the ticklag. src.verbs += /client/proc/cmd_admin_grantfullaccess @@ -142,8 +141,6 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/print_jobban_old src.verbs += /client/proc/print_jobban_old_filter src.verbs += /client/proc/forceEvent - src.verbs += /client/proc/break_all_air_groups - src.verbs += /client/proc/regroup_all_air_groups src.verbs += /client/proc/kill_pipe_processing src.verbs += /client/proc/kill_air_processing src.verbs += /client/proc/disable_communication @@ -239,27 +236,6 @@ var/intercom_range_display_status = 0 world << "There are [count] objects of type [type_path] in the game world" feedback_add_details("admin_verb","mOBJ") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - -var/global/prevent_airgroup_regroup = 0 - -/client/proc/break_all_air_groups() - set category = "Mapping" - set name = "Break All Airgroups" - - prevent_airgroup_regroup = 1 - for(var/datum/air_group/AG in air_master.air_groups) - AG.suspend_group_processing() - message_admins("[src.ckey] used 'Break All Airgroups'") - -/client/proc/regroup_all_air_groups() - set category = "Mapping" - set name = "Regroup All Airgroups Attempt" - - prevent_airgroup_regroup = 0 - for(var/datum/air_group/AG in air_master.air_groups) - AG.check_regroup() - message_admins("[src.ckey] used 'Regroup All Airgroups Attempt'") - /client/proc/kill_pipe_processing() set category = "Mapping" set name = "Kill pipe processing" diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 57e6c42a292..69c8deedd00 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -213,7 +213,7 @@ new src.type(tunnel, rand(10, 15), 0, dir) else SpawnFloor(tunnel) - else if(!istype(tunnel, src.parent)) // We hit space/normal/wall, stop our tunnel. + else //if(!istype(tunnel, src.parent)) // We hit space/normal/wall, stop our tunnel. break // Chance to change our direction left or right. diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index ff87953a519..97e09c42c18 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -95,7 +95,7 @@ if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath + var/datum/gas_mixture/breath // HACK NEED CHANGING LATER if(health <= config.health_threshold_crit) losebreath++ diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 0e7b4f40a32..34810129f39 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -70,7 +70,7 @@ if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath + var/datum/gas_mixture/breath // HACK NEED CHANGING LATER if(health <= config.health_threshold_crit) losebreath++ diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 27aa1113e2b..753c3a325c4 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -229,7 +229,7 @@ if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath + var/datum/gas_mixture/breath // HACK NEED CHANGING LATER if(health <= config.health_threshold_crit) losebreath++ diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 487ddc5215b..1edfa0c004f 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -156,7 +156,7 @@ if(!loc) return //probably ought to make a proper fix for this, but :effort: --NeoFite var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath + var/datum/gas_mixture/breath if(health <= config.health_threshold_crit) losebreath++ if(losebreath>0) //Suffocating so do not take a breath diff --git a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm index 0eba92cfeeb..e71571fe4ce 100644 --- a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm +++ b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm @@ -49,8 +49,7 @@ // DOORS // Simply updates the visibility of the area when it opens/closes/destroyed. -/obj/machinery/door/update_nearby_tiles(need_rebuild) - . = ..(need_rebuild) +/obj/machinery/door/proc/update_freelok_sight() // Glass door glass = 1 // don't check then? if(!glass && cameranet) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 25db03a46ab..15f6ce398fc 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -644,7 +644,8 @@ note dizziness decrements automatically in the mob's Life() proc. if(master_controller) stat(null,"MasterController-[last_tick_duration] ([master_controller.processing?"On":"Off"]-[controller_iteration])") - stat(null,"Air-[master_controller.air_cost]\tSun-[master_controller.sun_cost]") + stat(null,"Air-[master_controller.air_cost]\t#[air_master.active_turfs.len]") + stat(null,"Sun-[master_controller.sun_cost]") stat(null,"Mob-[master_controller.mobs_cost]\t#[mob_list.len]") stat(null,"Dis-[master_controller.diseases_cost]\t#[active_diseases.len]") stat(null,"Mch-[master_controller.machines_cost]\t#[machines.len]") diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index ce2819ad658..948350c3f98 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -1369,19 +1369,12 @@ datum if (egg.grown) egg.Hatch()*/ if((!O) || (!volume)) return 0 - var/turf/the_turf = get_turf(O) - var/datum/gas_mixture/napalm = new - var/datum/gas/volatile_fuel/fuel = new - fuel.moles = 5 - napalm.trace_gases += fuel - the_turf.assume_air(napalm) - reaction_turf(var/turf/T, var/volume) + O.atmos_spawn_air("fuel", 5) + + reaction_turf(var/turf/simulated/T, var/volume) src = null - var/datum/gas_mixture/napalm = new - var/datum/gas/volatile_fuel/fuel = new - fuel.moles = 5 - napalm.trace_gases += fuel - T.assume_air(napalm) + if(istype(T)) + T.atmos_spawn_air("fuel", 5) return toxin/lexorin diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm index c3308970122..eb060df709c 100644 --- a/code/modules/reagents/Chemistry-Recipes.dm +++ b/code/modules/reagents/Chemistry-Recipes.dm @@ -348,18 +348,9 @@ datum required_reagents = list("aluminum" = 1, "plasma" = 1, "sacid" = 1 ) result_amount = 1 on_reaction(var/datum/reagents/holder, var/created_volume) - var/turf/location = get_turf(holder.my_atom.loc) - for(var/turf/simulated/floor/target_tile in range(0,location)) - if(target_tile.parent && target_tile.parent.group_processing) - target_tile.parent.suspend_group_processing() - - var/datum/gas_mixture/napalm = new - - napalm.toxins = created_volume - napalm.temperature = 400+T0C - - target_tile.assume_air(napalm) - spawn (0) target_tile.hotspot_expose(700, 400) + var/turf/simulated/T = get_turf(src) + if(istype(T)) + T.atmos_spawn_air("fire", created_volume) holder.del_reagent("napalm") return @@ -1229,18 +1220,9 @@ datum for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) - var/turf/location = get_turf(holder.my_atom.loc) - for(var/turf/simulated/floor/target_tile in range(0,location)) - if(target_tile.parent && target_tile.parent.group_processing) - target_tile.parent.suspend_group_processing() - - var/datum/gas_mixture/napalm = new - - napalm.toxins = 50 - napalm.temperature = 2400 - - target_tile.assume_air(napalm) - spawn (0) target_tile.hotspot_expose(700, 400) + var/turf/simulated/T = get_turf(src) + if(istype(T)) + T.atmos_spawn_air("fire", 50) //Yellow slimeoverload diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index c819a11ec92..9fd27db3370 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -368,6 +368,7 @@ //Actually transfer the gas var/datum/gas_mixture/removed = env.remove(transfer_moles) air_contents.merge(removed) + air_update_turf() // if full enough, switch to ready mode diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index e7aed54f818..3e458226f1a 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -123,6 +123,7 @@ removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000) env.merge(removed) + air_update_turf() /obj/machinery/r_n_d/server/attackby(var/obj/item/O as obj, var/mob/user as mob) if (disabled) diff --git a/tgstation.dme b/tgstation.dme index 311dad68c1e..57ee6a16acc 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6,6 +6,43 @@ // BEGIN_FILE_DIR #define FILE_DIR . +#define FILE_DIR "html" +#define FILE_DIR "icons" +#define FILE_DIR "icons/effects" +#define FILE_DIR "icons/mecha" +#define FILE_DIR "icons/misc" +#define FILE_DIR "icons/mob" +#define FILE_DIR "icons/obj" +#define FILE_DIR "icons/obj/assemblies" +#define FILE_DIR "icons/obj/atmospherics" +#define FILE_DIR "icons/obj/clothing" +#define FILE_DIR "icons/obj/doors" +#define FILE_DIR "icons/obj/flora" +#define FILE_DIR "icons/obj/machines" +#define FILE_DIR "icons/obj/pipes" +#define FILE_DIR "icons/obj/power_cond" +#define FILE_DIR "icons/pda_icons" +#define FILE_DIR "icons/spideros_icons" +#define FILE_DIR "icons/stamp_icons" +#define FILE_DIR "icons/Testing" +#define FILE_DIR "icons/turf" +#define FILE_DIR "icons/vending_icons" +#define FILE_DIR "sound" +#define FILE_DIR "sound/AI" +#define FILE_DIR "sound/ambience" +#define FILE_DIR "sound/effects" +#define FILE_DIR "sound/hallucinations" +#define FILE_DIR "sound/items" +#define FILE_DIR "sound/machines" +#define FILE_DIR "sound/mecha" +#define FILE_DIR "sound/misc" +#define FILE_DIR "sound/piano" +#define FILE_DIR "sound/violin" +#define FILE_DIR "sound/voice" +#define FILE_DIR "sound/weapons" +#define FILE_DIR "tools" +#define FILE_DIR "tools/AddToChangelog" +#define FILE_DIR "tools/AddToChangelog/AddToChangelog" // END_FILE_DIR // BEGIN_PREFERENCES @@ -171,12 +208,7 @@ #include "code\defines\procs\command_alert.dm" #include "code\defines\procs\dbcore.dm" #include "code\defines\procs\statistics.dm" -#include "code\FEA\FEA_airgroup.dm" -#include "code\FEA\FEA_fire.dm" #include "code\FEA\FEA_gas_mixture.dm" -#include "code\FEA\FEA_group_helpers.dm" -#include "code\FEA\FEA_system.dm" -#include "code\FEA\FEA_turf_tile.dm" #include "code\game\asteroid.dm" #include "code\game\atoms.dm" #include "code\game\atoms_movable.dm" @@ -621,6 +653,9 @@ #include "code\game\verbs\who.dm" #include "code\js\byjax.dm" #include "code\js\menus.dm" +#include "code\LINDA\LINDA_fire.dm" +#include "code\LINDA\LINDA_system.dm" +#include "code\LINDA\LINDA_turf_tile.dm" #include "code\modules\admin\admin.dm" #include "code\modules\admin\admin_investigate.dm" #include "code\modules\admin\admin_memo.dm"