mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
reworked rust components to integrate more smoothly with each other, cleaned up a bunch of useability issues, made all relevant components portable, fixed some random bugs, added a mostly nonfunctional map to show an example layout (based on antiqua's engineering layout)
Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
142
code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm
Normal file
142
code/WorkInProgress/Cael_Aislinn/Rust/core_control.dm
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
/obj/machinery/computer/rust_core_control
|
||||
name = "RUST Core Control"
|
||||
icon_state = "power"
|
||||
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)
|
||||
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>"
|
||||
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)
|
||||
dat += "<b>Device tag:</b> [cur_viewed_device.id_tag ? cur_viewed_device.id_tag : "UNSET"]<br>"
|
||||
dat += "<font color=blue>Device [cur_viewed_device.owned_field ? "activated" : "deactivated"].</font><br>"
|
||||
dat += "<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>"
|
||||
dat += "<b>Device [cur_viewed_device.anchored ? "secured" : "unsecured"].</b><br>"
|
||||
dat += "<hr>"
|
||||
dat += "<b>Field encumbrance:</b> [cur_viewed_device.owned_field ? 0 : "NA"]<br>"
|
||||
dat += "<b>Field strength:</b> [cur_viewed_device.field_strength] Wm^3<br>"
|
||||
dat += "<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>"
|
||||
dat += "<b>Field frequency:</b> [cur_viewed_device.field_frequency] MHz<br>"
|
||||
dat += "<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>"
|
||||
|
||||
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)
|
||||
dat += "<table width='100%' border=1>"
|
||||
dat += "<tr>"
|
||||
dat += "<td><b>Device tag</b></td>"
|
||||
dat += "<td></td>"
|
||||
dat += "</tr>"
|
||||
for(var/obj/machinery/power/rust_core/C in connected_devices)
|
||||
if(!check_core_status(C))
|
||||
connected_devices.Remove(C)
|
||||
continue
|
||||
|
||||
dat += "<tr>"
|
||||
dat += "<td>[C.id_tag]</td>"
|
||||
dat += "<td><a href='?src=\ref[src];manage_individual=\ref[C]'>\[Manage\]</a></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
else
|
||||
dat += "No devices connected.<br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<a href='?src=\ref[src];refresh=1'>Refresh</a> "
|
||||
dat += "<a href='?src=\ref[src];close=1'>Close</a>"
|
||||
|
||||
user << browse(dat, "window=core_control;size=500x400")
|
||||
onclose(user, "core_control")
|
||||
user.set_machine(src)
|
||||
|
||||
/obj/machinery/computer/rust_core_control/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if( href_list["goto_scanlist"] )
|
||||
cur_viewed_device = null
|
||||
|
||||
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)
|
||||
cur_viewed_device.Shutdown()
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=core_control")
|
||||
usr.unset_machine()
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/computer/rust_core_control/proc/check_core_status(var/obj/machinery/power/rust_core/C)
|
||||
if(!C)
|
||||
return 0
|
||||
|
||||
if(C.stat & (BROKEN|NOPOWER) || !C.remote_access_enabled || !C.id_tag)
|
||||
if(connected_devices.Find(C))
|
||||
connected_devices.Remove(C)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
File diff suppressed because it is too large
Load Diff
@@ -40,80 +40,248 @@ max volume of plasma storeable by the field = the total volume of a number of ti
|
||||
|
||||
*/
|
||||
|
||||
/obj/machinery/rust/core
|
||||
name = "Tokamak core"
|
||||
#define MAX_FIELD_FREQ 1000
|
||||
#define MIN_FIELD_FREQ 1
|
||||
#define MAX_FIELD_STR 1000
|
||||
#define MIN_FIELD_STR 1
|
||||
|
||||
/obj/machinery/power/rust_core
|
||||
name = "RUST Tokamak core"
|
||||
desc = "Enormous solenoid for generating extremely high power electromagnetic fields"
|
||||
icon = 'core.dmi'
|
||||
icon_state = "core0"
|
||||
anchored = 1
|
||||
var/on = 0
|
||||
var/obj/machinery/rust/em_field/owned_field
|
||||
var/field_strength = 0.01
|
||||
//
|
||||
density = 1
|
||||
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)
|
||||
//
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 300
|
||||
idle_power_usage = 50
|
||||
active_power_usage = 500 //multiplied by field strength
|
||||
var/cached_power_avail = 0
|
||||
directwired = 1
|
||||
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
var/remote_access_enabled = 1
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["startup"] )
|
||||
Startup()
|
||||
return
|
||||
if( href_list["shutdown"] )
|
||||
Shutdown()
|
||||
return
|
||||
if( href_list["modify_field_strength"] )
|
||||
var/new_field_str = text2num(input("Enter new field strength", "Modifying field strength", owned_field.field_strength))
|
||||
if(!new_field_str)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
field_strength = max(new_field_str,0.1)
|
||||
field_strength = min(new_field_str,50)
|
||||
if(owned_field)
|
||||
owned_field.ChangeFieldStrength(field_strength)
|
||||
return
|
||||
/obj/machinery/power/rust_core/process()
|
||||
if(stat & BROKEN || !powernet)
|
||||
Shutdown()
|
||||
|
||||
proc/Startup()
|
||||
cached_power_avail = avail()
|
||||
//luminosity = round(owned_field.field_strength/10)
|
||||
//luminosity = max(luminosity,1)
|
||||
|
||||
/obj/machinery/power/rust_core/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(owned_field)
|
||||
user << "Turn off [src] first."
|
||||
return
|
||||
on = 1
|
||||
owned_field = new(src.loc)
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(owned_field)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
user << "You weld the [src] to the floor."
|
||||
connect_to_network()
|
||||
src.directwired = 1
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
disconnect_from_network()
|
||||
src.directwired = 0
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(emagged)
|
||||
user << "\red The lock seems to be broken"
|
||||
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 << "\red The controls can only be locked when the [src] is online"
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
|
||||
return
|
||||
|
||||
..()
|
||||
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(!powernet || locked)
|
||||
dat += "<i>The console is dark and nonresponsive.</i>"
|
||||
else
|
||||
dat += "<b>RUST Tokamak pattern Electromagnetic Field Generator</b><br>"
|
||||
dat += "<b>Device ID tag: </b> [id_tag ? id_tag : "UNSET"] <a href='?src=\ref[src];new_id_tag=1'>\[Modify\]</a><br>"
|
||||
dat += "<a href='?src=\ref[src];toggle_active=1'>\[[owned_field ? "Deactivate" : "Activate"]\]</a><br>"
|
||||
dat += "<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>"
|
||||
dat += "<hr>"
|
||||
dat += "<b>Field strength:</b> [field_strength]Wm^3<br>"
|
||||
dat += "<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>"
|
||||
|
||||
dat += "<b>Field frequency:</b> [field_frequency]MHz<br>"
|
||||
dat += "<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>"
|
||||
|
||||
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(href_list["str"])
|
||||
var/dif = text2num(href_list["str"])
|
||||
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)
|
||||
active_power_usage = 5 * field_strength //change to 500 later
|
||||
if(owned_field)
|
||||
owned_field.ChangeFieldStrength(field_strength)
|
||||
icon_state = "core1"
|
||||
luminosity = 1
|
||||
return 1
|
||||
|
||||
proc/Shutdown()
|
||||
if(href_list["freq"])
|
||||
var/dif = text2num(href_list["freq"])
|
||||
field_frequency = min(max(field_frequency + dif, MIN_FIELD_FREQ), MAX_FIELD_FREQ)
|
||||
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.ChangeFieldStrength(field_strength)
|
||||
owned_field.ChangeFieldFrequency(field_frequency)
|
||||
icon_state = "core1"
|
||||
luminosity = 1
|
||||
use_power = 2
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/rust_core/proc/Shutdown()
|
||||
//todo: safety checks for field status
|
||||
if(owned_field)
|
||||
icon_state = "core0"
|
||||
on = 0
|
||||
del(owned_field)
|
||||
luminosity = 0
|
||||
use_power = 1
|
||||
|
||||
proc/AddParticles(var/name, var/quantity = 1)
|
||||
if(owned_field)
|
||||
owned_field.AddParticles(name, quantity)
|
||||
return 1
|
||||
return 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
|
||||
|
||||
process()
|
||||
..()
|
||||
use_power(100 * field_strength + 500)
|
||||
if(on && !owned_field)
|
||||
Shutdown()
|
||||
return
|
||||
//
|
||||
luminosity = round(owned_field.field_strength/10)
|
||||
luminosity = max(luminosity,1)
|
||||
//
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
Shutdown()
|
||||
|
||||
bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet" && owned_field)
|
||||
var/obj/item/projectile/beam/laserbeam = Proj
|
||||
owned_field.AddEnergy(0, laserbeam.damage / 5000, laserbeam.frequency)
|
||||
return 0
|
||||
/obj/machinery/power/rust_core/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet" && owned_field)
|
||||
owned_field.AddEnergy(Proj.damage, 0, 1)
|
||||
return 0
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
|
||||
/obj/machinery/computer/rust_radiation_monitor
|
||||
name = "Radiation Monitor"
|
||||
icon_state = "power"
|
||||
|
||||
/obj/machinery/computer/rust_energy_monitor
|
||||
name = "Core Primary Monitor"
|
||||
icon_state = "power"
|
||||
var/obj/machinery/rust/core/core_generator = null
|
||||
var/updating = 1
|
||||
|
||||
New()
|
||||
..()
|
||||
spawn(0)
|
||||
core_generator = locate() in world
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["shutdown"] )
|
||||
updating = 0
|
||||
core_generator.Topic(href, href_list)
|
||||
updateDialog()
|
||||
updating = 1
|
||||
return
|
||||
if( href_list["startup"] )
|
||||
updating = 0
|
||||
core_generator.Topic(href, href_list)
|
||||
updateDialog()
|
||||
updating = 1
|
||||
return
|
||||
if( href_list["modify_field_strength"] )
|
||||
updating = 0
|
||||
core_generator.Topic(href, href_list)
|
||||
updateDialog()
|
||||
updating = 1
|
||||
return
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=core_monitor")
|
||||
usr.machine = null
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
if(updating)
|
||||
src.updateDialog()
|
||||
|
||||
interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=core_monitor")
|
||||
return
|
||||
var/t = "<B>Reactor Core Primary Monitor</B><BR>"
|
||||
if(core_generator)
|
||||
t += "<font color=blue>[core_generator.on ? "Core Generator connected" : "Core Generator operational"]</font><br>"
|
||||
if(core_generator.owned_field)
|
||||
t += "<font color=green>Core suspension field online</font> <a href='?src=\ref[src];shutdown=1'>\[Bring field offline\]</a><br>"
|
||||
t += "Electromagnetic plasma suspension field status:<br>"
|
||||
t += " <font color=blue>Strength (T): [core_generator.owned_field.field_strength]</font> <a href='?src=\ref[src];modify_field_strength=1'>\[Modify\]</a><br>"
|
||||
t += " <font color=blue>Energy levels (MeV): [core_generator.owned_field.mega_energy]</font><br>"
|
||||
t += " <font color=blue>Core frequency: [core_generator.owned_field.frequency]</font><br>"
|
||||
t += " <font color=blue>Moles of plasma: [core_generator.owned_field.held_plasma.toxins]</font><br>"
|
||||
t += " <font color=blue>Core temperature: [core_generator.owned_field.held_plasma.temperature]</font><br>"
|
||||
t += "<hr>"
|
||||
t += "<b>Core atomic and subatomic constituents:</font></b><br>"
|
||||
if(core_generator.owned_field.dormant_reactant_quantities && core_generator.owned_field.dormant_reactant_quantities.len)
|
||||
for(var/reagent in core_generator.owned_field.dormant_reactant_quantities)
|
||||
t += " <font color=green>[reagent]:</font> [core_generator.owned_field.dormant_reactant_quantities[reagent]]<br>"
|
||||
else
|
||||
t += " <font color=blue>No reactants present.</font><br>"
|
||||
else
|
||||
t += "<font color=red>Core suspension field offline</font> <a href='?src=\ref[src];startup=1'>\[Bring field online\]</a><br>"
|
||||
else
|
||||
t += "<b><font color=red>Core Generator unresponsive</font></b><br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=core_monitor;size=500x400")
|
||||
user.machine = src
|
||||
@@ -4,7 +4,7 @@
|
||||
icon_state = "fuel_assembly"
|
||||
name = "Fuel Rod Assembly"
|
||||
var/list/rod_quantities
|
||||
var/percent_depleted = 0
|
||||
var/percent_depleted = 1
|
||||
//
|
||||
New()
|
||||
rod_quantities = new/list
|
||||
|
||||
@@ -1,31 +1,126 @@
|
||||
|
||||
/obj/machinery/rust/fuel_assembly_port
|
||||
/obj/machinery/rust_fuel_assembly_port
|
||||
name = "Fuel Assembly Port"
|
||||
icon = 'fuel_assembly_port.dmi'
|
||||
icon_state = "port0"
|
||||
density = 0
|
||||
var/obj/item/weapon/fuel_assembly/cur_assembly = null
|
||||
var/obj/item/weapon/fuel_assembly/cur_assembly
|
||||
layer = 4
|
||||
var/busy = 0
|
||||
anchored = 1
|
||||
|
||||
attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I,/obj/item/weapon/fuel_assembly))
|
||||
if(cur_assembly)
|
||||
del cur_assembly
|
||||
/obj/machinery/rust_fuel_assembly_port/attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I,/obj/item/weapon/fuel_assembly))
|
||||
if(cur_assembly)
|
||||
user << "\red There is already a fuel rod assembly in there!"
|
||||
else
|
||||
cur_assembly = I
|
||||
user.drop_item()
|
||||
I.loc = src
|
||||
icon_state = "port1"
|
||||
|
||||
attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
/*if(stat & (BROKEN|NOPOWER))
|
||||
return*/
|
||||
/obj/machinery/rust_fuel_assembly_port/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
if(!busy)
|
||||
busy = 1
|
||||
if(cur_assembly)
|
||||
cur_assembly.loc = src.loc
|
||||
spawn(30)
|
||||
if(!try_insert_assembly())
|
||||
spawn(30)
|
||||
eject_assembly()
|
||||
busy = 0
|
||||
else
|
||||
busy = 0
|
||||
else
|
||||
spawn(30)
|
||||
try_draw_assembly()
|
||||
busy = 0
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/proc/try_insert_assembly()
|
||||
var/success = 0
|
||||
if(cur_assembly)
|
||||
var/turf/check_turf = get_step(get_turf(src), src.dir)
|
||||
check_turf = get_step(check_turf, src.dir)
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in check_turf)
|
||||
if(I.stat & (BROKEN|NOPOWER))
|
||||
break
|
||||
if(I.cur_assembly)
|
||||
break
|
||||
|
||||
I.cur_assembly = cur_assembly
|
||||
cur_assembly.loc = I
|
||||
cur_assembly = null
|
||||
icon_state = "port0"
|
||||
success = 1
|
||||
|
||||
New()
|
||||
//embed the fuel port into a wall
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? 24 : -24)
|
||||
pixel_y = (dir & 3)? (dir ==1 ? 24 : -24) : 0
|
||||
if(success)
|
||||
src.visible_message("\blue \icon[src] a green light flashes on [src] as it inserts it's fuel rod assembly into an injector.")
|
||||
else
|
||||
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to insert it's fuel rod assembly into an injector.")
|
||||
return success
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/proc/eject_assembly()
|
||||
if(cur_assembly)
|
||||
var/turf/check_turf = get_step(get_turf(src), src.dir)
|
||||
cur_assembly.loc = check_turf
|
||||
cur_assembly = null
|
||||
icon_state = "port0"
|
||||
return 1
|
||||
else
|
||||
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to eject it's fuel rod assembly.")
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/proc/try_draw_assembly()
|
||||
var/success = 0
|
||||
if(cur_assembly)
|
||||
var/turf/check_turf = get_step(get_turf(src), src.dir)
|
||||
check_turf = get_step(check_turf, src.dir)
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in check_turf)
|
||||
if(I.stat & (BROKEN|NOPOWER))
|
||||
break
|
||||
if(!I.cur_assembly)
|
||||
break
|
||||
if(I.injecting)
|
||||
break
|
||||
if(I.stat != 2)
|
||||
break
|
||||
|
||||
cur_assembly = I.cur_assembly
|
||||
cur_assembly.loc = src
|
||||
I.cur_assembly = null
|
||||
icon_state = "port1"
|
||||
success = 1
|
||||
|
||||
if(success)
|
||||
src.visible_message("\icon[src] a blue light flashes on [src] as it draws a fuel rod assembly from an injector.")
|
||||
else
|
||||
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to draw a fuel rod assembly from an injector.")
|
||||
return success
|
||||
|
||||
/*
|
||||
/obj/machinery/rust_fuel_assembly_port/verb/try_insert_assembly_verb()
|
||||
set name = "Attempt to insert assembly from port into injector"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!busy)
|
||||
try_insert_assembly()
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/verb/eject_assembly_verb()
|
||||
set name = "Attempt to eject assembly from port"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!busy)
|
||||
eject_assembly()
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/verb/try_draw_assembly_verb()
|
||||
set name = "Draw assembly from injector"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!busy)
|
||||
try_draw_assembly()
|
||||
*/
|
||||
|
||||
@@ -1,87 +1,89 @@
|
||||
var/const/max_assembly_amount = 300
|
||||
|
||||
/obj/machinery/rust/fuel_compressor
|
||||
/obj/machinery/rust_fuel_compressor
|
||||
icon = 'fuel_compressor.dmi'
|
||||
icon_state = "fuel_compressor"
|
||||
name = "Fuel Compressor"
|
||||
var/list/new_assembly_quantities
|
||||
//
|
||||
New()
|
||||
new_assembly_quantities = new/list
|
||||
spawn(0)
|
||||
new_assembly_quantities["Deuterium"] = 200
|
||||
new_assembly_quantities["Tritium"] = 100
|
||||
//
|
||||
new_assembly_quantities["Helium-3"] = 0
|
||||
new_assembly_quantities["Lithium-6"] = 0
|
||||
new_assembly_quantities["Silver"] = 0
|
||||
anchored = 1
|
||||
|
||||
attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
/*if(stat & (BROKEN|NOPOWER))
|
||||
return*/
|
||||
interact(user)
|
||||
|
||||
/*power_change()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "broken"
|
||||
else
|
||||
if( powered() )
|
||||
icon_state = initial(icon_state)
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
spawn(rand(0, 15))
|
||||
src.icon_state = "c_unpowered"
|
||||
stat |= NOPOWER*/
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuelcomp")
|
||||
usr.machine = null
|
||||
return
|
||||
/obj/machinery/rust_fuel_compressor/New()
|
||||
new_assembly_quantities = new/list
|
||||
spawn(0)
|
||||
new_assembly_quantities["Deuterium"] = 200
|
||||
new_assembly_quantities["Tritium"] = 100
|
||||
//
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
if(href_list[reagent])
|
||||
var/new_amount = text2num(input("Enter new rod amount", "Fuel Assembly Rod Composition ([reagent])", new_assembly_quantities[reagent]) as text|null)
|
||||
if(!new_amount)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
var/sum_reactants = new_amount - new_assembly_quantities[reagent]
|
||||
for(var/rod in new_assembly_quantities)
|
||||
sum_reactants += new_assembly_quantities[rod]
|
||||
if(sum_reactants > max_assembly_amount)
|
||||
usr << "\red You have entered too many rods."
|
||||
else
|
||||
new_assembly_quantities[reagent] = new_amount
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["activate"] )
|
||||
var/obj/item/weapon/fuel_assembly/F = new(src)
|
||||
//world << "\blue New fuel rod assembly"
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
F.rod_quantities[reagent] = new_assembly_quantities[reagent]
|
||||
//world << "\blue [reagent]: new_assembly_quantities[reagent]<br>"
|
||||
F.loc = src.loc
|
||||
return
|
||||
new_assembly_quantities["Helium-3"] = 0
|
||||
new_assembly_quantities["Lithium-6"] = 0
|
||||
new_assembly_quantities["Silver"] = 0
|
||||
|
||||
interact(mob/user)
|
||||
/*if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=fuelcomp")
|
||||
return*/
|
||||
var/t = "<B>Reactor Fuel Rod Compressor / Assembler</B><BR>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
t += "<A href='?src=\ref[src];activate=1'><b>Activate Fuel Synthesis</b></A><BR> (fuel assemblies require no more than [max_assembly_amount] rods).<br>"
|
||||
t += "<hr>"
|
||||
t += "- New fuel assembly constituents:- <br>"
|
||||
/obj/machinery/rust_fuel_compressor/attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
/*if(stat & (BROKEN|NOPOWER))
|
||||
return*/
|
||||
interact(user)
|
||||
|
||||
/*/obj/machinery/rust_fuel_compressor/power_change()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "broken"
|
||||
else
|
||||
if( powered() )
|
||||
icon_state = initial(icon_state)
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
spawn(rand(0, 15))
|
||||
src.icon_state = "c_unpowered"
|
||||
stat |= NOPOWER*/
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuelcomp")
|
||||
usr.machine = null
|
||||
return
|
||||
//
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
if(href_list[reagent])
|
||||
var/new_amount = text2num(input("Enter new rod amount", "Fuel Assembly Rod Composition ([reagent])", new_assembly_quantities[reagent]) as text|null)
|
||||
if(!new_amount)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
var/sum_reactants = new_amount - new_assembly_quantities[reagent]
|
||||
for(var/rod in new_assembly_quantities)
|
||||
sum_reactants += new_assembly_quantities[rod]
|
||||
if(sum_reactants > max_assembly_amount)
|
||||
usr << "\red You have entered too many rods."
|
||||
else
|
||||
new_assembly_quantities[reagent] = new_amount
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["activate"] )
|
||||
var/obj/item/weapon/fuel_assembly/F = new(src)
|
||||
//world << "\blue New fuel rod assembly"
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
t += " [reagent] rods: [new_assembly_quantities[reagent]] \[<A href='?src=\ref[src];reagent=1'>Modify</A>\]<br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=fuelcomp;size=500x800")
|
||||
user.machine = src
|
||||
F.rod_quantities[reagent] = new_assembly_quantities[reagent]
|
||||
//world << "\blue [reagent]: new_assembly_quantities[reagent]<br>"
|
||||
F.loc = src.loc
|
||||
F.percent_depleted = 0
|
||||
return
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/interact(mob/user)
|
||||
/*if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=fuelcomp")
|
||||
return*/
|
||||
var/t = "<B>Reactor Fuel Rod Compressor / Assembler</B><BR>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
t += "<A href='?src=\ref[src];activate=1'><b>Activate Fuel Synthesis</b></A><BR> (fuel assemblies require no more than [max_assembly_amount] rods).<br>"
|
||||
t += "<hr>"
|
||||
t += "- New fuel assembly constituents:- <br>"
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
t += " [reagent] rods: [new_assembly_quantities[reagent]] \[<A href='?src=\ref[src];reagent=1'>Modify</A>\]<br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=fuelcomp;size=500x300")
|
||||
user.machine = src
|
||||
|
||||
@@ -2,171 +2,190 @@
|
||||
/obj/machinery/computer/rust_fuel_control
|
||||
name = "Fuel Injection Control"
|
||||
icon_state = "power"
|
||||
var/list/fuel_injectors
|
||||
var/list/stage_status
|
||||
var/list/connected_injectors = list()
|
||||
var/list/active_stages = list()
|
||||
var/list/proceeding_stages = list()
|
||||
var/list/stage_times = list()
|
||||
//var/list/stage_status
|
||||
var/announce_fueldepletion = 0
|
||||
var/announce_stageprogression = 0
|
||||
//var/obj/machinery/rust/fuel_injector/Injector = null
|
||||
New()
|
||||
..()
|
||||
//these are the only three stages we can accept
|
||||
//we have another console for SCRAM
|
||||
fuel_injectors = new/list
|
||||
stage_status = new/list
|
||||
var/scan_range = 25
|
||||
var/ticks_this_stage = 0
|
||||
|
||||
fuel_injectors.Add("One")
|
||||
fuel_injectors["One"] = new/list
|
||||
stage_status.Add("One")
|
||||
stage_status["One"] = 0
|
||||
fuel_injectors.Add("Two")
|
||||
fuel_injectors["Two"] = new/list
|
||||
stage_status.Add("Two")
|
||||
stage_status["Two"] = 0
|
||||
fuel_injectors.Add("Three")
|
||||
fuel_injectors["Three"] = new/list
|
||||
stage_status.Add("Three")
|
||||
stage_status["Three"] = 0
|
||||
fuel_injectors.Add("SCRAM")
|
||||
fuel_injectors["SCRAM"] = new/list
|
||||
stage_status.Add("SCRAM")
|
||||
stage_status["SCRAM"] = 0
|
||||
/*/obj/machinery/computer/rust_fuel_control/New()
|
||||
..()
|
||||
//these are the only three stages we can accept
|
||||
//we have another console for SCRAM
|
||||
fuel_injectors = new/list
|
||||
stage_status = new/list
|
||||
|
||||
spawn(0)
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in world)
|
||||
if(Injector.stage in fuel_injectors)
|
||||
var/list/targetlist = fuel_injectors[Injector.stage]
|
||||
targetlist.Add(Injector)
|
||||
fuel_injectors.Add("One")
|
||||
fuel_injectors["One"] = new/list
|
||||
stage_status.Add("One")
|
||||
stage_status["One"] = 0
|
||||
fuel_injectors.Add("Two")
|
||||
fuel_injectors["Two"] = new/list
|
||||
stage_status.Add("Two")
|
||||
stage_status["Two"] = 0
|
||||
fuel_injectors.Add("Three")
|
||||
fuel_injectors["Three"] = new/list
|
||||
stage_status.Add("Three")
|
||||
stage_status["Three"] = 0
|
||||
fuel_injectors.Add("SCRAM")
|
||||
fuel_injectors["SCRAM"] = new/list
|
||||
stage_status.Add("SCRAM")
|
||||
stage_status["SCRAM"] = 0
|
||||
|
||||
attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
spawn(0)
|
||||
for(var/obj/machinery/power/rust_fuel_injector/Injector in world)
|
||||
if(Injector.stage in fuel_injectors)
|
||||
var/list/targetlist = fuel_injectors[Injector.stage]
|
||||
targetlist.Add(Injector)*/
|
||||
|
||||
attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
/*if(stat & (BROKEN|NOPOWER))
|
||||
return*/
|
||||
interact(user)
|
||||
/obj/machinery/computer/rust_fuel_control/attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
/*updateDialog()
|
||||
for(var/mob/M in range(1))
|
||||
if(M.machine == src)
|
||||
interact(m)*/
|
||||
/obj/machinery/computer/rust_fuel_control/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
interact(user)
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuel_monitor")
|
||||
usr.machine = null
|
||||
return
|
||||
if( href_list["beginstage"] )
|
||||
var/stage_name = href_list["beginstage"]
|
||||
if(stage_name in fuel_injectors)
|
||||
var/success = 1
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
|
||||
if(!Injector.BeginInjecting())
|
||||
success = 0
|
||||
if(!success) //may still partially complete
|
||||
usr << "\red Unable to complete command."
|
||||
stage_status[stage_name] = 1
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["begincool"] )
|
||||
var/stage_name = href_list["begincool"]
|
||||
if(stage_name in fuel_injectors)
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
|
||||
Injector.StopInjecting()
|
||||
stage_status[stage_name] = 0
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["restart"] )
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["cooldown"] )
|
||||
for(var/stage_name in fuel_injectors)
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
|
||||
Injector.StopInjecting()
|
||||
stage_status[stage_name] = 0
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["update"] )
|
||||
updateDialog()
|
||||
return
|
||||
//
|
||||
if( href_list["disable_fueldepletion"] )
|
||||
announce_fueldepletion = 0
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["announce_fueldepletion"] )
|
||||
announce_fueldepletion = 1
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["broadcast_fueldepletion"] )
|
||||
announce_fueldepletion = 2
|
||||
updateDialog()
|
||||
return
|
||||
//
|
||||
if( href_list["disable_stageprogression"] )
|
||||
announce_stageprogression = 0
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["announce_stageprogression"] )
|
||||
announce_stageprogression = 1
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["broadcast_stageprogression"] )
|
||||
announce_stageprogression = 2
|
||||
updateDialog()
|
||||
return
|
||||
/obj/machinery/computer/rust_fuel_control/interact(mob/user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_control")
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
src.updateDialog()
|
||||
if (!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_control")
|
||||
return
|
||||
|
||||
interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=fuel_monitor")
|
||||
return
|
||||
var/t = "<B>Reactor Core Fuel Control</B><BR>"
|
||||
var/cooling = 0
|
||||
for(var/stage in stage_status)
|
||||
if(stage_status[stage])
|
||||
t += "Fuel injection: <font color=blue>Active</font><br>"
|
||||
t += "<a href='?src=\ref[src];cooldown=1;'>Enter cooldown phase</a><br>"
|
||||
cooling = 1
|
||||
break
|
||||
if(!cooling)
|
||||
t += "Fuel injection: <font color=blue>Cooling</font><br>"
|
||||
t += "----<br>"
|
||||
//
|
||||
t += "Fuel depletion announcement: "
|
||||
t += "[announce_fueldepletion ? "<a href='?src=\ref[src];disable_fueldepletion=1'>Disable</a>" : "<b>Disabled</b>"] "
|
||||
t += "[announce_fueldepletion == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_fueldepletion=1'>Announce</a>"] "
|
||||
t += "[announce_fueldepletion == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_fueldepletion=1'>Broadcast</a>"]<br>"
|
||||
t += "Stage progression announcement: "
|
||||
t += "[announce_stageprogression ? "<a href='?src=\ref[src];disable_stageprogression=1'>Disable</a>" : "<b>Disabled</b>"] "
|
||||
t += "[announce_stageprogression == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_stageprogression=1'>Announce</a>"] "
|
||||
t += "[announce_stageprogression == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_stageprogression=1'>Broadcast</a>"] "
|
||||
t += "<hr>"
|
||||
t += "<table border=1><tr>"
|
||||
t += "<td><b>Injector Status</b></td>"
|
||||
t += "<td><b>Injection interval (sec)</b></td>"
|
||||
t += "<td><b>Assembly consumption per injection</b></td>"
|
||||
t += "<td><b>Fuel Assembly Port</b></td>"
|
||||
t += "<td><b>Assembly depletion percentage</b></td>"
|
||||
t += "</tr>"
|
||||
for(var/stage_name in fuel_injectors)
|
||||
var/list/cur_stage = fuel_injectors[stage_name]
|
||||
t += "<tr><td colspan=5><b>Fuel Injection Stage:</b> [stage_name]</font>, [stage_status[stage_name] ? "<font color=green>Active</font> <a href='?src=\ref[src];begincool=[stage_name]'>\[Enter cooldown\]</a>" : "Cooling <a href='?src=\ref[src];beginstage=[stage_name]'>\[Begin injection\]</a>"]</td></tr>"
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in cur_stage)
|
||||
t += "<tr>"
|
||||
t += "<td>[Injector.on && Injector.remote_enabled ? "<font color=green>Operational</font>" : "<font color=red>Unresponsive</font>"]</td>"
|
||||
t += "<td>[Injector.rate/10] <a href='?src=\ref[Injector];cyclerate=1'>Modify</a></td>"
|
||||
t += "<td>[Injector.fuel_usage*100]% <a href='?src=\ref[Injector];fuel_usage=1'>Modify</a></td>"
|
||||
t += "<td>[Injector.owned_assembly_port ? "[Injector.owned_assembly_port.cur_assembly ? "<font color=green>Loaded</font>": "<font color=blue>Empty</font>"]" : "<font color=red>Disconnected</font>" ]</td>"
|
||||
t += "<td>[Injector.owned_assembly_port && Injector.owned_assembly_port.cur_assembly ? "[Injector.owned_assembly_port.cur_assembly.percent_depleted]%" : ""]</td>"
|
||||
t += "</tr>"
|
||||
t += "</table>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=fuel_monitor;size=500x600")
|
||||
user.machine = src
|
||||
var/dat = "<B>Reactor Core Fuel Control</B><BR>"
|
||||
dat += "<b>Fuel depletion announcement:</b> "
|
||||
dat += "[announce_fueldepletion == 0 ? "Disabled" : "<a href='?src=\ref[src];announce_fueldepletion=0'>\[Disable\]</a>"] "
|
||||
dat += "[announce_fueldepletion == 1 ? "Announcing" : "<a href='?src=\ref[src];announce_fueldepletion=1'>\[Announce\]</a>"] "
|
||||
dat += "[announce_fueldepletion == 2 ? "Broadcasting" : "<a href='?src=\ref[src];announce_fueldepletion=2'>\[Broadcast\]</a>"]<br>"
|
||||
dat += "<b>Stage progression announcement:</b> "
|
||||
dat += "[announce_stageprogression == 0 ? "Disabled" : "<a href='?src=\ref[src];announce_stageprogression=0'>\[Disable\]</a>"] "
|
||||
dat += "[announce_stageprogression == 1 ? "Announcing" : "<a href='?src=\ref[src];announce_stageprogression=1'>\[Announce\]</a>"] "
|
||||
dat += "[announce_stageprogression == 2 ? "Broadcasting" : "<a href='?src=\ref[src];announce_stageprogression=2'>\[Broadcast\]</a>"]<br>"
|
||||
dat += "<hr>"
|
||||
|
||||
dat += "<b>Detected devices</b> <a href='?src=\ref[src];scan=1'>\[Refresh list\]</a>"
|
||||
dat += "<table border=1 width='100%'>"
|
||||
dat += "<tr>"
|
||||
dat += "<td><b>ID</b></td>"
|
||||
dat += "<td><b>Assembly</b></td>"
|
||||
dat += "<td><b>Consumption</b></td>"
|
||||
dat += "<td><b>Depletion</b></td>"
|
||||
dat += "<td><b>Duration</b></td>"
|
||||
dat += "<td><b>Next stage</b></td>"
|
||||
dat += "<td></td>"
|
||||
dat += "<td></td>"
|
||||
dat += "</tr>"
|
||||
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
|
||||
dat += "<tr>"
|
||||
dat += "<td>[I.id_tag]</td>"
|
||||
if(I.cur_assembly)
|
||||
dat += "<td><a href='?src=\ref[I];toggle_injecting=1;update_extern=\ref[src]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
|
||||
else
|
||||
dat += "<td>None</td>"
|
||||
dat += "<td>[I.fuel_usage * 100]%</td>"
|
||||
if(I.cur_assembly)
|
||||
dat += "<td>[I.cur_assembly.percent_depleted * 100]%</td>"
|
||||
else
|
||||
dat += "<td>NA</td>"
|
||||
if(stage_times.Find(I.id_tag))
|
||||
dat += "<td>[ticks_this_stage]/[stage_times[I.id_tag]]s <a href='?src=\ref[src];stage_time=[I.id_tag]'>Modify</td>"
|
||||
else
|
||||
dat += "<td>[ticks_this_stage]s <a href='?src=\ref[src];stage_time=[I.id_tag]'>Set</td>"
|
||||
if(proceeding_stages.Find(I.id_tag))
|
||||
dat += "<td><a href='?src=\ref[src];set_next_stage=[I.id_tag]'>[proceeding_stages[I.id_tag]]</a></td>"
|
||||
else
|
||||
dat += "<td>None <a href='?src=\ref[src];set_next_stage=[I.id_tag]'>\[modify\]</a></td>"
|
||||
dat += "<td><a href='?src=\ref[src];toggle_stage=[I.id_tag]'>\[[active_stages.Find(I.id_tag) ? "Deactivate stage" : "Activate stage "] \]</a></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<A href='?src=\ref[src];refresh=1'>Refresh</A> "
|
||||
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(dat, "window=fuel_control;size=800x400")
|
||||
user.set_machine(src)
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if( href_list["scan"] )
|
||||
connected_injectors = list()
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in range(scan_range, src))
|
||||
if(check_injector_status(I))
|
||||
connected_injectors.Add(I)
|
||||
|
||||
if( href_list["toggle_stage"] )
|
||||
var/cur_stage = href_list["toggle_stage"]
|
||||
if(active_stages.Find(cur_stage))
|
||||
active_stages.Remove(cur_stage)
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
|
||||
if(I.id_tag == cur_stage && check_injector_status(I))
|
||||
I.StopInjecting()
|
||||
else
|
||||
active_stages.Add(cur_stage)
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
|
||||
if(I.id_tag == cur_stage && check_injector_status(I))
|
||||
I.BeginInjecting()
|
||||
|
||||
if( href_list["cooldown"] )
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
|
||||
if(check_injector_status(I))
|
||||
I.StopInjecting()
|
||||
active_stages = list()
|
||||
|
||||
if( href_list["warmup"] )
|
||||
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
|
||||
if(check_injector_status(I))
|
||||
I.BeginInjecting()
|
||||
if(!active_stages.Find(I.id_tag))
|
||||
active_stages.Add(I.id_tag)
|
||||
|
||||
if( href_list["stage_time"] )
|
||||
var/cur_stage = href_list["stage_time"]
|
||||
var/new_duration = input("Enter new stage duration in seconds", "Stage duration") as num
|
||||
if(new_duration)
|
||||
stage_times[cur_stage] = new_duration
|
||||
else if(stage_times.Find(cur_stage))
|
||||
stage_times.Remove(cur_stage)
|
||||
|
||||
if( href_list["announce_fueldepletion"] )
|
||||
announce_fueldepletion = text2num(href_list["announce_fueldepletion"])
|
||||
|
||||
if( href_list["announce_stageprogression"] )
|
||||
announce_stageprogression = text2num(href_list["announce_stageprogression"])
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuel_control")
|
||||
usr.unset_machine()
|
||||
|
||||
if( href_list["set_next_stage"] )
|
||||
var/cur_stage = href_list["set_next_stage"]
|
||||
if(!proceeding_stages.Find(cur_stage))
|
||||
proceeding_stages.Add(cur_stage)
|
||||
var/next_stage = input("Enter next stage ID", "Automated stage procession") as text|null
|
||||
if(next_stage)
|
||||
proceeding_stages[cur_stage] = next_stage
|
||||
else
|
||||
proceeding_stages.Remove(cur_stage)
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control/proc/check_injector_status(var/obj/machinery/power/rust_fuel_injector/I)
|
||||
if(!I)
|
||||
return 0
|
||||
|
||||
if(I.stat & (BROKEN|NOPOWER) || !I.remote_access_enabled || !I.id_tag)
|
||||
if(connected_injectors.Find(I))
|
||||
connected_injectors.Remove(I)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1,210 +1,290 @@
|
||||
|
||||
/obj/machinery/rust/fuel_injector
|
||||
/obj/machinery/power/rust_fuel_injector
|
||||
name = "Fuel Injector"
|
||||
icon = 'fuel_injector.dmi'
|
||||
icon_state = "injector0"
|
||||
anchored = 1
|
||||
anchored = 0
|
||||
density = 1
|
||||
var/obj/machinery/rust/fuel_assembly_port/owned_assembly_port
|
||||
//var/list/stageone_assemblyports
|
||||
//var/list/stagetwo_assemblyports
|
||||
//var/list/scram_assemblyports
|
||||
var/obj/machinery/rust/reactor_vessel/Vessel = null
|
||||
var/rate = 10 //microseconds between each cycle
|
||||
var/fuel_usage = 0.0001 //percentage of available fuel to use per cycle
|
||||
var/on = 1
|
||||
var/remote_enabled = 1
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
var/obj/item/weapon/fuel_assembly/cur_assembly
|
||||
var/fuel_usage = 0.0001 //percentage of available fuel to use per cycle
|
||||
var/id_tag = "One"
|
||||
var/injecting = 0
|
||||
var/stage = "One"
|
||||
var/targetting_field = 0
|
||||
layer = 4
|
||||
var/trying_to_swap_fuel = 0
|
||||
//
|
||||
req_access = list(access_engine)
|
||||
//
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 300
|
||||
active_power_usage = 500
|
||||
var/remote_access_enabled = 1
|
||||
var/cached_power_avail = 0
|
||||
var/emergency_insert_ready = 0
|
||||
|
||||
//fuel assembly should be embedded into the wall behind the injector
|
||||
New()
|
||||
..()
|
||||
name = "Stage [stage] Fuel Injector"
|
||||
//pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
|
||||
//pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
|
||||
/*
|
||||
stageone_assemblyports = new/list()
|
||||
stagetwo_assemblyports = new/list()
|
||||
scram_assemblyports = new/list()
|
||||
spawn(1)
|
||||
Vessel = locate() in range(6,src)
|
||||
for(var/obj/machinery/rust/fuel_assembly_port/S in range(6,src))
|
||||
switch(S.stage)
|
||||
if("One")
|
||||
stageone_assemblyports.Add(S)
|
||||
if("Two")
|
||||
stagetwo_assemblyports.Add(S)
|
||||
if("SCRAM")
|
||||
scram_assemblyports.Add(S)
|
||||
*/
|
||||
spawn(1)
|
||||
var/rev_dir = reverse_direction(dir)
|
||||
var/turf/mid = get_step(src, rev_dir)
|
||||
for(var/obj/machinery/rust/fuel_assembly_port/port in get_step(mid, rev_dir))
|
||||
owned_assembly_port = port
|
||||
//
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuel_injector")
|
||||
usr.machine = null
|
||||
return
|
||||
if( href_list["begin_injecting"] )
|
||||
BeginInjecting()
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["end_injecting"] )
|
||||
/obj/machinery/power/rust_fuel_injector/process()
|
||||
if(injecting)
|
||||
if(stat & BROKEN || !powernet)
|
||||
StopInjecting()
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["cyclerate"] )
|
||||
var/new_rate = text2num(input("Enter new injection rate (0.1 - 10 sec)", "Modifying injection rate", rate/10))
|
||||
if(!new_rate)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_rate = min(new_rate,0.1)
|
||||
new_rate = max(new_rate,10)
|
||||
rate = new_rate * 10
|
||||
updateDialog()
|
||||
return
|
||||
if( href_list["fuel_usage"] )
|
||||
var/new_rate = text2num(input("Enter new fuel usage (1 - 100%)", "Modifying fuel usage", rate/10))
|
||||
if(!new_rate)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_rate = min(new_rate,0.1)
|
||||
new_rate = max(new_rate,10)
|
||||
rate = new_rate * 10
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
/*if(stat & (BROKEN|NOPOWER))
|
||||
return*/
|
||||
interact(user)
|
||||
|
||||
interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.machine = null
|
||||
user << browse(null, "window=fuel_injector")
|
||||
return
|
||||
var/t = "<B>Reactor Core Fuel Injector</B><hr>"
|
||||
t += "<b>Stage:</b> <font color=blue>[stage]</font><br>"
|
||||
t += "<b>Status:</b> [injecting ? "<font color=green>Active</font> <a href='?src=\ref[src];end_injecting=1'>\[Disable\]</a>" : "<font color=blue>Standby</font> <a href='?src=\ref[src];begin_injecting=1'>\[Enable\]</a>"]<br>"
|
||||
t += "<b>Interval (sec):</b> <font color=blue>[rate/10]</font> <a href='?src=\ref[src];cyclerate=1'>\[Modify\]</a><br>"
|
||||
t += "<b>Fuel usage:</b> [fuel_usage*100]% <a href='?src=\ref[src];fuel_usage=1'>\[Modify\]</a><br>"
|
||||
/*
|
||||
var/t = "<B>Reactor Core Fuel Control</B><BR>"
|
||||
t += "Current fuel injection stage: [active_stage]<br>"
|
||||
if(active_stage == "Cooling")
|
||||
//t += "<a href='?src=\ref[src];restart=1;'>Restart injection cycle</a><br>"
|
||||
t += "----<br>"
|
||||
else
|
||||
t += "<a href='?src=\ref[src];cooldown=1;'>Enter cooldown phase</a><br>"
|
||||
t += "Fuel depletion announcement: "
|
||||
t += "[announce_fueldepletion ? "<a href='?src=\ref[src];disable_fueldepletion=1'>Disable</a>" : "<b>Disabled</b>"] "
|
||||
t += "[announce_fueldepletion == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_fueldepletion=1'>Announce</a>"] "
|
||||
t += "[announce_fueldepletion == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_fueldepletion=1'>Broadcast</a>"]<br>"
|
||||
t += "Stage progression announcement: "
|
||||
t += "[announce_stageprogression ? "<a href='?src=\ref[src];disable_stageprogression=1'>Disable</a>" : "<b>Disabled</b>"] "
|
||||
t += "[announce_stageprogression == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_stageprogression=1'>Announce</a>"] "
|
||||
t += "[announce_stageprogression == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_stageprogression=1'>Broadcast</a>"] "
|
||||
t += "<hr>"
|
||||
t += "<table border=1><tr>"
|
||||
t += "<td><b>Injector Status</b></td>"
|
||||
t += "<td><b>Injection interval (sec)</b></td>"
|
||||
t += "<td><b>Assembly consumption per injection</b></td>"
|
||||
t += "<td><b>Fuel Assembly Port</b></td>"
|
||||
t += "<td><b>Assembly depletion percentage</b></td>"
|
||||
t += "</tr>"
|
||||
for(var/stage in fuel_injectors)
|
||||
var/list/cur_stage = fuel_injectors[stage]
|
||||
t += "<tr><td colspan=5><b>Fuel Injection Stage:</b> <font color=blue>[stage]</font> [active_stage == stage ? "<font color=green> (Currently active)</font>" : "<a href='?src=\ref[src];beginstage=[stage]'>Activate</a>"]</td></tr>"
|
||||
for(var/obj/machinery/rust/fuel_injector/Injector in cur_stage)
|
||||
t += "<tr>"
|
||||
t += "<td>[Injector.on && Injector.remote_enabled ? "<font color=green>Operational</font>" : "<font color=red>Unresponsive</font>"]</td>"
|
||||
t += "<td>[Injector.rate/10] <a href='?src=\ref[Injector];cyclerate=1'>Modify</a></td>"
|
||||
t += "<td>[Injector.fuel_usage*100]% <a href='?src=\ref[Injector];fuel_usage=1'>Modify</a></td>"
|
||||
t += "<td>[Injector.owned_assembly_port ? "[Injector.owned_assembly_port.cur_assembly ? "<font color=green>Loaded</font>": "<font color=blue>Empty</font>"]" : "<font color=red>Disconnected</font>" ]</td>"
|
||||
t += "<td>[Injector.owned_assembly_port && Injector.owned_assembly_port.cur_assembly ? "[100 - Injector.owned_assembly_port.cur_assembly.amount_depleted*100]%" : ""]</td>"
|
||||
t += "</tr>"
|
||||
t += "</table>"
|
||||
*/
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=fuel_injector;size=500x800")
|
||||
user.machine = src
|
||||
Inject()
|
||||
|
||||
proc/BeginInjecting()
|
||||
if(!injecting && owned_assembly_port && owned_assembly_port.cur_assembly)
|
||||
icon_state = "injector1"
|
||||
injecting = 1
|
||||
spawn(rate)
|
||||
Inject()
|
||||
return 1
|
||||
return 0
|
||||
cached_power_avail = avail()
|
||||
|
||||
proc/StopInjecting()
|
||||
/obj/machinery/power/rust_fuel_injector/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(injecting)
|
||||
injecting = 0
|
||||
icon_state = "injector0"
|
||||
return 1
|
||||
return 0
|
||||
|
||||
proc/Inject()
|
||||
if(!injecting)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
if(owned_assembly_port.cur_assembly)
|
||||
var/obj/machinery/rust/em_field/target_field
|
||||
if(targetting_field)
|
||||
for(var/obj/machinery/rust/em_field/field in range(15))
|
||||
target_field = field
|
||||
var/amount_left = 0
|
||||
for(var/reagent in owned_assembly_port.cur_assembly.rod_quantities)
|
||||
//world << "checking [reagent]"
|
||||
if(owned_assembly_port.cur_assembly.rod_quantities[reagent] > 0)
|
||||
//world << " rods left: [owned_assembly_port.cur_assembly.rod_quantities[reagent]]"
|
||||
var/amount = owned_assembly_port.cur_assembly.rod_quantities[reagent] * fuel_usage
|
||||
var/numparticles = round(amount * 1000)
|
||||
if(numparticles < 1)
|
||||
numparticles = 1
|
||||
//world << " amount: [amount]"
|
||||
//world << " numparticles: [numparticles]"
|
||||
//
|
||||
var/obj/effect/accelerated_particle/particle = new/obj/effect/accelerated_particle(src.loc, src.dir)
|
||||
particle.particle_type = reagent
|
||||
particle.energy = 0
|
||||
particle.icon_state = "particle"
|
||||
particle.additional_particles = numparticles - 1
|
||||
particle.target = target_field
|
||||
//
|
||||
owned_assembly_port.cur_assembly.rod_quantities[reagent] -= amount
|
||||
amount_left += owned_assembly_port.cur_assembly.rod_quantities[reagent]
|
||||
owned_assembly_port.cur_assembly.percent_depleted = amount_left / 300
|
||||
flick("injector-emitting",src)
|
||||
use_power(fuel_usage * 10000 + 100) //0.0001
|
||||
if(injecting)
|
||||
spawn(rate)
|
||||
Inject()
|
||||
else
|
||||
injecting = 0
|
||||
switch(state)
|
||||
if(0)
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the external reinforcing bolts to the floor.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 1
|
||||
if(1)
|
||||
state = 0
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
|
||||
"You undo the external reinforcing bolts.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 0
|
||||
if(2)
|
||||
user << "\red The [src.name] needs to be unwelded from the floor."
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(injecting)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
user << "\red The [src.name] needs to be wrenched to the floor."
|
||||
if(1)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
|
||||
"You start to weld the [src] to the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 2
|
||||
user << "You weld the [src] to the floor."
|
||||
connect_to_network()
|
||||
src.directwired = 1
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
if(2)
|
||||
if (WT.remove_fuel(0,user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
|
||||
"You start to cut the [src] free from the floor.", \
|
||||
"You hear welding")
|
||||
if (do_after(user,20))
|
||||
if(!src || !WT.isOn()) return
|
||||
state = 1
|
||||
user << "You cut the [src] free from the floor."
|
||||
disconnect_from_network()
|
||||
src.directwired = 0
|
||||
else
|
||||
user << "\red You need more welding fuel to complete this task."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(emagged)
|
||||
user << "\red The lock seems to be broken"
|
||||
return
|
||||
if(src.allowed(user))
|
||||
src.locked = !src.locked
|
||||
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/fuel_assembly) && !cur_assembly)
|
||||
if(emergency_insert_ready)
|
||||
cur_assembly = W
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
emergency_insert_ready = 0
|
||||
return
|
||||
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/interact(mob/user)
|
||||
if(stat & BROKEN)
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_injector")
|
||||
return
|
||||
if(get_dist(src, user) > 1 )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_injector")
|
||||
return
|
||||
|
||||
var/dat = ""
|
||||
if (!powernet || locked || state != 2)
|
||||
dat += "<i>The console is dark and nonresponsive.</i>"
|
||||
else
|
||||
dat += "<B>Reactor Core Fuel Injector</B><hr>"
|
||||
dat += "<b>Device ID tag:</b> [id_tag] <a href='?src=\ref[src];modify_tag=1'>\[Modify\]</a><br>"
|
||||
dat += "<b>Status:</b> [injecting ? "<font color=green>Active</font> <a href='?src=\ref[src];toggle_injecting=1'>\[Disable\]</a>" : "<font color=blue>Standby</font> <a href='?src=\ref[src];toggle_injecting=1'>\[Enable\]</a>"]<br>"
|
||||
dat += "<b>Fuel usage:</b> [fuel_usage*100]% <a href='?src=\ref[src];fuel_usage=1'>\[Modify\]</a><br>"
|
||||
dat += "<b>Fuel assembly port:</b> "
|
||||
dat += "<a href='?src=\ref[src];fuel_assembly=1'>\[[cur_assembly ? "Eject assembly to port" : "Draw assembly from port"]\]</a> "
|
||||
if(cur_assembly)
|
||||
dat += "<a href='?src=\ref[src];emergency_fuel_assembly=1'>\[Emergency eject\]</a><br>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];emergency_fuel_assembly=1'>\[[emergency_insert_ready ? "Cancel emergency insertion" : "Emergency insert"]\]</a><br>"
|
||||
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>"
|
||||
dat += "<a href='?src=\ref[src];toggle_remote=1'>\[[remote_access_enabled ? "Disable remote access" : "Enable remote access"]\]</a><br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<A href='?src=\ref[src];refresh=1'>Refresh</A> "
|
||||
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
|
||||
user << browse(dat, "window=fuel_injector;size=500x300")
|
||||
onclose(user, "fuel_injector")
|
||||
user.set_machine(src)
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if( href_list["modify_tag"] )
|
||||
id_tag = input("Enter new ID tag", "Modifying ID tag") as text|null
|
||||
|
||||
if( href_list["fuel_assembly"] )
|
||||
if(!trying_to_swap_fuel)
|
||||
trying_to_swap_fuel = 1
|
||||
spawn(50)
|
||||
attempt_fuel_swap()
|
||||
trying_to_swap_fuel = 0
|
||||
|
||||
if( href_list["emergency_fuel_assembly"] )
|
||||
if(cur_assembly)
|
||||
cur_assembly.loc = src.loc
|
||||
cur_assembly = null
|
||||
//irradiate!
|
||||
else
|
||||
emergency_insert_ready = !emergency_insert_ready
|
||||
|
||||
if( href_list["toggle_injecting"] )
|
||||
if(injecting)
|
||||
StopInjecting()
|
||||
else
|
||||
BeginInjecting()
|
||||
|
||||
if( href_list["toggle_remote"] )
|
||||
remote_access_enabled = !remote_access_enabled
|
||||
|
||||
if( href_list["fuel_usage"] )
|
||||
var/new_usage = text2num(input("Enter new fuel usage (0.01% - 100%)", "Modifying fuel usage", fuel_usage * 100))
|
||||
if(!new_usage)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_usage = max(new_usage, 0.01)
|
||||
new_usage = min(new_usage, 100)
|
||||
fuel_usage = new_usage / 100
|
||||
active_power_usage = 500 + 1000 * fuel_usage
|
||||
|
||||
if( href_list["update_extern"] )
|
||||
var/obj/machinery/computer/rust_fuel_control/C = locate(href_list["update_extern"])
|
||||
if(C)
|
||||
C.updateDialog()
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuel_injector")
|
||||
usr.unset_machine()
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/proc/BeginInjecting()
|
||||
if(!injecting && cur_assembly)
|
||||
icon_state = "injector1"
|
||||
injecting = 1
|
||||
use_power = 1
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/proc/StopInjecting()
|
||||
if(injecting)
|
||||
injecting = 0
|
||||
icon_state = "injector0"
|
||||
use_power = 0
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/proc/Inject()
|
||||
if(!injecting)
|
||||
return
|
||||
if(cur_assembly)
|
||||
var/amount_left = 0
|
||||
for(var/reagent in cur_assembly.rod_quantities)
|
||||
//world << "checking [reagent]"
|
||||
if(cur_assembly.rod_quantities[reagent] > 0)
|
||||
//world << " rods left: [cur_assembly.rod_quantities[reagent]]"
|
||||
var/amount = cur_assembly.rod_quantities[reagent] * fuel_usage
|
||||
var/numparticles = round(amount * 1000)
|
||||
if(numparticles < 1)
|
||||
numparticles = 1
|
||||
//world << " amount: [amount]"
|
||||
//world << " numparticles: [numparticles]"
|
||||
//
|
||||
|
||||
var/obj/effect/accelerated_particle/A = new/obj/effect/accelerated_particle(get_turf(src), dir)
|
||||
A.particle_type = reagent
|
||||
A.additional_particles = numparticles - 1
|
||||
//A.target = target_field
|
||||
//
|
||||
cur_assembly.rod_quantities[reagent] -= amount
|
||||
amount_left += cur_assembly.rod_quantities[reagent]
|
||||
cur_assembly.percent_depleted = amount_left / 300
|
||||
flick("injector-emitting",src)
|
||||
else
|
||||
StopInjecting()
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/proc/attempt_fuel_swap()
|
||||
var/rev_dir = reverse_direction(dir)
|
||||
var/turf/mid = get_step(src, rev_dir)
|
||||
var/success = 0
|
||||
for(var/obj/machinery/rust_fuel_assembly_port/check_port in get_step(mid, rev_dir))
|
||||
if(cur_assembly)
|
||||
if(!check_port.cur_assembly)
|
||||
check_port.cur_assembly = cur_assembly
|
||||
cur_assembly.loc = check_port
|
||||
cur_assembly = null
|
||||
check_port.icon_state = "port1"
|
||||
success = 1
|
||||
else
|
||||
if(check_port.cur_assembly)
|
||||
cur_assembly = check_port.cur_assembly
|
||||
cur_assembly.loc = src
|
||||
check_port.cur_assembly = null
|
||||
check_port.icon_state = "port0"
|
||||
success = 1
|
||||
|
||||
break
|
||||
if(success)
|
||||
src.visible_message("\blue \icon[src] a green light flashes on [src].")
|
||||
updateDialog()
|
||||
//
|
||||
else
|
||||
src.visible_message("\red \icon[src] a red light flashes on [src].")
|
||||
|
||||
@@ -67,4 +67,8 @@
|
||||
//particle.invisibility = 2
|
||||
//
|
||||
return particle
|
||||
*/
|
||||
*/
|
||||
|
||||
/obj/machinery/computer/rust_radiation_monitor
|
||||
name = "Radiation Monitor"
|
||||
icon_state = "power"
|
||||
|
||||
@@ -1,49 +1,53 @@
|
||||
|
||||
//gimmicky hack to collect particles and direct them into the field
|
||||
//byond multitiles are basically... shit
|
||||
/obj/machinery/rust/particle_catcher
|
||||
invisibility = 101
|
||||
/obj/effect/rust_particle_catcher
|
||||
icon = 'effects.dmi'
|
||||
icon_state = "energynet"
|
||||
density = 0
|
||||
anchored = 1
|
||||
var/obj/machinery/rust/em_field/parent
|
||||
//invisibility = 101
|
||||
layer = 4
|
||||
var/obj/effect/rust_em_field/parent
|
||||
var/mysize = 0
|
||||
|
||||
/*New()
|
||||
for(var/obj/machinery/rust/em_field/field in range(6))
|
||||
parent = field
|
||||
if(!parent)
|
||||
del(src)*/
|
||||
/*/obj/effect/rust_particle_catcher/New()
|
||||
for(var/obj/machinery/rust/em_field/field in range(6))
|
||||
parent = field
|
||||
if(!parent)
|
||||
del(src)*/
|
||||
|
||||
proc/SetSize(var/newsize)
|
||||
name = "collector [newsize]"
|
||||
mysize = newsize
|
||||
UpdateSize()
|
||||
/obj/effect/rust_particle_catcher/process()
|
||||
if(!parent)
|
||||
del(src)
|
||||
|
||||
proc/AddParticles(var/name, var/quantity = 1)
|
||||
if(parent && parent.size >= mysize)
|
||||
parent.AddParticles(name, quantity)
|
||||
return 1
|
||||
return 0
|
||||
/obj/effect/rust_particle_catcher/proc/SetSize(var/newsize)
|
||||
name = "collector [newsize]"
|
||||
mysize = newsize
|
||||
UpdateSize()
|
||||
|
||||
proc/UpdateSize()
|
||||
if(parent.size >= mysize)
|
||||
density = 1
|
||||
//invisibility = 101
|
||||
name = "collector [mysize] ON"
|
||||
else
|
||||
density = 0
|
||||
name = "collector [mysize] OFF"
|
||||
//invisibility = 101
|
||||
/obj/effect/rust_particle_catcher/proc/AddParticles(var/name, var/quantity = 1)
|
||||
if(parent && parent.size >= mysize)
|
||||
parent.AddParticles(name, quantity)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet" && parent)
|
||||
var/obj/item/projectile/beam/laserbeam = Proj
|
||||
parent.AddEnergy(0, laserbeam.damage / 5000, laserbeam.frequency)
|
||||
return 0
|
||||
/obj/effect/rust_particle_catcher/proc/UpdateSize()
|
||||
if(parent.size >= mysize)
|
||||
density = 1
|
||||
invisibility = 0
|
||||
name = "collector [mysize] ON"
|
||||
else
|
||||
density = 0
|
||||
invisibility = 101
|
||||
name = "collector [mysize] OFF"
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!parent)
|
||||
del(src)
|
||||
/obj/effect/rust_particle_catcher/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet" && parent)
|
||||
parent.AddEnergy(Proj.damage, 0, 1)
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
/obj/effect/rust_particle_catcher/Bumped(atom/AM)
|
||||
if(ismob(AM) && density && prob(10))
|
||||
AM << "\red A powerful force pushes you back."
|
||||
..()
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/machinery/singularity/)))
|
||||
A:energy += energy
|
||||
else if( istype(A,/obj/machinery/rust/particle_catcher) )
|
||||
var/obj/machinery/rust/particle_catcher/collided_catcher = A
|
||||
else if( istype(A,/obj/effect/rust_particle_catcher) )
|
||||
var/obj/effect/rust_particle_catcher/collided_catcher = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_catcher.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_catcher.parent.AddEnergy(energy,mega_energy)
|
||||
del (src)
|
||||
else if( istype(A,/obj/machinery/rust/core) )
|
||||
var/obj/machinery/rust/core/collided_core = A
|
||||
else if( istype(A,/obj/machinery/power/rust_core) )
|
||||
var/obj/machinery/power/rust_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
var/energy_loss_ratio = abs(collided_core.owned_field.frequency - frequency) / 1e9
|
||||
|
||||
Reference in New Issue
Block a user