mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-21 03:26:44 +01:00
Adds high performance gas/heat pumps (#3923)
* heat pump * quck config clicks * I forgot * performance factor setting * Heat pump power rating increase * passive flow adjustment * heatpump attackby proc * zeropoint fix and UI adjustment * Gas cooler perf reduction * reduces perf to upstream values * Un perfing for both heater and cooler, back to the original values * adds the "massive" gas pump, WIP * Fixes a merge fuckup * indents and whitespace corrections * adds power supply * circuit for the massive gas pump * _vr merge clean up * comments on atmos helpers * massive gas pump and UI * UI clean up * oh and I probably should push the bundle as well.. * adds the circuit to rnd hopefully * adds massive heatpump and its circuits * adds the circuits to the map * indention fix for js * more indentions * EVEN MORE INDENTIONS * last indention? * ICONS! * Directional and different speeds for icons
This commit is contained in:
@@ -7799,6 +7799,8 @@
|
||||
pixel_x = 3;
|
||||
pixel_y = -3
|
||||
},
|
||||
/obj/item/circuitboard/massive_gas_pump,
|
||||
/obj/item/circuitboard/massive_heat_pump,
|
||||
/turf/simulated/floor/plating,
|
||||
/area/storage/tech)
|
||||
"Bs" = (
|
||||
@@ -13757,6 +13759,8 @@
|
||||
/obj/machinery/atmospherics/pipe/simple/hidden/aux{
|
||||
dir = 4
|
||||
},
|
||||
/obj/item/circuitboard/massive_heat_pump,
|
||||
/obj/item/circuitboard/massive_gas_pump,
|
||||
/turf/simulated/floor/tiled,
|
||||
/area/engineering/atmos/monitoring)
|
||||
"Vf" = (
|
||||
|
||||
@@ -27,6 +27,27 @@
|
||||
/obj/item/stock_parts/capacitor = 1,
|
||||
/obj/item/stock_parts/console_screen = 1)
|
||||
|
||||
//Board for the High performance gas pump
|
||||
/obj/item/circuitboard/massive_gas_pump
|
||||
name = T_BOARD("High performance gas pump")
|
||||
build_path = /obj/machinery/atmospherics/binary/massive_gas_pump
|
||||
board_type = new /datum/frame/frame_types/machine
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_POWER = 2)
|
||||
req_components = list(
|
||||
/obj/item/stock_parts/matter_bin = 2,
|
||||
/obj/item/stock_parts/manipulator = 2,
|
||||
/obj/item/stock_parts/capacitor = 1)
|
||||
|
||||
/obj/item/circuitboard/massive_heat_pump
|
||||
name = T_BOARD("High performance heat pump")
|
||||
build_path = /obj/machinery/atmospherics/binary/massive_heat_pump
|
||||
board_type = new /datum/frame/frame_types/machine
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_POWER = 2)
|
||||
req_components = list(
|
||||
/obj/item/stock_parts/matter_bin = 1,
|
||||
/obj/item/stock_parts/micro_laser = 2,
|
||||
/obj/item/stock_parts/capacitor = 2)
|
||||
|
||||
// Board for the thermal regulator in airconditioner_vr.dm
|
||||
/obj/item/circuitboard/thermoregulator
|
||||
name = T_BOARD("thermal regulator")
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
//Calculate the amount of energy required and limit transfer_moles based on available power
|
||||
var/specific_power = calculate_specific_power(source, sink)/ATMOS_PUMP_EFFICIENCY //this has to be calculated before we modify any gas mixtures
|
||||
if (!isnull(available_power) && specific_power > 0)
|
||||
if (!isnull(available_power) && specific_power > 0)//specific_power > 0 means we need to use power to move moles, otherwise we can get away with just letting it flow passive
|
||||
transfer_moles = min(transfer_moles, available_power / specific_power)
|
||||
|
||||
if (transfer_moles < MINIMUM_MOLES_TO_PUMP) //if we cant transfer enough gas just stop to avoid further processing
|
||||
@@ -48,6 +48,7 @@
|
||||
A.last_flow_rate = (transfer_moles/source.total_moles)*source.volume //group_multiplier gets divided out here
|
||||
|
||||
if (A.debug)
|
||||
A.visible_message("[A]: power avaiable to move gases: [available_power] W")
|
||||
A.visible_message("[A]: source entropy: [round(source.specific_entropy(), 0.01)] J/Kmol --> sink entropy: [round(sink.specific_entropy(), 0.01)] J/Kmol")
|
||||
A.visible_message("[A]: specific entropy change = [round(sink.specific_entropy() - source.specific_entropy(), 0.01)] J/Kmol")
|
||||
A.visible_message("[A]: specific power = [round(specific_power, 0.1)] W/mol")
|
||||
|
||||
@@ -25,13 +25,12 @@
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
*/
|
||||
*/
|
||||
var/target_temp = T20C
|
||||
var/lowest_temp = TCMB
|
||||
///Need to bottle it somewhere, the sun's core has 15 million kelvin
|
||||
var/max_temp = 99999999
|
||||
var/max_temp = 99999999//Need to bottle it somewhere, the sun's core has 15 million kelvin
|
||||
|
||||
var/on = FALSE
|
||||
var/on = 0
|
||||
var/efficiency = 0
|
||||
|
||||
/obj/machinery/atmospherics/binary/heat_pump/CtrlClick(mob/user)
|
||||
@@ -104,15 +103,15 @@
|
||||
if (!W.is_wrench())
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && use_power)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench this [src], turn it off first."))
|
||||
return TRUE
|
||||
to_chat(user, "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>")
|
||||
return 1
|
||||
add_fingerprint(user)
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
to_chat(user, SPAN_NOTICE("You begin to unfasten \the [src]..."))
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40 * W.toolspeed))
|
||||
user.visible_message( \
|
||||
SPAN_NOTICE("\The [user] unfastens \the [src]."), \
|
||||
SPAN_NOTICE("You have unfastened \the [src]."), \
|
||||
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
|
||||
"<span class='notice'>You have unfastened \the [src].</span>", \
|
||||
"You hear ratchet.")
|
||||
deconstruct()
|
||||
|
||||
@@ -136,16 +135,9 @@
|
||||
return
|
||||
|
||||
//If there is no air1 or 2 the temperature is assumed 0 Kelvin which allows for
|
||||
if( (air1.temperature < 1) || (air2.temperature < 1))
|
||||
if((air1.temperature < 1) || (air2.temperature < 1))
|
||||
return
|
||||
|
||||
if((air2.temperature <= target_temp+0.1) && (air2.temperature >= target_temp-0.1))
|
||||
return //We are close enough to our target temp that its not worth the hassle
|
||||
|
||||
if(check_passive_opportunity())
|
||||
handle_passive_flow()
|
||||
return //No need to pump while there is passive flow occuring
|
||||
|
||||
//Now we are at the point where we need to actively pump
|
||||
efficiency = get_thermal_efficency()
|
||||
var/energy_transfered = 0
|
||||
@@ -154,15 +146,14 @@
|
||||
energy_transfered = clamp(air2.get_thermal_energy_change(target_temp),performance_factor*power_rating,-performance_factor*power_rating)
|
||||
|
||||
var/power_draw = abs(energy_transfered/performance_factor)
|
||||
//Only adds the energy actually removed from air one to air two(- infront of air1 because energy was removed)
|
||||
air2.add_thermal_energy(-air1.add_thermal_energy(-energy_transfered*efficiency))
|
||||
if(power_draw >= 0)
|
||||
air2.add_thermal_energy(-air1.add_thermal_energy(-energy_transfered*efficiency))//only adds the energy actually removed from air one to air two(- infront of air1 because energy was removed)
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
use_power(power_draw)
|
||||
if(network1)
|
||||
network1.update = TRUE
|
||||
network1.update = 1
|
||||
if(network2)
|
||||
network2.update = TRUE
|
||||
network2.update = 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/heat_pump/proc/get_thermal_efficency()
|
||||
if((target_temp < air2.temperature))
|
||||
@@ -183,13 +174,12 @@
|
||||
air2.temperature = new_temperature
|
||||
|
||||
/obj/machinery/atmospherics/binary/heat_pump/proc/check_passive_opportunity()
|
||||
//Little offsets to prevent just constant passive flow for minor temperature differences
|
||||
if((target_temp < air2.temperature) && (air1.temperature < air2.temperature - 5))
|
||||
return TRUE
|
||||
if((target_temp > air2.temperature) && (air1.temperature > air2.temperature + 5))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
if((target_temp < air2.temperature) && (air1.temperature < air2.temperature - 5))//Little offsets to prevent just constant passive flow for minor temperature differences
|
||||
return TRUE
|
||||
if((target_temp > air2.temperature) && (air1.temperature > air2.temperature + 5))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/atmospherics/binary/heat_pump/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
@@ -206,6 +196,7 @@
|
||||
data["highest_temp"] = max_temp
|
||||
data["efficency"] = efficiency
|
||||
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/heat_pump/ui_state(mob/user)
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* Massive gas pumps are wired, clunky machines that can use a dynamic amount of power to
|
||||
* do the job of normal gas pumps
|
||||
*/
|
||||
#define MAX_POWER_FOR_MASSIVE 100000000
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump
|
||||
name = "High performance gas pump"
|
||||
|
||||
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
||||
power_rating = 0 //7500 W ~ 10 HP
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
|
||||
|
||||
var/max_pressure_setting = 15000 //kPa
|
||||
|
||||
icon = 'icons/obj/machines/massive_pumps.dmi'
|
||||
icon_state = "pump"
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
anchored = 1
|
||||
density = 1
|
||||
circuit = /obj/item/circuitboard/massive_gas_pump
|
||||
|
||||
var/power_level = MAX_POWER_FOR_MASSIVE//So we can limit the power we work with and
|
||||
//dont just have a stupid pump that drains all power
|
||||
|
||||
var/obj/machinery/power/powersupply/power_machine = null//for funky massive power machines
|
||||
//if its not null the machine attempts to draw from the grid the power machinery is connected to
|
||||
//see examples in the file "code\modules\atmospherics\components\binary_devices\massive_gas_pump.dm"
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/Initialize(mapload)
|
||||
. = ..()
|
||||
power_machine = new(src)
|
||||
|
||||
on_construction("#000", PIPING_LAYER_DEFAULT)
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP * 50//give it a much larger volume
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP * 50//default is 200 L we give it 1000 L or 1m³
|
||||
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
default_apply_parts()
|
||||
update_icon()
|
||||
// TODO - Make these in actual icon states so its not silly like this
|
||||
var/image/I = image(icon = icon, icon_state = "algae-pipe-overlay", dir = dir)
|
||||
I.color = PIPE_COLOR_GREY
|
||||
overlays += I
|
||||
I = image(icon = icon, icon_state = "algae-pipe-overlay", dir = GLOB.reverse_dir[dir])
|
||||
I.color = PIPE_COLOR_GREY
|
||||
overlays += I
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/Destroy()
|
||||
. = ..()
|
||||
qdel(power_machine)
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/process(delta_time)
|
||||
if(!network1 || !network2)
|
||||
build_network()//built networks if we are missing them
|
||||
network1?.update = 1
|
||||
network2?.update = 1
|
||||
return
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
if(!power_machine || !power_machine.powernet)
|
||||
if(!power_machine || !power_machine.connect_to_network())//returns 0 if it fails to find a
|
||||
return//make sure we are connected to a powernet
|
||||
|
||||
power_rating = power_machine.surplus()//update power rateing to what ever is avaiable
|
||||
power_rating = clamp(power_rating, 0, power_level)
|
||||
|
||||
if(power_rating <= 0)
|
||||
return//no point in continuing if we dont have any power
|
||||
|
||||
var/power_draw = -1
|
||||
var/pressure_delta = target_pressure - air2.return_pressure()
|
||||
|
||||
if(pressure_delta > 0.01 && air1.temperature > 0)
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
var/transfer_moles = calculate_transfer_moles(air1, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
power_draw = pump_gas(src, air1, air2, transfer_moles, power_rating)
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
|
||||
power_machine.draw_power(power_draw)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/attackby(obj/item/W as obj, mob/user as mob)
|
||||
add_fingerprint(user)
|
||||
if(default_deconstruction_screwdriver(user, W))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, W))
|
||||
return
|
||||
if(default_part_replacement(user, W))
|
||||
return
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("You cannot insert this item into \the [src]!"))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/update_icon()
|
||||
if(inoperable() || !anchored || !power_machine.powernet)
|
||||
icon_state = "pump"
|
||||
else if(use_power)
|
||||
switch(last_power_draw)
|
||||
if(1 to (1 MEGAWATTS))
|
||||
icon_state = "pump_1"
|
||||
if((1 MEGAWATTS) to (10 MEGAWATTS))
|
||||
icon_state = "pump_2"
|
||||
if((10 MEGAWATTS) to MAX_POWER_FOR_MASSIVE)
|
||||
icon_state = "pump_3"
|
||||
else
|
||||
icon_state = "pump"
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "MassiveGasPump", name)
|
||||
ui.open()
|
||||
|
||||
//This is the data which will be sent to the ui
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data = list(
|
||||
"on" = use_power,
|
||||
"pressure_set" = round(target_pressure*100),
|
||||
"max_pressure" = max_pressure_setting,
|
||||
"power_level" = power_level,
|
||||
"last_flow_rate" = round(last_flow_rate*10),
|
||||
"last_power_draw" = round(last_power_draw),
|
||||
"max_power_draw" = MAX_POWER_FOR_MASSIVE,
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, SPAN_WARNING("Access denied."))
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_gas_pump/ui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("set_press")
|
||||
var/press = params["press"]
|
||||
switch(press)
|
||||
if("min")
|
||||
target_pressure = 0
|
||||
if("max")
|
||||
target_pressure = max_pressure_setting
|
||||
if("set")
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = between(0, new_pressure, max_pressure_setting)
|
||||
. = TRUE
|
||||
if("set_pow")
|
||||
var/pow = params["pow"]
|
||||
switch(pow)
|
||||
if("min")
|
||||
power_level = 0
|
||||
if("max")
|
||||
power_level = MAX_POWER_FOR_MASSIVE
|
||||
if("set")
|
||||
var/new_power_level = input(usr,"Enter new power level (0-10 GW)","Power control",src.power_level) as num
|
||||
src.power_level = between(0, new_power_level, MAX_POWER_FOR_MASSIVE)
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/**
|
||||
* Massive heat pumps are wired, clunky machines that can use a dynamic amount of power to
|
||||
* do the job of normal heat pumps
|
||||
*/
|
||||
|
||||
#define EFFICENCY_MULT 1
|
||||
#define EFFICENCY_LIMIT_MULT 1
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump
|
||||
name = "High performance heat pump"
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 150
|
||||
power_rating = MAX_POWER_FOR_MASSIVE
|
||||
var/target_temp = T20C
|
||||
var/min_heat_setting = TCMB
|
||||
var/max_heat_setting = 99999999
|
||||
|
||||
icon = 'icons/obj/machines/massive_pumps.dmi'
|
||||
icon_state = "pump"
|
||||
pipe_flags = PIPING_DEFAULT_LAYER_ONLY|PIPING_ONE_PER_TURF
|
||||
anchored = 1
|
||||
density = 1
|
||||
circuit = /obj/item/circuitboard/massive_heat_pump
|
||||
|
||||
var/power_level = MAX_POWER_FOR_MASSIVE//So we can limit the power we work with and
|
||||
//dont just have a stupid pump that drains all power
|
||||
|
||||
var/obj/machinery/power/powersupply/power_machine //for funky massive power machines
|
||||
//if its not null the machine attempts to draw from the grid the power machinery is connected to
|
||||
//see examples in the file "code\modules\atmospherics\components\binary_devices\massive_heat_pump.dm"
|
||||
var/on = 0
|
||||
var/efficiency = 0
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/Initialize(mapload)
|
||||
. = ..()
|
||||
power_machine = new(src)
|
||||
|
||||
on_construction("#000", PIPING_LAYER_DEFAULT)
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP * 50//give it a much larger volume
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP * 50//default is 200 L we give it 1000 L or 1m³
|
||||
|
||||
desc = initial(desc) + " Its outlet port is to the [dir2text(dir)]."
|
||||
default_apply_parts()
|
||||
update_icon()
|
||||
// TODO - Make these in actual icon states so its not silly like this
|
||||
var/image/I = image(icon = icon, icon_state = "algae-pipe-overlay", dir = dir)
|
||||
I.color = PIPE_COLOR_GREY
|
||||
overlays += I
|
||||
I = image(icon = icon, icon_state = "algae-pipe-overlay", dir = GLOB.reverse_dir[dir])
|
||||
I.color = PIPE_COLOR_GREY
|
||||
overlays += I
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/Destroy()
|
||||
. = ..()
|
||||
qdel(power_machine)
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/process(delta_time)
|
||||
if(!network1 || !network2)
|
||||
build_network()//built networks if we are missing them
|
||||
network1?.update = 1
|
||||
network2?.update = 1
|
||||
return
|
||||
if((stat & (NOPOWER|BROKEN)) || !use_power)
|
||||
return
|
||||
|
||||
if(!power_machine || !power_machine.powernet)
|
||||
if(!power_machine || !power_machine.connect_to_network())//returns 0 if it fails to find a
|
||||
return//make sure we are connected to a powernet
|
||||
|
||||
power_rating = power_machine.surplus()//update power rateing to what ever is avaiable
|
||||
power_rating = clamp(power_rating, 0, power_level)
|
||||
|
||||
if(power_rating <= 0)
|
||||
return//no point in continuing if we dont have any power
|
||||
|
||||
if(!air1 || !air2)
|
||||
return
|
||||
|
||||
//If there is no air1 or 2 the temperature is assumed 0 Kelvin which allows for
|
||||
if((air1.temperature < 1) || (air2.temperature < 1))
|
||||
return
|
||||
|
||||
var/power_draw = -1
|
||||
//Now we are at the point where we need to actively pump
|
||||
efficiency = get_thermal_efficency()
|
||||
var/energy_transfered = 0
|
||||
CACHE_VSC_PROP(atmos_vsc, /atmos/heatpump/performance_factor, performance_factor)
|
||||
|
||||
energy_transfered = clamp(air2.get_thermal_energy_change(target_temp),performance_factor*power_rating,-performance_factor*power_rating)
|
||||
|
||||
power_draw = abs(energy_transfered/performance_factor)
|
||||
air2.add_thermal_energy(-air1.add_thermal_energy(-energy_transfered*efficiency))//only adds the energy actually removed from air one to air two(- infront of air1 because energy was removed)
|
||||
|
||||
if (power_draw >= 0)
|
||||
last_power_draw = power_draw
|
||||
|
||||
power_machine.draw_power(power_draw)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/proc/get_thermal_efficency()
|
||||
if((target_temp < air2.temperature))
|
||||
return clamp((air2.temperature / air1.temperature) * EFFICENCY_MULT, 0, 1 * EFFICENCY_LIMIT_MULT)
|
||||
else if((target_temp > air2.temperature))
|
||||
return clamp((air1.temperature / air2.temperature) * EFFICENCY_MULT, 0, 1 * EFFICENCY_LIMIT_MULT)
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/proc/handle_passive_flow()
|
||||
var/air_heat_capacity = air1.heat_capacity()
|
||||
var/other_air_heat_capacity = air2.heat_capacity()
|
||||
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
||||
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = air1.temperature*other_air_heat_capacity + air_heat_capacity*air2.temperature
|
||||
|
||||
var/new_temperature = combined_energy/combined_heat_capacity
|
||||
air1.temperature = new_temperature
|
||||
air2.temperature = new_temperature
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/proc/check_passive_opportunity()
|
||||
if((target_temp < air2.temperature) && (air1.temperature < air2.temperature - 5))//Little offsets to prevent just constant passive flow for minor temperature differences
|
||||
return TRUE
|
||||
if((target_temp > air2.temperature) && (air1.temperature > air2.temperature + 5))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/attackby(obj/item/W as obj, mob/user as mob)
|
||||
add_fingerprint(user)
|
||||
if(default_deconstruction_screwdriver(user, W))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, W))
|
||||
return
|
||||
if(default_part_replacement(user, W))
|
||||
return
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("You cannot insert this item into \the [src]!"))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/update_icon()
|
||||
if(inoperable() || !anchored || !power_machine.powernet)
|
||||
icon_state = "pump"
|
||||
else if(use_power)
|
||||
switch(last_power_draw)
|
||||
if(1 to (1 MEGAWATTS))
|
||||
icon_state = "heat_1"
|
||||
if((1 MEGAWATTS) to (10 MEGAWATTS))
|
||||
icon_state = "heat_2"
|
||||
if((10 MEGAWATTS) to MAX_POWER_FOR_MASSIVE)
|
||||
icon_state = "heat_3"
|
||||
else
|
||||
icon_state = "pump"
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/ui_interact(mob/user, datum/tgui/ui)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return FALSE
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "MassiveHeatPump", name)
|
||||
ui.open()
|
||||
|
||||
//This is the data which will be sent to the ui
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data = list(
|
||||
"on" = use_power,
|
||||
"target_temp" = target_temp,
|
||||
"highest_temp" = max_heat_setting,
|
||||
"lowest_temp" = min_heat_setting,
|
||||
"power_level" = power_level,
|
||||
"current_temp" = air2.temperature,
|
||||
"sink_temp" = air1.temperature,
|
||||
"last_power_draw" = round(last_power_draw),
|
||||
"max_power_draw" = MAX_POWER_FOR_MASSIVE,
|
||||
"efficiency" = efficiency,
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(!allowed(user))
|
||||
to_chat(user, SPAN_WARNING("Access denied."))
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/massive_heat_pump/ui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
update_use_power(!use_power)
|
||||
. = TRUE
|
||||
if("set_temp")
|
||||
var/temp = params["temp"]
|
||||
switch(temp)
|
||||
if("min")
|
||||
src.target_temp = min_heat_setting
|
||||
if("max")
|
||||
src.target_temp = max_heat_setting
|
||||
if("set")
|
||||
src.target_temp = input(usr,"Enter new target Temperature","Temperature controll",src.target_temp) as num
|
||||
src.target_temp = between(min_heat_setting, target_temp, max_heat_setting)
|
||||
. = TRUE
|
||||
if("set_pow")
|
||||
var/pow = params["pow"]
|
||||
switch(pow)
|
||||
if("min")
|
||||
power_level = 0
|
||||
if("max")
|
||||
power_level = MAX_POWER_FOR_MASSIVE
|
||||
if("set")
|
||||
var/new_power_level = input(usr,"Enter new power level (0-10 GW)","Power control",src.power_level) as num
|
||||
src.power_level = between(0, new_power_level, MAX_POWER_FOR_MASSIVE)
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
#undef EFFICENCY_MULT
|
||||
#undef EFFICENCY_LIMIT_MULT
|
||||
@@ -70,6 +70,8 @@ Thus, the two variables affect pump operation are set in New():
|
||||
. = ..()
|
||||
air1.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
air2.volume = ATMOS_DEFAULT_VOLUME_PUMP
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Destroy()
|
||||
unregister_radio(src, frequency)
|
||||
@@ -195,11 +197,6 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Initialize(mapload)
|
||||
. = ..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return FALSE
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file contains a subtype of machinery/power, that is used by other machinery as an interior object
|
||||
*/
|
||||
/obj/machinery/power/powersupply
|
||||
name = "power supply"
|
||||
desc = "An interior component of another machine meant to supply it with power."
|
||||
|
||||
/obj/machinery/power/powersupply/connect_to_network()
|
||||
var/turf/T = src.loc.loc//double loc, first loc is the machine we are in, second one gives us the turf of the machine we are in
|
||||
if(!T || !istype(T))
|
||||
return 0
|
||||
|
||||
var/obj/structure/cable/C = T.get_cable_node() //check if we have a node cable on the machine turf, the first found is picked
|
||||
if(!C || !C.powernet)
|
||||
return 0
|
||||
|
||||
C.powernet.add_machine(src)
|
||||
return 1
|
||||
@@ -662,3 +662,17 @@ CIRCUITS BELOW
|
||||
req_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 3, TECH_COMBAT = 2)
|
||||
build_path = /obj/item/circuitboard/pointdefense_control
|
||||
sort_string = "OAABB"
|
||||
|
||||
/datum/design/circuit/massive_gas_pump
|
||||
name = "High performance gas pump"
|
||||
id = "massive_gas_pump"
|
||||
req_tech = list(TECH_ENGINEERING = 3)
|
||||
build_path = /obj/item/circuitboard/massive_gas_pump
|
||||
sort_string = "OAABC"
|
||||
|
||||
/datum/design/circuit/massive_heat_pump
|
||||
name = "High performance heat pump"
|
||||
id = "massive_heat_pump"
|
||||
req_tech = list(TECH_ENGINEERING = 4)
|
||||
build_path = /obj/item/circuitboard/massive_heat_pump
|
||||
sort_string = "OAABD"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,95 @@
|
||||
import { useBackend } from "../backend";
|
||||
import { Button, LabeledList, ProgressBar, Section, LabeledControls, AnimatedNumber } from "../components";
|
||||
import { formatPower } from '../format';
|
||||
import { Fragment } from 'inferno';
|
||||
import { Window } from "../layouts";
|
||||
|
||||
export const MassiveGasPump = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
on,
|
||||
pressure_set,
|
||||
last_flow_rate,
|
||||
last_power_draw,
|
||||
power_level,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Window
|
||||
width={470}
|
||||
height={250}
|
||||
resizable>
|
||||
<Window.Content>
|
||||
<Section title="Status">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Effic">
|
||||
<AnimatedNumber value={last_flow_rate / 10} /> L/s
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Load">
|
||||
<ProgressBar
|
||||
value={last_power_draw}
|
||||
minValue={0}
|
||||
maxValue={power_level}
|
||||
color={last_power_draw < power_level - 5
|
||||
? 'good' : 'average'}>
|
||||
{formatPower(last_power_draw)}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<Section
|
||||
title="Controls"
|
||||
buttons={
|
||||
<Button
|
||||
icon="power-off"
|
||||
content={on ? "On" : "Off"}
|
||||
selected={on}
|
||||
onClick={() => act("power")} />
|
||||
}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Output Pressure"
|
||||
buttons={(
|
||||
<Fragment>
|
||||
<Button
|
||||
icon="compress-arrows-alt"
|
||||
content="MIN"
|
||||
onClick={() => act("set_press", { press: "min" })} />
|
||||
<Button
|
||||
icon="expand-arrows-alt"
|
||||
content="MAX"
|
||||
onClick={() => act("set_press", { press: "max" })} />
|
||||
<Button
|
||||
icon="wrench"
|
||||
content="SET"
|
||||
onClick={() => act("set_press", { press: "set" })} />
|
||||
</Fragment>
|
||||
)}>
|
||||
{pressure_set / 100} kPa
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Power Level"
|
||||
buttons={(
|
||||
<Fragment>
|
||||
<Button
|
||||
icon="compress-arrows-alt"
|
||||
content="MIN"
|
||||
onClick={() => act("set_pow", { pow: "min" })} />
|
||||
<Button
|
||||
icon="expand-arrows-alt"
|
||||
content="MAX"
|
||||
onClick={() => act("set_pow", { pow: "max" })} />
|
||||
<Button
|
||||
icon="wrench"
|
||||
content="SET"
|
||||
onClick={() => act("set_pow", { pow: "set" })} />
|
||||
</Fragment>
|
||||
|
||||
)}>
|
||||
{formatPower(power_level)}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,106 @@
|
||||
import { useBackend } from "../backend";
|
||||
import { Button, LabeledList, ProgressBar, Section, NumberInput, AnimatedNumber } from "../components";
|
||||
import { formatPower, formatSiUnit } from '../format';
|
||||
import { Fragment } from 'inferno';
|
||||
import { Window } from "../layouts";
|
||||
|
||||
export const MassiveHeatPump = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
power_level,
|
||||
target_temp,
|
||||
current_temp,
|
||||
sink_temp,
|
||||
on,
|
||||
lowest_temp,
|
||||
efficiency,
|
||||
highest_temp,
|
||||
last_power_draw,
|
||||
max_power_draw,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Window
|
||||
width={470}
|
||||
height={270}
|
||||
resizable>
|
||||
<Window.Content>
|
||||
<Section title="Status">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Efficiency">
|
||||
<AnimatedNumber value={efficiency * 100} /> %
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Current Temperaute">
|
||||
<AnimatedNumber value={current_temp} /> K
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Sink Temperature">
|
||||
<AnimatedNumber value={sink_temp} /> K
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Load">
|
||||
<ProgressBar
|
||||
value={last_power_draw}
|
||||
minValue={0}
|
||||
maxValue={power_level}
|
||||
color={last_power_draw < power_level - 5
|
||||
? 'good' : 'average'}>
|
||||
{formatPower(last_power_draw)}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
<Section
|
||||
title="Controls"
|
||||
buttons={
|
||||
<Button
|
||||
icon="power-off"
|
||||
content={on ? "On" : "Off"}
|
||||
selected={on}
|
||||
onClick={() => act("power")} />
|
||||
}>
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Target Temperature"
|
||||
buttons={(
|
||||
<Fragment>
|
||||
<Button
|
||||
icon="compress-arrows-alt"
|
||||
content="MIN"
|
||||
onClick={() => act("set_temp", { temp: "min" })} />
|
||||
<Button
|
||||
icon="expand-arrows-alt"
|
||||
content="MAX"
|
||||
onClick={() => act("set_temp", { temp: "max" })} />
|
||||
<Button
|
||||
icon="wrench"
|
||||
content="SET"
|
||||
onClick={() => act("set_temp", { temp: "set" })} />
|
||||
</Fragment>
|
||||
)}>
|
||||
{formatSiUnit(target_temp, 0, 'K')}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Power Level"
|
||||
buttons={(
|
||||
<Fragment>
|
||||
<Button
|
||||
icon="compress-arrows-alt"
|
||||
content="MIN"
|
||||
onClick={() => act("set_pow", { pow: "min" })} />
|
||||
<Button
|
||||
icon="expand-arrows-alt"
|
||||
content="MAX"
|
||||
onClick={() => act("set_pow", { pow: "max" })} />
|
||||
<Button
|
||||
icon="wrench"
|
||||
content="SET"
|
||||
onClick={() => act("set_pow", { pow: "set" })} />
|
||||
</Fragment>
|
||||
)}>
|
||||
{formatPower(power_level)}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1667,6 +1667,8 @@
|
||||
#include "code\modules\atmospherics\components\binary_devices\circulator.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\dp_vent_pump.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\heat_pump.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\massive_gas_pump.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\massive_heat_pump.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\passive_gate.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\pipeturbine.dm"
|
||||
#include "code\modules\atmospherics\components\binary_devices\pump.dm"
|
||||
@@ -3173,6 +3175,7 @@
|
||||
#include "code\modules\power\port_gen.dm"
|
||||
#include "code\modules\power\power.dm"
|
||||
#include "code\modules\power\powernet.dm"
|
||||
#include "code\modules\power\powersupply.dm"
|
||||
#include "code\modules\power\smes.dm"
|
||||
#include "code\modules\power\smes_construction.dm"
|
||||
#include "code\modules\power\solar.dm"
|
||||
|
||||
Reference in New Issue
Block a user