[MIRROR] R-UST rises again.

This commit is contained in:
Chompstation Bot
2021-03-09 21:47:50 +00:00
committed by Darlantan
parent 611a6d1238
commit 2204cba6d8
21 changed files with 738 additions and 111 deletions

View File

@@ -2,13 +2,13 @@
TODO README TODO README
*/ */
var/list/fusion_cores = list() GLOBAL_LIST_EMPTY(fusion_cores)
#define MAX_FIELD_STR 1000 #define MAX_FIELD_STR 1000
#define MIN_FIELD_STR 1 #define MIN_FIELD_STR 1
/obj/machinery/power/fusion_core /obj/machinery/power/fusion_core
name = "\improper R-UST Mk. 8 Tokamak core" name = "\improper R-UST Mk. 9 Tokamak core"
desc = "An enormous solenoid for generating extremely high power electromagnetic fields. It includes a kinetic energy harvester." desc = "An enormous solenoid for generating extremely high power electromagnetic fields. It includes a kinetic energy harvester."
icon = 'icons/obj/machines/power/fusion.dmi' icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core0" icon_state = "core0"
@@ -20,16 +20,25 @@ var/list/fusion_cores = list()
circuit = /obj/item/weapon/circuitboard/fusion_core circuit = /obj/item/weapon/circuitboard/fusion_core
var/obj/item/hose_connector/output/Output
var/obj/effect/fusion_em_field/owned_field var/obj/effect/fusion_em_field/owned_field
var/field_strength = 1//0.01 var/field_strength = 1//0.01
var/target_field_strength = 1
var/id_tag var/id_tag
var/reactant_dump = FALSE // Does the tokomak actively try to syphon materials?
/obj/machinery/power/fusion_core/mapped /obj/machinery/power/fusion_core/mapped
anchored = 1 anchored = 1
/obj/machinery/power/fusion_core/Initialize() /obj/machinery/power/fusion_core/Initialize()
. = ..() . = ..()
fusion_cores += src GLOB.fusion_cores += src
Output = new(src)
create_reagents(10000)
default_apply_parts() default_apply_parts()
/obj/machinery/power/fusion_core/mapped/Initialize() /obj/machinery/power/fusion_core/mapped/Initialize()
@@ -41,14 +50,31 @@ var/list/fusion_cores = list()
FCC.connected_devices -= src FCC.connected_devices -= src
if(FCC.cur_viewed_device == src) if(FCC.cur_viewed_device == src)
FCC.cur_viewed_device = null FCC.cur_viewed_device = null
fusion_cores -= src GLOB.fusion_cores -= src
return ..() return ..()
/obj/machinery/power/fusion_core/proc/check_core_status()
if(stat & BROKEN)
return
if(idle_power_usage > avail())
return
. = 1
/obj/machinery/power/fusion_core/process() /obj/machinery/power/fusion_core/process()
if((stat & BROKEN) || !powernet || !owned_field) if((stat & BROKEN) || !powernet || !owned_field)
Shutdown() Shutdown()
if(Output.get_pairing())
reagents.trans_to_holder(Output.reagents, Output.reagents.maximum_volume)
if(prob(5))
visible_message("<span class='notice'>\The [src] gurgles as it exports fluid.</span>")
if(owned_field) if(owned_field)
set_strength(target_field_strength)
spawn(1) spawn(1)
owned_field.process()
owned_field.stability_monitor() owned_field.stability_monitor()
owned_field.radiation_scale() owned_field.radiation_scale()
owned_field.temp_dump() owned_field.temp_dump()
@@ -95,10 +121,12 @@ var/list/fusion_cores = list()
/obj/machinery/power/fusion_core/proc/set_strength(var/value) /obj/machinery/power/fusion_core/proc/set_strength(var/value)
value = CLAMP(value, MIN_FIELD_STR, MAX_FIELD_STR) value = CLAMP(value, MIN_FIELD_STR, MAX_FIELD_STR)
field_strength = value
update_active_power_usage(5 * value) if(field_strength != value)
if(owned_field) field_strength = value
owned_field.ChangeFieldStrength(value) update_active_power_usage(5 * value)
if(owned_field)
owned_field.ChangeFieldStrength(value)
/obj/machinery/power/fusion_core/attack_hand(var/mob/user) /obj/machinery/power/fusion_core/attack_hand(var/mob/user)
if(!Adjacent(user)) // As funny as it was for the AI to hug-kill the tokamak field from a distance... if(!Adjacent(user)) // As funny as it was for the AI to hug-kill the tokamak field from a distance...

View File

@@ -1,26 +1,46 @@
/obj/machinery/computer/fusion_core_control /obj/machinery/computer/fusion_core_control
name = "\improper R-UST Mk. 8 core control" name = "\improper R-UST Mk. 8 core control"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core_control"
light_color = COLOR_ORANGE light_color = COLOR_ORANGE
circuit = /obj/item/weapon/circuitboard/fusion_core_control circuit = /obj/item/weapon/circuitboard/fusion_core_control
var/id_tag
icon_keyboard = "tech_key"
icon_screen = "core_control"
// var/id_tag
var/scan_range = 25 var/scan_range = 25
var/list/connected_devices = list() var/list/connected_devices = list()
var/obj/machinery/power/fusion_core/cur_viewed_device var/obj/machinery/power/fusion_core/cur_viewed_device
var/datum/tgui_module/rustcore_monitor/monitor
/obj/machinery/computer/fusion_core_control/New()
..()
monitor = new(src)
/obj/machinery/computer/fusion_core_control/Destroy()
QDEL_NULL(monitor)
..()
/obj/machinery/computer/fusion_core_control/attackby(var/obj/item/thing, var/mob/user) /obj/machinery/computer/fusion_core_control/attackby(var/obj/item/thing, var/mob/user)
..() ..()
if(istype(thing, /obj/item/device/multitool)) if(istype(thing, /obj/item/device/multitool))
var/new_ident = input("Enter a new ident tag.", "Core Control", id_tag) as null|text var/new_ident = sanitize_text(input("Enter a new ident tag.", "Core Control", monitor.core_tag) as null|text)
if(new_ident && user.Adjacent(src)) if(new_ident && user.Adjacent(src))
id_tag = new_ident monitor.core_tag = new_ident
cur_viewed_device = null // id_tag = new_ident
// cur_viewed_device = null
return return
/obj/machinery/computer/fusion_core_control/attack_ai(mob/user) /obj/machinery/computer/fusion_core_control/attack_ai(mob/user)
attack_hand(user) attack_hand(user)
/obj/machinery/computer/fusion_core_control/attack_hand(var/mob/user as mob)
..()
if(stat & (BROKEN|NOPOWER))
return
monitor.tgui_interact(user)
/*
/obj/machinery/computer/fusion_core_control/attack_hand(mob/user) /obj/machinery/computer/fusion_core_control/attack_hand(mob/user)
add_fingerprint(user) add_fingerprint(user)
interact(user) interact(user)
@@ -47,10 +67,11 @@
if(cur_viewed_device) if(cur_viewed_device)
dat += {" dat += {"
<a href='?src=\ref[src];goto_scanlist=1'>Back to overview</a><hr> <a href='?src=\ref[src];goto_scanlist=1'>Back to overview</a><hr>
Device ident '[cur_viewed_device.id_tag]' <span style='color: [cur_viewed_device.owned_field ? "green" : "red"]'>[cur_viewed_device.owned_field ? "active" : "inactive"].</span><br> Device ident '[cur_viewed_device.id_tag]' <span style='color: [cur_viewed_device.owned_field ? "green" : "red"]'>[cur_viewed_device.owned_field ? "Active" : "Inactive"].</span><br>
<b>Power status:</b> [cur_viewed_device.avail()]/[cur_viewed_device.active_power_usage] W<br> <b>Power status:</b> [cur_viewed_device.avail()]/[cur_viewed_device.active_power_usage] W<br>
<hr> <hr>
<a href='?src=\ref[src];toggle_active=1'>Bring field [cur_viewed_device.owned_field ? "offline" : "online"].</a><br> <b>Field Status:</b> <span style='color: [cur_viewed_device.owned_field ? "red" : "green"]'><a href='?src=\ref[src];toggle_active=1'>[cur_viewed_device.owned_field ? "Online" : "Offline"].</a></span><br>
<b>Reactant Dump:</b> <a href='?src=\ref[src];syphon=1'><span style='color: [cur_viewed_device.owned_field ? "red" : "green"]'>[cur_viewed_device.reactant_dump ? "Active" : "Inactive"].</span></a><br>
<hr> <hr>
<b>Field power density (W.m<sup>-3</sup>):</b><br> <b>Field power density (W.m<sup>-3</sup>):</b><br>
<a href='?src=\ref[src];str=-1000'>----</a> <a href='?src=\ref[src];str=-1000'>----</a>
@@ -169,16 +190,16 @@
updateUsrDialog() updateUsrDialog()
return 1 return 1
if(href_list["syphon"])
cur_viewed_device.reactant_dump = !cur_viewed_device.reactant_dump
updateUsrDialog()
*/
//Returns 1 if the machine can be interacted with via this console. //Returns 1 if the machine can be interacted with via this console.
/obj/machinery/computer/fusion_core_control/proc/check_core_status(var/obj/machinery/power/fusion_core/C) /obj/machinery/computer/fusion_core_control/proc/check_core_status(var/obj/machinery/power/fusion_core/C)
if(isnull(C)) return istype(C) ? C.check_core_status() : FALSE
return
if(C.stat & BROKEN)
return
if(C.idle_power_usage > C.avail())
return
. = 1
/*
/obj/machinery/computer/fusion_core_control/update_icon() /obj/machinery/computer/fusion_core_control/update_icon()
if(stat & (BROKEN)) if(stat & (BROKEN))
icon = 'icons/obj/computer.dmi' icon = 'icons/obj/computer.dmi'
@@ -194,3 +215,4 @@
icon = initial(icon) icon = initial(icon)
icon_state = initial(icon_state) icon_state = initial(icon_state)
set_light(light_range_on, light_power_on) set_light(light_range_on, light_power_on)
*/

View File

@@ -117,8 +117,6 @@
catcher.SetSize(7) catcher.SetSize(7)
particle_catchers.Add(catcher) particle_catchers.Add(catcher)
START_PROCESSING(SSobj, src)
/obj/effect/fusion_em_field/process() /obj/effect/fusion_em_field/process()
//make sure the field generator is still intact //make sure the field generator is still intact
if(!owned_core || QDELETED(owned_core)) if(!owned_core || QDELETED(owned_core))
@@ -161,6 +159,13 @@
dormant_reactant_quantities[reactant] -= radiate dormant_reactant_quantities[reactant] -= radiate
radiation += radiate radiation += radiate
if(owned_core.reactant_dump)
var/datum/material/Mat = get_material_by_name(reactant)
// If the reactor won't be able to produce a sheet during shutdown with the material, it can syphon it from the field into internal storage.
if(!Mat && amount > 1000 && owned_core.reagents.add_reagent(reactant, 0.1)) // If you want to get ingots / sheets from the tokomak, you have to shut it down, hopefully safely. Reactor reactants are either gas with a corresponding reagent IE Oxygen, Phoron, a Material which condenses uniquely on its own, or just a reagent.
dormant_reactant_quantities[reactant] -= 1000
var/use_range var/use_range
var/use_power var/use_power
if(plasma_temperature <= 6000) if(plasma_temperature <= 6000)
@@ -309,6 +314,21 @@
// Radiate all our unspent fuel and energy. // Radiate all our unspent fuel and energy.
for(var/particle in dormant_reactant_quantities) for(var/particle in dormant_reactant_quantities)
radiation += dormant_reactant_quantities[particle] radiation += dormant_reactant_quantities[particle]
var/datum/material/Mat = get_material_by_name(particle)
if(Mat)
while(dormant_reactant_quantities[particle] > 0)
var/present_amount = dormant_reactant_quantities[particle] / 10000 // Reset this to the amount of the reagent present.
if(present_amount >= 20 && Mat.stack_type)
var/obj/S = new Mat.stack_type
dormant_reactant_quantities[particle] -= 20
S.throw_at_random(FALSE, 7, 3)
else
dormant_reactant_quantities[particle] = 0
dormant_reactant_quantities.Remove(particle) dormant_reactant_quantities.Remove(particle)
radiation += plasma_temperature/2 radiation += plasma_temperature/2
plasma_temperature = 0 plasma_temperature = 0
@@ -496,7 +516,6 @@
if(owned_core) if(owned_core)
owned_core.owned_field = null owned_core.owned_field = null
owned_core = null owned_core = null
STOP_PROCESSING(SSobj, src)
. = ..() . = ..()
/obj/effect/fusion_em_field/bullet_act(var/obj/item/projectile/Proj) /obj/effect/fusion_em_field/bullet_act(var/obj/item/projectile/Proj)
@@ -579,8 +598,7 @@
RadiateAll() RadiateAll()
var/list/things_in_range = range(10, owned_core) var/list/things_in_range = range(10, owned_core)
var/list/turfs_in_range = list() var/list/turfs_in_range = list()
var/turf/T for (var/turf/T in things_in_range)
for (T in things_in_range)
turfs_in_range.Add(T) turfs_in_range.Add(T)
explosion(pick(things_in_range), -1, 5, 5, 5) explosion(pick(things_in_range), -1, 5, 5, 5)
@@ -605,8 +623,7 @@
set_light(15, 15, "#ff00d8") set_light(15, 15, "#ff00d8")
var/list/things_in_range = range(15, owned_core) var/list/things_in_range = range(15, owned_core)
var/list/turfs_in_range = list() var/list/turfs_in_range = list()
var/turf/T for (var/turf/T in things_in_range)
for (T in things_in_range)
turfs_in_range.Add(T) turfs_in_range.Add(T)
for(var/loopcount = 1 to 10) for(var/loopcount = 1 to 10)
spawn(200) spawn(200)
@@ -618,8 +635,7 @@
global_announcer.autosay("Warning! Quantum fluxuation detected! Flammable gas release expected.", "Field Stability Monitor") global_announcer.autosay("Warning! Quantum fluxuation detected! Flammable gas release expected.", "Field Stability Monitor")
var/list/things_in_range = range(15, owned_core) var/list/things_in_range = range(15, owned_core)
var/list/turfs_in_range = list() var/list/turfs_in_range = list()
var/turf/T for (var/turf/T in things_in_range)
for (T in things_in_range)
turfs_in_range.Add(T) turfs_in_range.Add(T)
for(var/loopcount = 1 to 10) for(var/loopcount = 1 to 10)
var/turf/TT = get_turf(pick(turfs_in_range)) var/turf/TT = get_turf(pick(turfs_in_range))
@@ -660,8 +676,7 @@
RadiateAll() RadiateAll()
var/list/things_in_range = range(10, owned_core) var/list/things_in_range = range(10, owned_core)
var/list/turfs_in_range = list() var/list/turfs_in_range = list()
var/turf/T for (var/turf/T in things_in_range)
for (T in things_in_range)
turfs_in_range.Add(T) turfs_in_range.Add(T)
for(var/loopcount = 1 to 10) for(var/loopcount = 1 to 10)
explosion(pick(things_in_range), -1, 5, 5, 5) explosion(pick(things_in_range), -1, 5, 5, 5)

View File

@@ -10,7 +10,7 @@
var/fuel_type = "composite" var/fuel_type = "composite"
var/fuel_colour var/fuel_colour
var/radioactivity = 0 var/radioactivity = 0
var/const/initial_amount = 300 var/const/initial_amount = 3000000
/obj/item/weapon/fuel_assembly/New(var/newloc, var/_material, var/_colour) /obj/item/weapon/fuel_assembly/New(var/newloc, var/_material, var/_colour)
fuel_type = _material fuel_type = _material

View File

@@ -22,8 +22,8 @@
if(thing.reagents.reagent_list.len > 1) if(thing.reagents.reagent_list.len > 1)
to_chat(user, "<span class='warning'>The contents of \the [thing] are impure and cannot be used as fuel.</span>") to_chat(user, "<span class='warning'>The contents of \the [thing] are impure and cannot be used as fuel.</span>")
return 1 return 1
if(thing.reagents.total_volume < 50) if(thing.reagents.total_volume < 300)
to_chat(user, "<span class='warning'>You need at least fifty units of material to form a fuel rod.</span>") to_chat(user, "<span class='warning'>You need at least three hundred units of material to form a fuel rod.</span>")
return 1 return 1
var/datum/reagent/R = thing.reagents.reagent_list[1] var/datum/reagent/R = thing.reagents.reagent_list[1]
visible_message("<span class='notice'>\The [src] compresses the contents of \the [thing] into a new fuel assembly.</span>") visible_message("<span class='notice'>\The [src] compresses the contents of \the [thing] into a new fuel assembly.</span>")
@@ -51,6 +51,7 @@
if(istype(thing, /obj/item/stack/material)) if(istype(thing, /obj/item/stack/material))
var/obj/item/stack/material/M = thing var/obj/item/stack/material/M = thing
var/datum/material/mat = M.get_material() var/datum/material/mat = M.get_material()
<<<<<<< HEAD
if(!blitzprogress) if(!blitzprogress)
if(!mat.is_fusion_fuel) if(!mat.is_fusion_fuel)
to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>") to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>")
@@ -82,6 +83,29 @@
else else
to_chat(user, "<span class='warning'>A blitz rod is currently in progress! Either add 25 phoron sheets to complete it, or eject the supermatter sheet!</span>") to_chat(user, "<span class='warning'>A blitz rod is currently in progress! Either add 25 phoron sheets to complete it, or eject the supermatter sheet!</span>")
return return
||||||| parent of d0ad1a4c89... Merge pull request #9756 from VOREStation/upstream-merge-7835
if(!mat.is_fusion_fuel)
to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>")
return
if(M.get_amount() < 25)
to_chat(user, "<span class='warning'>You need at least 25 [mat.sheet_plural_name] to make a fuel rod.</span>")
return
var/obj/item/weapon/fuel_assembly/F = new(get_turf(src), mat.name)
visible_message("<span class='notice'>\The [src] compresses the [mat.use_name] into a new fuel assembly.</span>")
M.use(25)
user.put_in_hands(F)
=======
if(!mat.is_fusion_fuel)
to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>")
return
if(M.get_amount() < 15)
to_chat(user, "<span class='warning'>You need at least 25 [mat.sheet_plural_name] to make a fuel rod.</span>")
return
var/obj/item/weapon/fuel_assembly/F = new(get_turf(src), mat.name)
visible_message("<span class='notice'>\The [src] compresses the [mat.use_name] into a new fuel assembly.</span>")
M.use(15)
user.put_in_hands(F)
>>>>>>> d0ad1a4c89... Merge pull request #9756 from VOREStation/upstream-merge-7835
else if(do_special_fuel_compression(thing, user)) else if(do_special_fuel_compression(thing, user))
return return

View File

@@ -1,16 +1,34 @@
/obj/machinery/computer/fusion_fuel_control /obj/machinery/computer/fusion_fuel_control
name = "fuel injection control computer" name = "fuel injection control computer"
desc = "Displays information about the fuel rods." desc = "Displays information about the fuel rods."
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "fuel"
circuit = /obj/item/weapon/circuitboard/fusion_fuel_control circuit = /obj/item/weapon/circuitboard/fusion_fuel_control
icon_keyboard = "tech_key"
icon_screen = "fuel_screen"
var/id_tag var/id_tag
var/scan_range = 25 var/scan_range = 25
var/datum/tgui_module/rustfuel_control/monitor
/obj/machinery/computer/fusion_fuel_control/attack_ai(mob/user) /obj/machinery/computer/fusion_fuel_control/New()
..()
monitor = new(src)
/obj/machinery/computer/fusion_fuel_control/Destroy()
QDEL_NULL(monitor)
..()
/obj/machinery/computer/fusion_fuel_control/attack_ai(var/mob/user)
attack_hand(user) attack_hand(user)
/obj/machinery/computer/fusion_fuel_control/attack_hand(var/mob/user as mob)
..()
if(stat & (BROKEN|NOPOWER))
return
monitor.tgui_interact(user)
/*
/obj/machinery/computer/fusion_fuel_control/attack_hand(mob/user) /obj/machinery/computer/fusion_fuel_control/attack_hand(mob/user)
add_fingerprint(user) add_fingerprint(user)
interact(user) interact(user)
@@ -93,16 +111,17 @@
usr.unset_machine() usr.unset_machine()
updateDialog() updateDialog()
*/
/obj/machinery/computer/fusion_fuel_control/attackby(var/obj/item/W, var/mob/user) /obj/machinery/computer/fusion_fuel_control/attackby(var/obj/item/W, var/mob/user)
..() ..()
if(istype(W, /obj/item/device/multitool)) if(istype(W, /obj/item/device/multitool))
var/new_ident = input("Enter a new ident tag.", "Fuel Control", id_tag) as null|text var/new_ident = input("Enter a new ident tag.", "Fuel Control", monitor.fuel_tag) as null|text
if(new_ident && user.Adjacent(src)) if(new_ident && user.Adjacent(src))
id_tag = new_ident monitor.fuel_tag = new_ident
return return
/*
/obj/machinery/computer/fusion_fuel_control/update_icon() /obj/machinery/computer/fusion_fuel_control/update_icon()
if(stat & (BROKEN)) if(stat & (BROKEN))
icon = 'icons/obj/computer.dmi' icon = 'icons/obj/computer.dmi'
@@ -118,3 +137,4 @@
icon = initial(icon) icon = initial(icon)
icon_state = initial(icon_state) icon_state = initial(icon_state)
set_light(light_range_on, light_power_on) set_light(light_range_on, light_power_on)
*/

View File

@@ -1,4 +1,4 @@
var/list/fuel_injectors = list() GLOBAL_LIST_EMPTY(fuel_injectors)
/obj/machinery/fusion_fuel_injector /obj/machinery/fusion_fuel_injector
name = "fuel injector" name = "fuel injector"
@@ -13,21 +13,21 @@ var/list/fuel_injectors = list()
circuit = /obj/item/weapon/circuitboard/fusion_injector circuit = /obj/item/weapon/circuitboard/fusion_injector
var/fuel_usage = 0.0001 var/fuel_usage = 30
var/id_tag var/id_tag
var/injecting = 0 var/injecting = 0
var/obj/item/weapon/fuel_assembly/cur_assembly var/obj/item/weapon/fuel_assembly/cur_assembly
/obj/machinery/fusion_fuel_injector/Initialize() /obj/machinery/fusion_fuel_injector/Initialize()
. = ..() . = ..()
fuel_injectors += src GLOB.fuel_injectors += src
default_apply_parts() default_apply_parts()
/obj/machinery/fusion_fuel_injector/Destroy() /obj/machinery/fusion_fuel_injector/Destroy()
if(cur_assembly) if(cur_assembly)
cur_assembly.forceMove(get_turf(src)) cur_assembly.forceMove(get_turf(src))
cur_assembly = null cur_assembly = null
fuel_injectors -= src GLOB.fuel_injectors -= src
return ..() return ..()
/obj/machinery/fusion_fuel_injector/mapped /obj/machinery/fusion_fuel_injector/mapped
@@ -130,15 +130,14 @@ var/list/fuel_injectors = list()
var/amount_left = 0 var/amount_left = 0
for(var/reagent in cur_assembly.rod_quantities) for(var/reagent in cur_assembly.rod_quantities)
if(cur_assembly.rod_quantities[reagent] > 0) if(cur_assembly.rod_quantities[reagent] > 0)
var/amount = cur_assembly.rod_quantities[reagent] * fuel_usage var/numparticles = fuel_usage
var/numparticles = round(amount * 1000)
if(numparticles < 1) if(numparticles < 1)
numparticles = 1 numparticles = 1
var/obj/effect/accelerated_particle/A = new/obj/effect/accelerated_particle(get_turf(src), dir) var/obj/effect/accelerated_particle/A = new/obj/effect/accelerated_particle(get_turf(src), dir)
A.particle_type = reagent A.particle_type = reagent
A.additional_particles = numparticles - 1 A.additional_particles = numparticles - 1
if(cur_assembly) if(cur_assembly)
cur_assembly.rod_quantities[reagent] -= amount cur_assembly.rod_quantities[reagent] -= fuel_usage
amount_left += cur_assembly.rod_quantities[reagent] amount_left += cur_assembly.rod_quantities[reagent]
if(cur_assembly) if(cur_assembly)
cur_assembly.percent_depleted = amount_left / cur_assembly.initial_amount cur_assembly.percent_depleted = amount_left / cur_assembly.initial_amount

View File

@@ -1,4 +1,5 @@
var/list/gyrotrons = list()
GLOBAL_LIST_EMPTY(gyrotrons)
/obj/machinery/power/emitter/gyrotron /obj/machinery/power/emitter/gyrotron
name = "gyrotron" name = "gyrotron"
@@ -21,13 +22,13 @@ var/list/gyrotrons = list()
state = 2 state = 2
/obj/machinery/power/emitter/gyrotron/Initialize() /obj/machinery/power/emitter/gyrotron/Initialize()
gyrotrons += src GLOB.gyrotrons += src
update_active_power_usage(mega_energy * 50000) update_active_power_usage(mega_energy * 50000)
default_apply_parts() default_apply_parts()
. = ..() . = ..()
/obj/machinery/power/emitter/gyrotron/Destroy() /obj/machinery/power/emitter/gyrotron/Destroy()
gyrotrons -= src GLOB.gyrotrons -= src
return ..() return ..()
/obj/machinery/power/emitter/gyrotron/process() /obj/machinery/power/emitter/gyrotron/process()

View File

@@ -1,17 +1,35 @@
/obj/machinery/computer/gyrotron_control /obj/machinery/computer/gyrotron_control
name = "gyrotron control console" name = "gyrotron control console"
desc = "Used to control the R-UST stability beams." desc = "Used to control the R-UST stability beams."
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "engine"
light_color = COLOR_BLUE light_color = COLOR_BLUE
circuit = /obj/item/weapon/circuitboard/gyrotron_control circuit = /obj/item/weapon/circuitboard/gyrotron_control
icon_keyboard = "generic_key"
icon_screen = "mass_driver"
var/id_tag var/id_tag
var/scan_range = 25 var/scan_range = 25
var/datum/tgui_module/gyrotron_control/monitor
/obj/machinery/computer/gyrotron_control/New()
..()
monitor = new(src)
/obj/machinery/computer/gyrotron_control/Destroy()
QDEL_NULL(monitor)
..()
/obj/machinery/computer/gyrotron_control/attack_ai(var/mob/user) /obj/machinery/computer/gyrotron_control/attack_ai(var/mob/user)
attack_hand(user) attack_hand(user)
/obj/machinery/computer/gyrotron_control/attack_hand(var/mob/user as mob)
..()
if(stat & (BROKEN|NOPOWER))
return
monitor.tgui_interact(user)
/*
/obj/machinery/computer/gyrotron_control/attack_hand(var/mob/user) /obj/machinery/computer/gyrotron_control/attack_hand(var/mob/user)
add_fingerprint(user) add_fingerprint(user)
interact(user) interact(user)
@@ -94,15 +112,16 @@
return 1 return 1
return 0 return 0
*/
/obj/machinery/computer/gyrotron_control/attackby(var/obj/item/W, var/mob/user) /obj/machinery/computer/gyrotron_control/attackby(var/obj/item/W, var/mob/user)
..() ..()
if(istype(W, /obj/item/device/multitool)) if(istype(W, /obj/item/device/multitool))
var/new_ident = input("Enter a new ident tag.", "Gyrotron Control", id_tag) as null|text var/new_ident = input("Enter a new ident tag.", "Gyrotron Control", monitor.gyro_tag) as null|text
if(new_ident && user.Adjacent(src)) if(new_ident && user.Adjacent(src))
id_tag = new_ident monitor.gyro_tag = new_ident
return return
/*
/obj/machinery/computer/gyrotron_control/update_icon() /obj/machinery/computer/gyrotron_control/update_icon()
if(stat & (BROKEN)) if(stat & (BROKEN))
icon = 'icons/obj/computer.dmi' icon = 'icons/obj/computer.dmi'
@@ -118,3 +137,4 @@
icon = initial(icon) icon = initial(icon)
icon_state = initial(icon_state) icon_state = initial(icon_state)
set_light(light_range_on, light_power_on) set_light(light_range_on, light_power_on)
*/

View File

@@ -13,19 +13,41 @@
var/active = 0 //are we even on? var/active = 0 //are we even on?
var/id_tag //needed for !!rasins!! var/id_tag //needed for !!rasins!!
/obj/machinery/power/hydromagnetic_trap/process() /obj/machinery/power/hydromagnetic_trap/attackby(var/obj/item/W, var/mob/user)
if(!powernet && anchored == 1) if(default_unfasten_wrench(user, W))
return return
spawn(1)
Active() return ..()
Search()
/obj/machinery/power/hydromagnetic_trap/process()
if(anchored)
if(!powernet)
src.active = 0
connect_to_network()
if(powernet)
spawn(1)
Active()
Search()
else
if(powernet)
active_field.Cut()
disconnect_from_network()
/obj/machinery/power/hydromagnetic_trap/proc/Search()//let's not have +100 instances of the same field in active_field. /obj/machinery/power/hydromagnetic_trap/proc/Search()//let's not have +100 instances of the same field in active_field.
things_in_range = range(7, src) things_in_range = range(7, src)
var/obj/effect/fusion_em_field/FFF for (var/obj/effect/fusion_em_field/FFF in things_in_range)
for (FFF in things_in_range)
fields_in_range.Add(FFF) fields_in_range.Add(FFF)
for (FFF in fields_in_range)
listclearnulls(active_field)
listclearnulls(fields_in_range)
for (var/obj/effect/fusion_em_field/FFF in fields_in_range)
if(get_dist(src, FFF) > 7)
fields_in_range.Remove(FFF)
continue
if (active_field.len > 0) if (active_field.len > 0)
return return
else if (active_field.len == 0) else if (active_field.len == 0)
@@ -35,17 +57,14 @@
/obj/machinery/power/hydromagnetic_trap/proc/Link() //discover our EM field /obj/machinery/power/hydromagnetic_trap/proc/Link() //discover our EM field
var/obj/effect/fusion_em_field/FFF var/obj/effect/fusion_em_field/FFF
for(FFF in fields_in_range) for(FFF in fields_in_range)
if (FFF.id_tag != id_tag)
return
active_field += FFF active_field += FFF
active = 1 active = 1
return return
/obj/machinery/power/hydromagnetic_trap/proc/Active()//POWERRRRR /obj/machinery/power/hydromagnetic_trap/proc/Active()//POWERRRRR
var/obj/effect/fusion_em_field/FF
if (active == 0) if (active == 0)
return return
for (FF in active_field) for (var/obj/effect/fusion_em_field/FF in active_field)
if (FF.plasma_temperature >= MINIMUM_PLASMA_TEMPERATURE) if (FF.plasma_temperature >= MINIMUM_PLASMA_TEMPERATURE)
icon_state = "mag_trap1" icon_state = "mag_trap1"
add_avail(ENERGY_PER_K * FF.plasma_temperature) add_avail(ENERGY_PER_K * FF.plasma_temperature)

View File

@@ -0,0 +1,73 @@
/datum/tgui_module/gyrotron_control
name = "Gyrotron Control"
tgui_id = "GyrotronControl"
var/gyro_tag = ""
/datum/tgui_module/gyrotron_control/tgui_act(action, params)
if(..())
return TRUE
for(var/parameter in params)
to_world("[parameter] - [params[parameter]]")
switch(action)
if("toggle_active")
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
if(!istype(G))
return 0
G.activate(usr)
return 1
if("set_tag")
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Gyrotron Control", gyro_tag) as null|text)
if(new_ident)
gyro_tag = new_ident
if("set_str")
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
if(!istype(G))
return 0
var/new_strength = params["str"]
G.mega_energy = new_strength
return 1
if("set_rate")
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
if(!istype(G))
return 0
var/new_delay = params["rate"]
G.rate = new_delay
return 1
/datum/tgui_module/gyrotron_control/tgui_data(mob/user)
var/list/data = list()
var/list/gyros = list()
for(var/obj/machinery/power/emitter/gyrotron/G in GLOB.gyrotrons)
if(G.id_tag == gyro_tag)
gyros.Add(list(list(
"name" = G.name,
"active" = G.active,
"strength" = G.mega_energy,
"fire_delay" = G.rate,
"deployed" = (G.state == 2),
"x" = G.x,
"y" = G.y,
"z" = G.z,
"ref" = "\ref[G]"
)))
data["gyros"] = gyros
return data
/datum/tgui_module/gyrotron_control/ntos
ntos = TRUE

View File

@@ -0,0 +1,84 @@
/datum/tgui_module/rustcore_monitor
name = "R-UST Core Monitoring"
tgui_id = "RustCoreMonitor"
var/core_tag = ""
/datum/tgui_module/rustcore_monitor/tgui_act(action, params)
if(..())
return TRUE
for(var/parameter in params)
to_world("[parameter] - [params[parameter]]")
switch(action)
if("toggle_active")
var/obj/machinery/power/fusion_core/C = locate(params["core"])
if(!istype(C))
return FALSE
if(!C.Startup()) //Startup() whilst the device is active will return null.
C.Shutdown()
return TRUE
if("toggle_reactantdump")
var/obj/machinery/power/fusion_core/C = locate(params["core"])
if(!istype(C))
return FALSE
C.reactant_dump = !C.reactant_dump
return TRUE
if("set_tag")
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Core Control", core_tag) as null|text)
if(new_ident)
core_tag = new_ident
if("set_fieldstr")
var/obj/machinery/power/fusion_core/C = locate(params["core"])
if(!istype(C))
return FALSE
var/new_strength = params["fieldstr"]
C.target_field_strength = new_strength
return TRUE
/datum/tgui_module/rustcore_monitor/tgui_data(mob/user)
var/list/data = list()
var/list/cores = list()
for(var/obj/machinery/power/fusion_core/C in GLOB.fusion_cores)
if(C.id_tag == core_tag)
var/list/reactants = list()
if(C.owned_field)
for(var/reagent in C.owned_field.dormant_reactant_quantities)
reactants.Add(list(list(
"name" = reagent,
"amount" = C.owned_field.dormant_reactant_quantities[reagent]
)))
for(var/list/reactant in reactants)
to_world("[reactant[1]] [reactant[2]]")
cores.Add(list(list(
"name" = C.name,
"has_field" = C.owned_field ? TRUE : FALSE,
"reactant_dump" = C.reactant_dump,
"core_operational" = C.check_core_status(),
"field_instability" = (C.owned_field ? "[C.owned_field.percent_unstable * 100]%" : "ERROR"),
"field_temperature" = (C.owned_field ? "[C.owned_field.plasma_temperature + 295]K" : "ERROR"),
"field_strength" = C.field_strength,
"target_field_strength" = C.target_field_strength,
"x" = C.x,
"y" = C.y,
"z" = C.z,
"ref" = "\ref[C]"
)))
data["cores"] = cores
return data
/datum/tgui_module/rustcore_monitor/ntos
ntos = TRUE

View File

@@ -0,0 +1,54 @@
/datum/tgui_module/rustfuel_control
name = "Fuel Injector Control"
tgui_id = "RustFuelControl"
var/fuel_tag = ""
/datum/tgui_module/rustfuel_control/tgui_act(action, params)
if(..())
return TRUE
for(var/parameter in params)
to_world("[parameter] - [params[parameter]]")
switch(action)
if("toggle_active")
var/obj/machinery/fusion_fuel_injector/FI = locate(params["fuel"])
if(!istype(FI))
return FALSE
if(FI.injecting)
FI.StopInjecting()
else
FI.BeginInjecting()
return TRUE
if("set_tag")
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Gyrotron Control", fuel_tag) as null|text)
if(new_ident)
fuel_tag = new_ident
/datum/tgui_module/rustfuel_control/tgui_data(mob/user)
var/list/data = list()
var/list/fuels = list()
for(var/obj/machinery/fusion_fuel_injector/FI in GLOB.fuel_injectors)
if(FI.id_tag == fuel_tag)
fuels.Add(list(list(
"name" = FI.name,
"active" = FI.injecting,
"fuel_type" = (FI.cur_assembly ? FI.cur_assembly.fuel_type : "NONE"),
"fuel_amt" = (FI.cur_assembly ? "[FI.cur_assembly.percent_depleted * 100]%" : "NONE"),
"deployed" = FI.anchored,
"x" = FI.x,
"y" = FI.y,
"z" = FI.z,
"ref" = "\ref[FI]"
)))
data["fuels"] = fuels
return data
/datum/tgui_module/rustfuel_control/ntos
ntos = TRUE

View File

@@ -10,19 +10,19 @@
if("toggle_enable") if("toggle_enable")
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"]) var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
if(!istype(S)) if(!istype(S))
return 0 return FALSE
S.close_on_leaks = !S.close_on_leaks S.close_on_leaks = !S.close_on_leaks
return 1 return TRUE
if("toggle_open") if("toggle_open")
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"]) var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
if(!istype(S)) if(!istype(S))
return 0 return FALSE
if(S.open) if(S.open)
S.close() S.close()
else else
S.open() S.open()
return 1 return TRUE
/datum/tgui_module/shutoff_monitor/tgui_data(mob/user) /datum/tgui_module/shutoff_monitor/tgui_data(mob/user)
var/list/data = list() var/list/data = list()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -279,9 +279,7 @@
/turf/simulated/floor/reinforced, /turf/simulated/floor/reinforced,
/area/engineering/engine_room) /area/engineering/engine_room)
"aQ" = ( "aQ" = (
/obj/machinery/computer/fusion_core_control{ /obj/machinery/computer/fusion_core_control,
id_tag = "engine"
},
/turf/simulated/floor, /turf/simulated/floor,
/area/engineering/engine_room) /area/engineering/engine_room)
"aR" = ( "aR" = (

View File

@@ -0,0 +1,88 @@
import { useBackend } from "../backend";
import { Window } from "../layouts";
import { Button, Section, Table, Knob } from "../components";
export const GyrotronControl = (props, context) => (
<Window
width={627}
height={700}
resizable>
<Window.Content>
<GyrotronControlContent />
</Window.Content>
</Window>
);
export const GyrotronControlContent = (props, context) => {
const { act, data } = useBackend(context);
const {
gyros,
} = data;
return (
<Section title="Gyrotrons"
buttons={(
<Button
icon="pencil-alt"
content={"Set Tag"}
onClick={() => act("set_tag")} />
)}>
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
<Table.Cell>Position</Table.Cell>
<Table.Cell>Status</Table.Cell>
<Table.Cell>Fire Delay</Table.Cell>
<Table.Cell>Strength</Table.Cell>
</Table.Row>
{gyros.map(gyro => (
<Table.Row key={gyro.name}>
<Table.Cell>{gyro.name}</Table.Cell>
<Table.Cell>{gyro.x}, {gyro.y}, {gyro.z}</Table.Cell>
<Table.Cell>
<Button
icon="power-off"
content={gyro.active ? "Online" : "Offline"}
selected={gyro.active}
disabled={!gyro.deployed}
onClick={() => act("toggle_active", {
gyro: gyro.ref,
})} />
</Table.Cell>
<Table.Cell>
<Knob
forcedInputWidth="60px"
size={1.25}
color={!!gyro.active && 'yellow'}
value={gyro.fire_delay}
unit="decisecond(s)"
minValue={1}
maxValue={60}
stepPixelSize={1}
onDrag={(e, value) => act('set_rate', {
gyro: gyro.ref,
rate: value,
})} />
</Table.Cell>
<Table.Cell>
<Knob
forcedInputWidth="60px"
size={1.25}
color={!!gyro.active && 'yellow'}
value={gyro.strength}
unit="penta-dakw"
minValue={1}
maxValue={50}
stepPixelSize={1}
onDrag={(e, value) => act('set_str', {
gyro: gyro.ref,
str: value,
})} />
</Table.Cell>
</Table.Row>
))}
</Table>
</Section>
);
};

View File

@@ -0,0 +1,89 @@
import { useBackend } from "../backend";
import { Window } from "../layouts";
import { Button, Section, Table, Knob } from "../components";
export const RustCoreMonitor = (props, context) => (
<Window
width={627}
height={700}
resizable>
<Window.Content>
<RustCoreMonitorContent />
</Window.Content>
</Window>
);
export const RustCoreMonitorContent = (props, context) => {
const { act, data } = useBackend(context);
const {
cores,
} = data;
return (
<Section title="Cores"
buttons={(
<Button
icon="pencil-alt"
content={"Set Tag"}
onClick={() => act("set_tag")} />
)}>
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
<Table.Cell>Position</Table.Cell>
<Table.Cell>Field Status</Table.Cell>
<Table.Cell>Reactant Mode</Table.Cell>
<Table.Cell>Field Instability</Table.Cell>
<Table.Cell>Field Temperature</Table.Cell>
<Table.Cell>Field Strength</Table.Cell>
<Table.Cell>Plasma Content</Table.Cell>
</Table.Row>
{cores.map(core => (
<Table.Row key={core.name}>
<Table.Cell>{core.name}</Table.Cell>
<Table.Cell>{core.x}, {core.y}, {core.z}</Table.Cell>
<Table.Cell>
<Button
icon="power-off"
content={core.has_field ? "Online" : "Offline"}
selected={core.has_field}
disabled={!core.core_operational}
onClick={() => act("toggle_active", {
core: core.ref,
})} />
</Table.Cell>
<Table.Cell>
<Button
icon="power-off"
content={core.reactant_dump ? "Dump" : "Maintain"}
selected={core.has_field}
disabled={!core.core_operational}
onClick={() => act("toggle_reactantdump", {
core: core.ref,
})} />
</Table.Cell>
<Table.Cell>{core.field_instability}</Table.Cell>
<Table.Cell>{core.field_temperature}</Table.Cell>
<Table.Cell>
<Knob
forcedInputWidth="60px"
size={1.25}
color={!!core.has_field && 'yellow'}
value={core.target_field_strength}
unit="(W.m^-3)"
minValue={1}
maxValue={1000}
stepPixelSize={1}
onDrag={(e, value) => act('set_fieldstr', {
core: core.ref,
fieldstr: value,
})} />
</Table.Cell>
<Table.Cell />
</Table.Row>
))}
</Table>
</Section>
);
};

View File

@@ -0,0 +1,60 @@
import { useBackend } from "../backend";
import { Window } from "../layouts";
import { Button, Section, Table, Knob } from "../components";
export const RustFuelControl = (props, context) => (
<Window
width={627}
height={700}
resizable>
<Window.Content>
<RustFuelContent />
</Window.Content>
</Window>
);
export const RustFuelContent = (props, context) => {
const { act, data } = useBackend(context);
const {
fuels,
} = data;
return (
<Section title="Fuel Injectors"
buttons={(
<Button
icon="pencil-alt"
content={"Set Tag"}
onClick={() => act("set_tag")} />
)}>
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
<Table.Cell>Position</Table.Cell>
<Table.Cell>Status</Table.Cell>
<Table.Cell>Remaining Fuel</Table.Cell>
<Table.Cell>Fuel Rod Composition</Table.Cell>
</Table.Row>
{fuels.map(fuel => (
<Table.Row key={fuel.name}>
<Table.Cell>{fuel.name}</Table.Cell>
<Table.Cell>{fuel.x}, {fuel.y}, {fuel.z}</Table.Cell>
<Table.Cell>
<Button
icon="power-off"
content={fuel.active ? "Online" : "Offline"}
selected={fuel.active}
disabled={!fuel.deployed}
onClick={() => act("toggle_active", {
fuel: fuel.ref,
})} />
</Table.Cell>
<Table.Cell>{fuel.fuel_amt}</Table.Cell>
<Table.Cell>{fuel.fuel_type}</Table.Cell>
</Table.Row>
))}
</Table>
</Section>
);
};

File diff suppressed because one or more lines are too long

View File

@@ -3895,10 +3895,13 @@
#include "code\modules\tgui\modules\communications.dm" #include "code\modules\tgui\modules\communications.dm"
#include "code\modules\tgui\modules\crew_manifest.dm" #include "code\modules\tgui\modules\crew_manifest.dm"
#include "code\modules\tgui\modules\crew_monitor.dm" #include "code\modules\tgui\modules\crew_monitor.dm"
#include "code\modules\tgui\modules\gyrotron_control.dm"
#include "code\modules\tgui\modules\law_manager.dm" #include "code\modules\tgui\modules\law_manager.dm"
#include "code\modules\tgui\modules\overmap.dm" #include "code\modules\tgui\modules\overmap.dm"
#include "code\modules\tgui\modules\power_monitor.dm" #include "code\modules\tgui\modules\power_monitor.dm"
#include "code\modules\tgui\modules\rcon.dm" #include "code\modules\tgui\modules\rcon.dm"
#include "code\modules\tgui\modules\rustcore_monitor.dm"
#include "code\modules\tgui\modules\rustfuel_control.dm"
#include "code\modules\tgui\modules\shutoff_monitor.dm" #include "code\modules\tgui\modules\shutoff_monitor.dm"
#include "code\modules\tgui\modules\supermatter_monitor.dm" #include "code\modules\tgui\modules\supermatter_monitor.dm"
#include "code\modules\tgui\modules\teleporter.dm" #include "code\modules\tgui\modules\teleporter.dm"