From b6f8b3fb77cc0af29d1e02a6490a5dabe941c30f Mon Sep 17 00:00:00 2001 From: "mport2004@gmail.com" Date: Mon, 18 Jun 2012 01:56:24 +0000 Subject: [PATCH] =?UTF-8?q?Added=20Willox=E2=80=99s=20explosion=20code.=20?= =?UTF-8?q?=20It=20should=20make=20explosions=20faster=20than=20they=20hav?= =?UTF-8?q?e=20been=20lately.=20Moved=20an=20unchecked=20file=20into=20unu?= =?UTF-8?q?sed,=20please=20put=20any=20unchecked=20files=20out=20of=20WIP?= =?UTF-8?q?=20or=20FEA=20into=20unused=20that=20way=20if=20you=20see=20an?= =?UTF-8?q?=20unchecked=20file=20you=20know=20it=20should=20be=20checked.?= =?UTF-8?q?=20=20DM=20loves=20to=20uncheck=20files=20when=20you=20are=20me?= =?UTF-8?q?ssing=20around=20with=20folders=20in=20the=20editor.=20Moved=20?= =?UTF-8?q?the=20old=20TEG=20defines=20into=20the=20proper=20files.=20Comm?= =?UTF-8?q?ented=20out=20some=20old=20nonfunctioning=20FEA=20debug=20code.?= =?UTF-8?q?=20Removed=20some=20commented=20out=20codechunks=20from=20FEA?= =?UTF-8?q?=20and=20attempted=20to=20clean=20up=20a=20few=20of=20the=20fil?= =?UTF-8?q?es=20a=20bit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3852 316c924e-a436-60f5-8080-3fe189b3f50e --- code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm | 3 +- code/FEA/FEA_airgroup.dm | 498 ++++--- code/FEA/FEA_fire.dm | 274 ++-- code/FEA/FEA_gas_mixture.dm | 1616 +++++++++++------------ code/defines/obj/machinery.dm | 25 - code/defines/procs/gamehelpers.dm | 10 + code/game/objects/explosion.dm | 96 +- code/modules/power/generator.dm | 233 ++-- code/modules/power/generator_type2.dm | 184 +-- code/{game => unused}/dna_mutations.dm | 0 tgstation.dme | 191 +++ 11 files changed, 1632 insertions(+), 1498 deletions(-) rename code/{game => unused}/dna_mutations.dm (100%) diff --git a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm index ed68cce383b..35125615cba 100644 --- a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm +++ b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm @@ -116,7 +116,7 @@ obj/machinery/portable_atmospherics/canister valve_open = 1 release_pressure = 1000 - +/* obj/machinery/atmospherics unary heat_reservoir @@ -352,6 +352,7 @@ obj/machinery/atmospherics usr << "[x],[y] is in a pipeline with [parent.members.len] members ([parent.edges.len] edges)! Volume: [parent.air.volume]" usr << "Pressure: [parent.air.return_pressure()], Temperature: [parent.air.temperature]" usr << "[parent.air.oxygen], [parent.air.toxins], [parent.air.nitrogen], [parent.air.carbon_dioxide] .. [parent.alert_pressure]" +*/ mob verb flag_all_pipe_networks() diff --git a/code/FEA/FEA_airgroup.dm b/code/FEA/FEA_airgroup.dm index c31ab6f503a..5be0c199ee4 100644 --- a/code/FEA/FEA_airgroup.dm +++ b/code/FEA/FEA_airgroup.dm @@ -1,315 +1,279 @@ -datum - air_group - var/tmp/group_processing = 1 //Processing all tiles as one large tile if 1 +datum/air_group + var/group_processing = 1 //Processing all tiles as one large tile if 1 - var/tmp/datum/gas_mixture/air = new + var/datum/gas_mixture/air = new - var/tmp/current_cycle = 0 //cycle that oxygen value represents - var/tmp/archived_cycle = 0 //cycle that oxygen_archived value represents - //The use of archived cycle saves processing power by permitting the archiving step of FET - // to be rolled into the updating step + var/current_cycle = 0 //cycle that oxygen value represents + var/archived_cycle = 0 //cycle that oxygen_archived value represents + //The use of archived cycle saves processing power by permitting the archiving step of FET + // to be rolled into the updating step - //optimization vars - var/tmp/next_check = 0 //number of ticks before this group updates - var/tmp/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way + //optimization vars + var/next_check = 0 //number of ticks before this group updates + var/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way - proc - archive() + proc/members() + //Returns the members of the group + proc/process_group() - members() - //Returns the members of the group - check_regroup() - //If individually processing tiles, checks all member tiles to see if they are close enough - // that the group may resume group processing - //Warning: Do not call, called by air_master.process() + var/list/borders //Tiles that connect this group to other groups/individual tiles + var/list/members //All tiles in this group - process_group() - suspend_group_processing() - update_group_from_tiles() - //Copy group air information to individual tile air - //Used right before turning on group processing + var/list/space_borders + var/length_space_border = 0 - update_tiles_from_group() - //Copy group air information to individual tile air - //Used right before turning off group processing - var/list/borders //Tiles that connect this group to other groups/individual tiles - var/list/members //All tiles in this group + proc/suspend_group_processing() + group_processing = 0 + update_tiles_from_group() + check_delay=0 + next_check=0 - var/list/space_borders - var/length_space_border = 0 - suspend_group_processing() - group_processing = 0 - update_tiles_from_group() - check_delay=0 - next_check=0 + //Copy group air information to individual tile air + //Used right before turning on group processing + proc/update_group_from_tiles() + var/sample_member = pick(members) + var/datum/gas_mixture/sample_air = sample_member:air + + air.copy_from(sample_air) + air.group_multiplier = members.len + return 1 + + + //Copy group air information to individual tile air + //Used right before turning off group processing + proc/update_tiles_from_group() + for(var/member in members) + member:air.copy_from(air) + if (istype(member,/turf/simulated)) + var/turf/simulated/turfmem=member + turfmem.reset_delay() + + + proc/archive() + air.archive() + archived_cycle = air_master.current_cycle + + + //If individually processing tiles, checks all member tiles to see if they are close enough that the group may resume group processing + //Warning: Do not call, called by air_master.process() + proc/check_regroup() + //Purpose: Checks to see if group processing should be turned back on + //Returns: group_processing + if(group_processing) return 1 + + var/turf/simulated/sample = pick(members) + for(var/member in members) + if(member:active_hotspot) + return 0 + if(member:air.compare(sample.air)) continue + else + return 0 update_group_from_tiles() - var/sample_member = pick(members) - var/datum/gas_mixture/sample_air = sample_member:air + group_processing = 1 + return 1 - air.copy_from(sample_air) - air.group_multiplier = members.len +//Look into this + turf/process_group() + current_cycle = air_master.current_cycle + if(!group_processing) //Revert to individual processing then end + for(var/turf/simulated/member in members) + member.process_cell() + return + + //check if we're skipping this tick + if (next_check > 0) + next_check-- return 1 + next_check += check_delay + rand(0,check_delay/2) + check_delay++ - update_tiles_from_group() - for(var/member in members) - member:air.copy_from(air) - if (istype(member,/turf/simulated)) - var/turf/simulated/turfmem=member - turfmem.reset_delay() + var/turf/simulated/list/border_individual = list() + var/datum/air_group/list/border_group = list() - archive() - air.archive() - archived_cycle = air_master.current_cycle + var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc + var/turf/simulated/list/self_group_borders = list() + var/turf/simulated/list/self_tile_borders = list() - check_regroup() - //Purpose: Checks to see if group processing should be turned back on - //Returns: group_processing - if(group_processing) return 1 + if(archived_cycle < air_master.current_cycle) + archive() + //Archive air data for use in calculations + //But only if another group didn't store it for us + for(var/turf/simulated/border_tile in src.borders) + for(var/direction in cardinal) //Go through all border tiles and get bordering groups and individuals + if(border_tile.group_border&direction) + var/turf/simulated/enemy_tile = get_step(border_tile, direction) //Add found tile to appropriate category + if(istype(enemy_tile) && enemy_tile.parent && enemy_tile.parent.group_processing) + border_group += enemy_tile.parent + enemies += enemy_tile + self_group_borders += border_tile + else + border_individual += enemy_tile + self_tile_borders += border_tile - var/turf/simulated/sample = pick(members) - for(var/member in members) - if(member:active_hotspot) - return 0 - if(member:air.compare(sample.air)) continue + var/abort_group = 0 + + // Process connections to adjacent groups + var/border_index = 1 + for(var/datum/air_group/AG in border_group) + if(AG.archived_cycle < archived_cycle) //archive other groups information if it has not been archived yet this cycle + AG.archive() + if(AG.current_cycle < current_cycle) + //This if statement makes sure two groups only process their individual connections once! + //Without it, each connection would be processed a second time as the second group is evaluated + + var/connection_difference = 0 + var/turf/simulated/floor/self_border = self_group_borders[border_index] + var/turf/simulated/floor/enemy_border = enemies[border_index] + + var/result = air.check_gas_mixture(AG.air) + if(result == 1) + connection_difference = air.share(AG.air) + else if(result == -1) + AG.suspend_group_processing() + connection_difference = air.share(enemy_border.air) else - return 0 + abort_group = 1 + break - update_group_from_tiles() - group_processing = 1 + if(connection_difference) + if(connection_difference > 0) + self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_border)) + else + var/turf/enemy_turf = enemy_border + if(!isturf(enemy_turf)) + enemy_turf = enemy_border.loc + enemy_turf.consider_pressure_difference(-connection_difference, get_dir(enemy_turf,self_border)) - return 1 + border_index++ - turf/process_group() - current_cycle = air_master.current_cycle - if(group_processing) //See if processing this group as a group - //check if we're skipping this tick - if (next_check > 0) - next_check-- - return 1 - next_check += check_delay + rand(0,check_delay/2) - check_delay++ + // Process connections to adjacent tiles + border_index = 1 + if(!abort_group) + for(var/atom/enemy_tile in border_individual) + var/connection_difference = 0 + var/turf/simulated/floor/self_border = self_tile_borders[border_index] - var/turf/simulated/list/border_individual = list() - var/datum/air_group/list/border_group = list() - - var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc - var/turf/simulated/list/self_group_borders = list() - var/turf/simulated/list/self_tile_borders = list() - - if(archived_cycle < air_master.current_cycle) - archive() - //Archive air data for use in calculations - //But only if another group didn't store it for us - - for(var/turf/simulated/border_tile in src.borders) - //var/obj/movable/floor/movable_on_me = locate(/obj/movable/floor) in border_tile - for(var/direction in cardinal) //Go through all border tiles and get bordering groups and individuals - if(border_tile.group_border&direction) - var/turf/simulated/enemy_tile = get_step(border_tile, direction) //Add found tile to appropriate category - //var/obj/movable/floor/movable_on_enemy - //if(!movable_on_me) - // movable_on_enemy = locate(/obj/movable/floor) in enemy_tile - /*if(movable_on_enemy) //guaranteed !movable_on_me if this is set - if(movable_on_enemy.parent && movable_on_enemy.parent.group_processing) - border_group += movable_on_enemy.parent - enemies += movable_on_enemy - self_group_borders += border_tile - else - border_individual += movable_on_enemy - self_tile_borders += border_tile - else*/ - if(istype(enemy_tile) && enemy_tile.parent && enemy_tile.parent.group_processing) - border_group += enemy_tile.parent - enemies += enemy_tile - self_group_borders += border_tile - else - border_individual += enemy_tile - self_tile_borders += border_tile - - var/abort_group = 0 - - // Process connections to adjacent groups - var/border_index = 1 - for(var/datum/air_group/AG in border_group) - if(AG.archived_cycle < archived_cycle) //archive other groups information if it has not been archived yet this cycle - AG.archive() - if(AG.current_cycle < current_cycle) - //This if statement makes sure two groups only process their individual connections once! - //Without it, each connection would be processed a second time as the second group is evaluated - - var/connection_difference = 0 - var/turf/simulated/floor/self_border = self_group_borders[border_index] - var/turf/simulated/floor/enemy_border = enemies[border_index] - - var/result = air.check_gas_mixture(AG.air) - if(result == 1) - connection_difference = air.share(AG.air) - else if(result == -1) - AG.suspend_group_processing() - connection_difference = air.share(enemy_border.air) + if(istype(enemy_tile, /turf/simulated)) + if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done + enemy_tile:archive() + if(enemy_tile:current_cycle < current_cycle) + if(air.check_gas_mixture(enemy_tile:air)) + connection_difference = air.share(enemy_tile:air) else abort_group = 1 break + else if(isturf(enemy_tile)) + if(air.check_turf(enemy_tile)) + connection_difference = air.mimic(enemy_tile) + else + abort_group = 1 + break - if(connection_difference) - if(connection_difference > 0) - self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_border)) - else - var/turf/enemy_turf = enemy_border - if(!isturf(enemy_turf)) - enemy_turf = enemy_border.loc - enemy_turf.consider_pressure_difference(-connection_difference, get_dir(enemy_turf,self_border)) + if(connection_difference) + if(connection_difference > 0) + self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_tile)) + else + var/turf/enemy_turf = enemy_tile + if(!isturf(enemy_turf)) + enemy_turf = enemy_tile.loc + enemy_turf.consider_pressure_difference(-connection_difference, get_dir(enemy_tile,enemy_turf)) - border_index++ + // Process connections to space + border_index = 1 + if(!abort_group) + if(length_space_border > 0) + var/turf/space/sample = locate() + var/connection_difference = 0 - // Process connections to adjacent tiles - border_index = 1 - if(!abort_group) - for(var/atom/enemy_tile in border_individual) - var/connection_difference = 0 - var/turf/simulated/floor/self_border = self_tile_borders[border_index] - - if(istype(enemy_tile, /turf/simulated)) - if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done - enemy_tile:archive() - if(enemy_tile:current_cycle < current_cycle) - if(air.check_gas_mixture(enemy_tile:air)) - connection_difference = air.share(enemy_tile:air) - else - abort_group = 1 - break - else if(isturf(enemy_tile)) - if(air.check_turf(enemy_tile)) - connection_difference = air.mimic(enemy_tile) - else - abort_group = 1 - break - - if(connection_difference) - if(connection_difference > 0) - self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_tile)) - else - var/turf/enemy_turf = enemy_tile - if(!isturf(enemy_turf)) - enemy_turf = enemy_tile.loc - enemy_turf.consider_pressure_difference(-connection_difference, get_dir(enemy_tile,enemy_turf)) - - // Process connections to space - border_index = 1 - if(!abort_group) - if(length_space_border > 0) - var/turf/space/sample = locate() - var/connection_difference = 0 - - if(air.check_turf(sample)) - connection_difference = air.mimic(sample, length_space_border) - else - abort_group = 1 - - if(connection_difference) - for(var/turf/simulated/self_border in space_borders) - self_border.consider_pressure_difference_space(connection_difference) - - if(abort_group) - suspend_group_processing() + if(air.check_turf(sample)) + connection_difference = air.mimic(sample, length_space_border) else - if(air.check_tile_graphic()) - for(var/turf/simulated/member in members) - member.update_visuals(air) + abort_group = 1 + if(connection_difference) + for(var/turf/simulated/self_border in space_borders) + self_border.consider_pressure_difference_space(connection_difference) - if(!group_processing) //Revert to individual processing + if(abort_group) + suspend_group_processing() + else + if(air.check_tile_graphic()) for(var/turf/simulated/member in members) - member.process_cell() - else - if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - for(var/turf/simulated/member in members) - member.hotspot_expose(air.temperature, CELL_VOLUME) - member.consider_superconductivity(starting=1) + member.update_visuals(air) - air.react() - object/process_group() - current_cycle = air_master.current_cycle + if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + for(var/turf/simulated/member in members) + member.hotspot_expose(air.temperature, CELL_VOLUME) + member.consider_superconductivity(starting=1) - if(group_processing) //See if processing this group as a group + air.react() + return - var/turf/simulated/list/border_individual = list() - var/datum/air_group/list/border_group = list() - var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc - var/enemy_index = 1 - if(archived_cycle < air_master.current_cycle) - archive() - //Archive air data for use in calculations - //But only if another group didn't store it for us -/* - for(var/obj/movable/floor/border_tile in src.borders) - for(var/direction in list(NORTH,SOUTH,EAST,WEST)) //Go through all border tiles and get bordering groups and individuals - if(border_tile.group_border&direction) - var/turf/simulated/enemy_tile = get_step(border_tile, direction) //Add found tile to appropriate category - 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) - border_group += movable_on_enemy.parent - enemies += movable_on_enemy - enemy_index++ - else - border_individual += movable_on_enemy + object/process_group() + current_cycle = air_master.current_cycle - else - if(istype(enemy_tile) && enemy_tile.parent && enemy_tile.parent.group_processing) - border_group += enemy_tile.parent - enemies += enemy_tile - enemy_index++ - else - border_individual += enemy_tile -*/ - enemy_index = 1 - var/abort_group = 0 - for(var/datum/air_group/AG in border_group) - if(AG.archived_cycle < archived_cycle) //archive other groups information if it has not been archived yet this cycle - AG.archive() - if(AG.current_cycle < current_cycle) - //This if statement makes sure two groups only process their individual connections once! - //Without it, each connection would be processed a second time as the second group is evaluated + if(!group_processing) return //See if processing this group as a group - var/result = air.check_gas_mixture(AG.air) - if(result == 1) - air.share(AG.air) - else if(result == -1) - AG.suspend_group_processing() - var/turf/simulated/floor/enemy_border = enemies[enemy_index] - air.share(enemy_border.air) + var/turf/simulated/list/border_individual = list() + var/datum/air_group/list/border_group = list() + + var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc + var/enemy_index = 1 + + if(archived_cycle < air_master.current_cycle) + archive() + //Archive air data for use in calculations + //But only if another group didn't store it for us + + enemy_index = 1 + var/abort_group = 0 + for(var/datum/air_group/AG in border_group) + if(AG.archived_cycle < archived_cycle) //archive other groups information if it has not been archived yet this cycle + AG.archive() + if(AG.current_cycle < current_cycle) + //This if statement makes sure two groups only process their individual connections once! + //Without it, each connection would be processed a second time as the second group is evaluated + + var/result = air.check_gas_mixture(AG.air) + if(result == 1) + air.share(AG.air) + else if(result == -1) + AG.suspend_group_processing() + var/turf/simulated/floor/enemy_border = enemies[enemy_index] + air.share(enemy_border.air) + else + abort_group = 0 + break + enemy_index++ + + if(!abort_group) + for(var/enemy_tile in border_individual) + if(istype(enemy_tile, /turf/simulated)) + if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done + enemy_tile:archive() + if(enemy_tile:current_cycle < current_cycle) + if(air.check_gas_mixture(enemy_tile:air)) + air.share(enemy_tile:air) else - abort_group = 0 + abort_group = 1 break - enemy_index++ + else + if(air.check_turf(enemy_tile)) + air.mimic(enemy_tile) + else + abort_group = 1 + break - if(!abort_group) - for(var/enemy_tile in border_individual) - if(istype(enemy_tile, /turf/simulated)) - if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done - enemy_tile:archive() - if(enemy_tile:current_cycle < current_cycle) - if(air.check_gas_mixture(enemy_tile:air)) - air.share(enemy_tile:air) - else - abort_group = 1 - break - else - if(air.check_turf(enemy_tile)) - air.mimic(enemy_tile) - else - abort_group = 1 - break + if(abort_group) + suspend_group_processing() - if(abort_group) - suspend_group_processing() \ No newline at end of file + return \ No newline at end of file diff --git a/code/FEA/FEA_fire.dm b/code/FEA/FEA_fire.dm index 502d40efdf1..57adbadd6ad 100644 --- a/code/FEA/FEA_fire.dm +++ b/code/FEA/FEA_fire.dm @@ -1,175 +1,163 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 -atom - proc - temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) - return null +/atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) + return null -turf - proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0) - 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 +/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 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 - if(parent&&parent.group_processing) - parent.suspend_group_processing() +/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 - active_hotspot = new(src) - active_hotspot.temperature = exposed_temperature - active_hotspot.volume = exposed_volume + var/igniting = 0 - active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) - //remove just_spawned protection if no longer processing this cell + if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && air_contents.toxins > 0.5) + igniting = 1 - //start processing quickly if we aren't already - reset_delay() + if(igniting) + if(air_contents.oxygen < 0.5 || air_contents.toxins < 0.5) + return 0 - return igniting + if(parent&&parent.group_processing) + parent.suspend_group_processing() -obj - effect/hotspot - //Icon for fire on turfs, also helps for nurturing small fires until they are full tile + active_hotspot = new(src) + active_hotspot.temperature = exposed_temperature + active_hotspot.volume = exposed_volume - anchored = 1 - mouse_opacity = 0 - unacidable = 1//So you can't melt fire with acid. + active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) + //remove just_spawned protection if no longer processing this cell - //luminosity = 3 + //start processing quickly if we aren't already + reset_delay() - icon = 'fire.dmi' - icon_state = "1" + return igniting - layer = TURF_LAYER - var/volume = 125 - var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST +//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 = 'fire.dmi' + icon_state = "1" + layer = TURF_LAYER - var/just_spawned = 1 + var/volume = 125 + var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + var/just_spawned = 1 + var/bypassing = 0 - var/bypassing = 0 - proc/perform_exposure() - var/turf/simulated/floor/location = loc - if(!istype(location)) - return 0 + 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(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 + 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) + item.temperature_expose(null, temperature, volume) + return 0 + + + process(turf/simulated/list/possible_spread) + if(just_spawned) + just_spawned = 0 + return 0 + + var/turf/simulated/floor/location = loc + if(!istype(location)) + del(src) + + if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1)) + del(src) + + if(location.air.toxins < 0.5 || location.air.oxygen < 0.5) + del(src) + + 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/turf/simulated/possible_target in possible_spread) + if(!possible_target.active_hotspot) + possible_target.hotspot_expose(radiated_temperature, CELL_VOLUME/4) + + else + if(volume > CELL_VOLUME*0.4) + icon_state = "2" else - var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume) + icon_state = "1" - affected.temperature = temperature + if(temperature > location.max_fire_temperature_sustained) + location.max_fire_temperature_sustained = temperature - affected.react() - - temperature = affected.temperature - volume = affected.fuel_burnt*FIRE_GROWTH_RATE - - location.assume_air(affected) - - for(var/atom/item in loc) - item.temperature_expose(null, temperature, volume) - - process(turf/simulated/list/possible_spread) - if(just_spawned) - just_spawned = 0 - return 0 - - var/turf/simulated/floor/location = loc - if(!istype(location)) - del(src) - - if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1)) - del(src) - - if(location.air.toxins < 0.5 || location.air.oxygen < 0.5) - del(src) + if(temperature > location.heat_capacity) + location.to_be_destroyed = 1 + /*if(prob(25)) + location.ReplaceWithSpace() + return 0*/ + return 1 - perform_exposure() + New() + ..() + dir = pick(cardinal) + sd_SetLuminosity(3) + return - if(location.wet) location.wet = 0 - if(bypassing) - icon_state = "3" - location.burn_tile() + Del() + if (istype(loc, /turf/simulated)) + var/turf/simulated/T = loc + loc:active_hotspot = null + src.sd_SetLuminosity(0) - //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/turf/simulated/possible_target in possible_spread) - if(!possible_target.active_hotspot) - possible_target.hotspot_expose(radiated_temperature, CELL_VOLUME/4) - - else - if(volume > CELL_VOLUME*0.4) - icon_state = "2" + 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 - icon_state = "1" + chance_of_deletion = 100 + if(prob(chance_of_deletion)) + T.ReplaceWithSpace() + else + T.to_be_destroyed = 0 + T.max_fire_temperature_sustained = 0 - if(temperature > location.max_fire_temperature_sustained) - location.max_fire_temperature_sustained = temperature - - if(temperature > location.heat_capacity) - location.to_be_destroyed = 1 - /*if(prob(25)) - location.ReplaceWithSpace() - return 0*/ - - return 1 - - New() - ..() - dir = pick(cardinal) - sd_SetLuminosity(3) - - Del() - if (istype(loc, /turf/simulated)) - var/turf/simulated/T = loc - loc:active_hotspot = null - src.sd_SetLuminosity(0) - - - - 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.ReplaceWithSpace() - else - T.to_be_destroyed = 0 - T.max_fire_temperature_sustained = 0 - - loc = null - - ..() + loc = null + ..() + return diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 4c9a2091d64..d0866ad5e79 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -13,948 +13,932 @@ What are the archived variables for? #define MINIMUM_HEAT_CAPACITY 0.0003 #define QUANTIZE(variable) (round(variable,0.0001)) -datum - gas - sleeping_agent - specific_heat = 40 +/datum/gas + sleeping_agent + specific_heat = 40 - oxygen_agent_b - specific_heat = 300 + oxygen_agent_b + specific_heat = 300 - volatile_fuel - specific_heat = 30 + volatile_fuel + specific_heat = 30 - var - moles = 0 - specific_heat = 0 + var + moles = 0 + specific_heat = 0 - moles_archived = 0 + moles_archived = 0 - gas_mixture - var - oxygen = 0 - carbon_dioxide = 0 - nitrogen = 0 - toxins = 0 - volume = CELL_VOLUME +/datum/gas_mixture + var/oxygen = 0 + var/carbon_dioxide = 0 + var/nitrogen = 0 + var/toxins = 0 - temperature = 0 //in Kelvin, use calculate_temperature() to modify + var/volume = CELL_VOLUME - var/group_multiplier = 1 - //Size of the group this gas_mixture is representing. - //=1 for singletons + var/temperature = 0 //in Kelvin, use calculate_temperature() to modify - graphic + var/group_multiplier = 1 + //Size of the group this gas_mixture is representing. + //=1 for singletons - var/list/datum/gas/trace_gases = list() + var/graphic - tmp - oxygen_archived - carbon_dioxide_archived - nitrogen_archived - toxins_archived + var/list/datum/gas/trace_gases = list() - temperature_archived - graphic_archived - fuel_burnt = 0 + var/tmp/oxygen_archived + var/tmp/carbon_dioxide_archived + var/tmp/nitrogen_archived + var/tmp/toxins_archived - proc //PV=nRT - related procedures - heat_capacity() - var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) + var/tmp/temperature_archived - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - heat_capacity += trace_gas.moles*trace_gas.specific_heat + var/tmp/graphic_archived + var/tmp/fuel_burnt = 0 - return heat_capacity + //PV=nRT - related procedures + proc/heat_capacity() + var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) - heat_capacity_archived() - var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived) + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + heat_capacity += trace_gas.moles*trace_gas.specific_heat + return heat_capacity - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat - return heat_capacity_archived + proc/heat_capacity_archived() + var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived) - total_moles() - var/moles = oxygen + carbon_dioxide + nitrogen + toxins - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - moles += trace_gas.moles - - return moles - - return_pressure() - if(volume>0) - return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume - return 0 - - return_temperature() - return temperature + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat + return heat_capacity_archived - return_volume() - return max(0, volume) - thermal_energy() - return temperature*heat_capacity() - - proc //Procedures used for very specific events - check_tile_graphic() - //returns 1 if graphic changed - graphic = null - if(toxins > MOLES_PLASMA_VISIBLE) - graphic = "plasma" - else - var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases - if(sleeping_agent && (sleeping_agent.moles > 1)) - graphic = "sleeping_agent" - else - graphic = null - - return graphic != graphic_archived + proc/total_moles() + var/moles = oxygen + carbon_dioxide + nitrogen + toxins - react(atom/dump_location) - var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + moles += trace_gas.moles + return moles - if(trace_gases.len > 0) - if(temperature > 900) - if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) - var/datum/gas/oxygen_agent_b/trace_gas = locate(/datum/gas/oxygen_agent_b/) in trace_gases - if(trace_gas) - var/reaction_rate = min(carbon_dioxide*0.75, toxins*0.25, trace_gas.moles*0.05) - - carbon_dioxide -= reaction_rate - oxygen += reaction_rate - - trace_gas.moles -= reaction_rate*0.05 - - temperature -= (reaction_rate*20000)/heat_capacity() - - reacting = 1 - fuel_burnt = 0 - if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - //world << "pre [temperature], [oxygen], [toxins]" - if(fire() > 0) - reacting = 1 - //world << "post [temperature], [oxygen], [toxins]" - - return reacting + proc/return_pressure() + if(volume>0) + return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume + return 0 - fire() - var/energy_released = 0 - var/old_heat_capacity = heat_capacity() - - var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel/) in trace_gases - if(fuel_store) //General volatile gas burn - var/burned_fuel = 0 - - if(oxygen < fuel_store.moles) - burned_fuel = oxygen - fuel_store.moles -= burned_fuel - oxygen = 0 - else - burned_fuel = fuel_store.moles - oxygen -= fuel_store.moles - del(fuel_store) - - energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel - carbon_dioxide += burned_fuel - fuel_burnt += burned_fuel - - //Handle plasma burning - if(toxins > MINIMUM_HEAT_CAPACITY) - var/plasma_burn_rate = 0 - var/oxygen_burn_rate = 0 - //more plasma released at higher temperatures - var/temperature_scale - if(temperature > PLASMA_UPPER_TEMPERATURE) - temperature_scale = 1 - else - temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) - if(temperature_scale > 0) - oxygen_burn_rate = 1.4 - temperature_scale - if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN) - plasma_burn_rate = (toxins*temperature_scale)/4 - else - plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4 - if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) - toxins -= plasma_burn_rate - oxygen -= plasma_burn_rate*oxygen_burn_rate - carbon_dioxide += plasma_burn_rate - energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) + proc/return_temperature() + return temperature - fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate) - if(energy_released > 0) - var/new_heat_capacity = heat_capacity() - if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity + proc/return_volume() + return max(0, volume) - return fuel_burnt - proc - archive() - //Update archived versions of variables - //Returns: 1 in all cases - - merge(datum/gas_mixture/giver) - //Merges all air from giver into self. Deletes giver. - //Returns: 1 on success (no failure cases yet) + proc/thermal_energy() + return temperature*heat_capacity() - check_then_merge(datum/gas_mixture/giver) - //Similar to merge(...) but first checks to see if the amount of air assumed is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: 1 on successful merge, 0 if the check failed - remove(amount) - //Proportionally removes amount of gas from the gas_mixture - //Returns: gas_mixture with the gases removed - - remove_ratio(ratio) - //Proportionally removes amount of gas from the gas_mixture - //Returns: gas_mixture with the gases removed - - subtract(datum/gas_mixture/right_side) - //Subtracts right_side from air_mixture. Used to help turfs mingle - - check_then_remove(amount) - //Similar to remove(...) but first checks to see if the amount of air removed is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: gas_mixture with the gases removed or null - - copy_from(datum/gas_mixture/sample) - //Copies variables from sample - - share(datum/gas_mixture/sharer) - //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length - //Return: amount of gas exchanged (+ if sharer received) - - mimic(turf/model) - //Similar to share(...), except the model is not modified - //Return: amount of gas exchanged - - check_gas_mixture(datum/gas_mixture/sharer) - //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if both checks pass - - check_turf(turf/model) - //Returns: 0 if self-check failed or 1 if check passes - - // check_me_then_share(datum/gas_mixture/sharer) - //Similar to share(...) but first checks to see if amount of air moved is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: 1 on successful share, 0 if the check failed - - // check_me_then_mimic(turf/model) - //Similar to mimic(...) but first checks to see if amount of air moved is small enough - // that group processing is still accurate (aborts if not) - //Returns: 1 on successful mimic, 0 if the check failed - - // check_both_then_share(datum/gas_mixture/sharer) - //Similar to check_me_then_share(...) but also checks to see if amount of air moved is small enough - // that group processing is still accurate for the sharer (aborts if not) - //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if successful share - - - temperature_mimic(turf/model, conduction_coefficient) - - temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - - - check_me_then_temperature_mimic(turf/model, conduction_coefficient) - - check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - - compare(datum/gas_mixture/sample) - //Compares sample to self to see if within acceptable ranges that group processing may be enabled - - archive() - oxygen_archived = oxygen - carbon_dioxide_archived = carbon_dioxide - nitrogen_archived = nitrogen - toxins_archived = toxins - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - trace_gas.moles_archived = trace_gas.moles - - temperature_archived = temperature - - graphic_archived = graphic - - return 1 - - check_then_merge(datum/gas_mixture/giver) - if(!giver) - return 0 - if(((giver.oxygen > MINIMUM_AIR_TO_SUSPEND) && (giver.oxygen >= oxygen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((giver.carbon_dioxide > MINIMUM_AIR_TO_SUSPEND) && (giver.carbon_dioxide >= carbon_dioxide*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((giver.nitrogen > MINIMUM_AIR_TO_SUSPEND) && (giver.nitrogen >= nitrogen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((giver.toxins > MINIMUM_AIR_TO_SUSPEND) && (giver.toxins >= toxins*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - if(abs(giver.temperature - temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) - return 0 - - if(giver.trace_gases.len) - for(var/datum/gas/trace_gas in giver.trace_gases) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if((trace_gas.moles > MINIMUM_AIR_TO_SUSPEND) && (!corresponding || (trace_gas.moles >= corresponding.moles*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - - return merge(giver) - - merge(datum/gas_mixture/giver) - if(!giver) - return 0 - - if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity()*group_multiplier - var/giver_heat_capacity = giver.heat_capacity()*giver.group_multiplier - var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity - if(combined_heat_capacity != 0) - temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity - - if((group_multiplier>1)||(giver.group_multiplier>1)) - oxygen += giver.oxygen*giver.group_multiplier/group_multiplier - carbon_dioxide += giver.carbon_dioxide*giver.group_multiplier/group_multiplier - nitrogen += giver.nitrogen*giver.group_multiplier/group_multiplier - toxins += giver.toxins*giver.group_multiplier/group_multiplier + //Procedures used for very specific events + proc/check_tile_graphic() + //returns 1 if graphic changed + graphic = null + if(toxins > MOLES_PLASMA_VISIBLE) + graphic = "plasma" + else + var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases + if(sleeping_agent && (sleeping_agent.moles > 1)) + graphic = "sleeping_agent" else - oxygen += giver.oxygen - carbon_dioxide += giver.carbon_dioxide - nitrogen += giver.nitrogen - toxins += giver.toxins + graphic = null - if(giver.trace_gases.len) - for(var/datum/gas/trace_gas in giver.trace_gases) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - trace_gases += corresponding - corresponding.moles += trace_gas.moles*giver.group_multiplier/group_multiplier + return graphic != graphic_archived - del(giver) - return 1 + proc/react(atom/dump_location) + var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) - remove(amount) + if(trace_gases.len > 0) + if(temperature > 900) + if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) + var/datum/gas/oxygen_agent_b/trace_gas = locate(/datum/gas/oxygen_agent_b/) in trace_gases + if(trace_gas) + var/reaction_rate = min(carbon_dioxide*0.75, toxins*0.25, trace_gas.moles*0.05) - var/sum = total_moles() - amount = min(amount,sum) //Can not take more air than tile has! - if(amount <= 0) - return null + carbon_dioxide -= reaction_rate + oxygen += reaction_rate - var/datum/gas_mixture/removed = new + trace_gas.moles -= reaction_rate*0.05 + + temperature -= (reaction_rate*20000)/heat_capacity() + + reacting = 1 + + fuel_burnt = 0 + if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + //world << "pre [temperature], [oxygen], [toxins]" + if(fire() > 0) + reacting = 1 + //world << "post [temperature], [oxygen], [toxins]" + + return reacting + + proc/fire() + var/energy_released = 0 + var/old_heat_capacity = heat_capacity() + + var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel/) in trace_gases + if(fuel_store) //General volatile gas burn + var/burned_fuel = 0 + + if(oxygen < fuel_store.moles) + burned_fuel = oxygen + fuel_store.moles -= burned_fuel + oxygen = 0 + else + burned_fuel = fuel_store.moles + oxygen -= fuel_store.moles + del(fuel_store) + + energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel + carbon_dioxide += burned_fuel + fuel_burnt += burned_fuel + + //Handle plasma burning + if(toxins > MINIMUM_HEAT_CAPACITY) + var/plasma_burn_rate = 0 + var/oxygen_burn_rate = 0 + //more plasma released at higher temperatures + var/temperature_scale + if(temperature > PLASMA_UPPER_TEMPERATURE) + temperature_scale = 1 + else + temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) + if(temperature_scale > 0) + oxygen_burn_rate = 1.4 - temperature_scale + if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN) + plasma_burn_rate = (toxins*temperature_scale)/4 + else + plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4 + if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) + toxins -= plasma_burn_rate + oxygen -= plasma_burn_rate*oxygen_burn_rate + carbon_dioxide += plasma_burn_rate + + energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) + + fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate) + + if(energy_released > 0) + var/new_heat_capacity = heat_capacity() + if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) + temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity + + return fuel_burnt + + proc/archive() + //Update archived versions of variables + //Returns: 1 in all cases + + proc/merge(datum/gas_mixture/giver) + //Merges all air from giver into self. Deletes giver. + //Returns: 1 on success (no failure cases yet) + + proc/check_then_merge(datum/gas_mixture/giver) + //Similar to merge(...) but first checks to see if the amount of air assumed is small enough + // that group processing is still accurate for source (aborts if not) + //Returns: 1 on successful merge, 0 if the check failed + + proc/remove(amount) + //Proportionally removes amount of gas from the gas_mixture + //Returns: gas_mixture with the gases removed + + proc/remove_ratio(ratio) + //Proportionally removes amount of gas from the gas_mixture + //Returns: gas_mixture with the gases removed + + proc/subtract(datum/gas_mixture/right_side) + //Subtracts right_side from air_mixture. Used to help turfs mingle + + proc/check_then_remove(amount) + //Similar to remove(...) but first checks to see if the amount of air removed is small enough + // that group processing is still accurate for source (aborts if not) + //Returns: gas_mixture with the gases removed or null + + proc/copy_from(datum/gas_mixture/sample) + //Copies variables from sample + + proc/share(datum/gas_mixture/sharer) + //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length + //Return: amount of gas exchanged (+ if sharer received) + + proc/mimic(turf/model) + //Similar to share(...), except the model is not modified + //Return: amount of gas exchanged + + proc/check_gas_mixture(datum/gas_mixture/sharer) + //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if both checks pass + + proc/check_turf(turf/model) + //Returns: 0 if self-check failed or 1 if check passes + + // check_me_then_share(datum/gas_mixture/sharer) + //Similar to share(...) but first checks to see if amount of air moved is small enough + // that group processing is still accurate for source (aborts if not) + //Returns: 1 on successful share, 0 if the check failed + + // check_me_then_mimic(turf/model) + //Similar to mimic(...) but first checks to see if amount of air moved is small enough + // that group processing is still accurate (aborts if not) + //Returns: 1 on successful mimic, 0 if the check failed + + // check_both_then_share(datum/gas_mixture/sharer) + //Similar to check_me_then_share(...) but also checks to see if amount of air moved is small enough + // that group processing is still accurate for the sharer (aborts if not) + //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if successful share - removed.oxygen = QUANTIZE((oxygen/sum)*amount) - removed.nitrogen = QUANTIZE((nitrogen/sum)*amount) - removed.carbon_dioxide = QUANTIZE((carbon_dioxide/sum)*amount) - removed.toxins = QUANTIZE((toxins/sum)*amount) + proc/temperature_mimic(turf/model, conduction_coefficient) - oxygen -= removed.oxygen/group_multiplier - nitrogen -= removed.nitrogen/group_multiplier - carbon_dioxide -= removed.carbon_dioxide/group_multiplier - toxins -= removed.toxins/group_multiplier + proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - var/datum/gas/corresponding = new trace_gas.type() - removed.trace_gases += corresponding + proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - corresponding.moles = (trace_gas.moles/sum)*amount - trace_gas.moles -= corresponding.moles/group_multiplier - removed.temperature = temperature + proc/check_me_then_temperature_mimic(turf/model, conduction_coefficient) - return removed + proc/check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - remove_ratio(ratio) + proc/check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - if(ratio <= 0) - return null + proc/check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - ratio = min(ratio, 1) + proc/compare(datum/gas_mixture/sample) + //Compares sample to self to see if within acceptable ranges that group processing may be enabled - var/datum/gas_mixture/removed = new + archive() + oxygen_archived = oxygen + carbon_dioxide_archived = carbon_dioxide + nitrogen_archived = nitrogen + toxins_archived = toxins - removed.oxygen = QUANTIZE(oxygen*ratio) - removed.nitrogen = QUANTIZE(nitrogen*ratio) - removed.carbon_dioxide = QUANTIZE(carbon_dioxide*ratio) - removed.toxins = QUANTIZE(toxins*ratio) + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + trace_gas.moles_archived = trace_gas.moles - oxygen -= removed.oxygen/group_multiplier - nitrogen -= removed.nitrogen/group_multiplier - carbon_dioxide -= removed.carbon_dioxide/group_multiplier - toxins -= removed.toxins/group_multiplier + temperature_archived = temperature - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - var/datum/gas/corresponding = new trace_gas.type() - removed.trace_gases += corresponding + graphic_archived = graphic - corresponding.moles = trace_gas.moles*ratio - trace_gas.moles -= corresponding.moles/group_multiplier + return 1 - removed.temperature = temperature + check_then_merge(datum/gas_mixture/giver) + if(!giver) + return 0 + if(((giver.oxygen > MINIMUM_AIR_TO_SUSPEND) && (giver.oxygen >= oxygen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((giver.carbon_dioxide > MINIMUM_AIR_TO_SUSPEND) && (giver.carbon_dioxide >= carbon_dioxide*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((giver.nitrogen > MINIMUM_AIR_TO_SUSPEND) && (giver.nitrogen >= nitrogen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((giver.toxins > MINIMUM_AIR_TO_SUSPEND) && (giver.toxins >= toxins*MINIMUM_AIR_RATIO_TO_SUSPEND))) + return 0 + if(abs(giver.temperature - temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) + return 0 - return removed + if(giver.trace_gases.len) + for(var/datum/gas/trace_gas in giver.trace_gases) + var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases + if((trace_gas.moles > MINIMUM_AIR_TO_SUSPEND) && (!corresponding || (trace_gas.moles >= corresponding.moles*MINIMUM_AIR_RATIO_TO_SUSPEND))) + return 0 - check_then_remove(amount) + return merge(giver) - //Since it is all proportional, the check may be done on the gas as a whole - var/sum = total_moles() - amount = min(amount,sum) //Can not take more air than tile has! + merge(datum/gas_mixture/giver) + if(!giver) + return 0 - if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > sum*MINIMUM_AIR_RATIO_TO_SUSPEND)) - return 0 + if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/self_heat_capacity = heat_capacity()*group_multiplier + var/giver_heat_capacity = giver.heat_capacity()*giver.group_multiplier + var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity + if(combined_heat_capacity != 0) + temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity - return remove(amount) + if((group_multiplier>1)||(giver.group_multiplier>1)) + oxygen += giver.oxygen*giver.group_multiplier/group_multiplier + carbon_dioxide += giver.carbon_dioxide*giver.group_multiplier/group_multiplier + nitrogen += giver.nitrogen*giver.group_multiplier/group_multiplier + toxins += giver.toxins*giver.group_multiplier/group_multiplier + else + oxygen += giver.oxygen + carbon_dioxide += giver.carbon_dioxide + nitrogen += giver.nitrogen + toxins += giver.toxins - copy_from(datum/gas_mixture/sample) - oxygen = sample.oxygen - carbon_dioxide = sample.carbon_dioxide - nitrogen = sample.nitrogen - toxins = sample.toxins + if(giver.trace_gases.len) + for(var/datum/gas/trace_gas in giver.trace_gases) + var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases + if(!corresponding) + corresponding = new trace_gas.type() + trace_gases += corresponding + corresponding.moles += trace_gas.moles*giver.group_multiplier/group_multiplier - trace_gases.len=null - if(sample.trace_gases.len > 0) - for(var/datum/gas/trace_gas in sample.trace_gases) - var/datum/gas/corresponding = new trace_gas.type() + del(giver) + return 1 + + remove(amount) + + var/sum = total_moles() + amount = min(amount,sum) //Can not take more air than tile has! + if(amount <= 0) + return null + + var/datum/gas_mixture/removed = new + + + removed.oxygen = QUANTIZE((oxygen/sum)*amount) + removed.nitrogen = QUANTIZE((nitrogen/sum)*amount) + removed.carbon_dioxide = QUANTIZE((carbon_dioxide/sum)*amount) + removed.toxins = QUANTIZE((toxins/sum)*amount) + + oxygen -= removed.oxygen/group_multiplier + nitrogen -= removed.nitrogen/group_multiplier + carbon_dioxide -= removed.carbon_dioxide/group_multiplier + toxins -= removed.toxins/group_multiplier + + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + var/datum/gas/corresponding = new trace_gas.type() + removed.trace_gases += corresponding + + corresponding.moles = (trace_gas.moles/sum)*amount + trace_gas.moles -= corresponding.moles/group_multiplier + + removed.temperature = temperature + + return removed + + remove_ratio(ratio) + + if(ratio <= 0) + return null + + ratio = min(ratio, 1) + + var/datum/gas_mixture/removed = new + + removed.oxygen = QUANTIZE(oxygen*ratio) + removed.nitrogen = QUANTIZE(nitrogen*ratio) + removed.carbon_dioxide = QUANTIZE(carbon_dioxide*ratio) + removed.toxins = QUANTIZE(toxins*ratio) + + oxygen -= removed.oxygen/group_multiplier + nitrogen -= removed.nitrogen/group_multiplier + carbon_dioxide -= removed.carbon_dioxide/group_multiplier + toxins -= removed.toxins/group_multiplier + + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + var/datum/gas/corresponding = new trace_gas.type() + removed.trace_gases += corresponding + + corresponding.moles = trace_gas.moles*ratio + trace_gas.moles -= corresponding.moles/group_multiplier + + removed.temperature = temperature + + return removed + + check_then_remove(amount) + + //Since it is all proportional, the check may be done on the gas as a whole + var/sum = total_moles() + amount = min(amount,sum) //Can not take more air than tile has! + + if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > sum*MINIMUM_AIR_RATIO_TO_SUSPEND)) + return 0 + + return remove(amount) + + copy_from(datum/gas_mixture/sample) + oxygen = sample.oxygen + carbon_dioxide = sample.carbon_dioxide + nitrogen = sample.nitrogen + toxins = sample.toxins + + trace_gases.len=null + if(sample.trace_gases.len > 0) + for(var/datum/gas/trace_gas in sample.trace_gases) + var/datum/gas/corresponding = new trace_gas.type() + trace_gases += corresponding + + corresponding.moles = trace_gas.moles + + temperature = sample.temperature + + return 1 + + subtract(datum/gas_mixture/right_side) + oxygen -= right_side.oxygen + carbon_dioxide -= right_side.carbon_dioxide + nitrogen -= right_side.nitrogen + toxins -= right_side.toxins + + if((trace_gases.len > 0)||(right_side.trace_gases.len > 0)) + for(var/datum/gas/trace_gas in right_side.trace_gases) + var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases + if(!corresponding) + corresponding = new trace_gas.type() trace_gases += corresponding - corresponding.moles = trace_gas.moles + corresponding.moles -= trace_gas.moles - temperature = sample.temperature + return 1 - return 1 + check_gas_mixture(datum/gas_mixture/sharer) + if(!sharer) return 0 + var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5 + var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 + var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5 + var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5 - subtract(datum/gas_mixture/right_side) - oxygen -= right_side.oxygen - carbon_dioxide -= right_side.carbon_dioxide - nitrogen -= right_side.nitrogen - toxins -= right_side.toxins + var/delta_temperature = (temperature_archived - sharer.temperature_archived) - if((trace_gases.len > 0)||(right_side.trace_gases.len > 0)) - for(var/datum/gas/trace_gas in right_side.trace_gases) + if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) + return 0 + + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) + return 0 + + if(sharer.trace_gases.len) + for(var/datum/gas/trace_gas in sharer.trace_gases) + if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - trace_gases += corresponding - - corresponding.moles -= trace_gas.moles - - return 1 - - /* check_me_then_share(datum/gas_mixture/sharer) - var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5 - var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 - var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5 - var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5 - - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) - return 0 - - return share(sharer)*/ - - check_gas_mixture(datum/gas_mixture/sharer) - if(!sharer) return 0 - var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5 - var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 - var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5 - var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5 - - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) - return 0 - - if(sharer.trace_gases.len) - for(var/datum/gas/trace_gas in sharer.trace_gases) - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(corresponding) - if(trace_gas.moles_archived >= corresponding.moles_archived*MINIMUM_AIR_RATIO_TO_SUSPEND*4) - return 0 - else + if(corresponding) + if(trace_gas.moles_archived >= corresponding.moles_archived*MINIMUM_AIR_RATIO_TO_SUSPEND*4) return 0 - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) - if(!locate(trace_gas.type) in sharer.trace_gases) - return 0 - - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= sharer.oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= sharer.carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= sharer.nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= sharer.toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return -1 - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) - var/datum/gas/corresponding = locate(trace_gas.type) in sharer.trace_gases - if(corresponding) - if(trace_gas.moles_archived >= corresponding.moles_archived*MINIMUM_AIR_RATIO_TO_SUSPEND*4) - return -1 - else - return -1 - - return 1 - - check_turf(turf/model) - var/delta_oxygen = (oxygen_archived - model.oxygen)/5 - var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/5 - var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/5 - var/delta_toxins = (toxins_archived - model.toxins)/5 - - var/delta_temperature = (temperature_archived - model.temperature) - - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) - return 0 - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) + else return 0 - return 1 + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) + if(!locate(trace_gas.type) in sharer.trace_gases) + return 0 - share(datum/gas_mixture/sharer) - 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_temperature = (temperature_archived - sharer.temperature_archived) - - var/old_self_heat_capacity = 0 - var/old_sharer_heat_capacity = 0 - - var/heat_self_to_sharer = 0 - var/heat_capacity_self_to_sharer = 0 - var/heat_sharer_to_self = 0 - var/heat_capacity_sharer_to_self = 0 - - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - - var/delta_air = delta_oxygen+delta_nitrogen - if(delta_air) - var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air - if(delta_air > 0) - heat_self_to_sharer += air_heat_capacity*temperature_archived - heat_capacity_self_to_sharer += air_heat_capacity - else - heat_sharer_to_self -= air_heat_capacity*sharer.temperature_archived - heat_capacity_sharer_to_self -= air_heat_capacity - - if(delta_carbon_dioxide) - var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide - if(delta_carbon_dioxide > 0) - heat_self_to_sharer += carbon_dioxide_heat_capacity*temperature_archived - heat_capacity_self_to_sharer += carbon_dioxide_heat_capacity - else - heat_sharer_to_self -= carbon_dioxide_heat_capacity*sharer.temperature_archived - heat_capacity_sharer_to_self -= carbon_dioxide_heat_capacity - - if(delta_toxins) - var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins - if(delta_toxins > 0) - heat_self_to_sharer += toxins_heat_capacity*temperature_archived - heat_capacity_self_to_sharer += toxins_heat_capacity - else - heat_sharer_to_self -= toxins_heat_capacity*sharer.temperature_archived - heat_capacity_sharer_to_self -= toxins_heat_capacity - - old_self_heat_capacity = heat_capacity()*group_multiplier - old_sharer_heat_capacity = sharer.heat_capacity()*sharer.group_multiplier - - oxygen -= delta_oxygen/group_multiplier - sharer.oxygen += delta_oxygen/sharer.group_multiplier - - carbon_dioxide -= delta_carbon_dioxide/group_multiplier - sharer.carbon_dioxide += delta_carbon_dioxide/sharer.group_multiplier - - nitrogen -= delta_nitrogen/group_multiplier - sharer.nitrogen += delta_nitrogen/sharer.group_multiplier - - toxins -= delta_toxins/group_multiplier - sharer.toxins += delta_toxins/sharer.group_multiplier - - var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) - - var/list/trace_types_considered = list() - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) + if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= sharer.oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= sharer.carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= sharer.nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= sharer.toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) + return -1 + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) var/datum/gas/corresponding = locate(trace_gas.type) in sharer.trace_gases - var/delta = 0 - if(corresponding) - delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/5 + if(trace_gas.moles_archived >= corresponding.moles_archived*MINIMUM_AIR_RATIO_TO_SUSPEND*4) + return -1 else - corresponding = new trace_gas.type() - sharer.trace_gases += corresponding + return -1 - delta = trace_gas.moles_archived/5 + return 1 - trace_gas.moles -= delta/group_multiplier - corresponding.moles += delta/sharer.group_multiplier + check_turf(turf/model) + var/delta_oxygen = (oxygen_archived - model.oxygen)/5 + var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/5 + var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/5 + var/delta_toxins = (toxins_archived - model.toxins)/5 - if(delta) - var/individual_heat_capacity = trace_gas.specific_heat*delta - if(delta > 0) - heat_self_to_sharer += individual_heat_capacity*temperature_archived - heat_capacity_self_to_sharer += individual_heat_capacity - else - heat_sharer_to_self -= individual_heat_capacity*sharer.temperature_archived - heat_capacity_sharer_to_self -= individual_heat_capacity + var/delta_temperature = (temperature_archived - model.temperature) - moved_moles += delta + if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ + || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) + return 0 + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) + return 0 - trace_types_considered += trace_gas.type + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND*4) + return 0 + return 1 - if(sharer.trace_gases.len) - for(var/datum/gas/trace_gas in sharer.trace_gases) - if(trace_gas.type in trace_types_considered) continue - else - var/datum/gas/corresponding - var/delta = 0 + share(datum/gas_mixture/sharer) + 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 - corresponding = new trace_gas.type() - trace_gases += corresponding + var/delta_temperature = (temperature_archived - sharer.temperature_archived) - delta = trace_gas.moles_archived/5 + var/old_self_heat_capacity = 0 + var/old_sharer_heat_capacity = 0 - trace_gas.moles -= delta/sharer.group_multiplier - corresponding.moles += delta/group_multiplier + var/heat_self_to_sharer = 0 + var/heat_capacity_self_to_sharer = 0 + var/heat_sharer_to_self = 0 + var/heat_capacity_sharer_to_self = 0 - //Guaranteed transfer from sharer to self - var/individual_heat_capacity = trace_gas.specific_heat*delta - heat_sharer_to_self += individual_heat_capacity*sharer.temperature_archived - heat_capacity_sharer_to_self += individual_heat_capacity + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - moved_moles += -delta + var/delta_air = delta_oxygen+delta_nitrogen + if(delta_air) + var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air + if(delta_air > 0) + heat_self_to_sharer += air_heat_capacity*temperature_archived + heat_capacity_self_to_sharer += air_heat_capacity + else + heat_sharer_to_self -= air_heat_capacity*sharer.temperature_archived + heat_capacity_sharer_to_self -= air_heat_capacity - 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 - var/new_sharer_heat_capacity = old_sharer_heat_capacity + heat_capacity_self_to_sharer - heat_capacity_sharer_to_self + if(delta_carbon_dioxide) + var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide + if(delta_carbon_dioxide > 0) + heat_self_to_sharer += carbon_dioxide_heat_capacity*temperature_archived + heat_capacity_self_to_sharer += carbon_dioxide_heat_capacity + else + heat_sharer_to_self -= carbon_dioxide_heat_capacity*sharer.temperature_archived + heat_capacity_sharer_to_self -= carbon_dioxide_heat_capacity - if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (old_self_heat_capacity*temperature - heat_capacity_self_to_sharer*temperature_archived + heat_capacity_sharer_to_self*sharer.temperature_archived)/new_self_heat_capacity + if(delta_toxins) + var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins + if(delta_toxins > 0) + heat_self_to_sharer += toxins_heat_capacity*temperature_archived + heat_capacity_self_to_sharer += toxins_heat_capacity + else + heat_sharer_to_self -= toxins_heat_capacity*sharer.temperature_archived + heat_capacity_sharer_to_self -= toxins_heat_capacity - if(new_sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) - sharer.temperature = (old_sharer_heat_capacity*sharer.temperature-heat_capacity_sharer_to_self*sharer.temperature_archived + heat_capacity_self_to_sharer*temperature_archived)/new_sharer_heat_capacity + old_self_heat_capacity = heat_capacity()*group_multiplier + old_sharer_heat_capacity = sharer.heat_capacity()*sharer.group_multiplier - if(abs(old_sharer_heat_capacity) > MINIMUM_HEAT_CAPACITY) - if(abs(new_sharer_heat_capacity/old_sharer_heat_capacity - 1) < 0.10) // <10% change in sharer heat capacity - temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT) + oxygen -= delta_oxygen/group_multiplier + sharer.oxygen += delta_oxygen/sharer.group_multiplier - if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - 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 + carbon_dioxide -= delta_carbon_dioxide/group_multiplier + sharer.carbon_dioxide += delta_carbon_dioxide/sharer.group_multiplier - else - return 0 + nitrogen -= delta_nitrogen/group_multiplier + sharer.nitrogen += delta_nitrogen/sharer.group_multiplier - 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 + toxins -= delta_toxins/group_multiplier + sharer.toxins += delta_toxins/sharer.group_multiplier - var/delta_temperature = (temperature_archived - model.temperature) + var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) - var/heat_transferred = 0 - var/old_self_heat_capacity = 0 - var/heat_capacity_transferred = 0 + var/list/trace_types_considered = list() - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) - var/delta_air = delta_oxygen+delta_nitrogen - if(delta_air) - var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air - heat_transferred -= air_heat_capacity*model.temperature - heat_capacity_transferred -= air_heat_capacity + var/datum/gas/corresponding = locate(trace_gas.type) in sharer.trace_gases + var/delta = 0 - if(delta_carbon_dioxide) - var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide - heat_transferred -= carbon_dioxide_heat_capacity*model.temperature - heat_capacity_transferred -= carbon_dioxide_heat_capacity - - if(delta_toxins) - var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins - heat_transferred -= toxins_heat_capacity*model.temperature - heat_capacity_transferred -= toxins_heat_capacity - - old_self_heat_capacity = heat_capacity()*group_multiplier - - if(border_multiplier) - oxygen -= delta_oxygen*border_multiplier/group_multiplier - carbon_dioxide -= delta_carbon_dioxide*border_multiplier/group_multiplier - nitrogen -= delta_nitrogen*border_multiplier/group_multiplier - toxins -= delta_toxins*border_multiplier/group_multiplier - else - oxygen -= delta_oxygen/group_multiplier - carbon_dioxide -= delta_carbon_dioxide/group_multiplier - nitrogen -= delta_nitrogen/group_multiplier - toxins -= delta_toxins/group_multiplier - - var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - var/delta = 0 + if(corresponding) + delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/5 + else + corresponding = new trace_gas.type() + sharer.trace_gases += corresponding delta = trace_gas.moles_archived/5 - if(border_multiplier) - trace_gas.moles -= delta*border_multiplier/group_multiplier + trace_gas.moles -= delta/group_multiplier + corresponding.moles += delta/sharer.group_multiplier + + if(delta) + var/individual_heat_capacity = trace_gas.specific_heat*delta + if(delta > 0) + heat_self_to_sharer += individual_heat_capacity*temperature_archived + heat_capacity_self_to_sharer += individual_heat_capacity else - trace_gas.moles -= delta/group_multiplier + heat_sharer_to_self -= individual_heat_capacity*sharer.temperature_archived + heat_capacity_sharer_to_self -= individual_heat_capacity - var/heat_cap_transferred = delta*trace_gas.specific_heat - heat_transferred += heat_cap_transferred*temperature_archived - heat_capacity_transferred += heat_cap_transferred - moved_moles += delta + moved_moles += delta - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred - if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) - if(border_multiplier) - temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity - else - temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity + trace_types_considered += trace_gas.type - temperature_mimic(model, model.thermal_conductivity, border_multiplier) - if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins) - return delta_pressure*R_IDEAL_GAS_EQUATION/volume - else - return 0 + if(sharer.trace_gases.len) + for(var/datum/gas/trace_gas in sharer.trace_gases) + if(trace_gas.type in trace_types_considered) continue + else + var/datum/gas/corresponding + var/delta = 0 - check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - var/delta_temperature = (temperature_archived - sharer.temperature_archived) + corresponding = new trace_gas.type() + trace_gases += corresponding + delta = trace_gas.moles_archived/5 + + trace_gas.moles -= delta/sharer.group_multiplier + corresponding.moles += delta/group_multiplier + + //Guaranteed transfer from sharer to self + var/individual_heat_capacity = trace_gas.specific_heat*delta + heat_sharer_to_self += individual_heat_capacity*sharer.temperature_archived + heat_capacity_sharer_to_self += individual_heat_capacity + + moved_moles += -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 + var/new_sharer_heat_capacity = old_sharer_heat_capacity + heat_capacity_self_to_sharer - heat_capacity_sharer_to_self + + if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) + temperature = (old_self_heat_capacity*temperature - heat_capacity_self_to_sharer*temperature_archived + heat_capacity_sharer_to_self*sharer.temperature_archived)/new_self_heat_capacity + + if(new_sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) + sharer.temperature = (old_sharer_heat_capacity*sharer.temperature-heat_capacity_sharer_to_self*sharer.temperature_archived + heat_capacity_self_to_sharer*temperature_archived)/new_sharer_heat_capacity + + if(abs(old_sharer_heat_capacity) > MINIMUM_HEAT_CAPACITY) + if(abs(new_sharer_heat_capacity/old_sharer_heat_capacity - 1) < 0.10) // <10% change in sharer heat capacity + temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT) + + if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) + 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 + + var/delta_temperature = (temperature_archived - model.temperature) + + var/heat_transferred = 0 + var/old_self_heat_capacity = 0 + var/heat_capacity_transferred = 0 + + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + + var/delta_air = delta_oxygen+delta_nitrogen + if(delta_air) + var/air_heat_capacity = SPECIFIC_HEAT_AIR*delta_air + heat_transferred -= air_heat_capacity*model.temperature + heat_capacity_transferred -= air_heat_capacity + + if(delta_carbon_dioxide) + var/carbon_dioxide_heat_capacity = SPECIFIC_HEAT_CDO*delta_carbon_dioxide + heat_transferred -= carbon_dioxide_heat_capacity*model.temperature + heat_capacity_transferred -= carbon_dioxide_heat_capacity + + if(delta_toxins) + var/toxins_heat_capacity = SPECIFIC_HEAT_TOXIN*delta_toxins + heat_transferred -= toxins_heat_capacity*model.temperature + heat_capacity_transferred -= toxins_heat_capacity + + old_self_heat_capacity = heat_capacity()*group_multiplier + + if(border_multiplier) + oxygen -= delta_oxygen*border_multiplier/group_multiplier + carbon_dioxide -= delta_carbon_dioxide*border_multiplier/group_multiplier + nitrogen -= delta_nitrogen*border_multiplier/group_multiplier + toxins -= delta_toxins*border_multiplier/group_multiplier + else + oxygen -= delta_oxygen/group_multiplier + carbon_dioxide -= delta_carbon_dioxide/group_multiplier + nitrogen -= delta_nitrogen/group_multiplier + toxins -= delta_toxins/group_multiplier + + var/moved_moles = (delta_oxygen + delta_carbon_dioxide + delta_nitrogen + delta_toxins) + + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + var/delta = 0 + + delta = trace_gas.moles_archived/5 + + if(border_multiplier) + trace_gas.moles -= delta*border_multiplier/group_multiplier + else + trace_gas.moles -= delta/group_multiplier + + var/heat_cap_transferred = delta*trace_gas.specific_heat + heat_transferred += heat_cap_transferred*temperature_archived + heat_capacity_transferred += heat_cap_transferred + moved_moles += delta + + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred + if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) + if(border_multiplier) + temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity + else + temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity + + temperature_mimic(model, model.thermal_conductivity, border_multiplier) + + if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) + var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins) + return delta_pressure*R_IDEAL_GAS_EQUATION/volume + else + return 0 + + check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + var/delta_temperature = (temperature_archived - sharer.temperature_archived) + + var/self_heat_capacity = heat_capacity_archived() + var/sharer_heat_capacity = sharer.heat_capacity_archived() + + var/self_temperature_delta = 0 + var/sharer_temperature_delta = 0 + + if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + var/heat = conduction_coefficient*delta_temperature* \ + (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) + + self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) + sharer_temperature_delta = heat/(sharer_heat_capacity*sharer.group_multiplier) + else + return 1 + + if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ + && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) + return 0 + + if((abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ + && (abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*sharer.temperature_archived)) + return -1 + + temperature += self_temperature_delta + sharer.temperature += sharer_temperature_delta + + return 1 + //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency + + check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + var/delta_temperature = (temperature_archived - sharer.temperature_archived) + + var/self_heat_capacity = heat_capacity_archived() + var/sharer_heat_capacity = sharer.heat_capacity_archived() + + var/self_temperature_delta = 0 + var/sharer_temperature_delta = 0 + + if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + var/heat = conduction_coefficient*delta_temperature* \ + (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) + + self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) + sharer_temperature_delta = heat/(sharer_heat_capacity*sharer.group_multiplier) + else + return 1 + + if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ + && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) + return 0 + + temperature += self_temperature_delta + sharer.temperature += sharer_temperature_delta + + return 1 + //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency + + check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) + var/delta_temperature = (temperature_archived - sharer.temperature) + + var/self_temperature_delta = 0 + var/sharer_temperature_delta = 0 + + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/self_heat_capacity = heat_capacity_archived() + + if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + var/heat = conduction_coefficient*delta_temperature* \ + (self_heat_capacity*sharer.heat_capacity/(self_heat_capacity+sharer.heat_capacity)) + + self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) + sharer_temperature_delta = heat/sharer.heat_capacity + else + return 1 + + if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ + && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) + return 0 + + temperature += self_temperature_delta + sharer.temperature += sharer_temperature_delta + + return 1 + //Logic integrated from: temperature_turf_share(sharer, conduction_coefficient) for efficiency + + check_me_then_temperature_mimic(turf/model, conduction_coefficient) + var/delta_temperature = (temperature_archived - model.temperature) + var/self_temperature_delta = 0 + + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/self_heat_capacity = heat_capacity_archived() + + if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + var/heat = conduction_coefficient*delta_temperature* \ + (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) + + self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) + + if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ + && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) + return 0 + + temperature += self_temperature_delta + + return 1 + //Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency + + temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + + var/delta_temperature = (temperature_archived - sharer.temperature_archived) + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity_archived() var/sharer_heat_capacity = sharer.heat_capacity_archived() - var/self_temperature_delta = 0 - var/sharer_temperature_delta = 0 - if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) var/heat = conduction_coefficient*delta_temperature* \ (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) - self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) - sharer_temperature_delta = heat/(sharer_heat_capacity*sharer.group_multiplier) - else - return 1 + temperature -= heat/(self_heat_capacity*group_multiplier) + sharer.temperature += heat/(sharer_heat_capacity*sharer.group_multiplier) - if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ - && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) - return 0 + temperature_mimic(turf/model, conduction_coefficient, border_multiplier) + var/delta_temperature = (temperature - model.temperature) + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/self_heat_capacity = heat_capacity()//_archived() - if((abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ - && (abs(sharer_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*sharer.temperature_archived)) - return -1 - - temperature += self_temperature_delta - sharer.temperature += sharer_temperature_delta - - return 1 - //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency - - check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - - var/self_heat_capacity = heat_capacity_archived() - var/sharer_heat_capacity = sharer.heat_capacity_archived() - - var/self_temperature_delta = 0 - var/sharer_temperature_delta = 0 - - if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) - - self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) - sharer_temperature_delta = heat/(sharer_heat_capacity*sharer.group_multiplier) - else - return 1 - - if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ - && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) - return 0 - - temperature += self_temperature_delta - sharer.temperature += sharer_temperature_delta - - return 1 - //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency - - check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - var/delta_temperature = (temperature_archived - sharer.temperature) - - var/self_temperature_delta = 0 - var/sharer_temperature_delta = 0 - - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity_archived() - - if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer.heat_capacity/(self_heat_capacity+sharer.heat_capacity)) - - self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) - sharer_temperature_delta = heat/sharer.heat_capacity - else - return 1 - - if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ - && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) - return 0 - - temperature += self_temperature_delta - sharer.temperature += sharer_temperature_delta - - return 1 - //Logic integrated from: temperature_turf_share(sharer, conduction_coefficient) for efficiency - - check_me_then_temperature_mimic(turf/model, conduction_coefficient) - var/delta_temperature = (temperature_archived - model.temperature) - var/self_temperature_delta = 0 - - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity_archived() - - if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) - - self_temperature_delta = -heat/(self_heat_capacity*group_multiplier) - - if((abs(self_temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) \ - && (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived)) - return 0 - - temperature += self_temperature_delta - - return 1 - //Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency - - temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity_archived() - var/sharer_heat_capacity = sharer.heat_capacity_archived() - - if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity)) + (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) + if(border_multiplier) + temperature -= heat*border_multiplier/(self_heat_capacity*group_multiplier) + else temperature -= heat/(self_heat_capacity*group_multiplier) - sharer.temperature += heat/(sharer_heat_capacity*sharer.group_multiplier) - temperature_mimic(turf/model, conduction_coefficient, border_multiplier) - var/delta_temperature = (temperature - model.temperature) - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity()//_archived() + temperature_turf_share(turf/simulated/sharer, conduction_coefficient) + var/delta_temperature = (temperature_archived - sharer.temperature) + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) + var/self_heat_capacity = heat_capacity() - if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity)) + if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) + var/heat = conduction_coefficient*delta_temperature* \ + (self_heat_capacity*sharer.heat_capacity/(self_heat_capacity+sharer.heat_capacity)) - if(border_multiplier) - temperature -= heat*border_multiplier/(self_heat_capacity*group_multiplier) + temperature -= heat/(self_heat_capacity*group_multiplier) + sharer.temperature += heat/sharer.heat_capacity + + compare(datum/gas_mixture/sample) + if((abs(oxygen-sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \ + ((oxygen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen))) + return 0 + if((abs(nitrogen-sample.nitrogen) > MINIMUM_AIR_TO_SUSPEND) && \ + ((nitrogen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen) || (nitrogen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen))) + return 0 + if((abs(carbon_dioxide-sample.carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && \ + ((carbon_dioxide < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide))) + return 0 + if((abs(toxins-sample.toxins) > MINIMUM_AIR_TO_SUSPEND) && \ + ((toxins < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins) || (toxins > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins))) + return 0 + + if(total_moles() > MINIMUM_AIR_TO_SUSPEND) + if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ + ((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature))) + //world << "temp fail [temperature] & [sample.temperature]" + return 0 + + if(sample.trace_gases.len) + for(var/datum/gas/trace_gas in sample.trace_gases) + if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND) + var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases + if(corresponding) + if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ + ((corresponding.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles) || (corresponding.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles))) + return 0 else - temperature -= heat/(self_heat_capacity*group_multiplier) + return 0 - temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - var/delta_temperature = (temperature_archived - sharer.temperature) - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity() - - if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) - var/heat = conduction_coefficient*delta_temperature* \ - (self_heat_capacity*sharer.heat_capacity/(self_heat_capacity+sharer.heat_capacity)) - - temperature -= heat/(self_heat_capacity*group_multiplier) - sharer.temperature += heat/sharer.heat_capacity - - compare(datum/gas_mixture/sample) - if((abs(oxygen-sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \ - ((oxygen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen))) - return 0 - if((abs(nitrogen-sample.nitrogen) > MINIMUM_AIR_TO_SUSPEND) && \ - ((nitrogen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen) || (nitrogen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.nitrogen))) - return 0 - if((abs(carbon_dioxide-sample.carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && \ - ((carbon_dioxide < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.carbon_dioxide))) - return 0 - if((abs(toxins-sample.toxins) > MINIMUM_AIR_TO_SUSPEND) && \ - ((toxins < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins) || (toxins > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins))) - return 0 - - if(total_moles() > MINIMUM_AIR_TO_SUSPEND) - if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ - ((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature))) - //world << "temp fail [temperature] & [sample.temperature]" - return 0 - - if(sample.trace_gases.len) - for(var/datum/gas/trace_gas in sample.trace_gases) - if(trace_gas.moles_archived > MINIMUM_AIR_TO_SUSPEND) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(corresponding) - if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ - ((corresponding.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles) || (corresponding.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*trace_gas.moles))) - return 0 - else + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + if(trace_gas.moles > MINIMUM_AIR_TO_SUSPEND) + var/datum/gas/corresponding = locate(trace_gas.type) in sample.trace_gases + if(corresponding) + if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ + ((trace_gas.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles) || (trace_gas.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles))) return 0 - - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - if(trace_gas.moles > MINIMUM_AIR_TO_SUSPEND) - var/datum/gas/corresponding = locate(trace_gas.type) in sample.trace_gases - if(corresponding) - if((abs(trace_gas.moles - corresponding.moles) > MINIMUM_AIR_TO_SUSPEND) && \ - ((trace_gas.moles < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles) || (trace_gas.moles > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*corresponding.moles))) - return 0 - else - return 0 - return 1 \ No newline at end of file + else + return 0 + return 1 \ No newline at end of file diff --git a/code/defines/obj/machinery.dm b/code/defines/obj/machinery.dm index 876ee22d5ec..0aa09ba8205 100644 --- a/code/defines/obj/machinery.dm +++ b/code/defines/obj/machinery.dm @@ -334,31 +334,6 @@ directwired = 0 // must have a cable on same turf connecting to terminal layer = 2.6 // a bit above wires -/obj/machinery/power/generator - name = "thermoelectric generator" - desc = "It's a high efficiency thermoelectric generator." - icon_state = "teg" - anchored = 1 - density = 1 - - var/obj/machinery/atmospherics/binary/circulator/circ1 - var/obj/machinery/atmospherics/binary/circulator/circ2 - - var/lastgen = 0 - var/lastgenlev = -1 - -/obj/machinery/power/generator_type2 - name = "thermoelectric generator" - desc = "It's a high efficiency thermoelectric generator." - icon_state = "teg" - anchored = 1 - density = 1 - - var/obj/machinery/atmospherics/unary/generator_input/input1 - var/obj/machinery/atmospherics/unary/generator_input/input2 - - var/lastgen = 0 - var/lastgenlev = -1 /obj/machinery/power/monitor name = "power monitoring computer" diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index 069daa7fae2..862d09e09ef 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -33,6 +33,15 @@ return 0 //not in range and not telekinetic +/proc/circledistance(center=usr, T) // T is just the second atom to check distance to center with + var/turf/centerturf = get_turf(center) + var/turf/targetturf = get_turf(T) + + var/dx2 = (targetturf.x - centerturf.x)**2 + var/dy2 = (targetturf.y - centerturf.y)**2 + + return sqrt(dx2 + dy2) + /proc/circlerange(center=usr,radius=3) var/turf/centerturf = get_turf(center) @@ -98,6 +107,7 @@ return turfs + /proc/get_mobs_in_view(var/R, var/atom/source) // Returns a list of mobs in range of R from source. Used in radio and say code. diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index eba12f2f31a..31ba10048bc 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -1,14 +1,20 @@ -var/roundExplosions = 1 +var/roundExplosions = 1 // If anyone else gets confused this means round as in circle, not the game round + + +//TODO: Flash range does nothing currently proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1) if(!epicenter) return spawn(0) if(defer_powernet_rebuild != 2) defer_powernet_rebuild = 1 + if (!istype(epicenter, /turf)) epicenter = get_turf(epicenter.loc) + playsound(epicenter.loc, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) ) playsound(epicenter.loc, "explosion", 100, 1, round(devastation_range,1) ) + if (adminlog) message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") @@ -20,62 +26,52 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa E.set_up(epicenter) E.start() - var/list/dTurfs = list() //Holds the turfs in devestation range. - var/list/hTurfs = list() //Holds the turfs in heavy impact range, minus turfs in devestation range. - var/list/lTurfs = list() //Holds the turfs in light impact range, minus turfs in devestation range and heavy impact range. - var/list/fTurfs = list() //Holds turfs to loop through for mobs to flash. (Hehehe, dirty) + var/list/expTurfs = list() // All turfs being affected by the explosion (not flash range) if(roundExplosions) - fTurfs = circlerangeturfs(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) - dTurfs = circlerangeturfs(epicenter,devastation_range) - hTurfs = circlerangeturfs(epicenter,heavy_impact_range) - dTurfs - lTurfs = circlerangeturfs(epicenter,light_impact_range) - dTurfs - hTurfs + expTurfs = circlerangeturfs(epicenter, max(devastation_range, heavy_impact_range, light_impact_range)) else - fTurfs = range(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) - dTurfs = range(epicenter,devastation_range) - hTurfs = range(epicenter,heavy_impact_range) - dTurfs - lTurfs = range(epicenter,light_impact_range) - dTurfs - hTurfs + expTurfs = range(epicenter, max(devastation_range, heavy_impact_range, light_impact_range)) + + + // Hello future editors, please note that 1000 calls to spawn will not speed this up, but this exact amount has been tested + // Now, tonnes of calls to spawn will allow other stuff to happen, but I believe we may as well let explosions + // Get over with and blow up like an explosion would + + var/list/dTurfs = list() + var/list/hTurfs = list() + var/list/lTurfs = list() + + for(var/turf/T in expTurfs) // This doesn't slow it down at all, even 100,100,100 bombs + var/dist = circledistance(epicenter, T) + + if(dist < devastation_range) + dTurfs.Add(T) + else if(dist < heavy_impact_range) + hTurfs.Add(T) + else // The expTurfs list only has turfs that are in it's range, so no if here for light_impact + lTurfs.Add(T) spawn() - for(var/mob/living/carbon/mob in fTurfs) - flick("flash", mob:flash) + for(var/turf/T in dTurfs) + if(prob(10)) + T.ex_act(2) + else + T.ex_act(1) + for(var/atom/object in T.contents) + object.ex_act(1) + spawn() + for(var/turf/T in hTurfs) + T.ex_act(2) + for(var/atom/object in T.contents) + object.ex_act(2) - for(var/turf/T in dTurfs) //Loop through the turfs in devestation range. - spawn() //Try to pop each turf into it's own thread, speed things along. - if(T) //Sanity checking. - //Now, the actual explosion stuff happens. - if(prob(5)) - T.ex_act(2) - else - T.ex_act(1) - for(var/atom/object in T.contents) - spawn() - if(object) - object.ex_act(1) + spawn() + for(var/turf/T in lTurfs) + T.ex_act(3) + for(var/atom/object in T.contents) + object.ex_act(3) - for(var/turf/T in hTurfs) - spawn() - if(T) - if(prob(15) && devastation_range > 2 && heavy_impact_range > 2) - secondaryexplosion(T, 1) - else - T.ex_act(2) - for(var/atom/object in T.contents) - spawn() - if(object) - object.ex_act(2) - - for(var/turf/T in lTurfs) - spawn() - if(T) - T.ex_act(3) - for(var/atom/object in T.contents) - spawn() - if(object) - object.ex_act(3) - - sleep(-1) - sleep(20) if(defer_powernet_rebuild != 2) defer_powernet_rebuild = 0 return 1 diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 766fec40699..0c527c6e85f 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -6,148 +6,159 @@ gen_amount = g */ +/obj/machinery/power/generator + name = "thermoelectric generator" + desc = "It's a high efficiency thermoelectric generator." + icon_state = "teg" + anchored = 1 + density = 1 -/obj/machinery/power/generator/New() - ..() + var/obj/machinery/atmospherics/binary/circulator/circ1 + var/obj/machinery/atmospherics/binary/circulator/circ2 - spawn(5) - circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST) - circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST) + var/lastgen = 0 + var/lastgenlev = -1 - if(circ1) - circ1.side = 1 - circ1.update_icon() - if(circ2) - circ2.side = 2 - circ2.update_icon() - if(!circ1 || !circ2) - stat |= BROKEN + New() + ..() - updateicon() + spawn(5) + circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST) + circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST) -/obj/machinery/power/generator/proc/updateicon() + if(circ1) + circ1.side = 1 + circ1.update_icon() + if(circ2) + circ2.side = 2 + circ2.update_icon() - if(stat & (NOPOWER|BROKEN)) - overlays = null - else - overlays = null + if(!circ1 || !circ2) + stat |= BROKEN - if(lastgenlev != 0) - overlays += image('power.dmi', "teg-op[lastgenlev]") + updateicon() + + proc/updateicon() + + if(stat & (NOPOWER|BROKEN)) + overlays = null + else + overlays = null + + if(lastgenlev != 0) + overlays += image('power.dmi', "teg-op[lastgenlev]") #define GENRATE 800 // generator output coefficient from Q -/obj/machinery/power/generator/process() + process() - //world << "Generator process ran" + //world << "Generator process ran" - if(!circ1 || !circ2) - return + if(!circ1 || !circ2) + return - //world << "circ1 and circ2 pass" + //world << "circ1 and circ2 pass" - var/datum/gas_mixture/cold_air = circ1.return_transfer_air() - var/datum/gas_mixture/hot_air = circ2.return_transfer_air() + var/datum/gas_mixture/cold_air = circ1.return_transfer_air() + var/datum/gas_mixture/hot_air = circ2.return_transfer_air() - lastgen = 0 + lastgen = 0 - //world << "hot_air = [hot_air]; cold_air = [cold_air];" + //world << "hot_air = [hot_air]; cold_air = [cold_air];" - if(cold_air && hot_air) + if(cold_air && hot_air) - //world << "hot_air = [hot_air] temperature = [hot_air.temperature]; cold_air = [cold_air] temperature = [hot_air.temperature];" + //world << "hot_air = [hot_air] temperature = [hot_air.temperature]; cold_air = [cold_air] temperature = [hot_air.temperature];" - //world << "coldair and hotair pass" - var/cold_air_heat_capacity = cold_air.heat_capacity() - var/hot_air_heat_capacity = hot_air.heat_capacity() + //world << "coldair and hotair pass" + var/cold_air_heat_capacity = cold_air.heat_capacity() + var/hot_air_heat_capacity = hot_air.heat_capacity() - var/delta_temperature = hot_air.temperature - cold_air.temperature + var/delta_temperature = hot_air.temperature - cold_air.temperature - //world << "delta_temperature = [delta_temperature]; cold_air_heat_capacity = [cold_air_heat_capacity]; hot_air_heat_capacity = [hot_air_heat_capacity]" + //world << "delta_temperature = [delta_temperature]; cold_air_heat_capacity = [cold_air_heat_capacity]; hot_air_heat_capacity = [hot_air_heat_capacity]" - if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0) - var/efficiency = 0.65 + if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0) + var/efficiency = 0.65 - var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity) + var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity) - var/heat = energy_transfer*(1-efficiency) - lastgen = energy_transfer*efficiency + var/heat = energy_transfer*(1-efficiency) + lastgen = energy_transfer*efficiency - //world << "lastgen = [lastgen]; heat = [heat]; delta_temperature = [delta_temperature]; hot_air_heat_capacity = [hot_air_heat_capacity]; cold_air_heat_capacity = [cold_air_heat_capacity];" + //world << "lastgen = [lastgen]; heat = [heat]; delta_temperature = [delta_temperature]; hot_air_heat_capacity = [hot_air_heat_capacity]; cold_air_heat_capacity = [cold_air_heat_capacity];" - hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity - cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity + hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity + cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity - world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]" + world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]" - add_avail(lastgen) - // update icon overlays only if displayed level has changed + add_avail(lastgen) + // update icon overlays only if displayed level has changed - if(hot_air) - circ2.air2.merge(hot_air) + if(hot_air) + circ2.air2.merge(hot_air) - if(cold_air) - circ1.air2.merge(cold_air) + if(cold_air) + circ1.air2.merge(cold_air) - var/genlev = max(0, min( round(11*lastgen / 100000), 11)) - if(genlev != lastgenlev) - lastgenlev = genlev + var/genlev = max(0, min( round(11*lastgen / 100000), 11)) + if(genlev != lastgenlev) + lastgenlev = genlev + updateicon() + + src.updateDialog() + + attack_ai(mob/user) + if(stat & (BROKEN|NOPOWER)) return + interact(user) + + + attack_hand(mob/user) + add_fingerprint(user) + if(stat & (BROKEN|NOPOWER)) return + interact(user) + + + proc/interact(mob/user) + if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai))) + user.machine = null + user << browse(null, "window=teg") + return + + user.machine = src + + var/t = "
Thermo-Electric Generator
" + + t += "Output : [round(lastgen)] W

" + + t += "Cold loop
" + t += "Temperature Inlet: [round(circ1.air1.temperature, 0.1)] K Outlet: [round(circ1.air2.temperature, 0.1)] K
" + t += "Pressure Inlet: [round(circ1.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ1.air2.return_pressure(), 0.1)] kPa
" + + t += "Hot loop
" + t += "Temperature Inlet: [round(circ2.air1.temperature, 0.1)] K Outlet: [round(circ2.air2.temperature, 0.1)] K
" + t += "Pressure Inlet: [round(circ2.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ2.air2.return_pressure(), 0.1)] kPa
" + + t += "

Close" + + t += "
" + user << browse(t, "window=teg;size=460x300") + onclose(user, "teg") + return 1 + + + Topic(href, href_list) + ..() + if( href_list["close"] ) + usr << browse(null, "window=teg") + usr.machine = null + return 0 + return 1 + + + power_change() + ..() updateicon() - src.updateDialog() - -/obj/machinery/power/generator/attack_ai(mob/user) - if(stat & (BROKEN|NOPOWER)) return - - interact(user) - -/obj/machinery/power/generator/attack_hand(mob/user) - - add_fingerprint(user) - - if(stat & (BROKEN|NOPOWER)) return - - interact(user) - -/obj/machinery/power/generator/proc/interact(mob/user) - if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai))) - user.machine = null - user << browse(null, "window=teg") - return - - user.machine = src - - var/t = "
Thermo-Electric Generator
" - - t += "Output : [round(lastgen)] W

" - - t += "Cold loop
" - t += "Temperature Inlet: [round(circ1.air1.temperature, 0.1)] K Outlet: [round(circ1.air2.temperature, 0.1)] K
" - t += "Pressure Inlet: [round(circ1.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ1.air2.return_pressure(), 0.1)] kPa
" - - t += "Hot loop
" - t += "Temperature Inlet: [round(circ2.air1.temperature, 0.1)] K Outlet: [round(circ2.air2.temperature, 0.1)] K
" - t += "Pressure Inlet: [round(circ2.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ2.air2.return_pressure(), 0.1)] kPa
" - - t += "

Close" - - t += "
" - user << browse(t, "window=teg;size=460x300") - onclose(user, "teg") - return 1 - -/obj/machinery/power/generator/Topic(href, href_list) - ..() - - if( href_list["close"] ) - usr << browse(null, "window=teg") - usr.machine = null - return 0 - - return 1 - -/obj/machinery/power/generator/power_change() - ..() - updateicon() - diff --git a/code/modules/power/generator_type2.dm b/code/modules/power/generator_type2.dm index fe80f97416c..9b8997e641e 100644 --- a/code/modules/power/generator_type2.dm +++ b/code/modules/power/generator_type2.dm @@ -1,128 +1,142 @@ -/obj/machinery/power/generator_type2/New() - ..() +/obj/machinery/power/generator_type2 + name = "thermoelectric generator" + desc = "It's a high efficiency thermoelectric generator." + icon_state = "teg" + anchored = 1 + density = 1 - spawn(5) - input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,WEST) - input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,EAST) - if(!input1 || !input2) - stat |= BROKEN + var/obj/machinery/atmospherics/unary/generator_input/input1 + var/obj/machinery/atmospherics/unary/generator_input/input2 - updateicon() + var/lastgen = 0 + var/lastgenlev = -1 -/obj/machinery/power/generator_type2/proc/updateicon() - if(stat & (NOPOWER|BROKEN)) - overlays = null - else - overlays = null + New() + ..() + spawn(5) + input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,WEST) + input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,EAST) + if(!input1 || !input2) + stat |= BROKEN + updateicon() - if(lastgenlev != 0) - overlays += image('power.dmi', "teg-op[lastgenlev]") + + proc/updateicon() + + if(stat & (NOPOWER|BROKEN)) + overlays = null + else + overlays = null + + if(lastgenlev != 0) + overlays += image('power.dmi', "teg-op[lastgenlev]") #define GENRATE 800 // generator output coefficient from Q -/obj/machinery/power/generator_type2/process() - if(!input1 || !input2) - return + process() + if(!input1 || !input2) + return - var/datum/gas_mixture/air1 = input1.return_exchange_air() - var/datum/gas_mixture/air2 = input2.return_exchange_air() + var/datum/gas_mixture/air1 = input1.return_exchange_air() + var/datum/gas_mixture/air2 = input2.return_exchange_air() - lastgen = 0 + lastgen = 0 - if(air1 && air2) - var/datum/gas_mixture/hot_air = air1 - var/datum/gas_mixture/cold_air = air2 - if(hot_air.temperature < cold_air.temperature) - hot_air = air2 - cold_air = air1 + if(air1 && air2) + var/datum/gas_mixture/hot_air = air1 + var/datum/gas_mixture/cold_air = air2 + if(hot_air.temperature < cold_air.temperature) + hot_air = air2 + cold_air = air1 - var/hot_air_heat_capacity = hot_air.heat_capacity() - var/cold_air_heat_capacity = cold_air.heat_capacity() + var/hot_air_heat_capacity = hot_air.heat_capacity() + var/cold_air_heat_capacity = cold_air.heat_capacity() - var/delta_temperature = hot_air.temperature - cold_air.temperature + var/delta_temperature = hot_air.temperature - cold_air.temperature - if(delta_temperature > 1 && cold_air_heat_capacity > 0.01 && hot_air_heat_capacity > 0.01) - var/efficiency = (1 - cold_air.temperature/hot_air.temperature)*0.65 //65% of Carnot efficiency + if(delta_temperature > 1 && cold_air_heat_capacity > 0.01 && hot_air_heat_capacity > 0.01) + var/efficiency = (1 - cold_air.temperature/hot_air.temperature)*0.65 //65% of Carnot efficiency - var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity) + var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity) - var/heat = energy_transfer*(1-efficiency) - lastgen = energy_transfer*efficiency + var/heat = energy_transfer*(1-efficiency) + lastgen = energy_transfer*efficiency - hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity - cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity + hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity + cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity - world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]" + world << "POWER: [lastgen] W generated at [efficiency*100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]" - if(input1.network) - input1.network.update = 1 + if(input1.network) + input1.network.update = 1 - if(input2.network) - input2.network.update = 1 + if(input2.network) + input2.network.update = 1 - add_avail(lastgen) - // update icon overlays only if displayed level has changed + add_avail(lastgen) + // update icon overlays only if displayed level has changed - var/genlev = max(0, min( round(11*lastgen / 100000), 11)) - if(genlev != lastgenlev) - lastgenlev = genlev - updateicon() + var/genlev = max(0, min( round(11*lastgen / 100000), 11)) + if(genlev != lastgenlev) + lastgenlev = genlev + updateicon() - src.updateDialog() + src.updateDialog() -/obj/machinery/power/generator_type2/attack_ai(mob/user) - if(stat & (BROKEN|NOPOWER)) return - interact(user) + attack_ai(mob/user) + if(stat & (BROKEN|NOPOWER)) return + interact(user) -/obj/machinery/power/generator_type2/attack_hand(mob/user) - add_fingerprint(user) + attack_hand(mob/user) + add_fingerprint(user) + if(stat & (BROKEN|NOPOWER)) return + interact(user) - if(stat & (BROKEN|NOPOWER)) return - interact(user) + proc/interact(mob/user) + if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai))) + user.machine = null + user << browse(null, "window=teg") + return -/obj/machinery/power/generator_type2/proc/interact(mob/user) - if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai))) - user.machine = null - user << browse(null, "window=teg") - return + user.machine = src - user.machine = src + var/t = "
Thermo-Electric Generator
" - var/t = "
Thermo-Electric Generator
" + t += "Output : [round(lastgen)] W

" - t += "Output : [round(lastgen)] W

" + t += "Cold loop
" + t += "Temperature: [round(input1.air_contents.temperature, 0.1)] K
" + t += "Pressure: [round(input1.air_contents.return_pressure(), 0.1)] kPa
" - t += "Cold loop
" - t += "Temperature: [round(input1.air_contents.temperature, 0.1)] K
" - t += "Pressure: [round(input1.air_contents.return_pressure(), 0.1)] kPa
" + t += "Hot loop
" + t += "Temperature: [round(input2.air_contents.temperature, 0.1)] K
" + t += "Pressure: [round(input2.air_contents.return_pressure(), 0.1)] kPa
" - t += "Hot loop
" - t += "Temperature: [round(input2.air_contents.temperature, 0.1)] K
" - t += "Pressure: [round(input2.air_contents.return_pressure(), 0.1)] kPa
" + t += "

Close" - t += "

Close" + t += "
" + user << browse(t, "window=teg;size=460x300") + onclose(user, "teg") + return 1 - t += "
" - user << browse(t, "window=teg;size=460x300") - onclose(user, "teg") - return 1 -/obj/machinery/power/generator_type2/Topic(href, href_list) - ..() + Topic(href, href_list) + ..() - if( href_list["close"] ) - usr << browse(null, "window=teg") - usr.machine = null - return 0 + if( href_list["close"] ) + usr << browse(null, "window=teg") + usr.machine = null + return 0 - return 1 + return 1 -/obj/machinery/power/generator_type2/power_change() - ..() - updateicon() \ No newline at end of file + + power_change() + ..() + updateicon() \ No newline at end of file diff --git a/code/game/dna_mutations.dm b/code/unused/dna_mutations.dm similarity index 100% rename from code/game/dna_mutations.dm rename to code/unused/dna_mutations.dm diff --git a/tgstation.dme b/tgstation.dme index 608d2686522..04f64bbc465 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5,6 +5,197 @@ // END_INTERNALS // BEGIN_FILE_DIR #define FILE_DIR . +#define FILE_DIR "code" +#define FILE_DIR "code/ATMOSPHERICS" +#define FILE_DIR "code/ATMOSPHERICS/components" +#define FILE_DIR "code/ATMOSPHERICS/components/binary_devices" +#define FILE_DIR "code/ATMOSPHERICS/components/trinary_devices" +#define FILE_DIR "code/ATMOSPHERICS/components/unary" +#define FILE_DIR "code/datums" +#define FILE_DIR "code/datums/diseases" +#define FILE_DIR "code/datums/helper_datums" +#define FILE_DIR "code/datums/spells" +#define FILE_DIR "code/defines" +#define FILE_DIR "code/defines/area" +#define FILE_DIR "code/defines/mob" +#define FILE_DIR "code/defines/mob/dead" +#define FILE_DIR "code/defines/mob/living" +#define FILE_DIR "code/defines/mob/living/carbon" +#define FILE_DIR "code/defines/mob/living/silicon" +#define FILE_DIR "code/defines/obj" +#define FILE_DIR "code/defines/obj/clothing" +#define FILE_DIR "code/defines/procs" +#define FILE_DIR "code/defines/tanning" +#define FILE_DIR "code/FEA" +#define FILE_DIR "code/game" +#define FILE_DIR "code/game/area" +#define FILE_DIR "code/game/asteroid" +#define FILE_DIR "code/game/gamemodes" +#define FILE_DIR "code/game/gamemodes/blob" +#define FILE_DIR "code/game/gamemodes/changeling" +#define FILE_DIR "code/game/gamemodes/cult" +#define FILE_DIR "code/game/gamemodes/events" +#define FILE_DIR "code/game/gamemodes/events/holidays" +#define FILE_DIR "code/game/gamemodes/extended" +#define FILE_DIR "code/game/gamemodes/malfunction" +#define FILE_DIR "code/game/gamemodes/meteor" +#define FILE_DIR "code/game/gamemodes/nuclear" +#define FILE_DIR "code/game/gamemodes/revolution" +#define FILE_DIR "code/game/gamemodes/sandbox" +#define FILE_DIR "code/game/gamemodes/traitor" +#define FILE_DIR "code/game/gamemodes/wizard" +#define FILE_DIR "code/game/jobs" +#define FILE_DIR "code/game/jobs/job" +#define FILE_DIR "code/game/machinery" +#define FILE_DIR "code/game/machinery/atmoalter" +#define FILE_DIR "code/game/machinery/bots" +#define FILE_DIR "code/game/machinery/computer" +#define FILE_DIR "code/game/machinery/doors" +#define FILE_DIR "code/game/machinery/embedded_controller" +#define FILE_DIR "code/game/machinery/kitchen" +#define FILE_DIR "code/game/machinery/pipe" +#define FILE_DIR "code/game/machinery/telecomms" +#define FILE_DIR "code/game/magic" +#define FILE_DIR "code/game/magic/cultist" +#define FILE_DIR "code/game/mecha" +#define FILE_DIR "code/game/mecha/combat" +#define FILE_DIR "code/game/mecha/equipment" +#define FILE_DIR "code/game/mecha/equipment/tools" +#define FILE_DIR "code/game/mecha/equipment/weapons" +#define FILE_DIR "code/game/mecha/medical" +#define FILE_DIR "code/game/mecha/working" +#define FILE_DIR "code/game/objects" +#define FILE_DIR "code/game/objects/alien" +#define FILE_DIR "code/game/objects/closets" +#define FILE_DIR "code/game/objects/closets/secure" +#define FILE_DIR "code/game/objects/devices" +#define FILE_DIR "code/game/objects/devices/PDA" +#define FILE_DIR "code/game/objects/items" +#define FILE_DIR "code/game/objects/items/weapons" +#define FILE_DIR "code/game/objects/items/weapons/implants" +#define FILE_DIR "code/game/objects/radio" +#define FILE_DIR "code/game/objects/secstorage" +#define FILE_DIR "code/game/objects/stacks" +#define FILE_DIR "code/game/objects/storage" +#define FILE_DIR "code/game/objects/tanks" +#define FILE_DIR "code/game/vehicles" +#define FILE_DIR "code/game/vehicles/airtight" +#define FILE_DIR "code/game/verbs" +#define FILE_DIR "code/js" +#define FILE_DIR "code/modules" +#define FILE_DIR "code/modules/admin" +#define FILE_DIR "code/modules/admin/verbs" +#define FILE_DIR "code/modules/assembly" +#define FILE_DIR "code/modules/chemical" +#define FILE_DIR "code/modules/client" +#define FILE_DIR "code/modules/clothing" +#define FILE_DIR "code/modules/clothing/glasses" +#define FILE_DIR "code/modules/clothing/spacesuits" +#define FILE_DIR "code/modules/clothing/suits" +#define FILE_DIR "code/modules/clothing/uniforms" +#define FILE_DIR "code/modules/critters" +#define FILE_DIR "code/modules/critters/hivebots" +#define FILE_DIR "code/modules/detectivework" +#define FILE_DIR "code/modules/flufftext" +#define FILE_DIR "code/modules/food" +#define FILE_DIR "code/modules/maps" +#define FILE_DIR "code/modules/mining" +#define FILE_DIR "code/modules/mob" +#define FILE_DIR "code/modules/mob/dead" +#define FILE_DIR "code/modules/mob/dead/observer" +#define FILE_DIR "code/modules/mob/living" +#define FILE_DIR "code/modules/mob/living/blob" +#define FILE_DIR "code/modules/mob/living/carbon" +#define FILE_DIR "code/modules/mob/living/carbon/alien" +#define FILE_DIR "code/modules/mob/living/carbon/alien/humanoid" +#define FILE_DIR "code/modules/mob/living/carbon/alien/humanoid/caste" +#define FILE_DIR "code/modules/mob/living/carbon/alien/larva" +#define FILE_DIR "code/modules/mob/living/carbon/brain" +#define FILE_DIR "code/modules/mob/living/carbon/human" +#define FILE_DIR "code/modules/mob/living/carbon/human/Tajara" +#define FILE_DIR "code/modules/mob/living/carbon/metroid" +#define FILE_DIR "code/modules/mob/living/carbon/monkey" +#define FILE_DIR "code/modules/mob/living/silicon" +#define FILE_DIR "code/modules/mob/living/silicon/ai" +#define FILE_DIR "code/modules/mob/living/silicon/decoy" +#define FILE_DIR "code/modules/mob/living/silicon/pai" +#define FILE_DIR "code/modules/mob/living/silicon/robot" +#define FILE_DIR "code/modules/mob/new_player" +#define FILE_DIR "code/modules/mob/organ" +#define FILE_DIR "code/modules/mob/simple_animal" +#define FILE_DIR "code/modules/paperwork" +#define FILE_DIR "code/modules/power" +#define FILE_DIR "code/modules/power/antimatter" +#define FILE_DIR "code/modules/power/singularity" +#define FILE_DIR "code/modules/power/singularity/particle_accelerator" +#define FILE_DIR "code/modules/projectiles" +#define FILE_DIR "code/modules/projectiles/ammunition" +#define FILE_DIR "code/modules/projectiles/guns" +#define FILE_DIR "code/modules/projectiles/guns/energy" +#define FILE_DIR "code/modules/projectiles/guns/projectile" +#define FILE_DIR "code/modules/projectiles/projectile" +#define FILE_DIR "code/modules/recycling" +#define FILE_DIR "code/modules/research" +#define FILE_DIR "code/modules/scripting" +#define FILE_DIR "code/modules/scripting/AST" +#define FILE_DIR "code/modules/scripting/AST/Operators" +#define FILE_DIR "code/modules/scripting/Implementations" +#define FILE_DIR "code/modules/scripting/Interpreter" +#define FILE_DIR "code/modules/scripting/Parser" +#define FILE_DIR "code/modules/scripting/Scanner" +#define FILE_DIR "code/modules/security levels" +#define FILE_DIR "code/unused" +#define FILE_DIR "code/unused/beast" +#define FILE_DIR "code/unused/computer2" +#define FILE_DIR "code/unused/disease2" +#define FILE_DIR "code/unused/gamemodes" +#define FILE_DIR "code/unused/hivebot" +#define FILE_DIR "code/unused/mining" +#define FILE_DIR "code/unused/optics" +#define FILE_DIR "code/unused/pda2" +#define FILE_DIR "code/unused/powerarmor" +#define FILE_DIR "code/unused/spacecraft" +#define FILE_DIR "code/WorkInProgress" +#define FILE_DIR "code/WorkInProgress/BS12" +#define FILE_DIR "code/WorkInProgress/mapload" +#define FILE_DIR "code/WorkInProgress/organs" +#define FILE_DIR "code/WorkInProgress/virus2" +#define FILE_DIR "html" +#define FILE_DIR "icons" +#define FILE_DIR "icons/48x48" +#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/machines" +#define FILE_DIR "icons/obj/pipes" +#define FILE_DIR "icons/pda_icons" +#define FILE_DIR "icons/spideros_icons" +#define FILE_DIR "icons/Testing" +#define FILE_DIR "icons/turf" +#define FILE_DIR "icons/unused" +#define FILE_DIR "icons/vehicles" +#define FILE_DIR "icons/vending_icons" +#define FILE_DIR "interface" +#define FILE_DIR "maps" +#define FILE_DIR "maps/RandomZLevels" +#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/voice" +#define FILE_DIR "sound/weapons" // END_FILE_DIR // BEGIN_PREFERENCES