initial commit - cross reference with 5th port - obviously has compile errors
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
/atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
return null
|
||||
|
||||
|
||||
|
||||
/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
|
||||
return
|
||||
|
||||
|
||||
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
var/datum/gas_mixture/air_contents = return_air()
|
||||
if(!air_contents)
|
||||
return 0
|
||||
|
||||
var/oxy = air_contents.gases["o2"] ? air_contents.gases["o2"][MOLES] : 0
|
||||
var/tox = air_contents.gases["plasma"] ? air_contents.gases["plasma"][MOLES] : 0
|
||||
|
||||
if(active_hotspot)
|
||||
if(soh)
|
||||
if(tox > 0.5 && oxy > 0.5)
|
||||
if(active_hotspot.temperature < exposed_temperature)
|
||||
active_hotspot.temperature = exposed_temperature
|
||||
if(active_hotspot.volume < exposed_volume)
|
||||
active_hotspot.volume = exposed_volume
|
||||
return 1
|
||||
|
||||
var/igniting = 0
|
||||
|
||||
if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && tox > 0.5)
|
||||
igniting = 1
|
||||
|
||||
if(igniting)
|
||||
if(oxy < 0.5 || tox < 0.5)
|
||||
return 0
|
||||
|
||||
active_hotspot = PoolOrNew(/obj/effect/hotspot, src)
|
||||
active_hotspot.temperature = exposed_temperature
|
||||
active_hotspot.volume = exposed_volume
|
||||
|
||||
active_hotspot.just_spawned = (current_cycle < SSair.times_fired)
|
||||
//remove just_spawned protection if no longer processing this cell
|
||||
SSair.add_to_active(src, 0)
|
||||
return igniting
|
||||
|
||||
//This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile
|
||||
/obj/effect/hotspot
|
||||
anchored = 1
|
||||
mouse_opacity = 0
|
||||
unacidable = 1//So you can't melt fire with acid.
|
||||
icon = 'icons/effects/fire.dmi'
|
||||
icon_state = "1"
|
||||
layer = ABOVE_OPEN_TURF_LAYER
|
||||
luminosity = 3
|
||||
|
||||
var/volume = 125
|
||||
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
|
||||
var/just_spawned = 1
|
||||
var/bypassing = 0
|
||||
|
||||
/obj/effect/hotspot/New()
|
||||
..()
|
||||
SSair.hotspots += src
|
||||
perform_exposure()
|
||||
setDir(pick(cardinal))
|
||||
air_update_turf()
|
||||
|
||||
|
||||
/obj/effect/hotspot/proc/perform_exposure()
|
||||
var/turf/open/location = loc
|
||||
if(!istype(location) || !(location.air))
|
||||
return 0
|
||||
|
||||
if(volume > CELL_VOLUME*0.95)
|
||||
bypassing = 1
|
||||
else
|
||||
bypassing = 0
|
||||
|
||||
if(bypassing)
|
||||
if(!just_spawned)
|
||||
volume = location.air.fuel_burnt*FIRE_GROWTH_RATE
|
||||
temperature = location.air.temperature
|
||||
else
|
||||
var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume)
|
||||
affected.temperature = temperature
|
||||
affected.react()
|
||||
temperature = affected.temperature
|
||||
volume = affected.fuel_burnt*FIRE_GROWTH_RATE
|
||||
location.assume_air(affected)
|
||||
|
||||
for(var/A in loc)
|
||||
var/atom/item = A
|
||||
if(item && item != src) // It's possible that the item is deleted in temperature_expose
|
||||
item.fire_act(null, temperature, volume)
|
||||
return 0
|
||||
|
||||
|
||||
/obj/effect/hotspot/process()
|
||||
if(just_spawned)
|
||||
just_spawned = 0
|
||||
return 0
|
||||
|
||||
var/turf/open/location = loc
|
||||
if(!istype(location))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(location.excited_group)
|
||||
location.excited_group.reset_cooldowns()
|
||||
|
||||
if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(!(location.air) || !location.air.gases["plasma"] || !location.air.gases["o2"] || location.air.gases["plasma"][MOLES] < 0.5 || location.air.gases["o2"][MOLES] < 0.5)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
perform_exposure()
|
||||
|
||||
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/t in location.atmos_adjacent_turfs)
|
||||
var/turf/open/T = t
|
||||
if(T.active_hotspot)
|
||||
T.hotspot_expose(radiated_temperature, CELL_VOLUME/4)
|
||||
|
||||
else
|
||||
if(volume > CELL_VOLUME*0.4)
|
||||
icon_state = "2"
|
||||
else
|
||||
icon_state = "1"
|
||||
|
||||
if(temperature > location.max_fire_temperature_sustained)
|
||||
location.max_fire_temperature_sustained = temperature
|
||||
|
||||
if(location.heat_capacity && temperature > location.heat_capacity)
|
||||
location.to_be_destroyed = 1
|
||||
/*if(prob(25))
|
||||
location.ReplaceWithSpace()
|
||||
return 0*/
|
||||
return 1
|
||||
|
||||
/obj/effect/hotspot/Destroy()
|
||||
SetLuminosity(0)
|
||||
SSair.hotspots -= src
|
||||
DestroyTurf()
|
||||
if(istype(loc, /turf))
|
||||
var/turf/open/T = loc
|
||||
if(T.active_hotspot == src)
|
||||
T.active_hotspot = null
|
||||
loc = null
|
||||
..()
|
||||
return QDEL_HINT_PUTINPOOL
|
||||
|
||||
/obj/effect/hotspot/proc/DestroyTurf()
|
||||
|
||||
if(istype(loc, /turf))
|
||||
var/turf/T = loc
|
||||
if(T.to_be_destroyed)
|
||||
var/chance_of_deletion
|
||||
if (T.heat_capacity) //beware of division by zero
|
||||
chance_of_deletion = T.max_fire_temperature_sustained / T.heat_capacity * 8 //there is no problem with prob(23456), min() was redundant --rastaf0
|
||||
else
|
||||
chance_of_deletion = 100
|
||||
if(prob(chance_of_deletion))
|
||||
T.ChangeTurf(T.baseturf)
|
||||
else
|
||||
T.to_be_destroyed = 0
|
||||
T.max_fire_temperature_sustained = 0
|
||||
|
||||
/obj/effect/hotspot/Crossed(mob/living/L)
|
||||
..()
|
||||
if(isliving(L))
|
||||
L.fire_act()
|
||||
@@ -0,0 +1,124 @@
|
||||
/turf/proc/CanAtmosPass(turf/T)
|
||||
|
||||
/turf/closed/CanAtmosPass(turf/T)
|
||||
return 0
|
||||
|
||||
/turf/open/CanAtmosPass(turf/T)
|
||||
var/R
|
||||
if(blocks_air || T.blocks_air)
|
||||
R = 1
|
||||
|
||||
for(var/obj/O in contents+T.contents)
|
||||
var/turf/other = (O.loc == src ? T : src)
|
||||
if(!O.CanAtmosPass(other))
|
||||
R = 1
|
||||
if(O.BlockSuperconductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments
|
||||
var/D = get_dir(src, T)
|
||||
atmos_supeconductivity |= D
|
||||
D = get_dir(T, src)
|
||||
T.atmos_supeconductivity |= D
|
||||
return 0 //no need to keep going, we got all we asked
|
||||
|
||||
atmos_supeconductivity &= ~get_dir(src, T)
|
||||
T.atmos_supeconductivity &= ~get_dir(T, src)
|
||||
|
||||
return !R
|
||||
|
||||
/atom/movable/proc/CanAtmosPass()
|
||||
return 1
|
||||
|
||||
/atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5)
|
||||
return (!density || !height)
|
||||
|
||||
/turf/CanPass(atom/movable/mover, turf/target, height=1.5)
|
||||
if(!target) return 0
|
||||
|
||||
if(istype(mover)) // turf/Enter(...) will perform more advanced checks
|
||||
return !density
|
||||
|
||||
else // Now, doing more detailed checks for air movement and air group formation
|
||||
if(target.blocks_air||blocks_air)
|
||||
return 0
|
||||
|
||||
for(var/obj/obstacle in src)
|
||||
if(!obstacle.CanPass(mover, target, height))
|
||||
return 0
|
||||
for(var/obj/obstacle in target)
|
||||
if(!obstacle.CanPass(mover, src, height))
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/atom/movable/proc/BlockSuperconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
|
||||
return 0
|
||||
|
||||
/turf/proc/CalculateAdjacentTurfs()
|
||||
for(var/direction in cardinal)
|
||||
var/turf/open/T = get_step(src, direction)
|
||||
if(!istype(T))
|
||||
continue
|
||||
if(CanAtmosPass(T))
|
||||
atmos_adjacent_turfs |= T
|
||||
T.atmos_adjacent_turfs |= src
|
||||
else
|
||||
atmos_adjacent_turfs -= T
|
||||
T.atmos_adjacent_turfs -= src
|
||||
|
||||
//returns a list of adjacent turfs that can share air with this one.
|
||||
//alldir includes adjacent diagonal tiles that can share
|
||||
// air with both of the related adjacent cardinal tiles
|
||||
/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
|
||||
var/adjacent_turfs = atmos_adjacent_turfs.Copy()
|
||||
if (!alldir)
|
||||
return adjacent_turfs
|
||||
var/turf/curloc = src
|
||||
|
||||
for (var/direction in diagonals)
|
||||
var/matchingDirections = 0
|
||||
var/turf/S = get_step(curloc, direction)
|
||||
|
||||
for (var/checkDirection in cardinal)
|
||||
var/turf/checkTurf = get_step(S, checkDirection)
|
||||
if(!(checkTurf in S.atmos_adjacent_turfs))
|
||||
continue
|
||||
|
||||
if (checkTurf in adjacent_turfs)
|
||||
matchingDirections++
|
||||
|
||||
if (matchingDirections >= 2)
|
||||
adjacent_turfs += S
|
||||
break
|
||||
|
||||
return adjacent_turfs
|
||||
|
||||
/atom/movable/proc/air_update_turf(command = 0)
|
||||
if(!istype(loc,/turf) && command)
|
||||
return
|
||||
var/turf/T = get_turf(loc)
|
||||
T.air_update_turf(command)
|
||||
|
||||
/turf/proc/air_update_turf(command = 0)
|
||||
if(command)
|
||||
CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(src,command)
|
||||
|
||||
/atom/movable/proc/move_update_air(turf/T)
|
||||
if(istype(T,/turf))
|
||||
T.air_update_turf(1)
|
||||
air_update_turf(1)
|
||||
|
||||
/atom/movable/proc/atmos_spawn_air(text) //because a lot of people loves to copy paste awful code lets just make a easy proc to spawn your plasma fires
|
||||
var/turf/open/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
T.atmos_spawn_air(text)
|
||||
|
||||
/turf/open/proc/atmos_spawn_air(text)
|
||||
if(!text || !air)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/G = new
|
||||
G.parse_gas_string(text)
|
||||
|
||||
air.merge(G)
|
||||
SSair.add_to_active(src, 0)
|
||||
@@ -0,0 +1,425 @@
|
||||
/turf
|
||||
//used for temperature calculations
|
||||
var/thermal_conductivity = 0.05
|
||||
var/heat_capacity = 1
|
||||
var/temperature_archived
|
||||
|
||||
//list of open turfs adjacent to us
|
||||
var/list/atmos_adjacent_turfs = list()
|
||||
//bitfield of dirs in which we are superconducitng
|
||||
var/atmos_supeconductivity = 0
|
||||
|
||||
//used to determine whether we should archive
|
||||
var/archived_cycle = 0
|
||||
var/current_cycle = 0
|
||||
|
||||
//used for mapping and for breathing while in walls (because that's a thing that needs to be accounted for...)
|
||||
//string parsed by /datum/gas/proc/copy_from_turf
|
||||
var/initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
|
||||
//approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
|
||||
// If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
|
||||
|
||||
/turf/open
|
||||
//used for spacewind
|
||||
var/pressure_difference = 0
|
||||
var/pressure_direction = 0
|
||||
|
||||
var/datum/excited_group/excited_group
|
||||
var/excited = 0
|
||||
var/recently_active = 0
|
||||
var/datum/gas_mixture/air
|
||||
|
||||
var/obj/effect/hotspot/active_hotspot
|
||||
|
||||
var/list/atmos_overlay_types = list() //gas IDs of current active gas overlays
|
||||
|
||||
/turf/open/New()
|
||||
..()
|
||||
if(!blocks_air)
|
||||
air = new
|
||||
air.copy_from_turf(src)
|
||||
|
||||
/turf/open/Destroy()
|
||||
if(active_hotspot)
|
||||
qdel(active_hotspot)
|
||||
active_hotspot = null
|
||||
// Adds the adjacent turfs to the current atmos processing
|
||||
for(var/T in atmos_adjacent_turfs)
|
||||
SSair.add_to_active(T)
|
||||
return ..()
|
||||
|
||||
/////////////////GAS MIXTURE PROCS///////////////////
|
||||
|
||||
/turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air
|
||||
if(!giver)
|
||||
return 0
|
||||
air.merge(giver)
|
||||
update_visuals()
|
||||
return 1
|
||||
|
||||
/turf/open/remove_air(amount)
|
||||
var/datum/gas_mixture/ours = return_air()
|
||||
var/datum/gas_mixture/removed = ours.remove(amount)
|
||||
update_visuals()
|
||||
return removed
|
||||
|
||||
/turf/open/proc/copy_air_with_tile(turf/open/T)
|
||||
if(istype(T))
|
||||
air.copy_from(T.air)
|
||||
|
||||
/turf/open/proc/copy_air(datum/gas_mixture/copy)
|
||||
if(copy)
|
||||
air.copy_from(copy)
|
||||
|
||||
/turf/return_air()
|
||||
var/datum/gas_mixture/GM = new
|
||||
GM.copy_from_turf(src)
|
||||
return GM
|
||||
|
||||
/turf/open/return_air()
|
||||
return air
|
||||
|
||||
/turf/temperature_expose()
|
||||
if(temperature > heat_capacity)
|
||||
to_be_destroyed = 1
|
||||
|
||||
/turf/proc/archive()
|
||||
temperature_archived = temperature
|
||||
|
||||
/turf/open/archive()
|
||||
air.archive()
|
||||
archived_cycle = SSair.times_fired
|
||||
..()
|
||||
|
||||
/////////////////////////GAS OVERLAYS//////////////////////////////
|
||||
|
||||
/turf/open/proc/update_visuals()
|
||||
var/list/new_overlay_types = tile_graphic()
|
||||
|
||||
for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added
|
||||
overlays -= overlay
|
||||
atmos_overlay_types -= overlay
|
||||
|
||||
for(var/overlay in new_overlay_types-atmos_overlay_types) //doesn't add overlays that already exist
|
||||
add_overlay(overlay)
|
||||
|
||||
atmos_overlay_types = new_overlay_types
|
||||
|
||||
/turf/open/proc/tile_graphic()
|
||||
. = new /list
|
||||
var/list/gases = air.gases
|
||||
for(var/id in gases)
|
||||
var/gas = gases[id]
|
||||
if(gas[GAS_META][META_GAS_OVERLAY] && gas[MOLES] > gas[GAS_META][META_GAS_MOLES_VISIBLE])
|
||||
. += gas[GAS_META][META_GAS_OVERLAY]
|
||||
|
||||
/////////////////////////////SIMULATION///////////////////////////////////
|
||||
|
||||
/turf/proc/process_cell(fire_count)
|
||||
SSair.remove_from_active(src)
|
||||
|
||||
/turf/open/process_cell(fire_count)
|
||||
if(archived_cycle < fire_count) //archive self if not already done
|
||||
archive()
|
||||
|
||||
current_cycle = fire_count
|
||||
var/remove = 1 //set by non simulated turfs who are sharing with this turf
|
||||
|
||||
//cache for sanic speed
|
||||
var/list/adjacent_turfs = atmos_adjacent_turfs
|
||||
var/datum/excited_group/our_excited_group = excited_group
|
||||
var/adjacent_turfs_length = adjacent_turfs.len
|
||||
|
||||
for(var/t in adjacent_turfs)
|
||||
var/turf/open/enemy_tile = t
|
||||
|
||||
if(fire_count > enemy_tile.current_cycle)
|
||||
enemy_tile.archive()
|
||||
|
||||
/******************* GROUP HANDLING START *****************************************************************/
|
||||
|
||||
if(enemy_tile.excited)
|
||||
//cache for sanic speed
|
||||
var/datum/excited_group/enemy_excited_group = enemy_tile.excited_group
|
||||
if(our_excited_group)
|
||||
if(enemy_excited_group)
|
||||
if(our_excited_group != enemy_excited_group)
|
||||
//combine groups (this also handles updating the excited_group var of all involved turfs)
|
||||
our_excited_group.merge_groups(enemy_excited_group)
|
||||
our_excited_group = excited_group //update our cache
|
||||
share_air(enemy_tile, fire_count, adjacent_turfs_length) //share
|
||||
else
|
||||
if((recently_active == 1 && enemy_tile.recently_active == 1) || air.compare(enemy_tile.air))
|
||||
our_excited_group.add_turf(enemy_tile) //add enemy to our group
|
||||
share_air(enemy_tile, fire_count, adjacent_turfs_length) //share
|
||||
else
|
||||
if(enemy_excited_group)
|
||||
if((recently_active == 1 && enemy_tile.recently_active == 1) || air.compare(enemy_tile.air))
|
||||
enemy_excited_group.add_turf(src) //join self to enemy group
|
||||
our_excited_group = excited_group //update our cache
|
||||
share_air(enemy_tile, fire_count, adjacent_turfs_length) //share
|
||||
else
|
||||
if((recently_active == 1 && enemy_tile.recently_active == 1) || air.compare(enemy_tile.air))
|
||||
var/datum/excited_group/EG = new //generate new group
|
||||
EG.add_turf(src)
|
||||
EG.add_turf(enemy_tile)
|
||||
our_excited_group = excited_group //update our cache
|
||||
share_air(enemy_tile, fire_count, adjacent_turfs_length) //share
|
||||
else
|
||||
if(air.compare(enemy_tile.air)) //compare if
|
||||
SSair.add_to_active(enemy_tile) //excite enemy
|
||||
if(our_excited_group)
|
||||
excited_group.add_turf(enemy_tile) //add enemy to group
|
||||
else
|
||||
var/datum/excited_group/EG = new //generate new group
|
||||
EG.add_turf(src)
|
||||
EG.add_turf(enemy_tile)
|
||||
our_excited_group = excited_group //update our cache
|
||||
share_air(enemy_tile, fire_count, adjacent_turfs_length) //share
|
||||
|
||||
/******************* GROUP HANDLING FINISH *********************************************************************/
|
||||
|
||||
air.react()
|
||||
|
||||
update_visuals()
|
||||
|
||||
if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
|
||||
hotspot_expose(air.temperature, CELL_VOLUME)
|
||||
for(var/atom/movable/item in src)
|
||||
item.temperature_expose(air, air.temperature, CELL_VOLUME)
|
||||
temperature_expose(air, air.temperature, CELL_VOLUME)
|
||||
|
||||
if(air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION)
|
||||
if(consider_superconductivity(starting = 1))
|
||||
remove = 0
|
||||
|
||||
if(!our_excited_group && remove == 1)
|
||||
SSair.remove_from_active(src)
|
||||
|
||||
/turf/open/proc/share_air(turf/open/T, fire_count, adjacent_turfs_length)
|
||||
if(T.current_cycle < fire_count)
|
||||
var/difference = air.share(T.air, adjacent_turfs_length)
|
||||
if(difference)
|
||||
if(difference > 0)
|
||||
consider_pressure_difference(T, difference)
|
||||
else
|
||||
T.consider_pressure_difference(src, -difference)
|
||||
last_share_check()
|
||||
|
||||
//////////////////////////SPACEWIND/////////////////////////////
|
||||
|
||||
/turf/open/proc/consider_pressure_difference(turf/T, difference)
|
||||
SSair.high_pressure_delta |= src
|
||||
if(difference > pressure_difference)
|
||||
pressure_direction = get_dir(src, T)
|
||||
pressure_difference = difference
|
||||
|
||||
/turf/open/proc/last_share_check()
|
||||
if(air.last_share > MINIMUM_AIR_TO_SUSPEND)
|
||||
excited_group.reset_cooldowns()
|
||||
else if(air.last_share > MINIMUM_MOLES_DELTA_TO_MOVE)
|
||||
excited_group.dismantle_cooldown = 0
|
||||
|
||||
/turf/open/proc/high_pressure_movements()
|
||||
for(var/atom/movable/M in src)
|
||||
M.experience_pressure_difference(pressure_difference, pressure_direction)
|
||||
|
||||
/atom/movable/var/pressure_resistance = 5
|
||||
/atom/movable/var/last_high_pressure_movement_air_cycle = 0
|
||||
/atom/movable/proc/experience_pressure_difference(pressure_difference, direction)
|
||||
set waitfor = 0
|
||||
. = 0
|
||||
if(!anchored && !pulledby)
|
||||
. = 1
|
||||
if(pressure_difference > pressure_resistance && last_high_pressure_movement_air_cycle < SSair.times_fired)
|
||||
last_high_pressure_movement_air_cycle = SSair.times_fired
|
||||
step(src, direction)
|
||||
|
||||
///////////////////////////EXCITED GROUPS/////////////////////////////
|
||||
|
||||
/datum/excited_group
|
||||
var/list/turf_list = list()
|
||||
var/breakdown_cooldown = 0
|
||||
var/dismantle_cooldown = 0
|
||||
|
||||
/datum/excited_group/New()
|
||||
SSair.excited_groups += src
|
||||
|
||||
/datum/excited_group/proc/add_turf(turf/open/T)
|
||||
turf_list += T
|
||||
T.excited_group = src
|
||||
T.recently_active = 1
|
||||
reset_cooldowns()
|
||||
|
||||
/datum/excited_group/proc/merge_groups(datum/excited_group/E)
|
||||
if(turf_list.len > E.turf_list.len)
|
||||
SSair.excited_groups -= E
|
||||
for(var/t in E.turf_list)
|
||||
var/turf/open/T = t
|
||||
T.excited_group = src
|
||||
turf_list += T
|
||||
reset_cooldowns()
|
||||
else
|
||||
SSair.excited_groups -= src
|
||||
for(var/t in turf_list)
|
||||
var/turf/open/T = t
|
||||
T.excited_group = E
|
||||
E.turf_list += T
|
||||
E.reset_cooldowns()
|
||||
|
||||
/datum/excited_group/proc/reset_cooldowns()
|
||||
breakdown_cooldown = 0
|
||||
dismantle_cooldown = 0
|
||||
|
||||
//argument is so world start can clear out any turf differences quickly.
|
||||
/datum/excited_group/proc/self_breakdown(space_is_all_consuming = 0)
|
||||
var/datum/gas_mixture/A = new
|
||||
|
||||
//make local for sanic speed
|
||||
var/list/A_gases = A.gases
|
||||
var/list/turf_list = src.turf_list
|
||||
var/turflen = turf_list.len
|
||||
var/space_in_group = 0
|
||||
|
||||
for(var/t in turf_list)
|
||||
var/turf/open/T = t
|
||||
if (space_is_all_consuming && !space_in_group && istype(T.air, /datum/gas_mixture/space))
|
||||
space_in_group = 1
|
||||
qdel(A)
|
||||
A = new/datum/gas_mixture/space()
|
||||
A.merge(T.air)
|
||||
|
||||
for(var/id in A_gases)
|
||||
A_gases[id][MOLES] = A_gases[id][MOLES]/turflen
|
||||
|
||||
for(var/t in turf_list)
|
||||
var/turf/open/T = t
|
||||
T.air.copy_from(A)
|
||||
T.update_visuals()
|
||||
|
||||
breakdown_cooldown = 0
|
||||
|
||||
/datum/excited_group/proc/dismantle()
|
||||
for(var/t in turf_list)
|
||||
var/turf/open/T = t
|
||||
T.excited = 0
|
||||
T.recently_active = 0
|
||||
T.excited_group = null
|
||||
SSair.active_turfs -= T
|
||||
garbage_collect()
|
||||
|
||||
/datum/excited_group/proc/garbage_collect()
|
||||
for(var/t in turf_list)
|
||||
var/turf/open/T = t
|
||||
T.excited_group = null
|
||||
turf_list.Cut()
|
||||
SSair.excited_groups -= src
|
||||
|
||||
////////////////////////SUPERCONDUCTIVITY/////////////////////////////
|
||||
/turf/proc/conductivity_directions()
|
||||
if(archived_cycle < SSair.times_fired)
|
||||
archive()
|
||||
return NORTH|SOUTH|EAST|WEST
|
||||
|
||||
/turf/open/conductivity_directions()
|
||||
if(blocks_air)
|
||||
return ..()
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(src, direction)
|
||||
if(!(T in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction))
|
||||
. |= direction
|
||||
|
||||
/turf/proc/neighbor_conduct_with_src(turf/open/other)
|
||||
if(!other.blocks_air) //Open but neighbor is solid
|
||||
other.temperature_share_open_to_solid(src)
|
||||
else //Both tiles are solid
|
||||
other.share_temperature_mutual_solid(src, thermal_conductivity)
|
||||
temperature_expose(null, temperature, null)
|
||||
|
||||
/turf/open/neighbor_conduct_with_src(turf/other)
|
||||
if(blocks_air)
|
||||
..()
|
||||
return
|
||||
|
||||
if(!other.blocks_air) //Both tiles are open
|
||||
var/turf/open/T = other
|
||||
T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
|
||||
else //Solid but neighbor is open
|
||||
temperature_share_open_to_solid(other)
|
||||
SSair.add_to_active(src, 0)
|
||||
|
||||
/turf/proc/super_conduct()
|
||||
var/conductivity_directions = conductivity_directions()
|
||||
|
||||
if(conductivity_directions)
|
||||
//Conduct with tiles around me
|
||||
for(var/direction in cardinal)
|
||||
if(conductivity_directions & direction)
|
||||
var/turf/neighbor = get_step(src,direction)
|
||||
|
||||
if(!neighbor.thermal_conductivity)
|
||||
continue
|
||||
|
||||
if(neighbor.archived_cycle < SSair.times_fired)
|
||||
neighbor.archive()
|
||||
|
||||
neighbor.neighbor_conduct_with_src(src)
|
||||
|
||||
neighbor.consider_superconductivity()
|
||||
|
||||
radiate_to_spess()
|
||||
|
||||
finish_superconduction()
|
||||
|
||||
/turf/proc/finish_superconduction(temp = temperature)
|
||||
//Make sure still hot enough to continue conducting heat
|
||||
if(temp < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)
|
||||
SSair.active_super_conductivity -= src
|
||||
return 0
|
||||
|
||||
/turf/open/finish_superconduction()
|
||||
//Conduct with air on my tile if I have it
|
||||
if(!blocks_air)
|
||||
temperature = air.temperature_share(null, thermal_conductivity, temperature, heat_capacity)
|
||||
..((blocks_air ? temperature : air.temperature))
|
||||
|
||||
/turf/proc/consider_superconductivity()
|
||||
if(!thermal_conductivity)
|
||||
return 0
|
||||
|
||||
SSair.active_super_conductivity |= src
|
||||
return 1
|
||||
|
||||
/turf/open/consider_superconductivity(starting)
|
||||
if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION))
|
||||
return 0
|
||||
if(air.heat_capacity() < M_CELL_WITH_RATIO) // Was: MOLES_CELLSTANDARD*0.1*0.05 Since there are no variables here we can make this a constant.
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
/turf/closed/consider_superconductivity(starting)
|
||||
if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION))
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
/turf/proc/radiate_to_spess() //Radiate excess tile heat to space
|
||||
if(temperature > T0C) //Considering 0 degC as te break even point for radiation in and out
|
||||
var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature
|
||||
if((heat_capacity > 0) && (abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER))
|
||||
|
||||
var/heat = thermal_conductivity*delta_temperature* \
|
||||
(heat_capacity*700000/(heat_capacity+700000)) //700000 is the heat_capacity from a space turf, hardcoded here
|
||||
temperature -= heat/heat_capacity
|
||||
|
||||
/turf/open/proc/temperature_share_open_to_solid(turf/sharer)
|
||||
sharer.temperature = air.temperature_share(null, sharer.thermal_conductivity, sharer.temperature, sharer.heat_capacity)
|
||||
|
||||
/turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //to be understood
|
||||
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER && heat_capacity && sharer.heat_capacity)
|
||||
|
||||
var/heat = conduction_coefficient*delta_temperature* \
|
||||
(heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity))
|
||||
|
||||
temperature -= heat/heat_capacity
|
||||
sharer.temperature += heat/sharer.heat_capacity
|
||||
Reference in New Issue
Block a user