mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
eaba74a2eb
## About The Pull Request - Opening the panel of a boulder refiner machine or un-wrenching it now turns off its environment light - The boulder refiner machine has reagent holder of type `/datum/reagents/plumbing` which fixes rounding errors & has other plumbing optimized features - The boulder refiner machine now only takes in booster reagents & only outputs waste reagent. This means even if you have a tank with random reagents attached to it, it will only take in booster reagents if present & exclude the rest thus saving you time & space from taking in other reagents - booster reagents is now a static list shared by all machines thus saving memory - Removed `supply_offset` & `demand_offset` vars from core plumbing component. These vars were making the pipes extend outside the tile causing it to overlap with adjacent tile machine pipes making everything ugly. Now the pipes are perpendicular to the conveyer belt sprite and will only take in boulders from the conveyer belt direction https://github.com/user-attachments/assets/5583a790-32b6-40df-a414-1602dd84fefd - Map edited smelters so the conveyer belt is in the direction of the refiner ## Changelog 🆑 fix: opening panel of boulder refinery with screwdriver or un-wrenching it turns of its light fix: boulder refinery only takes in booster reagents and excludes others and only outputs waste chemicals as intended fix: boulder refinery machines outputs waste reagents without rounding errors in them qol: removed conveyer sprite from boulder smelter & pixel shifts the refiner so you can see it's plumbing pipes properly sprite: smelters will now only take in boulders in the direction of its conveyer belt. It's plumbing pipes are perpendicular to its conveyer belt /🆑
127 lines
3.7 KiB
Plaintext
127 lines
3.7 KiB
Plaintext
///Same as a tier 3 chem heater
|
|
#define HEATER_COFFICIENT 0.3
|
|
///Decimal point in rounding temperature
|
|
#define TEMP_ROUNDING 0.01
|
|
///Minimal allowed difference temperature range
|
|
#define TEMP_DIFF 0.5
|
|
|
|
/obj/machinery/plumbing/acclimator
|
|
name = "chemical acclimator"
|
|
desc = "An efficient cooler and heater for the perfect showering temperature or illicit chemical factory."
|
|
icon_state = "acclimator"
|
|
base_icon_state = "acclimator"
|
|
buffer = 200
|
|
active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2.5
|
|
|
|
///towards wich temperature do we build?
|
|
var/target_temperature = 300
|
|
///See code/__DEFINES/plumbing.dm
|
|
var/acclimate_state = AC_FILLING
|
|
///Maximum volume intake before processing
|
|
var/max_volume = 200
|
|
|
|
/obj/machinery/plumbing/acclimator/Initialize(mapload, layer)
|
|
. = ..()
|
|
AddComponent(/datum/component/plumbing/acclimator, layer)
|
|
RegisterSignal(reagents, COMSIG_REAGENTS_HOLDER_UPDATED, PROC_REF(clear))
|
|
|
|
/obj/machinery/plumbing/acclimator/update_icon_state()
|
|
. = ..()
|
|
|
|
icon_state = base_icon_state
|
|
if(!is_operational || !anchored)
|
|
return
|
|
|
|
switch(acclimate_state)
|
|
if(AC_FILLING)
|
|
icon_state += "_fill"
|
|
if(AC_HEATING)
|
|
icon_state += "_hot"
|
|
if(AC_COOLING)
|
|
icon_state += "_cold"
|
|
if(AC_EMPTYING)
|
|
icon_state += "_empty"
|
|
|
|
/obj/machinery/plumbing/acclimator/wrench_act(mob/living/user, obj/item/tool)
|
|
. = ..()
|
|
if(. == ITEM_INTERACT_SUCCESS)
|
|
acclimate_state = AC_FILLING
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/plumbing/acclimator/plunger_act(obj/item/plunger/attacking_plunger, mob/living/user, reinforced)
|
|
. = ..()
|
|
if(.)
|
|
acclimate_state = AC_FILLING
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/plumbing/acclimator/process(seconds_per_tick)
|
|
if(!is_operational || !reagents.total_volume || acclimate_state == AC_FILLING || acclimate_state == AC_EMPTYING)
|
|
return
|
|
|
|
var/new_state = reagents.chem_temp > target_temperature ? AC_COOLING : AC_HEATING
|
|
if(acclimate_state != new_state)
|
|
acclimate_state = new_state
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
|
|
var/energy = (target_temperature - reagents.chem_temp) * HEATER_COFFICIENT * seconds_per_tick * reagents.heat_capacity()
|
|
reagents.adjust_thermal_energy(energy)
|
|
reagents.handle_reactions()
|
|
use_energy(active_power_usage + abs(ROUND_UP(energy) / 120))
|
|
|
|
if(reagents.is_reacting)
|
|
return
|
|
|
|
var/temp = round(reagents.chem_temp, TEMP_ROUNDING)
|
|
if(temp >= target_temperature - TEMP_DIFF && temp <= target_temperature + TEMP_DIFF)
|
|
reagents.set_temperature(target_temperature)
|
|
acclimate_state = AC_EMPTYING
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/plumbing/acclimator/proc/clear()
|
|
SIGNAL_HANDLER
|
|
|
|
if(acclimate_state == AC_EMPTYING && !reagents.total_volume)
|
|
acclimate_state = AC_FILLING
|
|
reagents.flags |= NO_REACT
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
|
|
/obj/machinery/plumbing/acclimator/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "ChemAcclimator", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/plumbing/acclimator/ui_data(mob/user)
|
|
return list(
|
|
chem_temp = round(reagents.chem_temp, TEMP_ROUNDING),
|
|
target_temperature = target_temperature,
|
|
max_volume = max_volume,
|
|
acclimate_state = acclimate_state
|
|
)
|
|
|
|
/obj/machinery/plumbing/acclimator/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("set_target_temperature")
|
|
var/value = text2num(params["temperature"])
|
|
if(!value)
|
|
return FALSE
|
|
|
|
target_temperature = round(clamp(value, 1, 1000), TEMP_ROUNDING)
|
|
return TRUE
|
|
|
|
if("change_volume")
|
|
var/value = text2num(params["volume"])
|
|
if(!value)
|
|
return FALSE
|
|
|
|
max_volume = round(clamp(value, 1, buffer), CHEMICAL_VOLUME_ROUNDING)
|
|
return TRUE
|
|
|
|
#undef HEATER_COFFICIENT
|
|
#undef TEMP_ROUNDING
|
|
#undef TEMP_DIFF
|