Added Willox’s explosion code. It should make explosions faster than they have been lately.

Moved an unchecked file into unused, please put any unchecked files out of WIP or FEA into unused that way if you see an unchecked file you know it should be checked.  DM loves to uncheck files when you are messing around with folders in the editor.
Moved the old TEG defines into the proper files.
Commented out some old nonfunctioning FEA debug code.
Removed some commented out codechunks from FEA and attempted to clean up a few of the files a bit. 


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3852 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2012-06-18 01:56:24 +00:00
parent b1394e315f
commit b6f8b3fb77
11 changed files with 1632 additions and 1498 deletions

View File

@@ -116,7 +116,7 @@ obj/machinery/portable_atmospherics/canister
valve_open = 1 valve_open = 1
release_pressure = 1000 release_pressure = 1000
/*
obj/machinery/atmospherics obj/machinery/atmospherics
unary unary
heat_reservoir 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 << "[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 << "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]" usr << "[parent.air.oxygen], [parent.air.toxins], [parent.air.nitrogen], [parent.air.carbon_dioxide] .. [parent.alert_pressure]"
*/
mob mob
verb verb
flag_all_pipe_networks() flag_all_pipe_networks()

View File

@@ -1,315 +1,279 @@
datum datum/air_group
air_group var/group_processing = 1 //Processing all tiles as one large tile if 1
var/tmp/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/current_cycle = 0 //cycle that oxygen value represents
var/tmp/archived_cycle = 0 //cycle that oxygen_archived 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 //The use of archived cycle saves processing power by permitting the archiving step of FET
// to be rolled into the updating step // to be rolled into the updating step
//optimization vars //optimization vars
var/tmp/next_check = 0 //number of ticks before this group updates var/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 var/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way
proc proc/members()
archive() //Returns the members of the group
proc/process_group()
members()
//Returns the members of the group
check_regroup() var/list/borders //Tiles that connect this group to other groups/individual tiles
//If individually processing tiles, checks all member tiles to see if they are close enough var/list/members //All tiles in this group
// that the group may resume group processing
//Warning: Do not call, called by air_master.process()
process_group() var/list/space_borders
suspend_group_processing() var/length_space_border = 0
update_group_from_tiles()
//Copy group air information to individual tile air
//Used right before turning on group processing
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 proc/suspend_group_processing()
var/list/members //All tiles in this group 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() //Copy group air information to individual tile air
group_processing = 0 //Used right before turning on group processing
update_tiles_from_group() proc/update_group_from_tiles()
check_delay=0 var/sample_member = pick(members)
next_check=0 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() update_group_from_tiles()
var/sample_member = pick(members) group_processing = 1
var/datum/gas_mixture/sample_air = sample_member:air 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 return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++
update_tiles_from_group() var/turf/simulated/list/border_individual = list()
for(var/member in members) var/datum/air_group/list/border_group = list()
member:air.copy_from(air)
if (istype(member,/turf/simulated))
var/turf/simulated/turfmem=member
turfmem.reset_delay()
archive() var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc
air.archive() var/turf/simulated/list/self_group_borders = list()
archived_cycle = air_master.current_cycle var/turf/simulated/list/self_tile_borders = list()
check_regroup() if(archived_cycle < air_master.current_cycle)
//Purpose: Checks to see if group processing should be turned back on archive()
//Returns: group_processing //Archive air data for use in calculations
if(group_processing) return 1 //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) var/abort_group = 0
for(var/member in members)
if(member:active_hotspot) // Process connections to adjacent groups
return 0 var/border_index = 1
if(member:air.compare(sample.air)) continue 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 else
return 0 abort_group = 1
break
update_group_from_tiles() if(connection_difference)
group_processing = 1 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() // Process connections to adjacent tiles
current_cycle = air_master.current_cycle border_index = 1
if(group_processing) //See if processing this group as a group if(!abort_group)
//check if we're skipping this tick for(var/atom/enemy_tile in border_individual)
if (next_check > 0) var/connection_difference = 0
next_check-- var/turf/simulated/floor/self_border = self_tile_borders[border_index]
return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++
var/turf/simulated/list/border_individual = list() if(istype(enemy_tile, /turf/simulated))
var/datum/air_group/list/border_group = list() if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done
enemy_tile:archive()
var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc if(enemy_tile:current_cycle < current_cycle)
var/turf/simulated/list/self_group_borders = list() if(air.check_gas_mixture(enemy_tile:air))
var/turf/simulated/list/self_tile_borders = list() connection_difference = air.share(enemy_tile:air)
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)
else else
abort_group = 1 abort_group = 1
break 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)
if(connection_difference > 0) if(connection_difference > 0)
self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_border)) self_border.consider_pressure_difference(connection_difference, get_dir(self_border,enemy_tile))
else else
var/turf/enemy_turf = enemy_border var/turf/enemy_turf = enemy_tile
if(!isturf(enemy_turf)) if(!isturf(enemy_turf))
enemy_turf = enemy_border.loc enemy_turf = enemy_tile.loc
enemy_turf.consider_pressure_difference(-connection_difference, get_dir(enemy_turf,self_border)) 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 if(air.check_turf(sample))
border_index = 1 connection_difference = air.mimic(sample, length_space_border)
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()
else else
if(air.check_tile_graphic()) abort_group = 1
for(var/turf/simulated/member in members)
member.update_visuals(air)
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) for(var/turf/simulated/member in members)
member.process_cell() member.update_visuals(air)
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)
air.react()
object/process_group() if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
current_cycle = air_master.current_cycle 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) object/process_group()
archive() current_cycle = air_master.current_cycle
//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
else if(!group_processing) return //See if processing this group as a group
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
var/result = air.check_gas_mixture(AG.air) var/turf/simulated/list/border_individual = list()
if(result == 1) var/datum/air_group/list/border_group = list()
air.share(AG.air)
else if(result == -1) var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc
AG.suspend_group_processing() var/enemy_index = 1
var/turf/simulated/floor/enemy_border = enemies[enemy_index]
air.share(enemy_border.air) 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 else
abort_group = 0 abort_group = 1
break break
enemy_index++ else
if(air.check_turf(enemy_tile))
air.mimic(enemy_tile)
else
abort_group = 1
break
if(!abort_group) if(abort_group)
for(var/enemy_tile in border_individual) suspend_group_processing()
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) return
suspend_group_processing()

View File

@@ -1,175 +1,163 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
atom /atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
proc return null
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) /turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
parent.suspend_group_processing() 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) var/igniting = 0
active_hotspot.temperature = exposed_temperature
active_hotspot.volume = exposed_volume
active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && air_contents.toxins > 0.5)
//remove just_spawned protection if no longer processing this cell igniting = 1
//start processing quickly if we aren't already if(igniting)
reset_delay() 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 active_hotspot = new(src)
effect/hotspot active_hotspot.temperature = exposed_temperature
//Icon for fire on turfs, also helps for nurturing small fires until they are full tile active_hotspot.volume = exposed_volume
anchored = 1 active_hotspot.just_spawned = (current_cycle < air_master.current_cycle)
mouse_opacity = 0 //remove just_spawned protection if no longer processing this cell
unacidable = 1//So you can't melt fire with acid.
//luminosity = 3 //start processing quickly if we aren't already
reset_delay()
icon = 'fire.dmi' return igniting
icon_state = "1"
layer = TURF_LAYER
var/volume = 125 //This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST /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() proc/perform_exposure()
var/turf/simulated/floor/location = loc var/turf/simulated/floor/location = loc
if(!istype(location)) if(!istype(location)) return 0
return 0
if(volume > CELL_VOLUME*0.95) if(volume > CELL_VOLUME*0.95) bypassing = 1
bypassing = 1 else bypassing = 0
else bypassing = 0
if(bypassing) if(bypassing)
if(!just_spawned) if(!just_spawned)
volume = location.air.fuel_burnt*FIRE_GROWTH_RATE volume = location.air.fuel_burnt*FIRE_GROWTH_RATE
temperature = location.air.temperature 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 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() if(temperature > location.heat_capacity)
location.to_be_destroyed = 1
temperature = affected.temperature /*if(prob(25))
volume = affected.fuel_burnt*FIRE_GROWTH_RATE location.ReplaceWithSpace()
return 0*/
location.assume_air(affected) return 1
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)
perform_exposure() New()
..()
dir = pick(cardinal)
sd_SetLuminosity(3)
return
if(location.wet) location.wet = 0
if(bypassing) Del()
icon_state = "3" if (istype(loc, /turf/simulated))
location.burn_tile() var/turf/simulated/T = loc
loc:active_hotspot = null
src.sd_SetLuminosity(0)
//Possible spread due to radiated heat if(T.to_be_destroyed)
if(location.air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD) var/chance_of_deletion
var/radiated_temperature = location.air.temperature*FIRE_SPREAD_RADIOSITY_SCALE 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
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 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) loc = null
location.max_fire_temperature_sustained = temperature ..()
return
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
..()

File diff suppressed because it is too large Load Diff

View File

@@ -334,31 +334,6 @@
directwired = 0 // must have a cable on same turf connecting to terminal directwired = 0 // must have a cable on same turf connecting to terminal
layer = 2.6 // a bit above wires 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 /obj/machinery/power/monitor
name = "power monitoring computer" name = "power monitoring computer"

View File

@@ -33,6 +33,15 @@
return 0 //not in range and not telekinetic 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) /proc/circlerange(center=usr,radius=3)
var/turf/centerturf = get_turf(center) var/turf/centerturf = get_turf(center)
@@ -98,6 +107,7 @@
return turfs return turfs
/proc/get_mobs_in_view(var/R, var/atom/source) /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. // Returns a list of mobs in range of R from source. Used in radio and say code.

View File

@@ -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) proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1)
if(!epicenter) return if(!epicenter) return
spawn(0) spawn(0)
if(defer_powernet_rebuild != 2) if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1 defer_powernet_rebuild = 1
if (!istype(epicenter, /turf)) if (!istype(epicenter, /turf))
epicenter = get_turf(epicenter.loc) epicenter = get_turf(epicenter.loc)
playsound(epicenter.loc, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) ) playsound(epicenter.loc, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) )
playsound(epicenter.loc, "explosion", 100, 1, round(devastation_range,1) ) playsound(epicenter.loc, "explosion", 100, 1, round(devastation_range,1) )
if (adminlog) if (adminlog)
message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") 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] ") 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.set_up(epicenter)
E.start() E.start()
var/list/dTurfs = list() //Holds the turfs in devestation range. var/list/expTurfs = list() // All turfs being affected by the explosion (not flash 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)
if(roundExplosions) if(roundExplosions)
fTurfs = circlerangeturfs(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) expTurfs = circlerangeturfs(epicenter, max(devastation_range, heavy_impact_range, light_impact_range))
dTurfs = circlerangeturfs(epicenter,devastation_range)
hTurfs = circlerangeturfs(epicenter,heavy_impact_range) - dTurfs
lTurfs = circlerangeturfs(epicenter,light_impact_range) - dTurfs - hTurfs
else else
fTurfs = range(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) expTurfs = range(epicenter, max(devastation_range, heavy_impact_range, light_impact_range))
dTurfs = range(epicenter,devastation_range)
hTurfs = range(epicenter,heavy_impact_range) - dTurfs
lTurfs = range(epicenter,light_impact_range) - dTurfs - hTurfs // 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() spawn()
for(var/mob/living/carbon/mob in fTurfs) for(var/turf/T in dTurfs)
flick("flash", mob:flash) 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()
spawn() //Try to pop each turf into it's own thread, speed things along. for(var/turf/T in lTurfs)
if(T) //Sanity checking. T.ex_act(3)
//Now, the actual explosion stuff happens. for(var/atom/object in T.contents)
if(prob(5)) object.ex_act(3)
T.ex_act(2)
else
T.ex_act(1)
for(var/atom/object in T.contents)
spawn()
if(object)
object.ex_act(1)
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) if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0 defer_powernet_rebuild = 0
return 1 return 1

View File

@@ -6,148 +6,159 @@
gen_amount = g 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) var/lastgen = 0
circ1 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,WEST) var/lastgenlev = -1
circ2 = locate(/obj/machinery/atmospherics/binary/circulator) in get_step(src,EAST)
if(circ1)
circ1.side = 1
circ1.update_icon()
if(circ2)
circ2.side = 2
circ2.update_icon()
if(!circ1 || !circ2) New()
stat |= BROKEN ..()
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)) if(!circ1 || !circ2)
overlays = null stat |= BROKEN
else
overlays = null
if(lastgenlev != 0) updateicon()
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 #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) if(!circ1 || !circ2)
return 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/cold_air = circ1.return_transfer_air()
var/datum/gas_mixture/hot_air = circ2.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" //world << "coldair and hotair pass"
var/cold_air_heat_capacity = cold_air.heat_capacity() var/cold_air_heat_capacity = cold_air.heat_capacity()
var/hot_air_heat_capacity = hot_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) if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
var/efficiency = 0.65 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) var/heat = energy_transfer*(1-efficiency)
lastgen = energy_transfer*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 hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity
cold_air.temperature = cold_air.temperature + heat/cold_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) add_avail(lastgen)
// update icon overlays only if displayed level has changed // update icon overlays only if displayed level has changed
if(hot_air) if(hot_air)
circ2.air2.merge(hot_air) circ2.air2.merge(hot_air)
if(cold_air) if(cold_air)
circ1.air2.merge(cold_air) circ1.air2.merge(cold_air)
var/genlev = max(0, min( round(11*lastgen / 100000), 11)) var/genlev = max(0, min( round(11*lastgen / 100000), 11))
if(genlev != lastgenlev) if(genlev != lastgenlev)
lastgenlev = genlev 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 = "<PRE><B>Thermo-Electric Generator</B><HR>"
t += "Output : [round(lastgen)] W<BR><BR>"
t += "<B>Cold loop</B><BR>"
t += "Temperature Inlet: [round(circ1.air1.temperature, 0.1)] K Outlet: [round(circ1.air2.temperature, 0.1)] K<BR>"
t += "Pressure Inlet: [round(circ1.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ1.air2.return_pressure(), 0.1)] kPa<BR>"
t += "<B>Hot loop</B><BR>"
t += "Temperature Inlet: [round(circ2.air1.temperature, 0.1)] K Outlet: [round(circ2.air2.temperature, 0.1)] K<BR>"
t += "Pressure Inlet: [round(circ2.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ2.air2.return_pressure(), 0.1)] kPa<BR>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "</PRE>"
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() 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 = "<PRE><B>Thermo-Electric Generator</B><HR>"
t += "Output : [round(lastgen)] W<BR><BR>"
t += "<B>Cold loop</B><BR>"
t += "Temperature Inlet: [round(circ1.air1.temperature, 0.1)] K Outlet: [round(circ1.air2.temperature, 0.1)] K<BR>"
t += "Pressure Inlet: [round(circ1.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ1.air2.return_pressure(), 0.1)] kPa<BR>"
t += "<B>Hot loop</B><BR>"
t += "Temperature Inlet: [round(circ2.air1.temperature, 0.1)] K Outlet: [round(circ2.air2.temperature, 0.1)] K<BR>"
t += "Pressure Inlet: [round(circ2.air1.return_pressure(), 0.1)] kPa Outlet: [round(circ2.air2.return_pressure(), 0.1)] kPa<BR>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "</PRE>"
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()

View File

@@ -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) var/obj/machinery/atmospherics/unary/generator_input/input1
input1 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,WEST) var/obj/machinery/atmospherics/unary/generator_input/input2
input2 = locate(/obj/machinery/atmospherics/unary/generator_input) in get_step(src,EAST)
if(!input1 || !input2)
stat |= BROKEN
updateicon() var/lastgen = 0
var/lastgenlev = -1
/obj/machinery/power/generator_type2/proc/updateicon()
if(stat & (NOPOWER|BROKEN)) New()
overlays = null ..()
else spawn(5)
overlays = null 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 #define GENRATE 800 // generator output coefficient from Q
/obj/machinery/power/generator_type2/process()
if(!input1 || !input2) process()
return if(!input1 || !input2)
return
var/datum/gas_mixture/air1 = input1.return_exchange_air() var/datum/gas_mixture/air1 = input1.return_exchange_air()
var/datum/gas_mixture/air2 = input2.return_exchange_air() var/datum/gas_mixture/air2 = input2.return_exchange_air()
lastgen = 0 lastgen = 0
if(air1 && air2) if(air1 && air2)
var/datum/gas_mixture/hot_air = air1 var/datum/gas_mixture/hot_air = air1
var/datum/gas_mixture/cold_air = air2 var/datum/gas_mixture/cold_air = air2
if(hot_air.temperature < cold_air.temperature) if(hot_air.temperature < cold_air.temperature)
hot_air = air2 hot_air = air2
cold_air = air1 cold_air = air1
var/hot_air_heat_capacity = hot_air.heat_capacity() var/hot_air_heat_capacity = hot_air.heat_capacity()
var/cold_air_heat_capacity = cold_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) 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/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) var/heat = energy_transfer*(1-efficiency)
lastgen = energy_transfer*efficiency lastgen = energy_transfer*efficiency
hot_air.temperature = hot_air.temperature - energy_transfer/hot_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 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) if(input1.network)
input1.network.update = 1 input1.network.update = 1
if(input2.network) if(input2.network)
input2.network.update = 1 input2.network.update = 1
add_avail(lastgen) add_avail(lastgen)
// update icon overlays only if displayed level has changed // update icon overlays only if displayed level has changed
var/genlev = max(0, min( round(11*lastgen / 100000), 11)) var/genlev = max(0, min( round(11*lastgen / 100000), 11))
if(genlev != lastgenlev) if(genlev != lastgenlev)
lastgenlev = genlev 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 = "<PRE><B>Thermo-Electric Generator</B><HR>"
t += "Output : [round(lastgen)] W<BR><BR>"
t += "<B>Cold loop</B><BR>"
t += "Temperature: [round(input1.air_contents.temperature, 0.1)] K<BR>"
t += "Pressure: [round(input1.air_contents.return_pressure(), 0.1)] kPa<BR>"
t += "<B>Hot loop</B><BR>"
t += "Temperature: [round(input2.air_contents.temperature, 0.1)] K<BR>"
t += "Pressure: [round(input2.air_contents.return_pressure(), 0.1)] kPa<BR>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "</PRE>"
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() updateicon()
src.updateDialog()
/obj/machinery/power/generator_type2/attack_ai(mob/user)
if(stat & (BROKEN|NOPOWER)) return
interact(user)
/obj/machinery/power/generator_type2/attack_hand(mob/user)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER)) return
interact(user)
/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
var/t = "<PRE><B>Thermo-Electric Generator</B><HR>"
t += "Output : [round(lastgen)] W<BR><BR>"
t += "<B>Cold loop</B><BR>"
t += "Temperature: [round(input1.air_contents.temperature, 0.1)] K<BR>"
t += "Pressure: [round(input1.air_contents.return_pressure(), 0.1)] kPa<BR>"
t += "<B>Hot loop</B><BR>"
t += "Temperature: [round(input2.air_contents.temperature, 0.1)] K<BR>"
t += "Pressure: [round(input2.air_contents.return_pressure(), 0.1)] kPa<BR>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "</PRE>"
user << browse(t, "window=teg;size=460x300")
onclose(user, "teg")
return 1
/obj/machinery/power/generator_type2/Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=teg")
usr.machine = null
return 0
return 1
/obj/machinery/power/generator_type2/power_change()
..()
updateicon()

View File

@@ -5,6 +5,197 @@
// END_INTERNALS // END_INTERNALS
// BEGIN_FILE_DIR // BEGIN_FILE_DIR
#define 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 // END_FILE_DIR
// BEGIN_PREFERENCES // BEGIN_PREFERENCES