mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fire update. Should now burn out after a time, and temperature varies on a number of conditions. Fixed a runtime, and made fire work in canisters. Ingame modification of ZAS is now possible again. Firedoors now remove duplicate firedoors on the same turf.
This commit is contained in:
131
code/ZAS/Fire.dm
131
code/ZAS/Fire.dm
@@ -11,8 +11,6 @@ Attach to transfer valve and open. BOOM.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
//Some legacy definitions so fires can be started.
|
||||
atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
return null
|
||||
@@ -21,21 +19,12 @@ atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed
|
||||
turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
|
||||
|
||||
|
||||
|
||||
turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
if(fire_protection > world.time-300) return
|
||||
var/datum/gas_mixture/air_contents = return_air(1)
|
||||
if(!air_contents)
|
||||
var/datum/gas_mixture/air_contents = return_air()
|
||||
if(!air_contents || exposed_temperature < PLASMA_MINIMUM_BURN_TEMPERATURE)
|
||||
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
|
||||
if(locate(/obj/fire) in src)
|
||||
return 1
|
||||
@@ -47,9 +36,8 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
return 0
|
||||
|
||||
if(! (locate(/obj/fire) in src))
|
||||
var/obj/fire/F = new(src,1000)
|
||||
F.temperature = exposed_temperature
|
||||
F.volume = CELL_VOLUME
|
||||
|
||||
new /obj/fire(src,1000)
|
||||
|
||||
//active_hotspot.just_spawned = (current_cycle < air_master.current_cycle)
|
||||
//remove just_spawned protection if no longer processing this cell
|
||||
@@ -71,10 +59,7 @@ obj
|
||||
layer = TURF_LAYER
|
||||
|
||||
var
|
||||
volume = CELL_VOLUME
|
||||
temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
|
||||
firelevel = 10000 //Calculated by gas_mixture.calculate_firelevel()
|
||||
archived_firelevel = 0
|
||||
|
||||
process()
|
||||
. = 1
|
||||
@@ -92,7 +77,7 @@ obj
|
||||
//Also get liquid fuels on the ground.
|
||||
obj/effect/decal/cleanable/liquid_fuel/liquid = locate() in S
|
||||
|
||||
var/datum/gas_mixture/flow = air_contents.remove_ratio(0.25)
|
||||
var/datum/gas_mixture/flow = air_contents.remove_ratio(vsc.fire_consuption_rate)
|
||||
//The reason we're taking a part of the air instead of all of it is so that it doesn't jump to
|
||||
//the fire's max temperature instantaneously.
|
||||
|
||||
@@ -126,10 +111,13 @@ obj
|
||||
//Change icon depending on the fuel, and thus temperature.
|
||||
if(firelevel > 6)
|
||||
icon_state = "3"
|
||||
SetLuminosity(7)
|
||||
else if(firelevel > 2.5)
|
||||
icon_state = "2"
|
||||
SetLuminosity(5)
|
||||
else
|
||||
icon_state = "1"
|
||||
SetLuminosity(3)
|
||||
|
||||
//Ensure flow temperature is higher than minimum fire temperatures.
|
||||
flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature)
|
||||
@@ -153,11 +141,10 @@ obj
|
||||
else
|
||||
del src
|
||||
|
||||
//Should fix fire being extra damaging, temperature of the environment will now be the main source of fire damage.
|
||||
/*
|
||||
|
||||
for(var/mob/living/carbon/human/M in loc)
|
||||
M.FireBurn(min(max(0.1,firelevel / 20),10)) //Burn the humans!
|
||||
*/
|
||||
M.FireBurn(firelevel) //Burn the humans!
|
||||
|
||||
|
||||
New(newLoc,fl)
|
||||
..()
|
||||
@@ -166,13 +153,14 @@ obj
|
||||
del src
|
||||
|
||||
dir = pick(cardinal)
|
||||
//sd_SetLuminosity(3,2,0)
|
||||
SetLuminosity(3)
|
||||
firelevel = fl
|
||||
air_master.active_hotspots.Add(src)
|
||||
|
||||
|
||||
Del()
|
||||
if (istype(loc, /turf/simulated))
|
||||
//sd_SetLuminosity(0)
|
||||
SetLuminosity(0)
|
||||
|
||||
loc = null
|
||||
air_master.active_hotspots.Remove(src)
|
||||
@@ -180,36 +168,34 @@ obj
|
||||
..()
|
||||
|
||||
|
||||
|
||||
turf/simulated/var/fire_protection = 0 //Protects newly extinguished tiles from being overrun again.
|
||||
turf/proc/apply_fire_protection()
|
||||
turf/simulated/apply_fire_protection()
|
||||
fire_protection = world.time
|
||||
|
||||
|
||||
datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
//This proc is similar to fire(), but uses a simple logarithm to calculate temp, and is thus more stable with ZAS.
|
||||
if(temperature > PLASMA_MINIMUM_BURN_TEMPERATURE)
|
||||
var
|
||||
total_fuel = toxins
|
||||
fuel_sources = 0 //We'll divide by this later so that fuel is consumed evenly.
|
||||
|
||||
datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
|
||||
if(fuel)
|
||||
//Volatile Fuel
|
||||
total_fuel += fuel.moles
|
||||
fuel_sources++
|
||||
|
||||
if(liquid)
|
||||
//Liquid Fuel
|
||||
if(liquid.amount <= 0)
|
||||
del liquid
|
||||
else
|
||||
total_fuel += liquid.amount
|
||||
fuel_sources++
|
||||
total_fuel += liquid.amount*15
|
||||
|
||||
//Toxins
|
||||
if(toxins > 0.3) fuel_sources++
|
||||
|
||||
if(!fuel_sources) return 0 //If there's no fuel, there's no burn. Can't divide by zero anyway.
|
||||
if(! (fuel || toxins || liquid) )
|
||||
return 0 //If there's no fuel, there's no burn. Can't divide by zero anyway.
|
||||
|
||||
if(oxygen > 0.3)
|
||||
|
||||
@@ -219,46 +205,54 @@ datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
//Reaches a maximum practical temperature of around 4500.
|
||||
|
||||
//Increase temperature.
|
||||
temperature = max( 1700*log(0.4*firelevel + 1.23) , temperature )
|
||||
temperature = max( vsc.fire_temperature_multiplier*log(0.04*firelevel + 1.24) , temperature )
|
||||
|
||||
var/total_reactants = min(oxygen, 2*total_fuel) + total_fuel
|
||||
|
||||
//Consume some gas.
|
||||
var/consumed_gas = min(oxygen,0.05*firelevel,total_fuel) / fuel_sources
|
||||
var/consumed_gas = max( min( total_reactants, vsc.fire_gas_combustion_ratio*firelevel ), 0.2)
|
||||
|
||||
oxygen = max(0,oxygen-consumed_gas)
|
||||
oxygen -= min(oxygen, (total_reactants-total_fuel)*consumed_gas/total_reactants )
|
||||
|
||||
toxins = max(0,toxins-consumed_gas)
|
||||
toxins -= min(toxins, toxins*consumed_gas/total_reactants )
|
||||
|
||||
carbon_dioxide += consumed_gas*2
|
||||
carbon_dioxide += max(consumed_gas, 0)
|
||||
|
||||
if(fuel)
|
||||
fuel.moles -= consumed_gas
|
||||
fuel.moles -= fuel.moles*consumed_gas/total_reactants
|
||||
if(fuel.moles <= 0) del fuel
|
||||
|
||||
if(liquid)
|
||||
liquid.amount -= consumed_gas
|
||||
liquid.amount -= liquid.amount*consumed_gas/(15*total_reactants)
|
||||
if(liquid.amount <= 0) del liquid
|
||||
|
||||
update_values()
|
||||
return consumed_gas*fuel_sources
|
||||
return consumed_gas
|
||||
return 0
|
||||
|
||||
|
||||
datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
|
||||
var
|
||||
datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
liquid_concentration = 0
|
||||
|
||||
oxy_concentration = oxygen / volume
|
||||
tox_concentration = toxins / volume
|
||||
fuel_concentration = 0
|
||||
var/total_fuel = toxins - 0.5
|
||||
|
||||
if(fuel) fuel_concentration = (fuel.moles) / volume
|
||||
if(liquid) liquid_concentration = (liquid.amount*15) / volume
|
||||
return (oxy_concentration + tox_concentration + liquid_concentration + fuel_concentration)*100
|
||||
if(liquid)
|
||||
total_fuel += (liquid.amount*15)
|
||||
|
||||
/mob/living/carbon/human/proc/FireBurn(mx as num)
|
||||
if(fuel)
|
||||
total_fuel += fuel.moles
|
||||
|
||||
var/total_combustables = (total_fuel + oxygen)
|
||||
if(total_fuel <= 0 || oxygen <= 0)
|
||||
return 0
|
||||
|
||||
return max( 0, vsc.fire_firelevel_multiplier*(total_combustables/(total_combustables + nitrogen))*log(2*total_combustables/oxygen)*log(total_combustables/total_fuel))
|
||||
|
||||
|
||||
/mob/living/carbon/human/proc/FireBurn(var/firelevel)
|
||||
//Burns mobs due to fire. Respects heat transfer coefficients on various body parts.
|
||||
//Due to TG reworking how fireprotection works, this is kinda less meaningful.
|
||||
|
||||
var
|
||||
head_exposure = 1
|
||||
@@ -267,20 +261,26 @@ datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fue
|
||||
legs_exposure = 1
|
||||
arms_exposure = 1
|
||||
|
||||
var/mx = min(max(0.1,firelevel / 20),10)
|
||||
var/last_temperature = vsc.fire_temperature_multiplier*log(0.04*firelevel + 1.24)
|
||||
|
||||
//Get heat transfer coefficients for clothing.
|
||||
//skytodo: different handling of temp with tg
|
||||
/*for(var/obj/item/clothing/C in src)
|
||||
if(l_hand == C || r_hand == C) continue
|
||||
if(C.body_parts_covered & HEAD)
|
||||
head_exposure *= C.heat_transfer_coefficient
|
||||
if(C.body_parts_covered & UPPER_TORSO)
|
||||
chest_exposure *= C.heat_transfer_coefficient
|
||||
if(C.body_parts_covered & LOWER_TORSO)
|
||||
groin_exposure *= C.heat_transfer_coefficient
|
||||
if(C.body_parts_covered & LEGS)
|
||||
legs_exposure *= C.heat_transfer_coefficient
|
||||
if(C.body_parts_covered & ARMS)
|
||||
arms_exposure *= C.heat_transfer_coefficient*/
|
||||
//skytodo: kill anyone who breaks things then orders me to fix them
|
||||
for(var/obj/item/clothing/C in src)
|
||||
if(l_hand == C || r_hand == C)
|
||||
continue
|
||||
|
||||
if( C.max_heat_protection_temperature >= last_temperature )
|
||||
if(C.body_parts_covered & HEAD)
|
||||
head_exposure = 0
|
||||
if(C.body_parts_covered & UPPER_TORSO)
|
||||
chest_exposure = 0
|
||||
if(C.body_parts_covered & LOWER_TORSO)
|
||||
groin_exposure = 0
|
||||
if(C.body_parts_covered & LEGS)
|
||||
legs_exposure = 0
|
||||
if(C.body_parts_covered & ARMS)
|
||||
arms_exposure = 0
|
||||
|
||||
//Always check these damage procs first if fire damage isn't working. They're probably what's wrong.
|
||||
|
||||
@@ -292,4 +292,5 @@ datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fue
|
||||
apply_damage(0.4*mx*arms_exposure, BURN, "l_arm", 0, 0, "Fire")
|
||||
apply_damage(0.4*mx*arms_exposure, BURN, "r_arm", 0, 0, "Fire")
|
||||
|
||||
//flash_pain()
|
||||
//flash_pain()
|
||||
#undef ZAS_FIRE_CONSUMPTION_RATE
|
||||
@@ -2,40 +2,69 @@ var/global/vs_control/vsc = new
|
||||
|
||||
vs_control/var
|
||||
IgnitionLevel = 0.5
|
||||
IgnitionLevel_DESC = "Moles of oxygen+plasma - co2 needed to burn."
|
||||
IgnitionLevel_DESC = "Determines point at which fire can ignite"
|
||||
|
||||
fire_consuption_rate = 0.25
|
||||
fire_consuption_rate_NAME = "Fire - Air Consumption Ratio"
|
||||
fire_consuption_rate_DESC = "Ratio of air removed and combusted per tick."
|
||||
|
||||
fire_firelevel_multiplier = 25
|
||||
fire_firelevel_multiplier_NAME = "Fire - Firelevel Constant"
|
||||
fire_firelevel_multiplier_DESC = "Multiplied by the equation for firelevel, affects the combustion and ignition of gas mixes."
|
||||
|
||||
fire_temperature_multiplier = 1700
|
||||
fire_temperature_multiplier_NAME = "Fire - Temperature Multiplier"
|
||||
fire_temperature_multiplier_DESC = "Base value for fire temperatures."
|
||||
|
||||
fire_gas_combustion_ratio = 0.25
|
||||
fire_gas_combustion_ratio_NAME = "Fire - Gas Conversion Ratio"
|
||||
fire_gas_combustion_ratio_DESC = "The rate at which oxygen and plasma are converted to CO2, expressed in terms of the firelevel."
|
||||
|
||||
|
||||
airflow_lightest_pressure = 30
|
||||
airflow_lightest_pressure_NAME = "Airflow - Small Movement Threshold %"
|
||||
airflow_lightest_pressure_DESC = "Percent of 1 Atm. at which items with the small weight classes will move."
|
||||
|
||||
airflow_light_pressure = 45
|
||||
airflow_light_pressure_NAME = "Airflow - Medium Movement Threshold %"
|
||||
airflow_light_pressure_DESC = "Percent of 1 Atm. at which items with the medium weight classes will move."
|
||||
|
||||
airflow_medium_pressure = 90
|
||||
airflow_medium_pressure_NAME = "Airflow - Heavy Movement Threshold %"
|
||||
airflow_medium_pressure_DESC = "Percent of 1 Atm. at which items with the largest weight classes will move."
|
||||
|
||||
airflow_heavy_pressure = 95
|
||||
airflow_heavy_pressure_NAME = "Airflow - Mob Movement Threshold %"
|
||||
airflow_heavy_pressure_DESC = "Percent of 1 Atm. at which mobs will move."
|
||||
|
||||
airflow_dense_pressure = 120
|
||||
airflow_dense_pressure_NAME = "Airflow - Dense Movement Threshold %"
|
||||
airflow_dense_pressure_DESC = "Percent of 1 Atm. at which items with canisters and closets will move."
|
||||
|
||||
airflow_stun_pressure = 100
|
||||
airflow_stun_pressure_NAME = "Airflow - Mob Stunning Threshold %"
|
||||
airflow_stun_pressure_DESC = "Percent of 1 Atm. at which mobs will be stunned by airflow."
|
||||
|
||||
airflow_stun_cooldown = 60
|
||||
airflow_stun_cooldown_NAME = "Aiflow Stunning - Cooldown"
|
||||
airflow_stun_cooldown_DESC = "How long, in tenths of a second, to wait before stunning them again."
|
||||
|
||||
airflow_stun = 0.15
|
||||
airflow_stun_NAME = "Airflow Impact - Stunning"
|
||||
airflow_stun_DESC = "How much a mob is stunned when hit by an object."
|
||||
|
||||
airflow_damage = 0.3
|
||||
airflow_damage_NAME = "Airflow Impact - Damage"
|
||||
airflow_damage_DESC = "Damage from airflow impacts."
|
||||
|
||||
airflow_speed_decay = 1.5
|
||||
airflow_speed_decay_NAME = "Airflow Speed Decay"
|
||||
airflow_speed_decay_DESC = "How rapidly the speed gained from airflow decays."
|
||||
|
||||
airflow_delay = 30
|
||||
airflow_delay_NAME = "Airflow Retrigger Delay"
|
||||
airflow_delay_DESC = "Time in deciseconds before things can be moved by airflow again."
|
||||
|
||||
airflow_mob_slowdown = 1
|
||||
airflow_mob_slowdown_NAME = "Airflow Slowdown"
|
||||
airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow."
|
||||
|
||||
@@ -218,7 +218,7 @@ zone/proc/process()
|
||||
if(air.temperature > PLASMA_FLASHPOINT)
|
||||
for(var/atom/movable/item in S)
|
||||
item.temperature_expose(air, air.temperature, CELL_VOLUME)
|
||||
S.hotspot_expose(air, air.temperature, CELL_VOLUME)
|
||||
S.hotspot_expose(air.temperature, CELL_VOLUME)
|
||||
|
||||
progress = "problem with: calculating air graphic"
|
||||
|
||||
|
||||
@@ -136,6 +136,9 @@
|
||||
else
|
||||
can_label = 0
|
||||
|
||||
if(air_contents.temperature > PLASMA_FLASHPOINT)
|
||||
air_contents.zburn()
|
||||
|
||||
src.updateDialog()
|
||||
return
|
||||
|
||||
|
||||
@@ -229,6 +229,11 @@
|
||||
SetOpacity(1) //caaaaarn!
|
||||
operating = 0
|
||||
update_nearby_tiles()
|
||||
|
||||
//I shall not add a check every x ticks if a door has closed over some fire.
|
||||
var/obj/fire/fire = locate() in loc
|
||||
if(fire)
|
||||
del fire
|
||||
return
|
||||
|
||||
/obj/machinery/door/proc/requiresID()
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
|
||||
New()
|
||||
. = ..()
|
||||
for(var/obj/machinery/door/firedoor/F in loc)
|
||||
if(F != src)
|
||||
spawn(1)
|
||||
del src
|
||||
return .
|
||||
var/area/A = get_area(src)
|
||||
ASSERT(istype(A))
|
||||
|
||||
@@ -134,7 +139,7 @@
|
||||
else
|
||||
users_name = "Unknown"
|
||||
|
||||
if( !stat && ( istype(C, /obj/item/weapon/card/id) || istype(C, /obj/item/device/pda) ) )
|
||||
if( ishuman(user) && !stat && ( istype(C, /obj/item/weapon/card/id) || istype(C, /obj/item/device/pda) ) )
|
||||
var/obj/item/weapon/card/id/ID = C
|
||||
|
||||
if( istype(C, /obj/item/device/pda) )
|
||||
|
||||
@@ -499,9 +499,12 @@ var/global/floorIsLava = 0
|
||||
<A href='?src=\ref[src];quick_create_object=1'>Quick Create Object</A><br>
|
||||
<A href='?src=\ref[src];create_turf=1'>Create Turf</A><br>
|
||||
<A href='?src=\ref[src];create_mob=1'>Create Mob</A><br>
|
||||
<br><A href='?src=\ref[src];vsc=airflow'>Edit Airflow Settings</A><br>
|
||||
<A href='?src=\ref[src];vsc=plasma'>Edit Plasma Settings</A><br>
|
||||
<A href='?src=\ref[src];vsc=default'>Choose a default ZAS setting</A><br>
|
||||
"}
|
||||
|
||||
usr << browse(dat, "window=admin2;size=210x180")
|
||||
usr << browse(dat, "window=admin2;size=210x280")
|
||||
return
|
||||
|
||||
/datum/admins/proc/Secrets()
|
||||
|
||||
@@ -2422,6 +2422,15 @@
|
||||
if(check_rights(R_ADMIN|R_SERVER))
|
||||
populate_inactive_customitems_list(src.owner)
|
||||
|
||||
else if(href_list["vsc"])
|
||||
if(check_rights(R_ADMIN|R_SERVER))
|
||||
if(href_list["vsc"] == "airflow")
|
||||
vsc.ChangeSettingsDialog(usr,vsc.settings)
|
||||
if(href_list["vsc"] == "plasma")
|
||||
vsc.ChangeSettingsDialog(usr,vsc.plc.settings)
|
||||
if(href_list["vsc"] == "default")
|
||||
vsc.SetDefault(usr)
|
||||
|
||||
// player info stuff
|
||||
|
||||
if(href_list["add_player_info"])
|
||||
|
||||
Reference in New Issue
Block a user