mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 06:57:42 +01:00
LINDA -> MILLA (#25328)
* LINDA -> MILLA * Tiles now change their atmos mode properly. * Fixed a bug that made walls generate supercold air when deconstructed/destroyed. * Apply suggestions from code review Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Begone, var! * MILLA -> milla * Lint. * More lint. * Prevent negative/NaN atmos from spreading. * Made fires start more reliably. * Undef what the rest should not see. * Enums are nice. * Match LINDA better. * Debugging verbs. * Debug verb fixes. * Labelled more lavaland stuff with ATMOS_MODE_LAVALAND * Block superconductivity on a couple more things for Lavaland. * Updated milla.dll * Lavaland map fixes. * Missed a spot. * Begone, var! (again) * Add libmilla_ci.so for continuous integration tests. * Install/contributing instructions for MILLA. * Directional plasmaglass windows on shuttles shouldn't stop protecting from heat after moving. * Banish bad naming. * Better naming and debug stats for SSair. * Apply suggestions from code review Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Magic numbers and formatting. * Don't screw up the temperature during reactions. * Efficiency and readability. * Fix hotspots. * Removed redundant safety (MILLA will already output an error) * Optimizations. * oops * TGS build script update. * Change API of gas_mixture and how you get one from a turf. * Get in there. * so many vars * MILLA binary updates. * Lint * Made MT cost more honest. * Gave MILLA a read-only mode. * More read-only vs synchronized mode work. * Even more. * Synchronize disposals. * Updated a bunch of stuff to use SSair.synchronize or GM.synchronize. * MILLA <3 Tracy * lint * cargo fmt * more lint * Test needed MILLA sync. * Silence atmos machinery that's behaving as intended, but continue objecting to other potential failures to synchronize. * Push new MILLA DLL * Build MILLA * Update PR instructions for MILLA. * Add some fancy plasmaglass windows to the Lifebringers' ship. * The golems remembered that they should insulate *all* their engines. * First round of TM bugfixes. * Build MILLA * fix two lavaland ruin turf types * bunch more maps * fixes milla ci and makes the interesting turf verb better * Solid turfs can no longer conduct heat (for now...) * Made indoor tiles in beach and winter biodomes not lavaland air. * Re-added random IT teleport, adjusted warning message * Fixed a tinted window on Lavaland to be a plasglass window instead. * Made firelocks and holofans heatproof * Made RPD auto-wrench pipes if you have a wrench in your offhand. * Runtime fixes. * Made visuals update more reliably. * Lint * Update .github/CONTRIBUTING.md Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Build MILLA * The Syndicate have installed tiny fans on their research base. * The syndicate have figured out how to make plastitanium windows heatproof. * This is getting out of hand. Now there are two of them. * Un-break the auto-wrenching that I broke before committing. * Build MILLA * Build MILLA * Massive MILLA refactor, assorted bugfixes. * Build MILLA * Explicit typing. * Less sleeping/blocking. * Build MILLA * Yes, yes, this part can sleep. * Build MILLA * SSair reporting improvements. * Build MILLA * Please do not dock twice and splat yourself. * Build MILLA * Pls to not make SM go nuts. * Build MILLA * Build MILLA * Added stricter lower bounds on plasmafire, fixing perpetually-burning SM. * Build MILLA * Lint * Temporary logging, begone. * Build MILLA * Prevent hotspot strobing. * Add in radiate_to_spess behavior. * Build MILLA * progress * Compiling is good. * bugfixes * Progress. * Ruins update. * This one exists. * Fixup temporary hotspots to last longer than one tick. * Add/fix comments. * Cut the slash. * Fix test. * No sleep for you. * Build MILLA * Prevent nested MILLA safety from runtiming. * Build MILLA * Runtime fix. * Build MILLA * Fix canisters not updating icon when gas contents change. * Build MILLA * Build MILLA * Fixed an issue that made mechs very cold on environment air. * Build MILLA * oops * Build MILLA * Walls can make loud noises again. * Build MILLA * Fixes a rare runtime. * Build MILLA * Update .github/DOWNLOADING.md Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Review suggestions * Lint * Build MILLA * bound_mixtures now only contains mixtures that can be written * Build MILLA * Apply suggestions from code review Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Build MILLA * Restore the original async behavior of pyro anomalies. * Build MILLA * Build MILLA * Make the safety assertion in /datum/milla_safe safer. * Build MILLA --------- Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com> Co-authored-by: warriorstar-orion <orion@snowfrost.garden> Co-authored-by: GDN <Roanrichards1@Gmail.com>
This commit is contained in:
co-authored by
Burzah
GDN
AffectedArc07
FunnyMan3595
paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
warriorstar-orion
GDN
parent
56b4da8ffc
commit
d3584b1d1c
@@ -25,13 +25,13 @@
|
||||
/obj/machinery/power/rad_collector/process()
|
||||
if(!loaded_tank)
|
||||
return
|
||||
if(!loaded_tank.air_contents.toxins)
|
||||
if(!loaded_tank.air_contents.toxins())
|
||||
investigate_log("<font color='red'>out of fuel</font>.", "singulo")
|
||||
playsound(src, 'sound/machines/ding.ogg', 50, TRUE)
|
||||
eject()
|
||||
else
|
||||
var/gasdrained = min(powerproduction_drain * drainratio, loaded_tank.air_contents.toxins)
|
||||
loaded_tank.air_contents.toxins -= gasdrained
|
||||
var/gasdrained = min(powerproduction_drain * drainratio, loaded_tank.air_contents.toxins())
|
||||
loaded_tank.air_contents.set_toxins(loaded_tank.air_contents.toxins() - gasdrained)
|
||||
|
||||
var/power_produced = RAD_COLLECTOR_OUTPUT
|
||||
produce_direct_power(power_produced)
|
||||
@@ -43,7 +43,7 @@
|
||||
if(!locked)
|
||||
toggle_power()
|
||||
user.visible_message("[user.name] turns the [name] [active ? "on" : "off"].", "You turn the [name] [active ? "on" : "off"].")
|
||||
investigate_log("turned [active ? "<font color='green'>on</font>" : "<font color='red'>off</font>"] by [user.key]. [loaded_tank ? "Fuel: [round(loaded_tank.air_contents.toxins / 0.29)]%" : "<font color='red'>It is empty</font>"].", "singulo")
|
||||
investigate_log("turned [active ? "<font color='green'>on</font>" : "<font color='red'>off</font>"] by [user.key]. [loaded_tank ? "Fuel: [round(loaded_tank.air_contents.toxins() / 0.29)]%" : "<font color='red'>It is empty</font>"].", "singulo")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return SUPERMATTER_ERROR
|
||||
var/datum/gas_mixture/air = T.return_air()
|
||||
var/datum/gas_mixture/air = T.get_readonly_air()
|
||||
if(!air)
|
||||
return SUPERMATTER_ERROR
|
||||
|
||||
@@ -286,10 +286,10 @@
|
||||
if(integrity < SUPERMATTER_DANGER_PERCENT)
|
||||
return SUPERMATTER_DANGER
|
||||
|
||||
if((integrity < SUPERMATTER_WARNING_PERCENT) || (air.temperature > CRITICAL_TEMPERATURE))
|
||||
if((integrity < SUPERMATTER_WARNING_PERCENT) || (air.temperature() > CRITICAL_TEMPERATURE))
|
||||
return SUPERMATTER_WARNING
|
||||
|
||||
if(air.temperature > (CRITICAL_TEMPERATURE * 0.8))
|
||||
if(air.temperature() > (CRITICAL_TEMPERATURE * 0.8))
|
||||
return SUPERMATTER_NOTIFY
|
||||
|
||||
if(power > 5)
|
||||
@@ -402,9 +402,19 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/atmospherics/supermatter_crystal/process_atmos()
|
||||
var/datum/milla_safe/supermatter_process/milla = new()
|
||||
milla.invoke_async(src)
|
||||
|
||||
/datum/milla_safe/supermatter_process
|
||||
|
||||
/datum/milla_safe/supermatter_process/on_run(obj/machinery/atmospherics/supermatter_crystal/supermatter)
|
||||
var/turf/T = get_turf(supermatter)
|
||||
var/datum/gas_mixture/env = get_turf_air(T)
|
||||
supermatter.process_atmos_safely(T, env)
|
||||
|
||||
/obj/machinery/atmospherics/supermatter_crystal/proc/process_atmos_safely(turf/T, datum/gas_mixture/env)
|
||||
if(!processes) //Just fuck me up bro
|
||||
return
|
||||
var/turf/T = loc
|
||||
|
||||
if(isnull(T)) // We have a null turf...something is wrong, stop processing this entity.
|
||||
return PROCESS_KILL
|
||||
@@ -440,9 +450,6 @@
|
||||
var/next_sound = round((100 - aggression) * 5)
|
||||
last_accent_sound = world.time + max(SUPERMATTER_ACCENT_SOUND_MIN_COOLDOWN, next_sound)
|
||||
|
||||
//Ok, get the air from the turf
|
||||
var/datum/gas_mixture/env = T.return_air()
|
||||
|
||||
var/datum/gas_mixture/removed
|
||||
if(produces_gas)
|
||||
//Remove gas from surrounding area
|
||||
@@ -462,7 +469,7 @@
|
||||
//((((some value between 0.5 and 1 * temp - ((273.15 + 40) * some values between 1 and 10)) * some number between 0.25 and knock your socks off / 150) * 0.25
|
||||
//Heat and mols account for each other, a lot of hot mols are more damaging then a few
|
||||
//Mols start to have a positive effect on damage after 350
|
||||
damage = max(damage + (max(clamp(removed.total_moles() / 200, 0.5, 1) * removed.temperature - ((T0C + heat_penalty_threshold)*dynamic_heat_resistance), 0) * mole_heat_penalty / 150 ) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
damage = max(damage + (max(clamp(removed.total_moles() / 200, 0.5, 1) * removed.temperature() - ((T0C + heat_penalty_threshold)*dynamic_heat_resistance), 0) * mole_heat_penalty / 150 ) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
//Power only starts affecting damage when it is above 5000
|
||||
damage = max(damage + (max(power - POWER_PENALTY_THRESHOLD, 0)/500) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
//Molar count only starts affecting damage when it is above 1800
|
||||
@@ -472,24 +479,23 @@
|
||||
//healing damage
|
||||
if(combined_gas < MOLE_PENALTY_THRESHOLD)
|
||||
//Only has a net positive effect when the temp is below 313.15, heals up to 2 damage. Psycologists increase this temp min by up to 45
|
||||
damage = max(damage + (min(removed.temperature - (T0C + heat_penalty_threshold), 0) / 150 ), 0)
|
||||
damage = max(damage + (min(removed.temperature() - (T0C + heat_penalty_threshold), 0) / 150 ), 0)
|
||||
|
||||
//Check for holes in the SM inner chamber
|
||||
for(var/t in RANGE_TURFS(1, loc))
|
||||
if(!isspaceturf(t))
|
||||
var/turf/here = get_turf(src)
|
||||
for(var/turf/neighbor in here.GetAtmosAdjacentTurfs(alldir = TRUE))
|
||||
if(!isspaceturf(neighbor))
|
||||
continue
|
||||
var/turf/turf_to_check = t
|
||||
if(length(turf_to_check.atmos_adjacent_turfs))
|
||||
var/integrity = get_integrity()
|
||||
if(integrity < 10)
|
||||
damage += clamp((power * 0.0005) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 25)
|
||||
damage += clamp((power * 0.0009) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 45)
|
||||
damage += clamp((power * 0.005) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 75)
|
||||
damage += clamp((power * 0.002) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
break
|
||||
var/integrity = get_integrity()
|
||||
if(integrity < 10)
|
||||
damage += clamp((power * 0.0005) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 25)
|
||||
damage += clamp((power * 0.0009) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 45)
|
||||
damage += clamp((power * 0.005) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
else if(integrity < 75)
|
||||
damage += clamp((power * 0.002) * DAMAGE_INCREASE_MULTIPLIER, 0, MAX_SPACE_EXPOSURE_DAMAGE)
|
||||
break
|
||||
//caps damage rate
|
||||
|
||||
//Takes the lower number between archived damage + (1.8) and damage
|
||||
@@ -499,11 +505,11 @@
|
||||
//calculating gas related values
|
||||
combined_gas = max(removed.total_moles(), 0)
|
||||
|
||||
plasmacomp = max(removed.toxins / combined_gas, 0)
|
||||
o2comp = max(removed.oxygen / combined_gas, 0)
|
||||
co2comp = max(removed.carbon_dioxide / combined_gas, 0)
|
||||
n2ocomp = max(removed.sleeping_agent / combined_gas, 0)
|
||||
n2comp = max(removed.nitrogen / combined_gas, 0)
|
||||
plasmacomp = max(removed.toxins() / combined_gas, 0)
|
||||
o2comp = max(removed.oxygen() / combined_gas, 0)
|
||||
co2comp = max(removed.carbon_dioxide() / combined_gas, 0)
|
||||
n2ocomp = max(removed.sleeping_agent() / combined_gas, 0)
|
||||
n2comp = max(removed.nitrogen() / combined_gas, 0)
|
||||
|
||||
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp - n2comp, 0), 1)
|
||||
|
||||
@@ -544,7 +550,7 @@
|
||||
|
||||
|
||||
if(power_changes)
|
||||
power = max((removed.temperature * temp_factor / T0C) * gasmix_power_ratio + power, 0)
|
||||
power = max((removed.temperature() * temp_factor / T0C) * gasmix_power_ratio + power, 0)
|
||||
|
||||
if(prob(50))
|
||||
var/mole_crunch_bonus = 0
|
||||
@@ -563,19 +569,18 @@
|
||||
//Also keep in mind we are only adding this temperature to (efficiency)% of the one tile the rock
|
||||
//is on. An increase of 4*C @ 25% efficiency here results in an increase of 1*C / (#tilesincore) overall.
|
||||
//Power * 0.55 * (some value between 1.5 and 23) / 5
|
||||
removed.temperature += (((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_MODIFIER) * heat_multiplier)
|
||||
removed.set_temperature(removed.temperature() + (((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_MODIFIER) * heat_multiplier))
|
||||
//We can only emit so much heat, that being 57500
|
||||
removed.temperature = max(0, min(removed.temperature, 2500 * dynamic_heat_modifier))
|
||||
removed.set_temperature(max(0, min(removed.temperature(), 2500 * dynamic_heat_modifier)))
|
||||
|
||||
//Calculate how much gas to release
|
||||
//Varies based on power and gas content
|
||||
removed.toxins += max(((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER) * gas_multiplier, 0)
|
||||
removed.set_toxins(removed.toxins() + max(((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER) * gas_multiplier, 0))
|
||||
//Varies based on power, gas content, and heat
|
||||
removed.oxygen += max((((device_energy + removed.temperature * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER) * gas_multiplier, 0)
|
||||
removed.set_oxygen(removed.oxygen() + max((((device_energy + removed.temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER) * gas_multiplier, 0))
|
||||
|
||||
if(produces_gas)
|
||||
env.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
//Makes em go mad and accumulate rads.
|
||||
for(var/mob/living/carbon/human/l in view(src, HALLUCINATION_RANGE(power))) // If they can see it without mesons on. Bad on them.
|
||||
@@ -597,9 +602,9 @@
|
||||
if(power > POWER_PENALTY_THRESHOLD || damage > damage_penalty_point) //If the power is above 5000 or if the damage is above 550
|
||||
var/range = 4
|
||||
zap_cutoff = 1500
|
||||
if(removed && removed.return_pressure() > 0 && removed.return_temperature() > 0)
|
||||
if(removed && removed.return_pressure() > 0 && removed.temperature() > 0)
|
||||
//You may be able to freeze the zapstate of the engine with good planning, we'll see
|
||||
zap_cutoff = clamp(3000 - (power * (removed.total_moles()) / 10) / removed.return_temperature(), 350, 3000)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
zap_cutoff = clamp(3000 - (power * (removed.total_moles()) / 10) / removed.temperature(), 350, 3000)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
//We should always be able to zap our way out of the default enclosure
|
||||
//See supermatter_zap() for more details
|
||||
range = clamp(power / removed.return_pressure() * 10, 2, 7)
|
||||
@@ -1182,8 +1187,8 @@
|
||||
//This gotdamn variable is a boomer and keeps giving me problems
|
||||
var/turf/T = get_turf(target)
|
||||
var/pressure = 1
|
||||
if(T?.return_air())
|
||||
var/datum/gas_mixture/G = T.return_air()
|
||||
var/datum/gas_mixture/G = T?.get_readonly_air()
|
||||
if(G)
|
||||
pressure = max(1, G.return_pressure())
|
||||
//We get our range with the strength of the zap and the pressure, the higher the former and the lower the latter the better
|
||||
var/new_range = clamp(zap_str / pressure * 10, 2, 7)
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
/datum/supermatter_event
|
||||
var/name = "Unknown X-K (Report this to coders)"
|
||||
var/obj/machinery/atmospherics/supermatter_crystal/supermatter
|
||||
var/datum/gas_mixture/environment
|
||||
/// Probability of the event not running, higher tiers being rarer
|
||||
var/threat_level
|
||||
var/duration
|
||||
var/turf/supermatter_turf
|
||||
|
||||
/datum/supermatter_event/New(obj/machinery/atmospherics/supermatter_crystal/_supermatter)
|
||||
. = ..()
|
||||
supermatter = _supermatter
|
||||
supermatter_turf = get_turf(supermatter)
|
||||
if(!supermatter)
|
||||
stack_trace("a /datum/supermatter_event was called without an involved supermatter.")
|
||||
return
|
||||
if(!istype(supermatter))
|
||||
stack_trace("a /datum/supermatter_event was called with (name: [supermatter], type: [supermatter.type]) instead of a supermatter!")
|
||||
return
|
||||
var/turf/T = get_turf(supermatter)
|
||||
environment = T.return_air()
|
||||
|
||||
/datum/supermatter_event/proc/start_event()
|
||||
supermatter.event_active = src
|
||||
@@ -66,21 +65,27 @@
|
||||
name = "D-1"
|
||||
|
||||
/datum/supermatter_event/delta_tier/sleeping_gas/on_start()
|
||||
environment.sleeping_agent += 200
|
||||
var/datum/gas_mixture/air = new()
|
||||
air.set_sleeping_agent(200)
|
||||
supermatter_turf.blind_release_air(air)
|
||||
|
||||
// nitrogen
|
||||
/datum/supermatter_event/delta_tier/nitrogen
|
||||
name = "D-2"
|
||||
|
||||
/datum/supermatter_event/delta_tier/nitrogen/on_start()
|
||||
environment.nitrogen += 200
|
||||
var/datum/gas_mixture/air = new()
|
||||
air.set_nitrogen(200)
|
||||
supermatter_turf.blind_release_air(air)
|
||||
|
||||
// carbon dioxide
|
||||
/datum/supermatter_event/delta_tier/carbon_dioxide
|
||||
name = "D-3"
|
||||
|
||||
/datum/supermatter_event/delta_tier/carbon_dioxide/on_start()
|
||||
environment.carbon_dioxide += 250
|
||||
var/datum/gas_mixture/air = new()
|
||||
air.set_carbon_dioxide(250)
|
||||
supermatter_turf.blind_release_air(air)
|
||||
|
||||
|
||||
// C class events
|
||||
@@ -97,14 +102,18 @@
|
||||
name = "C-1"
|
||||
|
||||
/datum/supermatter_event/charlie_tier/oxygen/on_start()
|
||||
environment.oxygen += 250
|
||||
var/datum/gas_mixture/air = new()
|
||||
air.set_oxygen(250)
|
||||
supermatter_turf.blind_release_air(air)
|
||||
|
||||
// plasma
|
||||
/datum/supermatter_event/charlie_tier/plasma
|
||||
name = "C-2"
|
||||
|
||||
/datum/supermatter_event/charlie_tier/plasma/on_start()
|
||||
environment.toxins += 200
|
||||
var/datum/gas_mixture/air = new()
|
||||
air.set_toxins(200)
|
||||
supermatter_turf.blind_release_air(air)
|
||||
|
||||
// lowers the temp required for the SM to take damage.
|
||||
/datum/supermatter_event/charlie_tier/heat_penalty_threshold
|
||||
|
||||
@@ -125,10 +125,11 @@
|
||||
Gives traitors more opportunities to sabotage the generator or allows enterprising engineers to build additional
|
||||
cooling in order to get more power out.
|
||||
*/
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/gas_mixture/environment = T.get_readonly_air()
|
||||
if(environment)
|
||||
var/ratio = min(environment.return_pressure() / ONE_ATMOSPHERE, 1)
|
||||
var/ambient = environment.temperature - T20C
|
||||
var/ambient = environment.temperature() - T20C
|
||||
lower_limit += ambient * ratio
|
||||
upper_limit += ambient * ratio
|
||||
|
||||
@@ -154,10 +155,11 @@
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/handle_inactive()
|
||||
var/cooling_temperature = 20
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/gas_mixture/environment = T.get_readonly_air()
|
||||
if(environment)
|
||||
var/ratio = min(environment.return_pressure()/ONE_ATMOSPHERE, 1)
|
||||
var/ambient = environment.temperature - T20C
|
||||
var/ambient = environment.temperature() - T20C
|
||||
cooling_temperature += ambient*ratio
|
||||
|
||||
if(temperature > cooling_temperature)
|
||||
|
||||
@@ -110,13 +110,13 @@
|
||||
|
||||
if(cold_air && hot_air)
|
||||
|
||||
//log_debug("hot_air = [hot_air] temperature = [hot_air.temperature]; cold_air = [cold_air] temperature = [hot_air.temperature];")
|
||||
//log_debug("hot_air = [hot_air] temperature = [hot_air.temperature()]; cold_air = [cold_air] temperature = [hot_air.temperature()];")
|
||||
|
||||
//log_debug("coldair and hotair pass")
|
||||
var/cold_air_heat_capacity = cold_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()
|
||||
|
||||
//log_debug("delta_temperature = [delta_temperature]; cold_air_heat_capacity = [cold_air_heat_capacity]; hot_air_heat_capacity = [hot_air_heat_capacity]")
|
||||
|
||||
@@ -130,8 +130,8 @@
|
||||
|
||||
//log_debug("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
|
||||
cold_air.temperature = cold_air.temperature + heat / cold_air_heat_capacity
|
||||
hot_air.set_temperature(hot_air.temperature() - energy_transfer / hot_air_heat_capacity)
|
||||
cold_air.set_temperature(cold_air.temperature() + heat / cold_air_heat_capacity)
|
||||
|
||||
//log_debug("POWER: [lastgen] W generated at [efficiency * 100]% efficiency and sinks sizes [cold_air_heat_capacity], [hot_air_heat_capacity]")
|
||||
|
||||
@@ -221,10 +221,10 @@
|
||||
data["hot_dir"] = dir2text(hot_dir)
|
||||
data["output_power"] = round(lastgen)
|
||||
// Temps are K, pressures are kPa, power is W
|
||||
data["cold_inlet_temp"] = round(cold_circ_air2.temperature, 0.1)
|
||||
data["hot_inlet_temp"] = round(hot_circ_air2.temperature, 0.1)
|
||||
data["cold_outlet_temp"] = round(cold_circ_air1.temperature, 0.1)
|
||||
data["hot_outlet_temp"] = round(hot_circ_air1.temperature, 0.1)
|
||||
data["cold_inlet_temp"] = round(cold_circ_air2.temperature(), 0.1)
|
||||
data["hot_inlet_temp"] = round(hot_circ_air2.temperature(), 0.1)
|
||||
data["cold_outlet_temp"] = round(cold_circ_air1.temperature(), 0.1)
|
||||
data["hot_outlet_temp"] = round(hot_circ_air1.temperature(), 0.1)
|
||||
data["cold_delta_temp"] = data["cold_outlet_temp"] - data["cold_inlet_temp"]
|
||||
data["cold_inlet_pressure"] = round(cold_circ_air2.return_pressure(), 0.1)
|
||||
data["hot_inlet_pressure"] = round(hot_circ_air2.return_pressure(), 0.1)
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
M.set_multitool_buffer(user, src)
|
||||
|
||||
|
||||
/obj/machinery/power/compressor/CanAtmosPass(turf/T)
|
||||
/obj/machinery/power/compressor/CanAtmosPass(direction)
|
||||
return !density
|
||||
|
||||
/obj/machinery/power/compressor/proc/trigger_overheat()
|
||||
@@ -181,46 +181,46 @@
|
||||
return max(last_overheat + OVERHEAT_TIME - world.time, 0)
|
||||
|
||||
/obj/machinery/power/compressor/process()
|
||||
if(!turbine)
|
||||
stat = BROKEN
|
||||
if(stat & BROKEN || panel_open)
|
||||
var/datum/milla_safe/compressor_process/milla = new()
|
||||
milla.invoke_async(src)
|
||||
|
||||
/datum/milla_safe/compressor_process
|
||||
|
||||
/datum/milla_safe/compressor_process/on_run(obj/machinery/power/compressor/compressor)
|
||||
if(!compressor.turbine)
|
||||
compressor.stat = BROKEN
|
||||
if(compressor.stat & BROKEN || compressor.panel_open)
|
||||
return
|
||||
if(!starter)
|
||||
if(!compressor.starter)
|
||||
return
|
||||
|
||||
if(rpm_threshold == OVERDRIVE)
|
||||
//UI update here
|
||||
overheat += 2
|
||||
if(overheat >= OVERHEAT_THRESHOLD)
|
||||
trigger_overheat()
|
||||
else if(overheat > 0)
|
||||
overheat -= 2
|
||||
rpm = 0.9* rpm + 0.1 * rpmtarget
|
||||
var/datum/gas_mixture/environment = inturf.return_air()
|
||||
|
||||
// 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
|
||||
//2023 note: It works, im not touc
|
||||
if(compressor.rpm_threshold == OVERDRIVE)
|
||||
compressor.overheat += 2
|
||||
if(compressor.overheat >= OVERHEAT_THRESHOLD)
|
||||
compressor.trigger_overheat()
|
||||
else if(compressor.overheat > 0)
|
||||
compressor.overheat -= 2
|
||||
compressor.rpm = 0.9 * compressor.rpm + 0.1 * compressor.rpmtarget
|
||||
|
||||
var/datum/gas_mixture/environment = get_turf_air(compressor.inturf)
|
||||
var/transfer_moles = environment.total_moles()/10
|
||||
//var/transfer_moles = rpm/10000*capacity
|
||||
var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles)
|
||||
gas_contained.merge(removed)
|
||||
var/datum/gas_mixture/removed = environment.remove(transfer_moles)
|
||||
compressor.gas_contained.merge(removed)
|
||||
|
||||
// RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy
|
||||
|
||||
rpm = max(0, rpm - (rpm*rpm)/(COMPFRICTION*efficiency))
|
||||
compressor.rpm = max(0, compressor.rpm - (compressor.rpm*compressor.rpm)/(COMPFRICTION*compressor.efficiency))
|
||||
|
||||
|
||||
if(starter && !(stat & NOPOWER))
|
||||
use_power(2800)
|
||||
if(rpm<1000)
|
||||
rpmtarget = 1000
|
||||
if(!(compressor.stat & NOPOWER))
|
||||
compressor.use_power(2800)
|
||||
if(compressor.rpm < 1000)
|
||||
compressor.rpmtarget = 1000
|
||||
else
|
||||
if(rpm<1000)
|
||||
rpmtarget = 0
|
||||
if(compressor.rpm < 1000)
|
||||
compressor.rpmtarget = 0
|
||||
|
||||
var/new_rpm_threshold
|
||||
switch(rpm)
|
||||
switch(compressor.rpm)
|
||||
if(50001 to INFINITY)
|
||||
new_rpm_threshold = OVERDRIVE
|
||||
if(10001 to 50000)
|
||||
@@ -232,9 +232,9 @@
|
||||
else
|
||||
new_rpm_threshold = NONE
|
||||
|
||||
if(rpm_threshold != new_rpm_threshold)
|
||||
rpm_threshold = new_rpm_threshold
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
if(compressor.rpm_threshold != new_rpm_threshold)
|
||||
compressor.rpm_threshold = new_rpm_threshold
|
||||
compressor.update_icon(UPDATE_OVERLAYS)
|
||||
|
||||
/obj/machinery/power/compressor/update_overlays()
|
||||
. = ..()
|
||||
@@ -286,44 +286,49 @@
|
||||
return !density
|
||||
|
||||
/obj/machinery/power/turbine/process()
|
||||
var/datum/milla_safe/turbine_process/milla = new()
|
||||
milla.invoke_async(src)
|
||||
|
||||
if(!compressor)
|
||||
stat = BROKEN
|
||||
/datum/milla_safe/turbine_process
|
||||
|
||||
if((stat & BROKEN) || panel_open)
|
||||
/datum/milla_safe/turbine_process/on_run(obj/machinery/power/turbine/turbine)
|
||||
if(!turbine.compressor)
|
||||
turbine.stat = BROKEN
|
||||
|
||||
if((turbine.stat & BROKEN) || turbine.panel_open)
|
||||
return
|
||||
if(!compressor.starter)
|
||||
if(!turbine.compressor.starter)
|
||||
return
|
||||
|
||||
// This is the power generation function. If anything is needed it's good to plot it in EXCEL before modifying
|
||||
// the TURBPOWER and TURBCURVESHAPE values
|
||||
|
||||
if(compressor.gas_contained.temperature < 500)
|
||||
lastgen = 0
|
||||
if(turbine.compressor.gas_contained.temperature() < 500)
|
||||
turbine.lastgen = 0
|
||||
else
|
||||
lastgen = ((compressor.rpm / TURBPOWER) ** TURBCURVESHAPE) * TURBPOWER * productivity * POWER_CURVE_MOD
|
||||
turbine.lastgen = ((turbine.compressor.rpm / TURBPOWER) ** TURBCURVESHAPE) * TURBPOWER * turbine.productivity * POWER_CURVE_MOD
|
||||
|
||||
produce_direct_power(lastgen)
|
||||
turbine.produce_direct_power(turbine.lastgen)
|
||||
|
||||
// Weird function but it works. Should be something else...
|
||||
|
||||
var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles())/4
|
||||
var/newrpm = ((turbine.compressor.gas_contained.temperature()) * turbine.compressor.gas_contained.total_moles()) / 4
|
||||
|
||||
newrpm = max(0, newrpm)
|
||||
|
||||
if(!compressor.starter || newrpm > 1000)
|
||||
compressor.rpmtarget = newrpm
|
||||
if(!turbine.compressor.starter || newrpm > 1000)
|
||||
turbine.compressor.rpmtarget = newrpm
|
||||
|
||||
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)
|
||||
if(turbine.compressor.gas_contained.total_moles()>0)
|
||||
var/oamount = min(turbine.compressor.gas_contained.total_moles(), (turbine.compressor.rpm + 100) / 35000 * turbine.compressor.capacity)
|
||||
var/datum/gas_mixture/removed = turbine.compressor.gas_contained.remove(oamount)
|
||||
turbine.outturf.blind_release_air(removed)
|
||||
|
||||
if((lastgen > 100) != generator_threshold)
|
||||
generator_threshold = !generator_threshold
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
if((turbine.lastgen > 100) != turbine.generator_threshold)
|
||||
turbine.generator_threshold = !turbine.generator_threshold
|
||||
turbine.update_icon(UPDATE_OVERLAYS)
|
||||
|
||||
updateDialog()
|
||||
turbine.updateDialog()
|
||||
|
||||
/obj/machinery/power/turbine/update_overlays()
|
||||
. = ..()
|
||||
@@ -378,7 +383,7 @@
|
||||
data["online"] = compressor.starter
|
||||
data["power"] = compressor.turbine.lastgen
|
||||
data["rpm"] = compressor.rpm
|
||||
data["temperature"] = compressor.gas_contained.return_temperature()
|
||||
data["temperature"] = compressor.gas_contained.temperature()
|
||||
return data
|
||||
|
||||
/obj/machinery/power/turbine/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
@@ -446,7 +451,7 @@
|
||||
data["online"] = compressor.starter
|
||||
data["power"] = compressor.turbine.lastgen
|
||||
data["rpm"] = compressor.rpm
|
||||
data["temperature"] = compressor.gas_contained.return_temperature()
|
||||
data["temperature"] = compressor.gas_contained.temperature()
|
||||
data["bearing_heat"] = clamp((compressor.overheat / OVERHEAT_THRESHOLD) * 100, 0, 100)
|
||||
return data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user