Core monitor fixed + other shit.

This commit is contained in:
PJB3005
2015-06-20 19:15:55 +02:00
parent dca4b8017a
commit 5e04da2300
10 changed files with 291 additions and 332 deletions

View File

@@ -1,15 +1,14 @@
//////////////////////////////////////
// RUST Core Control computer
/obj/item/weapon/circuitboard/rust_core_control
name = "Circuit board (RUST core controller)"
name = "Circuit board (R-UST Mk. 7 core controller)"
build_path = "/obj/machinery/computer/rust_core_control"
origin_tech = "programming=4;engineering=4"
/datum/design/rust_core_control
name = "Circuit Design (RUST core controller)"
desc = "Allows for the construction of circuit boards used to build a core control console for the RUST fusion engine."
name = "Circuit Design (R-UST Mk. 7 core controller)"
desc = "Allows for the construction of circuit boards used to build a core control console for the R-UST Mk. 7 fusion engine."
id = "rust_core_control"
req_tech = list("programming" = 4, "engineering" = 4)
build_type = IMPRINTER
@@ -21,13 +20,13 @@
// RUST Fuel Control computer
/obj/item/weapon/circuitboard/rust_fuel_control
name = "Circuit board (RUST fuel controller)"
name = "Circuit board (R-UST Mk. 7 fuel controller)"
build_path = "/obj/machinery/computer/rust_fuel_control"
origin_tech = "programming=4;engineering=4"
/datum/design/rust_fuel_control
name = "Circuit Design (RUST fuel controller)"
desc = "Allows for the construction of circuit boards used to build a fuel injector control console for the RUST fusion engine."
name = "Circuit Design (R-UST Mk. 7 fuel controller)"
desc = "Allows for the construction of circuit boards used to build a fuel injector control console for the R-UST Mk. 7 fusion engine."
id = "rust_fuel_control"
req_tech = list("programming" = 4, "engineering" = 4)
build_type = IMPRINTER
@@ -39,13 +38,13 @@
// RUST Fuel Port board
/obj/item/weapon/module/rust_fuel_port
name = "Internal circuitry (RUST fuel port)"
name = "Internal circuitry (R-UST Mk. 7 fuel port)"
icon_state = "card_mod"
origin_tech = "engineering=4;materials=5"
/datum/design/rust_fuel_port
name = "Internal circuitry (RUST fuel port)"
desc = "Allows for the construction of circuit boards used to build a fuel injection port for the RUST fusion engine."
name = "Internal circuitry (R-UST Mk. 7 fuel port)"
desc = "Allows for the construction of circuit boards used to build a fuel injection port for the R-UST Mk. 7 fusion engine."
id = "rust_fuel_port"
req_tech = list("engineering" = 4, "materials" = 5)
build_type = IMPRINTER
@@ -57,13 +56,13 @@
// RUST Fuel Compressor board
/obj/item/weapon/module/rust_fuel_compressor
name = "Internal circuitry (RUST fuel compressor)"
name = "Internal circuitry (R-UST Mk. 7 fuel compressor)"
icon_state = "card_mod"
origin_tech = "materials=6;plasmatech=4"
/datum/design/rust_fuel_compressor
name = "Circuit Design (RUST fuel compressor)"
desc = "Allows for the construction of circuit boards used to build a fuel compressor of the RUST fusion engine."
name = "Circuit Design (R-UST Mk. 7 fuel compressor)"
desc = "Allows for the construction of circuit boards used to build a fuel compressor of the R-UST Mk. 7 fusion engine."
id = "rust_fuel_compressor"
req_tech = list("materials" = 6, "plasmatech" = 4)
build_type = IMPRINTER
@@ -75,7 +74,7 @@
// RUST Tokamak Core board
/obj/item/weapon/circuitboard/rust_core
name = "Internal circuitry (RUST tokamak core)"
name = "Internal circuitry (R-UST Mk. 7 tokamak core)"
build_path = "/obj/machinery/power/rust_core"
board_type = "machine"
origin_tech = "bluespace=3;plasmatech=4;magnets=5;powerstorage=6"
@@ -88,7 +87,7 @@
"/obj/item/stack/cable_coil" = 5)
/datum/design/rust_core
name = "Internal circuitry (RUST tokamak core)"
name = "Internal circuitry (R-UST Mk. 7 tokamak core)"
desc = "The circuit board that for a RUST-pattern tokamak fusion core."
id = "pacman"
req_tech = list(bluespace = 3, plasmatech = 4, magnets = 5, powerstorage = 6)
@@ -102,7 +101,7 @@
// RUST Fuel Injector board
/obj/item/weapon/circuitboard/rust_injector
name = "Internal circuitry (RUST fuel injector)"
name = "Internal circuitry (R-UST Mk. 7 fuel injector)"
build_path = "/obj/machinery/power/rust_fuel_injector"
board_type = "machine"
origin_tech = "powerstorage=3;engineering=4;plasmatech=4;materials=6"
@@ -115,7 +114,7 @@
"/obj/item/stack/cable_coil" = 5)
/datum/design/rust_injector
name = "Internal circuitry (RUST tokamak core)"
name = "Internal circuitry (R-UST Mk. 7 tokamak core)"
desc = "The circuit board that for a RUST-pattern particle accelerator."
id = "pacman"
req_tech = list(powerstorage = 3, engineering = 4, plasmatech = 4, materials = 6)
@@ -127,17 +126,16 @@
//Gyrotron controller board.
/obj/item/weapon/circuitboard/rust_gyrotron_control
name = "Circuit board (RUST gyrotron controller)"
name = "Circuit board (R-UST Mk. 7 gyrotron controller)"
build_path = "/obj/machinery/computer/rust_gyrotron_controller"
origin_tech = "programming=4;engineering=4"
/datum/design/rust_gyrotron_control
name = "Circuit Design (RUST gyrotron controller)"
desc = "Allows for the construction of circuit boards used to build a gyrotron control console for the RUST fusion engine."
name = "Circuit Design (R-UST Mk. 7 gyrotron controller)"
desc = "Allows for the construction of circuit boards used to build a gyrotron control console for the R-UST Mk. 7 fusion engine."
id = "rust_gyrotron_control"
req_tech = list("programming" = 4, "engineering" = 4)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20)
materials = list(MAT_GLASS = 2000, "sacid" = 20)
category = "Misc"
build_path = "/obj/item/weapon/circuitboard/rust_gyrotron_control"

View File

@@ -1,162 +1,204 @@
/obj/machinery/computer/rust_core_control
name = "RUST Core Control"
name = "R-UST Mk. 7 Core Control"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core_control"
light_color = LIGHT_COLOR_ORANGE
var/list/connected_devices = list()
var/id_tag = "allan remember to update this before you leave"
var/scan_range = 25
//currently viewed
var/obj/machinery/power/rust_core/cur_viewed_device
/obj/machinery/computer/rust_core_control/process()
if(stat & (BROKEN|NOPOWER))
return
/obj/machinery/computer/rust_core_control/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/computer/rust_core_control/attack_hand(mob/user)
add_fingerprint(user)
. = ..()
if(.)
if(user.machine == src)
user.unset_machine(src)
return
interact(user)
/obj/machinery/computer/rust_core_control/interact(mob/user)
if(stat & BROKEN)
user.unset_machine()
user << browse(null, "window=core_control")
return
if (!istype(user, /mob/living/silicon) && (get_dist(src, user) > 1 ))
user.unset_machine()
user << browse(null, "window=core_control")
return
var/dat = ""
if(stat & NOPOWER)
dat += "<i>The console is dark and nonresponsive.</i>"
if(!cur_viewed_device || !check_core_status(cur_viewed_device))
cur_viewed_device = null
if(cur_viewed_device)
dat += {"
<a href='?src=\ref[src];goto_scanlist=1'>Back to overview</a><hr>
<b>Device tag:</b> [cur_viewed_device.id_tag]<br>
<span style='color: [cur_viewed_device.owned_field ? "green" : "red"]'>Device [cur_viewed_device.owned_field ? "activated" : "deactivated"].</span><br>
<a href='?src=\ref[src];toggle_active=1'>Bring field [cur_viewed_device.owned_field ? "offline" : "online"]</a><br>
<hr>
<b>Field encumbrance:</b> [cur_viewed_device.owned_field ? 0 : "N/A"]<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=-100'>--- </a>
<a href='?src=\ref[src];str=-10'>-- </a>
<a href='?src=\ref[src];str=-1'>- </a>
<a href='?src=\ref[src];str=0'>[cur_viewed_device.field_strength]</a>
<a href='?src=\ref[src];str=1'>+ </a>
<a href='?src=\ref[src];str=10'>++ </a>
<a href='?src=\ref[src];str=100'>+++ </a>
<a href='?src=\ref[src];str=1000'>++++</a><hr>
"}
dat += {"
<b>Field frequency (MHz):</b><br>
<a href='?src=\ref[src];freq=-1000'>----</a>
<a href='?src=\ref[src];freq=-100'>--- </a>
<a href='?src=\ref[src];freq=-10'>-- </a>
<a href='?src=\ref[src];freq=-1'>- </a>
<a href='?src=\ref[src];freq=0'>[cur_viewed_device.field_frequency]</a>
<a href='?src=\ref[src];freq=1'>+ </a>
<a href='?src=\ref[src];freq=10'>++ </a>
<a href='?src=\ref[src];freq=100'>+++ </a>
<a href='?src=\ref[src];freq=1000'>++++</a><br>
<hr>
"}
else
dat += "<B>Reactor Core Primary Monitor</B><BR>"
if(cur_viewed_device && cur_viewed_device.stat & (BROKEN|NOPOWER))
cur_viewed_device = null
if(cur_viewed_device && !cur_viewed_device.remote_access_enabled)
cur_viewed_device = null
if(cur_viewed_device)
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_control.dm:45: dat += "<b>Device tag:</b> [cur_viewed_device.id_tag ? cur_viewed_device.id_tag : "UNSET"]<br>"
dat += {"<b>Device tag:</b> [cur_viewed_device.id_tag ? cur_viewed_device.id_tag : "UNSET"]<br>
<font color=blue>Device [cur_viewed_device.owned_field ? "activated" : "deactivated"].</font><br>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];toggle_active=1'>\[Bring field [cur_viewed_device.owned_field ? "offline" : "online"]\]</a><br>
<b>Device [cur_viewed_device.anchored ? "secured" : "unsecured"].</b><br>
<hr>
<b>Field encumbrance:</b> [cur_viewed_device.owned_field ? 0 : "NA"]<br>
<b>Field strength:</b> [cur_viewed_device.field_strength] Wm^3<br>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-1000'>\[----\]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-100'>\[--- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-10'>\[-- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-1'>\[- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=1'>\[+ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=10'>\[++ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=100'>\[+++ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=1000'>\[++++\]</a><br>"}
// END AUTOFIX
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_control.dm:60: dat += "<b>Field frequency:</b> [cur_viewed_device.field_frequency] MHz<br>"
dat += {"<b>Field frequency:</b> [cur_viewed_device.field_frequency] MHz<br>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-1000'>\[----\]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-100'>\[--- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-10'>\[-- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-1'>\[- \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=1'>\[+ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=10'>\[++ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=100'>\[+++ \]</a>
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=1000'>\[++++\]</a><br>"}
// END AUTOFIX
var/power_stat = "Good"
if(cur_viewed_device.cached_power_avail < cur_viewed_device.active_power_usage)
power_stat = "Insufficient"
else if(cur_viewed_device.cached_power_avail < cur_viewed_device.active_power_usage * 2)
power_stat = "Check"
dat += "<b>Power status:</b> [power_stat]<br>"
else
dat += "<a href='?src=\ref[src];scan=1'>\[Refresh device list\]</a><br><br>"
if(connected_devices.len)
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_control.dm:79: dat += "<table width='100%' border=1>"
dat += {"<table width='100%' border=1>
if(connected_devices.len)
dat += {"
<b>Connected R-UST Mk. 7 Tokamak pattern Electromagnetic Field Generators:</b><hr>
<table>
<tr>
<td><b>Device tag</b></td>
<td></td>
</tr>"}
// END AUTOFIX
for(var/obj/machinery/power/rust_core/C in connected_devices)
if(!check_core_status(C))
connected_devices.Remove(C)
continue
<th><b>Device tag</b></th>
<th><b>Status</b></th>
<th><b>Controls</b></th>
</tr>
"}
for(var/obj/machinery/power/rust_core/C in connected_devices)
var/status
var/can_access = 1
if(!check_core_status(C))
status = "<span style='color: red'>Unresponsive</span>"
can_access = 0
else if(C.avail() < C.active_power_usage)
status = "<span style='color: orange'>Underpowered</span>"
else
status = "<span style='color: green'>Good</span>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_control.dm:89: dat += "<tr>"
dat += {"<tr>
dat += {"
<tr>
<td>[C.id_tag]</td>
<td><a href='?src=\ref[src];manage_individual=\ref[C]'>\[Manage\]</a></td>
</tr>
</table>"}
// END AUTOFIX
else
dat += "No devices connected.<br>"
<td>[status]</td>
"}
if(!can_access)
dat += {"
<td><span style='color: red'>ERROR</span></td>
"}
else
dat += {"
<td><a href=?src=\ref[src];access_device=[connected_devices.Find(C)]'>ACCESS</a></td>
"}
dat += {"
</tr>
"}
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_control.dm:97: dat += "<hr>"
dat += {"<hr>
<a href='?src=\ref[src];refresh=1'>Refresh</a>
<a href='?src=\ref[src];close=1'>Close</a>"}
// END AUTOFIX
user << browse(dat, "window=core_control;size=500x400")
onclose(user, "core_control")
else
dat += "<span style='color: red'>No R-UST Mk. 7 Tokamak pattern Electromagnetic Field Generators connected.</span>"
var/datum/browser/popup = new(user, "rust_control", name, 500, 400, src)
popup.set_content(dat)
popup.open()
user.set_machine(src)
/obj/machinery/computer/rust_core_control/Topic(href, href_list)
if(..()) return 1
. = ..()
if(.)
return
if( href_list["goto_scanlist"] )
if(href_list["access_device"])
var/idx = Clamp(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
if(!cur_viewed_device || !check_core_status(cur_viewed_device)) //All HREFs from this point on require a device anyways.
return
if(href_list["goto_scanlist"])
cur_viewed_device = null
updateUsrDialog()
return 1
if( href_list["manage_individual"] )
cur_viewed_device = locate(href_list["manage_individual"])
if( href_list["scan"] )
connected_devices = list()
for(var/obj/machinery/power/rust_core/C in range(scan_range, src))
if(check_core_status(C))
connected_devices.Add(C)
if( href_list["startup"] )
if(cur_viewed_device)
cur_viewed_device.Startup()
if( href_list["shutdown"] )
if(cur_viewed_device)
if(href_list["toggle_active"])
if(!cur_viewed_device.Startup()) //Startup() whilst the device is active will return null.
cur_viewed_device.Shutdown()
updateUsrDialog()
return 1
if( href_list["close"] )
usr << browse(null, "window=core_control")
usr.unset_machine()
if(href_list["str"])
var/val = text2num(href_list["str"])
if(!val) //Value is 0, which is manual entering.
cur_viewed_device.set_strength(input("Enter the new field power density (W.m^-3)", "R-UST Mk. 7 Tokamak Controls", cur_viewed_device.field_strength) as num)
else
cur_viewed_device.set_strength(cur_viewed_device.field_strength + val)
updateUsrDialog()
return 1
updateDialog()
if(href_list["freq"])
var/val = text2num(href_list["freq"])
if(!val) //Value is 0, which is manual entering.
cur_viewed_device.set_frequency(input("Enter the new field frequency (MHz)", "R-UST Mk. 7 Tokamak Controls", cur_viewed_device.field_frequency) as num)
else
cur_viewed_device.set_frequency(cur_viewed_device.field_frequency + val)
updateUsrDialog()
return 1
//Returns 1 if the machine can be interacted with via this console.
/obj/machinery/computer/rust_core_control/proc/check_core_status(var/obj/machinery/power/rust_core/C)
if(!C)
return 0
if(isnull(C))
return
if(C.stat & (BROKEN|NOPOWER) || !C.remote_access_enabled || !C.id_tag)
if(connected_devices.Find(C))
connected_devices.Remove(C)
return 0
if(C.stat & BROKEN)
return
return 1
if(C.state != 2)
return
if(C.idle_power_usage > C.avail())
return
. = 1
//Multitool menu shit starts here.
//It's all . because . is faster than return, thanks BYOND.
/obj/machinery/computer/rust_core_control/multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
. = "Linked R-UST Tokamak cores:<br><lu>"
for(var/obj/machinery/power/rust_core/C in connected_devices)
. += "<li><b>[C.id_tag]</b> <a href='?src=\ref[src];unlink=[connected_devices.Find(C)]'>\[X\]</a></li>"
. += "</ul>"
/obj/machinery/computer/rust_core_control/linkMenu(var/obj/machinery/power/rust_core/O)
if(istype(O))
. = "<a href='?src=\ref[src];link=1'>\[LINK\]</a> "
/obj/machinery/computer/rust_core_control/canLink(var/obj/machinery/power/rust_core/O, var/list/context)
. = (istype(O) && get_dist(src, O) < scan_range)
/obj/machinery/computer/rust_core_control/isLinkedWith(var/obj/O)
. = (O in connected_devices)
/obj/machinery/computer/rust_core_control/linkWith(var/mob/user, var/obj/machinery/power/rust_core/O, var/list/context)
connected_devices += O
. = 1
/obj/machinery/computer/rust_core_control/getLink(var/idx)
if(idx <= connected_devices.len)
. = connected_devices[idx]
/obj/machinery/computer/rust_core_control/unlinkFrom(var/mob/user, var/obj/buffer)
connected_devices -= buffer
. = 1

View File

@@ -11,17 +11,18 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
desc = "A coruscating, barely visible field of energy. It is shaped like a slightly flattened torus."
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "emfield_s1"
//
alpha = 50
var/major_radius = 0 //longer radius in meters = field_strength * 0.21875, max = 8.75
var/minor_radius = 0 //shorter radius in meters = field_strength * 0.2125, max = 8.625
var/size = 1 //diameter in tiles
var/volume_covered = 0 //atmospheric volume covered
//
var/obj/machinery/power/rust_core/owned_core
var/list/dormant_reactant_quantities = new
//luminosity = 1
layer = 3.1
//
var/energy = 0
var/mega_energy = 0
var/radiation = 0
@@ -42,21 +43,17 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
if(!radiator)
radiator = new()
//make sure there's a field generator
for(var/obj/machinery/power/rust_core/core in loc)
owned_core = core
if(!owned_core)
del(src)
qdel(src)
//create the gimmicky things to handle field collisions
var/obj/effect/rust_particle_catcher/catcher
//
catcher = new (locate(src.x,src.y,src.z))
catcher.parent = src
catcher.SetSize(1)
particle_catchers.Add(catcher)
//
catcher = new (locate(src.x-1,src.y,src.z))
catcher.parent = src
catcher.SetSize(3)
@@ -73,7 +70,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
catcher.parent = src
catcher.SetSize(3)
particle_catchers.Add(catcher)
//
catcher = new (locate(src.x-2,src.y,src.z))
catcher.parent = src
catcher.SetSize(5)
@@ -90,7 +87,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
catcher.parent = src
catcher.SetSize(5)
particle_catchers.Add(catcher)
//
catcher = new (locate(src.x-3,src.y,src.z))
catcher.parent = src
catcher.SetSize(7)
@@ -431,8 +428,18 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
/obj/effect/rust_em_field/Destroy()
//radiate everything in one giant burst
for(var/obj/effect/rust_particle_catcher/catcher in particle_catchers)
del (catcher)
qdel(catcher)
owned_core.owned_field = null
owned_core = null
RadiateAll()
processing_objects.Remove(src)
..()
. = ..()
/obj/effect/rust_em_field/bullet_act(var/obj/item/projectile/Proj)
if(Proj.flag != "bullet")
AddEnergy(Proj.damage * 20, 0, 1)
update_icon()
return 0

View File

@@ -44,141 +44,58 @@ max volume of plasma storeable by the field = the total volume of a number of ti
#define MIN_FIELD_FREQ 1
#define MAX_FIELD_STR 1000
#define MIN_FIELD_STR 1
#define RUST_CORE_STR_COST 5
/obj/machinery/power/rust_core
name = "RUST Tokamak core"
desc = "Enormous solenoid for generating extremely high power electromagnetic fields"
name = "R-UST Mk 7 Tokamak core"
desc = "An enormous solenoid for generating extremely high power electromagnetic fields"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core0"
density = 1
light_power_on = 2
light_range_on = 3
light_color = LIGHT_COLOR_BLUE
var/obj/effect/rust_em_field/owned_field
var/field_strength = 1//0.01
var/field_frequency = 1
var/id_tag = "allan, don't forget to set the ID of this one too"
req_access = list(access_engine)
//
var/id_tag
use_power = 1
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
var/cached_power_avail = 0
anchored = 0
var/locked = 1
var/remote_access_enabled = 1
machine_flags = WRENCHMOVE | FIXED2WORK | WELD_FIXED | EMAGGABLE | MULTITOOL_MENU
machine_flags = WRENCHMOVE | FIXED2WORK | WELD_FIXED | EMAGGABLE
/obj/machinery/power/rust_core/New()
. = ..()
if(ticker)
initialize()
/obj/machinery/power/rust_core/initialize()
if(!id_tag)
assign_uid()
id_tag = uid
/obj/machinery/power/rust_core/process()
if(stat & BROKEN || !powernet)
Shutdown()
cached_power_avail = avail()
//luminosity = round(owned_field.field_strength/10)
//luminosity = max(luminosity,1)
/obj/machinery/power/rust_core/wrenchAnchor(mob/user)
if(owned_field)
user << "Turn off \the [src] first."
return -1
return ..()
/obj/machinery/power/rust_core/weldToFloor(var/obj/item/weapon/weldingtool/WT, mob/user)
if(owned_field)
user << user << "<span class='warning'>Turn \the [src] off first!</span>"
return -1
if(..() == 1)
switch(state)
if(1)
connect_to_network()
if(2)
disconnect_from_network()
if(2)
connect_to_network()
return 1
return -1
/obj/machinery/power/rust_core/emag(mob/user)
if(!emagged)
locked = 0
emagged = 1
user.visible_message("[user.name] emags the [src.name].","<span class='warning'>You short out the lock.</span>")
return
/obj/machinery/power/rust_core/attackby(obj/item/W, mob/user)
if(..())
return 1
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
if(emagged)
user << "<span class='warning'>The lock seems to be broken</span>"
return
if(src.allowed(user))
if(owned_field)
src.locked = !src.locked
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
src.locked = 0 //just in case it somehow gets locked
user << "<span class='warning'>The controls can only be locked when the [src] is online</span>"
else
user << "<span class='warning'>Access denied.</span>"
return
/obj/machinery/power/rust_core/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/power/rust_core/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/power/rust_core/interact(mob/user)
if(stat & BROKEN)
user.unset_machine()
user << browse(null, "window=core_gen")
return
if(!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
user.unset_machine()
user << browse(null, "window=core_gen")
return
var/dat = ""
if(stat & NOPOWER || locked || state != 2)
dat += "<i>The console is dark and nonresponsive.</i>"
else
// KINDA-AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Rust\core_gen.dm:187: dat += "<b>RUST Tokamak pattern Electromagnetic Field Generator</b><br>"
dat += {"<b>RUST Tokamak pattern Electromagnetic Field Generator</b><br>
<b>Device ID tag: </b> [id_tag ? id_tag : "UNSET"] <a href='?src=\ref[src];new_id_tag=1'>\[Modify\]</a><br>
<a href='?src=\ref[src];toggle_active=1'>\[[owned_field ? "Deactivate" : "Activate"]\]</a><br>
<a href='?src=\ref[src];toggle_remote=1'>\[[remote_access_enabled ? "Disable remote access to this device" : "Enable remote access to this device"]\]</a><br>
<hr>
<b>Field strength:</b> [field_strength]Wm^3<br>
<a href='?src=\ref[src];str=-1000'>\[----\]</a>
<a href='?src=\ref[src];str=-100'>\[--- \]</a>
<a href='?src=\ref[src];str=-10'>\[-- \]</a>
<a href='?src=\ref[src];str=-1'>\[- \]</a>
<a href='?src=\ref[src];str=1'>\[+ \]</a>
<a href='?src=\ref[src];str=10'>\[++ \]</a>
<a href='?src=\ref[src];str=100'>\[+++ \]</a>
<a href='?src=\ref[src];str=1000'>\[++++\]</a><br>
<b>Field frequency:</b> [field_frequency]MHz<br>
<a href='?src=\ref[src];freq=-1000'>\[----\]</a>
<a href='?src=\ref[src];freq=-100'>\[--- \]</a>
<a href='?src=\ref[src];freq=-10'>\[-- \]</a>
<a href='?src=\ref[src];freq=-1'>\[- \]</a>
<a href='?src=\ref[src];freq=1'>\[+ \]</a>
<a href='?src=\ref[src];freq=10'>\[++ \]</a>
<a href='?src=\ref[src];freq=100'>\[+++ \]</a>
<a href='?src=\ref[src];freq=1000'>\[++++\]</a><br>"}
// END KINDA-AUTOFIX
var/font_colour = "green"
if(cached_power_avail < active_power_usage)
font_colour = "red"
else if(cached_power_avail < active_power_usage * 2)
font_colour = "orange"
dat += "<b>Power status:</b> <font color=[font_colour]>[active_power_usage]/[cached_power_avail] W</font><br>"
user << browse(dat, "window=core_gen;size=500x300")
onclose(user, "core_gen")
user.set_machine(src)
/obj/machinery/power/rust_core/Topic(href, href_list)
if(..()) return 1
if(href_list["str"])
@@ -194,54 +111,51 @@ max volume of plasma storeable by the field = the total volume of a number of ti
if(owned_field)
owned_field.ChangeFieldFrequency(field_frequency)
if(href_list["toggle_active"])
if(!Startup())
Shutdown()
if( href_list["toggle_remote"] )
remote_access_enabled = !remote_access_enabled
if(href_list["new_id_tag"])
if(usr)
id_tag = input("Enter a new ID tag", "Tokamak core ID tag", id_tag) as text|null
if(href_list["close"])
usr << browse(null, "window=core_gen")
usr.unset_machine()
if(href_list["extern_update"])
var/obj/machinery/computer/rust_core_control/C = locate(href_list["extern_update"])
if(C)
C.updateDialog()
src.updateDialog()
/obj/machinery/power/rust_core/proc/Startup()
if(owned_field)
return
owned_field = new(src.loc)
owned_field = new(loc)
owned_field.ChangeFieldStrength(field_strength)
owned_field.ChangeFieldFrequency(field_frequency)
set_light(light_range_on, light_power_on)
icon_state = "core1"
luminosity = 1
use_power = 2
return 1
. = 1
/obj/machinery/power/rust_core/proc/Shutdown()
//todo: safety checks for field status
if(owned_field)
icon_state = "core0"
del(owned_field)
luminosity = 0
qdel(owned_field)
use_power = 1
set_light(0)
/obj/machinery/power/rust_core/proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
owned_field.AddParticles(name, quantity)
return 1
return 0
. = 1
/obj/machinery/power/rust_core/bullet_act(var/obj/item/projectile/Proj)
if(owned_field)
return owned_field.bullet_act(Proj)
return 0
. = owned_field.bullet_act(Proj)
/obj/machinery/power/rust_core/multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
return {"
<ul>
<li>[format_tag("ID Tag","id_tag")]</li>
</ul>
"}
/obj/machinery/power/rust_core/proc/set_strength(var/value)
value = Clamp(value, MIN_FIELD_STR, MAX_FIELD_STR)
field_strength = value
active_power_usage = RUST_CORE_STR_COST * value
if(owned_field)
owned_field.ChangeFieldStrength(value)
/obj/machinery/power/rust_core/proc/set_frequency(var/value)
value = Clamp(value, MIN_FIELD_FREQ, MAX_FIELD_FREQ)
field_frequency = value
if(owned_field)
owned_field.ChangeFieldFrequency(value)

View File

@@ -1,4 +1,3 @@
datum/fusion_reaction
var/primary_reactant = ""
var/secondary_reactant = ""

View File

@@ -18,7 +18,7 @@
use_power = 1
idle_power_usage = 10
active_power_usage = 300
active_power_usage = 100000 //Yes that is a shitton. No you're not running this engine on an SE/AME you SE/AME scrubs.
/obj/machinery/rust/gyrotron/initialize()
if(!id_tag)
@@ -39,7 +39,7 @@
update_icon()
/obj/machinery/rust/gyrotron/proc/start_emitting()
if(stat & (NOPOWER | BROKEN) || emitting) //Sanity.
if(stat & (NOPOWER | BROKEN) || emitting && state == 2) //Sanity.
return
emitting = 1

View File

@@ -13,6 +13,9 @@
if(.)
return
/obj/machinery/computer/rust_gyrotron_controller/attack_ai(var/mob/user)
. = attack_hand(user)
/obj/machinery/computer/rust_gyrotron_controller/attack_hand(mob/user)
. = ..()
if(.)
@@ -38,21 +41,21 @@
<th>ID tag</th>
<th>Status</th>
<th>Mode</th>
<th>Emissions rate</th>
<th>Power</th>
<th>Frequency</th>
<th>Emissions rate (1/10th sec)</th>
<th>Beam Output (TJ)</th>
<th>Frequency (GHz)</th>
</tr>
"}
for(var/obj/machinery/rust/gyrotron/gyro in linked_gyrotrons)
//These vars are here because muh readable HTML code.
var/gyro_id = linked_gyrotrons.Find(gyro)
var/status = (gyro.stat & (NOPOWER | BROKEN) ? "<span style='color: red'>Unresponsive</span>" : "<span style='color: green'>Operational</span>")
var/status = ((state != 2 || gyro.stat & (NOPOWER | BROKEN)) ? "<span style='color: red'>Unresponsive</span>" : "<span style='color: green'>Operational</span>")
dat += {"
</tr>
<td>[gyro.id_tag]</td>
<td>[status]</td>
"}
if(gyro.stat & (NOPOWER | BROKEN)) //Error data not found.
if(state != 2 || gyro.stat & (NOPOWER | BROKEN)) //Error data not found.
dat += {"
<td><span style='color: red'>ERROR</span></td>
<td><span style='color: red'>ERROR</span></td>
@@ -90,12 +93,13 @@
return
if(href_list["modifypower"])
var/new_val = input("Enter new emission power level (0.001 - 0.01)", "Modifying power level (MeV)", gyro.mega_energy) as num
var/new_val = input("Enter new emission power level (0.001 - 0.01)", "Modifying power level (TJ)", gyro.mega_energy) as num
if(!new_val)
usr << "<span class='warning'>That's not a valid number.</span>"
return 1
gyro.mega_energy = Clamp(new_val, 0.001, 0.01)
gyro.active_power_usage = gyro.mega_energy * 100000000 //1 MW for 0.01 TJ, 100 KW for 0.001 TJ.
updateUsrDialog()
return 1

View File

@@ -3,22 +3,20 @@
var/mega_energy = 0
var/time_alive = 0
var/source_alive = 2
New()
..()
process()
..()
//fade away over time
if(source_alive > 0)
time_alive++
source_alive--
else
time_alive -= 0.1
if(time_alive < 0)
del(src)
/obj/machinery/rust/process()
..()
//fade away over time
if(source_alive > 0)
time_alive++
source_alive--
else
time_alive -= 0.1
if(time_alive < 0)
del(src)
//radiate mobs nearby here
//
//radiate mobs nearby here
//
/*
/obj/machinery/rust
@@ -73,6 +71,8 @@
return particle
*/
/*
/obj/machinery/computer/rust_radiation_monitor
name = "Radiation Monitor"
icon_state = "power"
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -10,15 +10,10 @@
invisibility = 101
/*/obj/effect/rust_particle_catcher/New()
for(var/obj/machinery/rust/em_field/field in range(6))
parent = field
if(!parent)
del(src)*/
/obj/effect/rust_particle_catcher/process()
if(!parent)
del(src)
/obj/effect/rust_particle_catcher/Destroy()
. =..()
parent.particle_catchers -= src
parent = null
/obj/effect/rust_particle_catcher/proc/SetSize(var/newsize)
name = "collector [newsize]"