extreme optimization project to maybe fix game
This commit is contained in:
@@ -196,9 +196,8 @@
|
||||
ground_zero.air_update_turf()
|
||||
|
||||
/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
|
||||
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return
|
||||
T.assume_air(removed)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
|
||||
@@ -46,12 +46,45 @@
|
||||
/////////////////GAS MIXTURE PROCS///////////////////
|
||||
|
||||
/turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air
|
||||
return assume_air_ratio(giver, 1)
|
||||
|
||||
/turf/open/assume_air_moles(datum/gas_mixture/giver, moles)
|
||||
if(!giver)
|
||||
return FALSE
|
||||
if(SSair.thread_running())
|
||||
SSair.deferred_airs += list(list(src, giver))
|
||||
SSair.deferred_airs += list(list(giver, air, moles / giver.total_moles()))
|
||||
else
|
||||
air.merge(giver)
|
||||
giver.transfer_to(air, moles)
|
||||
update_visuals()
|
||||
return TRUE
|
||||
|
||||
/turf/open/assume_air_ratio(datum/gas_mixture/giver, ratio)
|
||||
if(!giver)
|
||||
return FALSE
|
||||
if(SSair.thread_running())
|
||||
SSair.deferred_airs += list(list(giver, air, ratio))
|
||||
else
|
||||
giver.transfer_ratio_to(air, ratio)
|
||||
update_visuals()
|
||||
return TRUE
|
||||
|
||||
/turf/open/transfer_air(datum/gas_mixture/taker, moles)
|
||||
if(!taker || !return_air()) // shouldn't transfer from space
|
||||
return FALSE
|
||||
if(SSair.thread_running())
|
||||
SSair.deferred_airs += list(list(air, taker, moles / air.total_moles()))
|
||||
else
|
||||
air.transfer_to(taker, moles)
|
||||
update_visuals()
|
||||
return TRUE
|
||||
|
||||
/turf/open/transfer_air_ratio(datum/gas_mixture/taker, ratio)
|
||||
if(!taker || !return_air())
|
||||
return FALSE
|
||||
if(SSair.thread_running())
|
||||
SSair.deferred_airs += list(list(air, taker, ratio))
|
||||
else
|
||||
air.transfer_ratio_to(taker, ratio)
|
||||
update_visuals()
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ GLOBAL_LIST_INIT(auxtools_atmos_initialized,FALSE)
|
||||
/datum/gas_mixture/proc/vv_react(datum/holder)
|
||||
return react(holder)
|
||||
|
||||
/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, list/gases)
|
||||
/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
|
||||
/datum/gas_mixture/proc/mark_immutable()
|
||||
/datum/gas_mixture/proc/get_gases()
|
||||
/datum/gas_mixture/proc/multiply(factor)
|
||||
@@ -183,7 +183,9 @@ GLOBAL_LIST_INIT(auxtools_atmos_initialized,FALSE)
|
||||
|
||||
/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/target, amount)
|
||||
//Transfers amount of gas to target. Equivalent to target.merge(remove(amount)) but faster.
|
||||
//Removes amount of gas from the gas_mixture
|
||||
|
||||
/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/target, ratio)
|
||||
//Transfers ratio of gas to target. Equivalent to target.merge(remove_ratio(amount)) but faster.
|
||||
|
||||
/datum/gas_mixture/proc/remove_ratio(ratio)
|
||||
//Proportionally removes amount of gas from the gas_mixture
|
||||
@@ -402,8 +404,7 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles()
|
||||
var/transfer_moles = pressure_delta*output_air.return_volume()/(input_air.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = input_air.remove(transfer_moles)
|
||||
output_air.merge(removed)
|
||||
input_air.transfer_to(output_air, transfer_moles)
|
||||
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -56,20 +56,20 @@
|
||||
return gases[gas_type]
|
||||
/datum/gas_mixture/set_moles(gas_type, moles)
|
||||
gases[gas_type] = moles
|
||||
/datum/gas_mixture/scrub_into(datum/gas_mixture/target, list/gases)
|
||||
/datum/gas_mixture/scrub_into(datum/gas_mixture/target, ratio, list/gases)
|
||||
if(isnull(target))
|
||||
return FALSE
|
||||
|
||||
var/list/removed_gases = target.gases
|
||||
var/list/removed_gases = gases
|
||||
|
||||
//Filter it
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
var/list/filtered_gases = filtered_out.gases
|
||||
filtered_out.temperature = removed.temperature
|
||||
for(var/gas in filter_types & removed_gases)
|
||||
filtered_gases[gas] = removed_gases[gas]
|
||||
removed_gases[gas] = 0
|
||||
merge(filtered_out)
|
||||
filtered_gases[gas] = removed_gases[gas] * ratio
|
||||
removed_gases[gas] = removed_gases[gas] * (1 - ratio)
|
||||
target.merge(filtered_out)
|
||||
/datum/gas_mixture/mark_immutable()
|
||||
return
|
||||
/datum/gas_mixture/get_gases()
|
||||
|
||||
@@ -72,12 +72,7 @@
|
||||
if(air1.return_temperature() > 0)
|
||||
var/transfer_moles = pressure_delta*environment.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
//Removed can be null if there is no atmosphere in air1
|
||||
if(!removed)
|
||||
return
|
||||
|
||||
loc.assume_air(removed)
|
||||
loc.assume_air_moles(air1, transfer_moles)
|
||||
air_update_turf()
|
||||
|
||||
var/datum/pipeline/parent1 = parents[1]
|
||||
@@ -93,11 +88,7 @@
|
||||
moles_delta = min(moles_delta, (input_pressure_min - air2.return_pressure()) * our_multiplier)
|
||||
|
||||
if(moles_delta > 0)
|
||||
var/datum/gas_mixture/removed = loc.remove_air(moles_delta)
|
||||
if (isnull(removed)) // in space
|
||||
return
|
||||
|
||||
air2.merge(removed)
|
||||
loc.transfer_air(air2, moles_delta)
|
||||
air_update_turf()
|
||||
|
||||
var/datum/pipeline/parent2 = parents[2]
|
||||
|
||||
@@ -81,9 +81,7 @@
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles = pressure_delta*air2.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
air1.transfer_to(air2,transfer_moles)
|
||||
|
||||
update_parents()
|
||||
|
||||
|
||||
@@ -67,9 +67,7 @@
|
||||
|
||||
var/transfer_ratio = transfer_rate/air1.return_volume()
|
||||
|
||||
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
|
||||
|
||||
air2.merge(removed)
|
||||
air1.transfer_ratio_to(air2,transfer_ratio)
|
||||
|
||||
update_parents()
|
||||
|
||||
|
||||
@@ -120,14 +120,9 @@
|
||||
times_lost++
|
||||
var/shared_loss = lost/times_lost
|
||||
|
||||
var/datum/gas_mixture/to_release
|
||||
for(var/i in 1 to device_type)
|
||||
var/datum/gas_mixture/air = airs[i]
|
||||
if(!to_release)
|
||||
to_release = air.remove(shared_loss)
|
||||
continue
|
||||
to_release.merge(air.remove(shared_loss))
|
||||
T.assume_air(to_release)
|
||||
T.assume_air_moles(air, shared_loss)
|
||||
air_update_turf(1)
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/safe_input(var/title, var/text, var/default_set)
|
||||
|
||||
@@ -98,11 +98,6 @@
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_ratio > 0)
|
||||
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
|
||||
|
||||
if(!removed)
|
||||
return
|
||||
|
||||
var/filtering = TRUE
|
||||
if(!ispath(filter_type))
|
||||
if(filter_type)
|
||||
@@ -110,21 +105,10 @@
|
||||
else
|
||||
filtering = FALSE
|
||||
|
||||
if(filtering && removed.get_moles(filter_type))
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
|
||||
filtered_out.set_temperature(removed.return_temperature())
|
||||
filtered_out.set_moles(filter_type, removed.get_moles(filter_type))
|
||||
|
||||
removed.set_moles(filter_type, 0)
|
||||
|
||||
var/datum/gas_mixture/target = (air2.return_pressure() < 9000 ? air2 : air1)
|
||||
target.merge(filtered_out)
|
||||
|
||||
if(air3.return_pressure() <= 9000)
|
||||
air3.merge(removed)
|
||||
else
|
||||
air1.merge(removed) // essentially just leaving it in
|
||||
if(filtering && air3.return_pressure() <= 9000)
|
||||
air1.scrub_into(air3, transfer_ratio, list(filter_type))
|
||||
if(air2.return_pressure() <= 9000)
|
||||
air1.transfer_ratio_to(air2, transfer_ratio)
|
||||
|
||||
update_parents()
|
||||
|
||||
|
||||
@@ -110,14 +110,12 @@
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_moles1)
|
||||
var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
|
||||
air3.merge(removed1)
|
||||
air1.transfer_to(air3, transfer_moles1)
|
||||
var/datum/pipeline/parent1 = parents[1]
|
||||
parent1.update = TRUE
|
||||
|
||||
if(transfer_moles2)
|
||||
var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
|
||||
air3.merge(removed2)
|
||||
air2.transfer_to(air3, transfer_moles2)
|
||||
var/datum/pipeline/parent2 = parents[2]
|
||||
parent2.update = TRUE
|
||||
|
||||
|
||||
@@ -66,11 +66,7 @@
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents.return_temperature() > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume())
|
||||
air_update_turf()
|
||||
|
||||
update_parents()
|
||||
@@ -85,9 +81,7 @@
|
||||
injecting = 1
|
||||
|
||||
if(air_contents.return_temperature() > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
loc.assume_air(removed)
|
||||
loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume())
|
||||
update_parents()
|
||||
|
||||
flick("inje_inject", src)
|
||||
|
||||
@@ -50,14 +50,11 @@
|
||||
else if(!opened && our_pressure >= open_pressure)
|
||||
opened = TRUE
|
||||
update_icon_nopipes()
|
||||
if(opened && air_contents.return_temperature() > 0)
|
||||
if(opened)
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/pressure_delta = our_pressure - environment.return_pressure()
|
||||
var/transfer_moles = pressure_delta*200/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
if(transfer_moles > 0)
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
var/pressure_delta = abs(our_pressure - environment.return_pressure())
|
||||
if(pressure_delta > 0.1)
|
||||
equalize_all_gases_in_list(list(air_contents,environment))
|
||||
air_update_turf()
|
||||
|
||||
update_parents()
|
||||
|
||||
@@ -109,9 +109,7 @@
|
||||
if(air_contents.return_temperature() > 0)
|
||||
var/transfer_moles = pressure_delta*environment.return_volume()/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
loc.assume_air_moles(air_contents, transfer_moles)
|
||||
air_update_turf()
|
||||
|
||||
else // external -> internal
|
||||
@@ -124,11 +122,7 @@
|
||||
moles_delta = min(moles_delta, (internal_pressure_bound - air_contents.return_pressure()) * our_multiplier)
|
||||
|
||||
if(moles_delta > 0)
|
||||
var/datum/gas_mixture/removed = loc.remove_air(moles_delta)
|
||||
if (isnull(removed)) // in space
|
||||
return
|
||||
|
||||
air_contents.merge(removed)
|
||||
loc.transfer_air(air_contents, moles_delta)
|
||||
air_update_turf()
|
||||
update_parents()
|
||||
|
||||
|
||||
@@ -152,28 +152,17 @@
|
||||
var/datum/gas_mixture/environment = tile.return_air()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents.return_pressure() >= 50*ONE_ATMOSPHERE)
|
||||
if(air_contents.return_pressure() >= 50*ONE_ATMOSPHERE || !islist(filter_types))
|
||||
return FALSE
|
||||
|
||||
if(scrubbing & SCRUBBING)
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed = tile.remove_air_ratio(volume_rate/environment.return_volume())
|
||||
environment.scrub_into(air_contents, volume_rate/environment.return_volume(), filter_types)
|
||||
|
||||
//Nothing left to remove from the tile
|
||||
if(isnull(removed))
|
||||
return FALSE
|
||||
|
||||
removed.scrub_into(air_contents, filter_types)
|
||||
|
||||
//Remix the resulting gases
|
||||
tile.assume_air(removed)
|
||||
tile.air_update_turf()
|
||||
|
||||
else //Just siphoning all air
|
||||
|
||||
var/datum/gas_mixture/removed = tile.remove_air_ratio((volume_rate/environment.return_volume()))
|
||||
|
||||
air_contents.merge(removed)
|
||||
environment.transfer_ratio_to(air_contents, volume_rate/environment.return_volume())
|
||||
tile.air_update_turf()
|
||||
|
||||
update_parents()
|
||||
|
||||
@@ -287,9 +287,8 @@
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/proc/canister_break()
|
||||
disconnect()
|
||||
var/datum/gas_mixture/expelled_gas = air_contents.remove(air_contents.total_moles())
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(expelled_gas)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
|
||||
obj_break()
|
||||
|
||||
@@ -42,12 +42,7 @@
|
||||
scrub(T.return_air())
|
||||
|
||||
/obj/machinery/portable_atmospherics/scrubber/proc/scrub(var/datum/gas_mixture/mixture)
|
||||
var/datum/gas_mixture/filtering = mixture.remove_ratio(volume_rate / mixture.return_volume()) // Remove part of the mixture to filter.
|
||||
if(!filtering)
|
||||
return
|
||||
|
||||
filtering.scrub_into(air_contents,scrubbing)
|
||||
mixture.merge(filtering) // Returned the cleaned gas.
|
||||
mixture.scrub_into(air_contents, volume_rate / mixture.return_volume(), scrubbing)
|
||||
if(!holding)
|
||||
air_update_turf()
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/stank = new
|
||||
stank.adjust_moles(/datum/gas/miasma,(yield + 6)*7*0.02) // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses
|
||||
stank.adjust_moles(/datum/gas/miasma,(yield + 6)*0.14) // 0.14 = 7*0.02, this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses
|
||||
stank.set_temperature(T20C) // without this the room would eventually freeze and miasma mining would be easier
|
||||
T.assume_air(stank)
|
||||
T.air_update_turf()
|
||||
|
||||
@@ -131,11 +131,10 @@
|
||||
var/pressure_delta = target_pressure - target_air.return_pressure()
|
||||
if(pressure_delta > 0.1)
|
||||
var/transfer_moles = (pressure_delta*target_air.return_volume()/(source_air.return_temperature() * R_IDEAL_GAS_EQUATION))*PUMP_EFFICIENCY
|
||||
var/datum/gas_mixture/removed = source_air.remove(transfer_moles)
|
||||
if(istype(snowflake)) //Snowflake check for tanks specifically, because tank ruptures are handled in a very snowflakey way that expects all tank interactions to be handled via the tank's procs
|
||||
snowflake.assume_air(removed)
|
||||
snowflake.assume_air_moles(source_air, transfer_moles)
|
||||
else
|
||||
target_air.merge(removed)
|
||||
source_air.transfer_to(target_air, transfer_moles)
|
||||
|
||||
|
||||
// - volume pump - // **Works**
|
||||
@@ -183,12 +182,10 @@
|
||||
//The second part of the min caps the pressure built by the volume pumps to the max pump pressure
|
||||
var/transfer_ratio = min(transfer_rate,target_air.return_volume()*PUMP_MAX_PRESSURE/source_air.return_pressure())/source_air.return_volume()
|
||||
|
||||
var/datum/gas_mixture/removed = source_air.remove_ratio(transfer_ratio * PUMP_EFFICIENCY)
|
||||
|
||||
if(istype(snowflake))
|
||||
snowflake.assume_air(removed)
|
||||
snowflake.assume_air_ratio(source_air, transfer_ratio * PUMP_EFFICIENCY)
|
||||
else
|
||||
target_air.merge(removed)
|
||||
source_air.transfer_ratio_to(target_air, transfer_ratio * PUMP_EFFICIENCY)
|
||||
|
||||
|
||||
// - gas vent - // **works**
|
||||
@@ -468,16 +465,12 @@
|
||||
|
||||
var/snowflakecheck = istype(gas_output, /obj/item/tank)
|
||||
|
||||
var/datum/gas_mixture/mix = source_1_gases.remove(transfer_moles * gas_percentage)
|
||||
if(snowflakecheck)
|
||||
gas_output.assume_air(mix)
|
||||
gas_output.assume_air_moles(source_1_gases, transfer_moles * gas_percentage)
|
||||
gas_output.assume_air_moles(source_2_gases, transfer_moles * (1-gas_percentage))
|
||||
else
|
||||
output_gases.merge(mix)
|
||||
mix = source_2_gases.remove(transfer_moles * (1-gas_percentage))
|
||||
if(snowflakecheck)
|
||||
gas_output.assume_air(mix)
|
||||
else
|
||||
output_gases.merge(mix)
|
||||
source_1_gases.transfer_to(output_gases, transfer_moles * gas_percentage)
|
||||
source_2_gases.transfer_to(output_gases, transfer_moles * (1-gas_percentage))
|
||||
|
||||
|
||||
// - integrated tank - // **works**
|
||||
|
||||
@@ -292,10 +292,7 @@
|
||||
if(!source_air || !target_air)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/removed = source_air.remove(gas_per_throw)
|
||||
if(!removed)
|
||||
return
|
||||
target_air.merge(removed)
|
||||
source_air.transfer_to(target_air, gas_per_throw)
|
||||
|
||||
// If the item is in a grabber circuit we'll update the grabber's outputs after we've thrown it.
|
||||
var/obj/item/integrated_circuit/manipulation/grabber/G = A.loc
|
||||
|
||||
@@ -131,8 +131,7 @@
|
||||
// It's a simplified version taking only 1/10 of the moles from the turf nearby. It should be later changed into a better version
|
||||
// above todo 7 years and counting
|
||||
|
||||
var/datum/gas_mixture/removed = inturf.remove_air_ratio(0.1)
|
||||
gas_contained.merge(removed)
|
||||
inturf.transfer_air_ratio(gas_contained, 0.1)
|
||||
|
||||
// RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy
|
||||
|
||||
@@ -219,8 +218,7 @@
|
||||
|
||||
if(compressor.gas_contained.total_moles()>0)
|
||||
var/oamount = min(compressor.gas_contained.total_moles(), (compressor.rpm+100)/35000*compressor.capacity)
|
||||
var/datum/gas_mixture/removed = compressor.gas_contained.remove(oamount)
|
||||
outturf.assume_air(removed)
|
||||
outturf.assume_air_moles(compressor.gas_contained, oamount)
|
||||
|
||||
// If it works, put an overlay that it works!
|
||||
|
||||
|
||||
@@ -524,10 +524,9 @@
|
||||
T.MakeSlippery(TURF_WET_LUBE, min_wet_time = 10 SECONDS, wet_time_to_add = reac_volume*2 SECONDS)
|
||||
var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T)
|
||||
if(hotspot)
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air(T.air.total_moles())
|
||||
lowertemp.set_temperature(max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,0))
|
||||
var/datum/gas_mixture/lowertemp = T.return_air()
|
||||
lowertemp.set_temperature(max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,TCMB))
|
||||
lowertemp.react(src)
|
||||
T.assume_air(lowertemp)
|
||||
qdel(hotspot)
|
||||
|
||||
/datum/reagent/consumable/enzyme
|
||||
|
||||
@@ -362,14 +362,7 @@
|
||||
else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff))
|
||||
visible_message("<span class='warning'>[src] malfunctions, melting [exp_on] and leaking hot air!</span>")
|
||||
var/datum/gas_mixture/env = loc.return_air()
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
if(removed)
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
if(heat_capacity == 0 || heat_capacity == null)
|
||||
heat_capacity = 1
|
||||
removed.set_temperature(min((removed.return_temperature()*heat_capacity + 100000)/heat_capacity, 1000))
|
||||
env.merge(removed)
|
||||
env.adjust_heat(100000)
|
||||
air_update_turf()
|
||||
investigate_log("Experimentor has released hot air.", INVESTIGATE_EXPERIMENTOR)
|
||||
ejectItem(TRUE)
|
||||
@@ -408,14 +401,7 @@
|
||||
else if(prob(EFFECT_PROB_LOW-badThingCoeff))
|
||||
visible_message("<span class='warning'>[src] malfunctions, shattering [exp_on] and leaking cold air!</span>")
|
||||
var/datum/gas_mixture/env = loc.return_air()
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
if(removed)
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
if(heat_capacity == 0 || heat_capacity == null)
|
||||
heat_capacity = 1
|
||||
removed.set_temperature((removed.return_temperature()*heat_capacity - 75000)/heat_capacity)
|
||||
env.merge(removed)
|
||||
env.adjust_heat(-75000)
|
||||
air_update_turf()
|
||||
investigate_log("Experimentor has released cold air.", INVESTIGATE_EXPERIMENTOR)
|
||||
ejectItem(TRUE)
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
circuit = /obj/item/circuitboard/machine/rdserver
|
||||
|
||||
var/datum/techweb/stored_research
|
||||
var/heat_health = 100
|
||||
//Code for point mining here.
|
||||
var/working = TRUE //temperature should break it.
|
||||
var/server_id = 0
|
||||
var/base_mining_income = 2
|
||||
var/heat_gen = 100
|
||||
var/heat_gen = 1
|
||||
var/heating_power = 40000
|
||||
var/delay = 5
|
||||
var/temp_tolerance_low = 0
|
||||
@@ -32,7 +31,7 @@
|
||||
var/tot_rating = 0
|
||||
for(var/obj/item/stock_parts/SP in src)
|
||||
tot_rating += SP.rating
|
||||
heat_gen /= max(1, tot_rating)
|
||||
heat_gen = initial(src.heat_gen) / max(1, tot_rating)
|
||||
|
||||
/obj/machinery/rnd/server/proc/refresh_working()
|
||||
if(stat & EMPED)
|
||||
@@ -56,31 +55,19 @@
|
||||
. = base_mining_income
|
||||
var/penalty = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient
|
||||
. = max(. - penalty, 0)
|
||||
produce_heat(. / base_mining_income)
|
||||
|
||||
/obj/machinery/rnd/server/proc/get_env_temp()
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
return environment.return_temperature()
|
||||
|
||||
/obj/machinery/rnd/server/proc/produce_heat(heat_amt)
|
||||
/obj/machinery/rnd/server/proc/produce_heat(perc)
|
||||
if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater.
|
||||
var/turf/L = loc
|
||||
if(istype(L))
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.return_temperature() < (heat_amt+T0C))
|
||||
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
if(removed)
|
||||
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
if(heat_capacity == 0 || heat_capacity == null)
|
||||
heat_capacity = 1
|
||||
removed.set_temperature(min((removed.return_temperature()*heat_capacity + heating_power)/heat_capacity, 1000))
|
||||
|
||||
env.merge(removed)
|
||||
air_update_turf()
|
||||
env.adjust_heat(heating_power * perc * heat_gen)
|
||||
air_update_turf()
|
||||
|
||||
/proc/fix_noid_research_servers()
|
||||
var/list/no_id_servers = list()
|
||||
|
||||
@@ -210,13 +210,9 @@
|
||||
|
||||
// Priority 3: use internals tank.
|
||||
var/obj/item/tank/I = owner.internal
|
||||
if(I && I.air_contents && I.air_contents.total_moles() > num)
|
||||
var/datum/gas_mixture/removed = I.air_contents.remove(num)
|
||||
if(removed.total_moles() > 0.005)
|
||||
T.assume_air(removed)
|
||||
return 1
|
||||
else
|
||||
T.assume_air(removed)
|
||||
if(I && I.air_contents && I.air_contents.total_moles() >= num)
|
||||
T.assume_air_moles(I.air_contents, num)
|
||||
return 1
|
||||
|
||||
toggle(silent = TRUE)
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user