mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Removes a very large amount of world loops. Adds a macro to painlessly generate a global list, and the needed code to modify the list when an object is made or deleted automatically. Cleans up some commented out code.
83 lines
2.4 KiB
Plaintext
83 lines
2.4 KiB
Plaintext
// temperature of the core of the sun
|
|
#define FUSION_HEAT_CAP 1.57e7
|
|
|
|
#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 SETUP_DELAYED 4 // Wait for other things first.
|
|
|
|
/datum/admins/proc/setup_fusion()
|
|
set category = "Debug"
|
|
set name = "Setup Fusion Core"
|
|
set desc = "Allows you to start the R-UST engine."
|
|
|
|
if (!istype(src,/datum/admins))
|
|
src = usr.client.holder
|
|
if (!istype(src,/datum/admins))
|
|
to_chat(usr, "Error: you are not an admin!")
|
|
return
|
|
|
|
if(!(locate(/obj/machinery/power/fusion_core/mapped) in machines))
|
|
to_chat(usr, "This map is not appropriate for this verb.")
|
|
return
|
|
|
|
var/response = input(usr, "Are you sure?", "Engine setup") as null|anything in list("No", "Yes")
|
|
if(!response || response == "No")
|
|
return
|
|
|
|
var/errors = 0
|
|
var/warnings = 0
|
|
var/success = 0
|
|
|
|
log_and_message_admins("## FUSION CORE SETUP - Setup initiated by [usr].")
|
|
|
|
for(var/obj/machinery/fusion_fuel_injector/mapped/injector in machines)
|
|
injector.cur_assembly = new /obj/item/weapon/fuel_assembly/deuterium(injector)
|
|
injector.BeginInjecting()
|
|
|
|
var/obj/machinery/power/fusion_core/mapped/core = locate() in machines
|
|
if(core.jumpstart(15000))
|
|
var/list/delayed_objects = list()
|
|
|
|
// SETUP PHASE
|
|
for(var/obj/effect/engine_setup/S in machines)
|
|
var/result = S.activate(0)
|
|
switch(result)
|
|
if(SETUP_OK)
|
|
success++
|
|
continue
|
|
if(SETUP_WARNING)
|
|
warnings++
|
|
continue
|
|
if(SETUP_ERROR)
|
|
errors++
|
|
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
|
|
break
|
|
if(SETUP_DELAYED)
|
|
delayed_objects.Add(S)
|
|
continue
|
|
|
|
if(!errors)
|
|
for(var/obj/effect/engine_setup/S in delayed_objects)
|
|
var/result = S.activate(1)
|
|
switch(result)
|
|
if(SETUP_OK)
|
|
success++
|
|
continue
|
|
if(SETUP_WARNING)
|
|
warnings++
|
|
continue
|
|
if(SETUP_ERROR)
|
|
errors++
|
|
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
|
|
break
|
|
else
|
|
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
|
|
errors++
|
|
|
|
log_and_message_admins("## FUSION CORE SETUP - Setup completed with [errors] errors, [warnings] warnings and [success] successful steps.")
|
|
|
|
#undef SETUP_OK
|
|
#undef SETUP_WARNING
|
|
#undef SETUP_ERROR
|
|
#undef SETUP_DELAYED |