diff --git a/code/FEA/FEA_airgroup.dm b/code/FEA/FEA_airgroup.dm index 67b5c757565..94c51102b27 100644 --- a/code/FEA/FEA_airgroup.dm +++ b/code/FEA/FEA_airgroup.dm @@ -62,6 +62,9 @@ datum/air_group proc/check_regroup() //Purpose: Checks to see if group processing should be turned back on //Returns: group_processing + if(prevent_airgroup_regroup) + return 0 + if(group_processing) return 1 var/turf/simulated/sample = pick(members) diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 9d609e673e7..6beeffc1870 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -23,11 +23,10 @@ What are the archived variables for? volatile_fuel specific_heat = 30 - var - moles = 0 - specific_heat = 0 + var/moles = 0 + var/specific_heat = 0 - moles_archived = 0 + var/moles_archived = 0 /datum/gas_mixture diff --git a/code/FEA/FEA_turf_tile.dm b/code/FEA/FEA_turf_tile.dm index 65f60c17326..8dbe19a04b5 100644 --- a/code/FEA/FEA_turf_tile.dm +++ b/code/FEA/FEA_turf_tile.dm @@ -1,6 +1,6 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 -atom/movable/var/pressure_resistance = 20 +atom/movable/var/pressure_resistance = 5 atom/movable/var/last_forced_movement = 0 atom/movable/proc/experience_pressure_difference(pressure_difference, direction) @@ -47,530 +47,514 @@ turf turf var/pressure_difference = 0 var/pressure_direction = 0 + var/reporting_pressure_difference //optimization vars var/next_check = 0 //number of ticks before this tile updates var/check_delay = 0 //number of ticks between updates - proc - high_pressure_movements() + proc/high_pressure_movements() + if(reporting_pressure_difference) + world << "pressure_difference = [pressure_difference]; pressure_direction = [pressure_direction]" + for(var/atom/movable/in_tile in src) + in_tile.experience_pressure_difference(pressure_difference, pressure_direction) - for(var/atom/movable/in_tile in src) - in_tile.experience_pressure_difference(pressure_difference, pressure_direction) + pressure_difference = 0 - pressure_difference = 0 + proc/consider_pressure_difference(connection_difference, connection_direction) + if(connection_difference < 0) + connection_difference = -connection_difference + connection_direction = turn(connection_direction,180) - consider_pressure_difference(connection_difference, connection_direction) - if(connection_difference < 0) - connection_difference = -connection_difference - connection_direction = turn(connection_direction,180) + if(connection_difference > pressure_difference) + if(!pressure_difference) + air_master.high_pressure_delta += src + pressure_difference = connection_difference + pressure_direction = connection_direction - if(connection_difference > pressure_difference) +turf/simulated/proc/consider_pressure_difference_space(connection_difference) + for(var/direction in cardinal) + if(direction&group_border) + if(istype(get_step(src,direction),/turf/space)) if(!pressure_difference) air_master.high_pressure_delta += src + pressure_direction = direction pressure_difference = connection_difference - pressure_direction = connection_direction - - simulated - proc - consider_pressure_difference_space(connection_difference) - for(var/direction in cardinal) - if(direction&group_border) - if(istype(get_step(src,direction),/turf/space)) - if(!pressure_difference) - air_master.high_pressure_delta += src - pressure_direction = direction - pressure_difference = connection_difference - return 1 + return 1 -turf - simulated +turf/simulated - var/current_graphic = null + var/current_graphic = null - var/tmp/datum/gas_mixture/air + var/tmp/datum/gas_mixture/air - var/tmp/processing = 1 - var/tmp/datum/air_group/turf/parent - var/tmp/group_border = 0 - var/tmp/length_space_border = 0 + var/tmp/processing = 1 + var/tmp/datum/air_group/turf/parent + var/tmp/group_border = 0 + var/tmp/length_space_border = 0 - var/tmp/air_check_directions = 0 //Do not modify this, just add turf to air_master.tiles_to_update + var/tmp/air_check_directions = 0 //Do not modify this, just add turf to air_master.tiles_to_update - var/tmp/archived_cycle = 0 - var/tmp/current_cycle = 0 + var/tmp/archived_cycle = 0 + var/tmp/current_cycle = 0 - var/tmp/obj/effect/hotspot/active_hotspot + var/tmp/obj/effect/hotspot/active_hotspot - var/tmp/temperature_archived //USED ONLY FOR SOLIDS - var/tmp/being_superconductive = 0 + var/tmp/temperature_archived //USED ONLY FOR SOLIDS + var/tmp/being_superconductive = 0 + proc/update_visuals(datum/gas_mixture/model) + overlays.Cut() - proc - process_cell() - update_air_properties() - archive() + var/siding_icon_state = return_siding_icon_state() + if(siding_icon_state) + overlays += image('icons/turf/floors.dmi',siding_icon_state) - mimic_air_with_tile(turf/model) - share_air_with_tile(turf/simulated/sharer) - - mimic_temperature_with_tile(turf/model) - share_temperature_with_tile(turf/simulated/sharer) - - - super_conduct() - - 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) + switch(model.graphic) + if("plasma") + overlays.Add(plmaster) + if("sleeping_agent") + overlays.Add(slmaster) - New() - ..() + New() + ..() - if(!blocks_air) - air = new + if(!blocks_air) + air = new - air.oxygen = oxygen - air.carbon_dioxide = carbon_dioxide - air.nitrogen = nitrogen - air.toxins = toxins + air.oxygen = oxygen + air.carbon_dioxide = carbon_dioxide + air.nitrogen = nitrogen + air.toxins = toxins - air.temperature = temperature + air.temperature = temperature - if(air_master) - air_master.tiles_to_update.Add(src) + if(air_master) + air_master.tiles_to_update.Add(src) - find_group() + find_group() // air.parent = src //TODO DEBUG REMOVE - else - if(air_master) - for(var/direction in cardinal) - var/turf/simulated/floor/target = get_step(src,direction) - if(istype(target)) - air_master.tiles_to_update.Add(target) - - Del() + else if(air_master) - if(parent) - air_master.groups_to_rebuild.Add(parent) - parent.members.Remove(src) - else - air_master.active_singletons.Remove(src) - if(active_hotspot) - del(active_hotspot) - if(blocks_air) - for(var/direction in list(NORTH, SOUTH, EAST, WEST)) - var/turf/simulated/tile = get_step(src,direction) - if(istype(tile) && !tile.blocks_air) - air_master.tiles_to_update.Add(tile) - ..() - - assume_air(datum/gas_mixture/giver) - if(!giver) return 0 - var/datum/gas_mixture/receiver = air - if(istype(receiver)) - if(parent&&parent.group_processing) - if(!parent.air.check_then_merge(giver)) - parent.suspend_group_processing() - air.merge(giver) - else - if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND) - reset_delay() - - air.merge(giver) - - if(!processing) - if(air.check_tile_graphic()) - update_visuals(air) - - return 1 - - else return ..() - - archive() - if(air) //For open space like floors - air.archive() - - temperature_archived = temperature - archived_cycle = air_master.current_cycle - - share_air_with_tile(turf/simulated/T) - return air.share(T.air) - - mimic_air_with_tile(turf/T) - return air.mimic(T) - - return_air() - if(air) - if(parent&&parent.group_processing) - return parent.air - else return air - - else - return ..() - - remove_air(amount as num) - if(air) - var/datum/gas_mixture/removed = null - - if(parent&&parent.group_processing) - removed = parent.air.check_then_remove(amount) - if(!removed) - parent.suspend_group_processing() - removed = air.remove(amount) - else - removed = air.remove(amount) - - if(!processing) - if(air.check_tile_graphic()) - update_visuals(air) - - return removed - - else - return ..() - - update_air_properties()//OPTIMIZE - air_check_directions = 0 - - for(var/direction in cardinal) - if(CanPass(null, get_step(src,direction), 0, 0)) - air_check_directions |= direction + for(var/direction in cardinal) + var/turf/simulated/floor/target = get_step(src,direction) + if(istype(target)) + air_master.tiles_to_update.Add(target) + Del() + if(air_master) if(parent) - if(parent.borders) - parent.borders -= src - if(length_space_border > 0) - parent.length_space_border -= length_space_border - length_space_border = 0 - - group_border = 0 - for(var/direction in cardinal) - if(air_check_directions&direction) - var/turf/simulated/T = get_step(src,direction) - - //See if actually a border - if(!istype(T) || (T.parent!=parent)) - - //See what kind of border it is - if(istype(T,/turf/space)) - if(parent.space_borders) - parent.space_borders -= src - parent.space_borders += src - else - parent.space_borders = list(src) - length_space_border++ - - else - if(parent.borders) - parent.borders -= src - parent.borders += src - else - parent.borders = list(src) - - group_border |= direction - - parent.length_space_border += length_space_border - - if(air_check_directions) - processing = 1 - if(!parent) - air_master.add_singleton(src) + air_master.groups_to_rebuild.Add(parent) + parent.members.Remove(src) else - processing = 0 + air_master.active_singletons.Remove(src) + if(active_hotspot) + del(active_hotspot) + if(blocks_air) + for(var/direction in list(NORTH, SOUTH, EAST, WEST)) + var/turf/simulated/tile = get_step(src,direction) + if(istype(tile) && !tile.blocks_air) + air_master.tiles_to_update.Add(tile) + ..() - process_cell() - //this proc does all the heavy lifting for individual tile processing - //it shares with all of its neighbors, spreads fire, calls superconduction - //and doesn't afraid of anything - - //check if we're skipping this tick - if (next_check > 0) - next_check-- - return 1 - var/player_count = max(player_list.len, 3) / 3 - next_check += check_delay + rand(player_count, player_count * 1.5) - check_delay++ - - var/turf/simulated/list/possible_fire_spreads = list() - if(processing) - if(archived_cycle < air_master.current_cycle) //archive self if not already done - archive() - current_cycle = air_master.current_cycle - - for(var/direction in cardinal) - if(air_check_directions&direction) //Grab all valid bordering tiles - var/turf/simulated/enemy_tile = get_step(src, direction) - var/connection_difference = 0 - - if(istype(enemy_tile)) //enemy_tile == neighbor, btw - if(enemy_tile.archived_cycle < archived_cycle) //archive bordering tile information if not already done - enemy_tile.archive() - - if (air && enemy_tile.air) - var/delay_trigger = air.compare(enemy_tile.air) - if (!delay_trigger) //if compare() didn't return 1, air is different enough to trigger processing - reset_delay() - enemy_tile.reset_delay() - - if(enemy_tile.parent && enemy_tile.parent.group_processing) //apply tile to group sharing - if(enemy_tile.parent.current_cycle < current_cycle) //if the group hasn't been archived, it could just be out of date - if(enemy_tile.parent.air.check_gas_mixture(air)) - connection_difference = air.share(enemy_tile.parent.air) - else - enemy_tile.parent.suspend_group_processing() - connection_difference = air.share(enemy_tile.air) - //group processing failed so interact with individual tile - - else - if(enemy_tile.current_cycle < current_cycle) - connection_difference = air.share(enemy_tile.air) - - if(active_hotspot) - possible_fire_spreads += enemy_tile - else -/* var/obj/movable/floor/movable_on_enemy = locate(/obj/movable/floor) in enemy_tile - - if(movable_on_enemy) - if(movable_on_enemy.parent && movable_on_enemy.parent.group_processing) //apply tile to group sharing - if(movable_on_enemy.parent.current_cycle < current_cycle) - if(movable_on_enemy.parent.air.check_gas_mixture(air)) - connection_difference = air.share(movable_on_enemy.parent.air) - - else - movable_on_enemy.parent.suspend_group_processing() - - if(movable_on_enemy.archived_cycle < archived_cycle) //archive bordering tile information if not already done - movable_on_enemy.archive() - connection_difference = air.share(movable_on_enemy.air) - //group processing failed so interact with individual tile - else - if(movable_on_enemy.archived_cycle < archived_cycle) //archive bordering tile information if not already done - movable_on_enemy.archive() - - if(movable_on_enemy.current_cycle < current_cycle) - connection_difference = share_air_with_tile(movable_on_enemy) - - else*/ - connection_difference = mimic_air_with_tile(enemy_tile) - //bordering a tile with fixed air properties - - if(connection_difference) - if(connection_difference > 0) - consider_pressure_difference(connection_difference, direction) - else - enemy_tile.consider_pressure_difference(connection_difference, direction) + assume_air(datum/gas_mixture/giver) + if(!giver) return 0 + var/datum/gas_mixture/receiver = air + if(istype(receiver)) + if(parent&&parent.group_processing) + if(!parent.air.check_then_merge(giver)) + parent.suspend_group_processing() + air.merge(giver) else - air_master.active_singletons -= src //not active if not processing! + if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND) + reset_delay() - air.react() + air.merge(giver) - if(active_hotspot) - if (!active_hotspot.process(possible_fire_spreads)) - return 0 - - if(air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) - consider_superconductivity(starting = 1) - - if(air.check_tile_graphic()) - update_visuals(air) - - if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - reset_delay() //hotspots always process quickly - 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(!processing) + if(air.check_tile_graphic()) + update_visuals(air) return 1 - 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 + else return ..() - if(archived_cycle < air_master.current_cycle) - archive() + proc/archive() + if(air) //For open space like floors + air.archive() + temperature_archived = temperature + archived_cycle = air_master.current_cycle + + proc/share_air_with_tile(turf/simulated/T) + return air.share(T.air) + + proc/mimic_air_with_tile(turf/T) + return air.mimic(T) + + return_air() + if(air) + if(parent&&parent.group_processing) + return parent.air + else return air + + else + return ..() + + remove_air(amount as num) + if(air) + var/datum/gas_mixture/removed = null + + if(parent&&parent.group_processing) + removed = parent.air.check_then_remove(amount) + if(!removed) + parent.suspend_group_processing() + removed = air.remove(amount) else - //Does particate in air exchange so only consider directions not considered during process_cell() - conductivity_directions = ~air_check_directions & (NORTH|SOUTH|EAST|WEST) + removed = air.remove(amount) - 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(!processing) + if(air.check_tile_graphic()) + update_visuals(air) - if(istype(neighbor, /turf/simulated)) //anything under this subtype will share in the exchange - var/turf/simulated/modeled_neighbor = neighbor + return removed - if(modeled_neighbor.archived_cycle < air_master.current_cycle) - modeled_neighbor.archive() + else + return ..() - if(modeled_neighbor.air) - if(air) //Both tiles are open + proc/update_air_properties()//OPTIMIZE + air_check_directions = 0 - if(modeled_neighbor.parent && modeled_neighbor.parent.group_processing) - if(parent && parent.group_processing) - //both are acting as a group - //modified using construct developed in datum/air_group/share_air_with_group(...) + for(var/direction in cardinal) + if(CanPass(null, get_step(src,direction), 0, 0)) + air_check_directions |= direction - var/result = parent.air.check_both_then_temperature_share(modeled_neighbor.parent.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - if(result==0) - //have to deconstruct parent air group + if(parent) + if(parent.borders) + parent.borders -= src + if(length_space_border > 0) + parent.length_space_border -= length_space_border + length_space_border = 0 - parent.suspend_group_processing() - if(!modeled_neighbor.parent.air.check_me_then_temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)) - //may have to deconstruct neighbors air group + group_border = 0 + for(var/direction in cardinal) + if(air_check_directions&direction) + var/turf/simulated/T = get_step(src,direction) - modeled_neighbor.parent.suspend_group_processing() - air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - else if(result==-1) - // have to deconstruct neightbors air group but not mine - - modeled_neighbor.parent.suspend_group_processing() - parent.air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - else - air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - else - if(parent && parent.group_processing) - if(!parent.air.check_me_then_temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)) - //may have to deconstruct neighbors air group - - parent.suspend_group_processing() - air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - - else - air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - // world << "OPEN, OPEN" - - else //Solid but neighbor is open - if(modeled_neighbor.parent && modeled_neighbor.parent.group_processing) - if(!modeled_neighbor.parent.air.check_me_then_temperature_turf_share(src, modeled_neighbor.thermal_conductivity)) - - modeled_neighbor.parent.suspend_group_processing() - modeled_neighbor.air.temperature_turf_share(src, modeled_neighbor.thermal_conductivity) - else - modeled_neighbor.air.temperature_turf_share(src, modeled_neighbor.thermal_conductivity) - // world << "SOLID, OPEN" + //See if actually a border + if(!istype(T) || (T.parent!=parent)) + //See what kind of border it is + if(istype(T,/turf/space)) + if(parent.space_borders) + parent.space_borders -= src + parent.space_borders += src else - if(air) //Open but neighbor is solid - if(parent && parent.group_processing) - if(!parent.air.check_me_then_temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity)) - parent.suspend_group_processing() - air.temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity) - else - air.temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity) - // world << "OPEN, SOLID" - - else //Both tiles are solid - share_temperature_mutual_solid(modeled_neighbor, modeled_neighbor.thermal_conductivity) - // world << "SOLID, SOLID" - - modeled_neighbor.consider_superconductivity() + parent.space_borders = list(src) + length_space_border++ else - if(air) //Open - if(parent && parent.group_processing) - if(!parent.air.check_me_then_temperature_mimic(neighbor, neighbor.thermal_conductivity)) - parent.suspend_group_processing() - air.temperature_mimic(neighbor, neighbor.thermal_conductivity) - else - air.temperature_mimic(neighbor, neighbor.thermal_conductivity) + if(parent.borders) + parent.borders -= src + parent.borders += src else - mimic_temperature_solid(neighbor, neighbor.thermal_conductivity) + parent.borders = list(src) - //Radiate excess tile heat to space - if(temperature > T0C) - // Is there a pre-defined Space Tile? - if(!Space_Tile) - Space_Tile = locate(/turf/space) // Define one - //Considering 0 degC as te break even point for radiation in and out - mimic_temperature_solid(Space_Tile, FLOOR_HEAT_TRANSFER_COEFFICIENT) + group_border |= direction - //Conduct with air on my tile if I have it - if(air) - if(parent && parent.group_processing) - if(!parent.air.check_me_then_temperature_turf_share(src, thermal_conductivity)) - parent.suspend_group_processing() - air.temperature_turf_share(src, thermal_conductivity) - else - air.temperature_turf_share(src, thermal_conductivity) + parent.length_space_border += length_space_border + if(air_check_directions) + processing = 1 + if(!parent) + air_master.add_singleton(src) + else + processing = 0 - //Make sure still hot enough to continue conducting heat - if(air) - if(air.temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) - being_superconductive = 0 - air_master.active_super_conductivity -= src - return 0 + proc/process_cell() + //this proc does all the heavy lifting for individual tile processing + //it shares with all of its neighbors, spreads fire, calls superconduction + //and doesn't afraid of anything + //Comment by errorage: In other words, this is the proc that lags the game. - else - if(temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) - being_superconductive = 0 - air_master.active_super_conductivity -= src - return 0 + //check if we're skipping this tick + if (next_check > 0) + next_check-- + return 1 + var/player_count = max(player_list.len, 3) / 3 + next_check += check_delay + rand(player_count, player_count * 1.5) + check_delay++ - 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/turf/simulated/list/possible_fire_spreads = list() + if(processing) + if(archived_cycle < air_master.current_cycle) //archive self if not already done + archive() + current_cycle = air_master.current_cycle - var/heat = conduction_coefficient*delta_temperature* \ - (heat_capacity*model.heat_capacity/(heat_capacity+model.heat_capacity)) - temperature -= heat/heat_capacity + for(var/direction in cardinal) + if(air_check_directions&direction) //Grab all valid bordering tiles + var/turf/simulated/enemy_tile = get_step(src, direction) + var/connection_difference = 0 - 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) + if(istype(enemy_tile)) //enemy_tile == neighbor, btw + if(enemy_tile.archived_cycle < archived_cycle) //archive bordering tile information if not already done + enemy_tile.archive() - var/heat = conduction_coefficient*delta_temperature* \ - (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) + if (air && enemy_tile.air) + var/delay_trigger = air.compare(enemy_tile.air) + if (!delay_trigger) //if compare() didn't return 1, air is different enough to trigger processing + reset_delay() + enemy_tile.reset_delay() - temperature -= heat/heat_capacity - sharer.temperature += heat/sharer.heat_capacity + if(enemy_tile.parent && enemy_tile.parent.group_processing) //apply tile to group sharing + if(enemy_tile.parent.current_cycle < current_cycle) //if the group hasn't been archived, it could just be out of date + if(enemy_tile.parent.air.check_gas_mixture(air)) + connection_difference = air.share(enemy_tile.parent.air) + else + enemy_tile.parent.suspend_group_processing() + connection_difference = air.share(enemy_tile.air) + //group processing failed so interact with individual tile - proc/consider_superconductivity(starting) + else + if(enemy_tile.current_cycle < current_cycle) + connection_difference = air.share(enemy_tile.air) - if(being_superconductive || !thermal_conductivity) + if(active_hotspot) + possible_fire_spreads += enemy_tile + else +/* var/obj/movable/floor/movable_on_enemy = locate(/obj/movable/floor) in enemy_tile + + if(movable_on_enemy) + if(movable_on_enemy.parent && movable_on_enemy.parent.group_processing) //apply tile to group sharing + if(movable_on_enemy.parent.current_cycle < current_cycle) + if(movable_on_enemy.parent.air.check_gas_mixture(air)) + connection_difference = air.share(movable_on_enemy.parent.air) + + else + movable_on_enemy.parent.suspend_group_processing() + + if(movable_on_enemy.archived_cycle < archived_cycle) //archive bordering tile information if not already done + movable_on_enemy.archive() + connection_difference = air.share(movable_on_enemy.air) + //group processing failed so interact with individual tile + else + if(movable_on_enemy.archived_cycle < archived_cycle) //archive bordering tile information if not already done + movable_on_enemy.archive() + + if(movable_on_enemy.current_cycle < current_cycle) + connection_difference = share_air_with_tile(movable_on_enemy) + + else*/ + connection_difference = mimic_air_with_tile(enemy_tile) + //bordering a tile with fixed air properties + + if(connection_difference) + if(connection_difference > 0) + consider_pressure_difference(connection_difference, direction) + else + enemy_tile.consider_pressure_difference(connection_difference, direction) + else + air_master.active_singletons -= src //not active if not processing! + + air.react() + + if(active_hotspot) + if (!active_hotspot.process(possible_fire_spreads)) return 0 - if(air) - if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) - return 0 - if(air.heat_capacity() < MOLES_CELLSTANDARD*0.1*0.05) - return 0 + if(air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) + consider_superconductivity(starting = 1) + + if(air.check_tile_graphic()) + update_visuals(air) + + if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + reset_delay() //hotspots always process quickly + 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) + + return 1 + + 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() + conductivity_directions = ~air_check_directions & (NORTH|SOUTH|EAST|WEST) + + 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(istype(neighbor, /turf/simulated)) //anything under this subtype will share in the exchange + var/turf/simulated/modeled_neighbor = neighbor + + if(modeled_neighbor.archived_cycle < air_master.current_cycle) + modeled_neighbor.archive() + + if(modeled_neighbor.air) + if(air) //Both tiles are open + + if(modeled_neighbor.parent && modeled_neighbor.parent.group_processing) + if(parent && parent.group_processing) + //both are acting as a group + //modified using construct developed in datum/air_group/share_air_with_group(...) + + var/result = parent.air.check_both_then_temperature_share(modeled_neighbor.parent.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + if(result==0) + //have to deconstruct parent air group + + parent.suspend_group_processing() + if(!modeled_neighbor.parent.air.check_me_then_temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)) + //may have to deconstruct neighbors air group + + modeled_neighbor.parent.suspend_group_processing() + air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + else if(result==-1) + // have to deconstruct neightbors air group but not mine + + modeled_neighbor.parent.suspend_group_processing() + parent.air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + else + air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + else + if(parent && parent.group_processing) + if(!parent.air.check_me_then_temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)) + //may have to deconstruct neighbors air group + + parent.suspend_group_processing() + air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + + else + air.temperature_share(modeled_neighbor.air, WINDOW_HEAT_TRANSFER_COEFFICIENT) + // world << "OPEN, OPEN" + + else //Solid but neighbor is open + if(modeled_neighbor.parent && modeled_neighbor.parent.group_processing) + if(!modeled_neighbor.parent.air.check_me_then_temperature_turf_share(src, modeled_neighbor.thermal_conductivity)) + + modeled_neighbor.parent.suspend_group_processing() + modeled_neighbor.air.temperature_turf_share(src, modeled_neighbor.thermal_conductivity) + else + modeled_neighbor.air.temperature_turf_share(src, modeled_neighbor.thermal_conductivity) + // world << "SOLID, OPEN" + + else + if(air) //Open but neighbor is solid + if(parent && parent.group_processing) + if(!parent.air.check_me_then_temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity)) + parent.suspend_group_processing() + air.temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity) + else + air.temperature_turf_share(modeled_neighbor, modeled_neighbor.thermal_conductivity) + // world << "OPEN, SOLID" + + else //Both tiles are solid + share_temperature_mutual_solid(modeled_neighbor, modeled_neighbor.thermal_conductivity) + // world << "SOLID, SOLID" + + modeled_neighbor.consider_superconductivity() + + else + if(air) //Open + if(parent && parent.group_processing) + if(!parent.air.check_me_then_temperature_mimic(neighbor, neighbor.thermal_conductivity)) + parent.suspend_group_processing() + air.temperature_mimic(neighbor, neighbor.thermal_conductivity) + else + air.temperature_mimic(neighbor, neighbor.thermal_conductivity) + else + mimic_temperature_solid(neighbor, neighbor.thermal_conductivity) + + //Radiate excess tile heat to space + if(temperature > T0C) + // Is there a pre-defined Space Tile? + if(!Space_Tile) + Space_Tile = locate(/turf/space) // Define one + //Considering 0 degC as te break even point for radiation in and out + mimic_temperature_solid(Space_Tile, FLOOR_HEAT_TRANSFER_COEFFICIENT) + + //Conduct with air on my tile if I have it + if(air) + if(parent && parent.group_processing) + if(!parent.air.check_me_then_temperature_turf_share(src, thermal_conductivity)) + parent.suspend_group_processing() + air.temperature_turf_share(src, thermal_conductivity) else - if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) - return 0 + air.temperature_turf_share(src, thermal_conductivity) - being_superconductive = 1 - air_master.active_super_conductivity += src + //Make sure still hot enough to continue conducting heat + if(air) + if(air.temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) + being_superconductive = 0 + air_master.active_super_conductivity -= src + return 0 - proc/reset_delay() - //sets this turf to process quickly again - next_check=0 - check_delay= -5 //negative numbers mean a mandatory quick-update period + else + if(temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) + being_superconductive = 0 + air_master.active_super_conductivity -= src + return 0 - //if this turf has a parent air group, suspend its processing - if (parent && parent.group_processing) - parent.suspend_group_processing() + 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 + + 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 + + proc/consider_superconductivity(starting) + + if(being_superconductive || !thermal_conductivity) + return 0 + + if(air) + if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + return 0 + if(air.heat_capacity() < MOLES_CELLSTANDARD*0.1*0.05) + return 0 + else + if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + return 0 + + being_superconductive = 1 + + air_master.active_super_conductivity += src + + proc/reset_delay() + //sets this turf to process quickly again + next_check=0 + check_delay= -5 //negative numbers mean a mandatory quick-update period + + //if this turf has a parent air group, suspend its processing + if (parent && parent.group_processing) + parent.suspend_group_processing() diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 8cafa13345a..e4c68c4dfcc 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -8,6 +8,9 @@ var/global/controller_iteration = 0 var/global/last_tick_timeofday = world.timeofday var/global/last_tick_duration = 0 +var/global/air_processing_killed = 0 +var/global/pipe_processing_killed = 0 + datum/controller/game_controller var/processing = 0 var/breather_ticks = 2 //a somewhat crude attempt to iron over the 'bumps' caused by high-cpu use by letting the MC have a breather for this many ticks after every loop @@ -111,10 +114,11 @@ datum/controller/game_controller/proc/process() vote.process() //AIR - timer = world.timeofday - last_thing_processed = air_master.type - air_master.process() - air_cost = (world.timeofday - timer) / 10 + if(!air_processing_killed) + timer = world.timeofday + last_thing_processed = air_master.type + air_master.process() + air_cost = (world.timeofday - timer) / 10 sleep(breather_ticks) @@ -190,17 +194,18 @@ datum/controller/game_controller/proc/process() sleep(breather_ticks) //PIPENETS - timer = world.timeofday - last_thing_processed = /datum/pipe_network - i = 1 - while(i<=pipe_networks.len) - var/datum/pipe_network/Network = pipe_networks[i] - if(Network) - Network.process() - i++ - continue - pipe_networks.Cut(i,i+1) - networks_cost = (world.timeofday - timer) / 10 + if(!pipe_processing_killed) + timer = world.timeofday + last_thing_processed = /datum/pipe_network + i = 1 + while(i<=pipe_networks.len) + var/datum/pipe_network/Network = pipe_networks[i] + if(Network) + Network.process() + i++ + continue + pipe_networks.Cut(i,i+1) + networks_cost = (world.timeofday - timer) / 10 sleep(breather_ticks) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5c4005c8e77..38058a0a560 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -13,7 +13,7 @@ flags = FPRINT | TABLEPASS var/slot_flags = 0 //This is used to determine on which slots an item can fit. pass_flags = PASSTABLE - pressure_resistance = 50 + pressure_resistance = 5 // causeerrorheresoifixthis var/obj/item/master = null diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index e4f69ee6318..1bfbd8ad588 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -13,7 +13,6 @@ icon = 'icons/obj/items.dmi' icon_state = "gift1" item_state = "gift1" - pressure_resistance = 70 /obj/item/weapon/a_gift/New() ..() diff --git a/code/game/objects/items/weapons/power_cells.dm b/code/game/objects/items/weapons/power_cells.dm index 75d94094c29..8348407e896 100644 --- a/code/game/objects/items/weapons/power_cells.dm +++ b/code/game/objects/items/weapons/power_cells.dm @@ -11,7 +11,6 @@ throw_speed = 3 throw_range = 5 w_class = 3.0 - pressure_resistance = 80 var/charge = 0 // note %age conveted to actual charge in New var/maxcharge = 1000 m_amt = 700 diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index db0c54a8204..c2ee938e6cf 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/janitor.dmi' icon_state = "mopbucket" density = 1 - pressure_resistance = ONE_ATMOSPHERE + pressure_resistance = 5 flags = FPRINT | TABLEPASS | OPENCONTAINER var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite diff --git a/code/game/objects/structures/stool_bed_chair_nest/stools.dm b/code/game/objects/structures/stool_bed_chair_nest/stools.dm index 7c40b55bdb4..f19a90ace79 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/stools.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/stools.dm @@ -5,7 +5,7 @@ icon_state = "stool" anchored = 1.0 flags = FPRINT - pressure_resistance = 3*ONE_ATMOSPHERE + pressure_resistance = 15 /obj/structure/stool/ex_act(severity) switch(severity) diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 7f214b615b4..172be842c67 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -153,6 +153,10 @@ 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/cmd_admin_rejuvenate feedback_add_details("admin_verb","mDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -225,4 +229,45 @@ var/intercom_range_display_status = 0 world << line*/ 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! \ No newline at end of file + 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" + + pipe_processing_killed = !pipe_processing_killed + if(pipe_processing_killed) + message_admins("[src.ckey] used 'kill pipe processing', stopping all pipe processing.") + else + message_admins("[src.ckey] used 'kill pipe processing', restoring all pipe processing.") + +/client/proc/kill_air_processing() + set category = "Mapping" + set name = "Kill air processing" + + air_processing_killed = !air_processing_killed + if(air_processing_killed) + message_admins("[src.ckey] used 'kill air processing', stopping all air processing.") + else + message_admins("[src.ckey] used 'kill air processing', restoring all air processing.") \ No newline at end of file diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index a99a5fcf085..ff0e2fc7483 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -11,7 +11,6 @@ var/obj/item/weapon/paper/toppaper //The topmost piece of paper. flags = FPRINT | TABLEPASS slot_flags = SLOT_BELT - pressure_resistance = 10 /obj/item/weapon/clipboard/New() update_icon() diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 5890e070b5f..37c994585ec 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -23,7 +23,7 @@ throw_range = 15 m_amt = 10 var/colour = "black" //what colour the ink is! - pressure_resistance = 5 + pressure_resistance = 2 /obj/item/weapon/pen/blue diff --git a/code/modules/paperwork/stamps.dm b/code/modules/paperwork/stamps.dm index df011d13a95..bf8b7c3b362 100644 --- a/code/modules/paperwork/stamps.dm +++ b/code/modules/paperwork/stamps.dm @@ -11,7 +11,7 @@ throw_range = 15 m_amt = 60 color = "cargo" - pressure_resistance = 5 + pressure_resistance = 2 attack_verb = list("stamped") /obj/item/weapon/stamp/captain