mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-07 07:52:00 +00:00
More changes for ZAS. Firelocks work properly, and rebuilding zones occurs at the proper times.
This commit is contained in:
@@ -126,11 +126,17 @@ proc/Airflow(zone/A,zone/B)
|
||||
//These turfs are the midway point between A and B, and will be the destination point for thrown objects.
|
||||
var/list/connection/connections_A = A.connections
|
||||
var/list/turf/connected_turfs = list()
|
||||
for(var/connection/C in connections_A)
|
||||
for(var/connection/C in connections_A) //Grab the turf that is in the zone we are flowing to (determined by n)
|
||||
if( ( A == C.A.zone || A == C.zone_A ) && ( B == C.B.zone || B == C.zone_B ) )
|
||||
connected_turfs |= C.A
|
||||
if(n < 0)
|
||||
connected_turfs |= C.B
|
||||
else
|
||||
connected_turfs |= C.A
|
||||
else if( ( A == C.B.zone || A == C.zone_B ) && ( B == C.A.zone || B == C.zone_A ) )
|
||||
connected_turfs |= C.B
|
||||
if(n < 0)
|
||||
connected_turfs |= C.A
|
||||
else
|
||||
connected_turfs |= C.B
|
||||
|
||||
//Get lists of things that can be thrown across the room for each zone.
|
||||
var/list/pplz = B.movables()
|
||||
@@ -333,6 +339,7 @@ atom/movable
|
||||
airflow_hit(A)
|
||||
else
|
||||
airflow_speed = 0
|
||||
airflow_time = 0
|
||||
. = ..()
|
||||
|
||||
atom/movable/proc/airflow_hit(atom/A)
|
||||
|
||||
@@ -166,9 +166,7 @@ datum
|
||||
|
||||
if(tiles_to_update.len > 0) //If there are tiles to update, do so.
|
||||
for(var/turf/simulated/T in tiles_to_update)
|
||||
spawn
|
||||
if(istype(T))
|
||||
T.update_air_properties()
|
||||
T.update_air_properties()
|
||||
tiles_to_update = list()
|
||||
|
||||
for(var/zone/Z in zones)
|
||||
|
||||
@@ -174,7 +174,7 @@ turf
|
||||
if(CanPass(null, get_step(src,direction), 0, 0))
|
||||
air_check_directions |= direction
|
||||
|
||||
if(!zone && !density) //No zone and not a wall, lets add ourself to a zone.
|
||||
if(!zone && CanPass(null, src, 1.5, 1)) //No zone and not a wall, lets add ourself to a zone.
|
||||
for(var/direction in cardinal)
|
||||
if(air_check_directions&direction)
|
||||
var/turf/simulated/T = get_step(src,direction)
|
||||
@@ -205,22 +205,17 @@ turf
|
||||
if(zone)
|
||||
zone.rebuild = 1
|
||||
continue
|
||||
else if(!(T.CanPass(null, src, 1.5, 1) && CanPass(null, T, 1.5, 1)) && (CanPass(null, T, 0, 0) || T.CanPass(null, src, 0, 0))) //I normally block air, but am permitting it.
|
||||
else if(!(T.CanPass(null, src, 1.5, 1) && CanPass(null, T, 1.5, 1)) && CanPass(null, T, 0, 0) && T.CanPass(null, src, 0, 0)) //I normally block air, but am permitting it.
|
||||
if(zone) //Either open or no doors, air can flow.
|
||||
ZConnect(src,T) //Connect 'em.
|
||||
else if(!(T.CanPass(null, src, 1.5, 1) && CanPass(null, T, 1.5, 1))) //If I block air, we must look to see if the adjacent turfs need rebuilt.
|
||||
else if(!T.CanPass(null, src, 1.5, 1) && !T.CanPass(null, src, 0, 0)) //If I block air, we must look to see if the adjacent turfs need rebuilt.
|
||||
if(T.zone && !T.zone.rebuild)
|
||||
for(var/direction2 in cardinal - direction) //Check all other directions for air that might be connected.
|
||||
var/turf/simulated/NT = get_step(src, direction2)
|
||||
if(NT.zone && NT.zone == T.zone)
|
||||
if(direction == reverse_direction(direction2)) //If it is opposite, then rebuild anyways.
|
||||
T.zone.rebuild = 1
|
||||
break
|
||||
else
|
||||
var/turf/simulated/LT = get_step(src, direction2|direction) //Is there a diagonal for the air to path around?
|
||||
if(!LT || !LT.zone || LT.zone != T.zone) //Either it does not exist or the zone does not match, rebuild
|
||||
T.zone.rebuild = 1
|
||||
break
|
||||
else if(!LT.CanPass(null, LT, 0, 0) || !NT.CanPass(null, NT, 0, 0)) //It exist, zone matches, see if it can transfer air. Otherwise, rebuild.
|
||||
T.zone.rebuild = 1
|
||||
break
|
||||
if(NT && NT.zone && NT.zone == T.zone)
|
||||
T.zone.rebuild = 1
|
||||
else if(zone && !zone.rebuild)
|
||||
for(var/direction2 in cardinal - reverse_direction(direction)) //Check all other directions for air that might be connected.
|
||||
var/turf/simulated/NT = get_step(T, direction2)
|
||||
if(NT && NT.zone && NT.zone == zone)
|
||||
zone.rebuild = 1
|
||||
110
code/ZAS/Fire.dm
110
code/ZAS/Fire.dm
@@ -268,6 +268,116 @@ datum/gas_mixture/proc/zburn(obj/liquid_fuel/liquid)
|
||||
return consumed_gas*fuel_sources
|
||||
return 0
|
||||
|
||||
/*
|
||||
OLD FIRE:
|
||||
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 += vsc.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 += vsc.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
|
||||
OLD ZBURN:
|
||||
datum/gas_mixture/proc/zburn(obj/liquid_fuel/liquid)
|
||||
if(vsc.switch_fire)
|
||||
. = fire()
|
||||
if(liquid && liquid.amount > 0)
|
||||
oxygen -= fire_ratio_1
|
||||
liquid.amount = max(liquid.amount-fire_ratio_1,0)
|
||||
carbon_dioxide += fire_ratio_1
|
||||
if(liquid.amount <= 0)
|
||||
del liquid
|
||||
return
|
||||
if(temperature > PLASMA_MINIMUM_BURN_TEMPERATURE)
|
||||
var
|
||||
fuel_level = 0
|
||||
datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
liquid_level = 0
|
||||
if(fuel) fuel_level = fuel.moles
|
||||
if(liquid) liquid_level = liquid.amount
|
||||
if(liquid.amount <= 0)
|
||||
del liquid
|
||||
liquid_level = 0
|
||||
if(oxygen > 0.3 && (toxins || fuel_level || liquid_level))
|
||||
if(toxins && temperature < PLASMA_UPPER_TEMPERATURE)
|
||||
temperature += (vsc.FIRE_PLASMA_ENERGY_RELEASED*fire_ratio_1) / heat_capacity()
|
||||
|
||||
if((fuel_level || liquid_level) && temperature < PLASMA_UPPER_TEMPERATURE)
|
||||
temperature += (vsc.FIRE_CARBON_ENERGY_RELEASED*fire_ratio_1) / heat_capacity()
|
||||
|
||||
if(toxins > fire_ratio_1)
|
||||
oxygen -= vsc.OXY_TO_PLASMA*fire_ratio_1
|
||||
toxins -= fire_ratio_1
|
||||
carbon_dioxide += fire_ratio_1
|
||||
else if(toxins)
|
||||
oxygen -= toxins * vsc.OXY_TO_PLASMA
|
||||
carbon_dioxide += toxins
|
||||
toxins = 0
|
||||
|
||||
if(fuel_level > fire_ratio_1/1.5)
|
||||
oxygen -= vsc.OXY_TO_PLASMA*fire_ratio_1
|
||||
fuel.moles -= fire_ratio_1
|
||||
carbon_dioxide += fire_ratio_1
|
||||
|
||||
else if(fuel_level)
|
||||
oxygen -= fuel.moles * vsc.OXY_TO_PLASMA
|
||||
carbon_dioxide += fuel.moles
|
||||
fuel.moles = 0
|
||||
|
||||
if(liquid_level > 0)
|
||||
oxygen -= fire_ratio_1
|
||||
liquid.amount = max(liquid.amount-fire_ratio_1,0)
|
||||
carbon_dioxide += fire_ratio_1
|
||||
if(liquid.amount <= 0)
|
||||
del liquid
|
||||
return 1
|
||||
return 0 */
|
||||
|
||||
datum/gas_mixture/proc/calculate_firelevel(obj/liquid_fuel/liquid)
|
||||
//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
|
||||
var
|
||||
|
||||
@@ -111,7 +111,9 @@ proc/ZConnect(turf/A,turf/B)
|
||||
//Make some preliminary checks to see if the connection is valid.
|
||||
if(!A.zone || !B.zone) return
|
||||
if(A.zone == B.zone) return
|
||||
if(!A.CanPass(0,B,0,0)) return
|
||||
if(!A.CanPass(0,B,0,0) || !B.CanPass(0,A,0,0)) return
|
||||
if(A.CanPass(null, B, 1.5, 1) && B.CanPass(null, A, 1.5, 1))
|
||||
return ZMerge(A.zone, B.zone)
|
||||
|
||||
//Ensure the connection isn't already made.
|
||||
for(var/connection/C in A.zone.connections)
|
||||
|
||||
Reference in New Issue
Block a user