mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-19 20:06:28 +01:00
Overhauls setup-supermatter admin verb
- Setup supermatter now uses series of map markers to do it's thing. These makers will make it easier to keep it up to date with map changes. - Setup supermatter now supports CO2 and PH coolant choices. - Fixes #9661
This commit is contained in:
@@ -846,89 +846,6 @@
|
||||
if(SMES.anchored)
|
||||
SMES.input_attempt = 1
|
||||
|
||||
/client/proc/setup_supermatter_engine()
|
||||
set category = "Debug"
|
||||
set name = "Setup supermatter"
|
||||
set desc = "Sets up the supermatter engine"
|
||||
|
||||
if(!check_rights(R_DEBUG|R_ADMIN)) return
|
||||
|
||||
var/response = alert("Are you sure? This will start up the engine. Should only be used during debug!",,"Setup Completely","Setup except coolant","No")
|
||||
|
||||
if(response == "No")
|
||||
return
|
||||
|
||||
var/found_the_pump = 0
|
||||
var/obj/machinery/power/supermatter/SM
|
||||
|
||||
for(var/obj/machinery/M in world)
|
||||
if(!M)
|
||||
continue
|
||||
if(!M.loc)
|
||||
continue
|
||||
if(!M.loc.loc)
|
||||
continue
|
||||
|
||||
if(istype(M.loc.loc,/area/engineering/engine_room))
|
||||
if(istype(M,/obj/machinery/power/rad_collector))
|
||||
var/obj/machinery/power/rad_collector/Rad = M
|
||||
Rad.anchored = 1
|
||||
Rad.connect_to_network()
|
||||
|
||||
var/obj/item/weapon/tank/phoron/Phoron = new/obj/item/weapon/tank/phoron(Rad)
|
||||
|
||||
Phoron.air_contents.gas["phoron"] = 29.1154 //This is a full tank if you filled it from a canister
|
||||
Rad.P = Phoron
|
||||
|
||||
Phoron.loc = Rad
|
||||
|
||||
if(!Rad.active)
|
||||
Rad.toggle_power()
|
||||
Rad.update_icon()
|
||||
|
||||
else if(istype(M,/obj/machinery/atmospherics/binary/pump)) //Turning on every pump.
|
||||
var/obj/machinery/atmospherics/binary/pump/Pump = M
|
||||
if(Pump.name == "Engine Feed" && response == "Setup Completely")
|
||||
found_the_pump = 1
|
||||
Pump.air2.gas["nitrogen"] = 3750 //The contents of 2 canisters.
|
||||
Pump.air2.temperature = 50
|
||||
Pump.air2.update_values()
|
||||
Pump.use_power=1
|
||||
Pump.target_pressure = 4500
|
||||
Pump.update_icon()
|
||||
|
||||
else if(istype(M,/obj/machinery/power/supermatter))
|
||||
SM = M
|
||||
spawn(50)
|
||||
SM.power = 320
|
||||
|
||||
else if(istype(M,/obj/machinery/power/smes)) //This is the SMES inside the engine room. We don't need much power.
|
||||
var/obj/machinery/power/smes/SMES = M
|
||||
SMES.input_attempt = 1
|
||||
SMES.input_level = 200000
|
||||
SMES.output_level = 75000
|
||||
|
||||
else if(istype(M.loc.loc,/area/engineering/engine_smes)) //Set every SMES to charge and spit out 300,000 power between the 4 of them.
|
||||
if(istype(M,/obj/machinery/power/smes))
|
||||
var/obj/machinery/power/smes/SMES = M
|
||||
SMES.input_attempt = 1
|
||||
SMES.input_level = 200000
|
||||
SMES.output_level = 75000
|
||||
|
||||
if(!found_the_pump && response == "Setup Completely")
|
||||
src << "\red Unable to locate air supply to fill up with coolant, adding some coolant around the supermatter"
|
||||
var/turf/simulated/T = SM.loc
|
||||
T.zone.air.gas["nitrogen"] += 450
|
||||
T.zone.air.temperature = 50
|
||||
T.zone.air.update_values()
|
||||
|
||||
|
||||
log_admin("[key_name(usr)] setup the supermatter engine [response == "Setup except coolant" ? "without coolant" : ""]")
|
||||
message_admins("\blue [key_name_admin(usr)] setup the supermatter engine [response == "Setup except coolant" ? "without coolant": ""]", 1)
|
||||
return
|
||||
|
||||
|
||||
|
||||
/client/proc/cmd_debug_mob_lists()
|
||||
set category = "Debug"
|
||||
set name = "Debug Mob Lists"
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
#define SETUP_OK 1 // All good
|
||||
#define SETUP_WARNING 2 // Something that shouldn't happen happened, but it's not critical so we will continue
|
||||
#define SETUP_ERROR 3 // Something bad happened, and it's important so we won't continue setup.
|
||||
|
||||
|
||||
#define ENERGY_NITROGEN 115 // Roughly 8 emitter shots.
|
||||
#define ENERGY_CARBONDIOXIDE 150 // Roughly 10 emitter shots.
|
||||
#define ENERGY_PHORON 300 // Roughly 20 emitter shots. Phoron can take more but this is enough to max out both SMESs anyway.
|
||||
|
||||
// Called by admin command setup-supermatter, this system uses landmarks to set up the engine.
|
||||
/client/proc/setup_supermatter_engine()
|
||||
set category = "Debug"
|
||||
set name = "Setup supermatter"
|
||||
set desc = "Sets up the supermatter engine"
|
||||
|
||||
if(!check_rights(R_DEBUG|R_ADMIN))
|
||||
usr << "You do not have access to this command!"
|
||||
return
|
||||
|
||||
var/response = input(usr, "Are you sure? This will start up the engine with selected gas as coolant.", "Engine setup") as null|anything in list("N2", "CO2", "PH", "Abort")
|
||||
if(!response || response == "Abort")
|
||||
return
|
||||
|
||||
var/errors = 0
|
||||
var/warnings = 0
|
||||
var/success = 0
|
||||
|
||||
log_and_message_admins("## SUPERMATTER SETUP - Setup initiated by [src]/[src.ckey] using coolant type [response].")
|
||||
|
||||
// CONFIGURATION PHASE
|
||||
// Coolant canisters, set types according to response.
|
||||
for(var/obj/effect/engine_setup/coolant_canister/C in world)
|
||||
switch(response)
|
||||
if("N2")
|
||||
C.canister_type = /obj/machinery/portable_atmospherics/canister/nitrogen/engine_setup/
|
||||
continue
|
||||
if("CO2")
|
||||
C.canister_type = /obj/machinery/portable_atmospherics/canister/carbon_dioxide/engine_setup/
|
||||
continue
|
||||
if("PH")
|
||||
C.canister_type = /obj/machinery/portable_atmospherics/canister/phoron/engine_setup/
|
||||
continue
|
||||
|
||||
for(var/obj/effect/engine_setup/core/C in world)
|
||||
switch(response)
|
||||
if("N2")
|
||||
C.energy_setting = ENERGY_NITROGEN
|
||||
continue
|
||||
if("CO2")
|
||||
C.energy_setting = ENERGY_CARBONDIOXIDE
|
||||
continue
|
||||
if("PH")
|
||||
C.energy_setting = ENERGY_PHORON
|
||||
continue
|
||||
|
||||
for(var/obj/effect/engine_setup/filter/F in world)
|
||||
F.coolant = response
|
||||
|
||||
// SETUP PHASE
|
||||
for(var/obj/effect/engine_setup/S in world)
|
||||
var/result = S.activate()
|
||||
switch(result)
|
||||
if(SETUP_OK)
|
||||
success++
|
||||
continue
|
||||
if(SETUP_WARNING)
|
||||
warnings++
|
||||
continue
|
||||
if(SETUP_ERROR)
|
||||
errors++
|
||||
log_and_message_admins("## SUPERMATTER SETUP - Error encountered! Aborting.")
|
||||
break
|
||||
|
||||
log_and_message_admins("## SUPERMATTER SETUP - Setup completed with [errors] errors, [warnings] warnings and [success] successful steps.")
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/effect/engine_setup/
|
||||
name = "Engine Setup Marker"
|
||||
desc = "You shouldn't see this."
|
||||
invisibility = 101
|
||||
anchored = 1
|
||||
density = 0
|
||||
icon = 'icons/mob/screen1.dmi'
|
||||
icon_state = "x2"
|
||||
|
||||
/obj/effect/engine_setup/proc/activate()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
// Tries to locate a pump, enables it, and sets it to MAX. Triggers warning if unable to locate a pump.
|
||||
/obj/effect/engine_setup/pump_max/
|
||||
name = "Pump Setup Marker"
|
||||
|
||||
/obj/effect/engine_setup/pump_max/activate()
|
||||
..()
|
||||
var/obj/machinery/atmospherics/binary/pump/P = locate() in get_turf(src)
|
||||
if(!P)
|
||||
log_and_message_admins("## WARNING: Unable to locate pump at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
P.target_pressure = P.max_pressure_setting
|
||||
P.use_power = 1
|
||||
P.update_icon()
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
|
||||
// Spawns an empty canister on this turf, if it has a connector port. Triggers warning if unable to find a connector port
|
||||
/obj/effect/engine_setup/empty_canister/
|
||||
name = "Empty Canister Marker"
|
||||
|
||||
/obj/effect/engine_setup/empty_canister/activate()
|
||||
..()
|
||||
var/obj/machinery/atmospherics/portables_connector/P = locate() in get_turf(src)
|
||||
if(!P)
|
||||
log_and_message_admins("## WARNING: Unable to locate connector port at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
new/obj/machinery/portable_atmospherics/canister(get_turf(src)) // Canisters automatically connect to connectors in New()
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
|
||||
|
||||
// Spawns a coolant canister on this turf, if it has a connector port.
|
||||
// Triggers error when unable to locate connector port or when coolant canister type is unset.
|
||||
/obj/effect/engine_setup/coolant_canister/
|
||||
name = "Coolant Canister Marker"
|
||||
var/canister_type = null
|
||||
|
||||
/obj/effect/engine_setup/coolant_canister/activate()
|
||||
..()
|
||||
var/obj/machinery/atmospherics/portables_connector/P = locate() in get_turf(src)
|
||||
if(!P)
|
||||
log_and_message_admins("## ERROR: Unable to locate coolant connector port at [x] [y] [z]!")
|
||||
return SETUP_ERROR
|
||||
if(!canister_type)
|
||||
log_and_message_admins("## ERROR: Canister type unset at [x] [y] [z]!")
|
||||
return SETUP_ERROR
|
||||
new canister_type(get_turf(src))
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
|
||||
// Energises the supermatter. Errors when unable to locate supermatter.
|
||||
/obj/effect/engine_setup/core/
|
||||
name = "Supermatter Core Marker"
|
||||
var/energy_setting = 0
|
||||
|
||||
/obj/effect/engine_setup/core/activate()
|
||||
..()
|
||||
var/obj/machinery/power/supermatter/SM = locate() in get_turf(src)
|
||||
if(!SM)
|
||||
log_and_message_admins("## ERROR: Unable to locate supermatter core at [x] [y] [z]!")
|
||||
return SETUP_ERROR
|
||||
if(!energy_setting)
|
||||
log_and_message_admins("## ERROR: Energy setting unset at [x] [y] [z]!")
|
||||
return SETUP_ERROR
|
||||
SM.power = energy_setting
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
|
||||
// Tries to enable the SMES on max input/output settings. With load balancing it should be fine as long as engine outputs at least ~500kW
|
||||
/obj/effect/engine_setup/smes/
|
||||
name = "SMES Marker"
|
||||
|
||||
/obj/effect/engine_setup/smes/activate()
|
||||
..()
|
||||
var/obj/machinery/power/smes/S = locate() in get_turf(src)
|
||||
if(!S)
|
||||
log_and_message_admins("## WARNING: Unable to locate SMES unit at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
S.input_attempt = 1
|
||||
S.output_attempt = 1
|
||||
S.input_level = S.input_level_max
|
||||
S.output_level = S.output_level_max
|
||||
S.update_icon()
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
|
||||
// Sets up filters. This assumes filters are set to filter out N2 back to the core loop by default!
|
||||
/obj/effect/engine_setup/filter/
|
||||
name = "Omni Filter Marker"
|
||||
var/coolant = null
|
||||
|
||||
/obj/effect/engine_setup/filter/activate()
|
||||
..()
|
||||
var/obj/machinery/atmospherics/omni/filter/F = locate() in get_turf(src)
|
||||
if(!F)
|
||||
log_and_message_admins("## WARNING: Unable to locate omni filter at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
if(!coolant)
|
||||
log_and_message_admins("## WARNING: No coolant type set at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
|
||||
// Non-nitrogen coolant, adjust the filter's config first.
|
||||
if(coolant != "N2")
|
||||
for(var/datum/omni_port/P in F.ports)
|
||||
if(P.mode != ATM_N2)
|
||||
continue
|
||||
if(coolant == "PH")
|
||||
P.mode = ATM_P
|
||||
break
|
||||
else if(coolant == "CO2")
|
||||
P.mode = ATM_CO2
|
||||
break
|
||||
else
|
||||
log_and_message_admins("## WARNING: Inapropriate filter coolant type set at [x] [y] [z]!")
|
||||
return SETUP_WARNING
|
||||
F.rebuild_filtering_list()
|
||||
|
||||
F.use_power = 1
|
||||
F.update_icon()
|
||||
return SETUP_OK
|
||||
|
||||
|
||||
#undef SETUP_OK
|
||||
#undef SETUP_WARNING
|
||||
#undef SETUP_ERROR
|
||||
#undef ENERGY_NITROGEN
|
||||
#undef ENERGY_CARBONDIOXIDE
|
||||
#undef ENERGY_PHORON
|
||||
Reference in New Issue
Block a user