mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge remote-tracking branch 'upstream/dev-freeze' into dev
Conflicts: code/modules/mob/living/silicon/ai/life.dm code/modules/power/rust/circuits_and_design.dm code/modules/power/rust/core_gen.dm code/modules/power/rust/fuel_compressor_construction.dm code/modules/power/rust/fuel_injector.dm
This commit is contained in:
@@ -1437,23 +1437,6 @@
|
||||
#include "code\modules\power\antimatter\containment_jar.dm"
|
||||
#include "code\modules\power\antimatter\control.dm"
|
||||
#include "code\modules\power\antimatter\shielding.dm"
|
||||
#include "code\modules\power\rust\circuits_and_design.dm"
|
||||
#include "code\modules\power\rust\core_control.dm"
|
||||
#include "code\modules\power\rust\core_field.dm"
|
||||
#include "code\modules\power\rust\core_gen.dm"
|
||||
#include "code\modules\power\rust\core_monitor.dm"
|
||||
#include "code\modules\power\rust\fuel_assembly.dm"
|
||||
#include "code\modules\power\rust\fuel_assembly_port.dm"
|
||||
#include "code\modules\power\rust\fuel_assembly_port_construction.dm"
|
||||
#include "code\modules\power\rust\fuel_compressor.dm"
|
||||
#include "code\modules\power\rust\fuel_compressor_construction.dm"
|
||||
#include "code\modules\power\rust\fuel_control.dm"
|
||||
#include "code\modules\power\rust\fuel_injector.dm"
|
||||
#include "code\modules\power\rust\fusion_reactions.dm"
|
||||
#include "code\modules\power\rust\gyrotron.dm"
|
||||
#include "code\modules\power\rust\gyrotron_controller.dm"
|
||||
#include "code\modules\power\rust\radiation.dm"
|
||||
#include "code\modules\power\rust\virtual_particle_catcher.dm"
|
||||
#include "code\modules\power\sensors\powernet_sensor.dm"
|
||||
#include "code\modules\power\sensors\sensor_monitoring.dm"
|
||||
#include "code\modules\power\singularity\act.dm"
|
||||
|
||||
@@ -1115,42 +1115,6 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
|
||||
containername = "Formalwear for the best occasions."
|
||||
group = "Miscellaneous"
|
||||
|
||||
/datum/supply_packs/rust_injector
|
||||
contains = list(/obj/machinery/power/rust_fuel_injector)
|
||||
name = "RUST fuel injector"
|
||||
cost = 50
|
||||
containertype = /obj/structure/closet/crate/secure/large
|
||||
containername = "RUST injector crate"
|
||||
group = "Engineering"
|
||||
access = access_engine
|
||||
|
||||
/datum/supply_packs/rust_compressor
|
||||
contains = list(/obj/item/weapon/module/rust_fuel_compressor)
|
||||
name = "RUST fuel compressor circuitry"
|
||||
cost = 60
|
||||
containertype = /obj/structure/closet/crate/secure
|
||||
containername = "RUST fuel compressor circuitry"
|
||||
group = "Engineering"
|
||||
access = access_engine
|
||||
|
||||
/datum/supply_packs/rust_assembly_port
|
||||
contains = list(/obj/item/weapon/module/rust_fuel_port)
|
||||
name = "RUST fuel assembly port circuitry"
|
||||
cost = 40
|
||||
containertype = /obj/structure/closet/crate/secure
|
||||
containername = "RUST fuel assembly port circuitry"
|
||||
group = "Engineering"
|
||||
access = access_engine
|
||||
|
||||
/datum/supply_packs/rust_core
|
||||
contains = list(/obj/machinery/power/rust_core)
|
||||
name = "RUST Tokamak Core"
|
||||
cost = 75
|
||||
containertype = /obj/structure/closet/crate/secure/large
|
||||
containername = "RUST tokamak crate"
|
||||
group = "Engineering"
|
||||
access = access_engine
|
||||
|
||||
/datum/supply_packs/shield_gen
|
||||
contains = list(/obj/item/weapon/circuitboard/shield_gen)
|
||||
name = "Bubble shield generator circuitry"
|
||||
|
||||
@@ -67,17 +67,3 @@
|
||||
icon_state = "bulb-construct-item"
|
||||
refund_amt = 1
|
||||
build_machine_type = /obj/machinery/light_construct/small
|
||||
|
||||
/obj/item/frame/rust
|
||||
name = "Fuel Compressor frame"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "fuel_compressor0"
|
||||
w_class = 4
|
||||
refund_type = /obj/item/stack/material/plasteel
|
||||
refund_amt = 12
|
||||
build_machine_type = /obj/machinery/rust_fuel_compressor
|
||||
|
||||
/obj/item/frame/rust/assembly
|
||||
name = "Fuel Assembly Port frame"
|
||||
icon_state = "port2"
|
||||
build_machine_type = /obj/machinery/rust_fuel_assembly_port
|
||||
|
||||
@@ -82,8 +82,6 @@
|
||||
..()
|
||||
recipes += new/datum/stack_recipe("AI core", /obj/structure/AIcore, 4, time = 50, one_per_turf = 1)
|
||||
recipes += new/datum/stack_recipe("Metal crate", /obj/structure/closet/crate, 10, time = 50, one_per_turf = 1)
|
||||
recipes += new/datum/stack_recipe("RUST fuel assembly port frame", /obj/item/frame/rust/assembly, 12, time = 50, one_per_turf = 1)
|
||||
recipes += new/datum/stack_recipe("RUST fuel compressor frame", /obj/item/frame/rust, 12, time = 50, one_per_turf = 1)
|
||||
recipes += new/datum/stack_recipe("knife grip", /obj/item/weapon/material/butterflyhandle, 4, time = 20, one_per_turf = 0, on_floor = 1)
|
||||
|
||||
/material/sandstone/generate_recipes()
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
//Being dead doesn't mean your temperature never changes
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
if (src.stat!=0)
|
||||
if (src.stat!=CONSCIOUS)
|
||||
src.cameraFollow = null
|
||||
src.reset_view(null)
|
||||
src.unset_machine()
|
||||
|
||||
src.updatehealth()
|
||||
|
||||
@@ -20,6 +19,7 @@
|
||||
if(!psupply)
|
||||
create_powersupply()
|
||||
|
||||
|
||||
// Handle power damage (oxy)
|
||||
if(aiRestorePowerRoutine != 0 && !APU_power)
|
||||
// Lose power
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
|
||||
//reactor areas
|
||||
|
||||
/area/engine
|
||||
icon_state = "engine"
|
||||
|
||||
fore
|
||||
name = "\improper Fore"
|
||||
|
||||
construction_storage
|
||||
name = "\improper Construction storage"
|
||||
|
||||
atmos_storage
|
||||
name = "\improper Atmos storage"
|
||||
icon_state = "engine_storage"
|
||||
|
||||
control
|
||||
name = "\improper Control"
|
||||
icon_state = "engine_control"
|
||||
|
||||
electrical_storage
|
||||
name = "\improper Electrical storage"
|
||||
|
||||
reactor_core
|
||||
name = "\improper Reactor Core"
|
||||
//icon_state = "engine_core"
|
||||
|
||||
reactor_gas
|
||||
name = "Reactor Gas Storage"
|
||||
//icon_state = "engine_atmos"
|
||||
|
||||
aux_control
|
||||
name = "Reactor Auxiliary Control"
|
||||
//icon_state = "engine_aux"
|
||||
|
||||
turbine_control
|
||||
name = "Turbine Control"
|
||||
//icon_state = "engine_turbine"
|
||||
|
||||
reactor_airlock
|
||||
name = "\improper Reactor Primary Entrance"
|
||||
//icon_state = "engine_airlock"
|
||||
|
||||
reactor_fuel_storage
|
||||
name = "Reactor Fuel Storage"
|
||||
//icon_state = "engine_fuel"
|
||||
|
||||
reactor_fuel_ports
|
||||
name = "\improper Reactor Fuel Ports"
|
||||
//icon_state = "engine_port"
|
||||
|
||||
generators
|
||||
name = "\improper Generator Room"
|
||||
//icon_state = "engine_generators"
|
||||
|
||||
port_gyro_bay
|
||||
name = "\improper Port Gyrotron Bay"
|
||||
//icon_state = "engine_starboardgyro"
|
||||
|
||||
starboard_gyro_bay
|
||||
name = "\improper Starboard Gyrotron Bay"
|
||||
//icon_state = "engine_portgyro"
|
||||
|
||||
storage
|
||||
name = "\improper Engineering Storage"
|
||||
icon_state = "engine_storage"
|
||||
|
||||
storage_hard
|
||||
name = "\improper Engineering Hard Storage"
|
||||
icon_state = "engine_storage"
|
||||
@@ -1,61 +0,0 @@
|
||||
//////////////////////////////////////
|
||||
// RUST Core Control computer
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_core_control
|
||||
name = "Circuit board (RUST core controller)"
|
||||
build_path = "/obj/machinery/computer/rust_core_control"
|
||||
origin_tech = list(TECH_DATA = 4, TECH_ENGINERING = 4)
|
||||
|
||||
//////////////////////////////////////
|
||||
// RUST Fuel Control computer
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_fuel_control
|
||||
name = "Circuit board (RUST fuel controller)"
|
||||
build_path = "/obj/machinery/computer/rust_fuel_control"
|
||||
origin_tech = list(TECH_DATA = 4, TECH_ENGINERING = 4)
|
||||
|
||||
//////////////////////////////////////
|
||||
// RUST Fuel Port board
|
||||
|
||||
/obj/item/weapon/module/rust_fuel_port
|
||||
name = "Internal circuitry (RUST fuel port)"
|
||||
icon_state = "card_mod"
|
||||
origin_tech = list(TECH_ENGINERING = 4, TECH_MATERIAL = 5)
|
||||
|
||||
//////////////////////////////////////
|
||||
// RUST Fuel Compressor board
|
||||
|
||||
/obj/item/weapon/module/rust_fuel_compressor
|
||||
name = "Internal circuitry (RUST fuel compressor)"
|
||||
icon_state = "card_mod"
|
||||
origin_tech = list(TECH_MATERIAL = 6, TECH_PHORON = 4)
|
||||
|
||||
//////////////////////////////////////
|
||||
// RUST Tokamak Core board
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_core
|
||||
name = "Internal circuitry (RUST tokamak core)"
|
||||
build_path = "/obj/machinery/power/rust_core"
|
||||
board_type = "machine"
|
||||
origin_tech = list(TECH_BLUESPACE = 3, TECH_PHORON = 4, TECH_MAGNET = 5, TECH_POWER = 6)
|
||||
req_components = list(
|
||||
"/obj/item/weapon/stock_parts/manipulator/pico" = 2,
|
||||
"/obj/item/weapon/stock_parts/micro_laser/ultra" = 1,
|
||||
"/obj/item/weapon/stock_parts/subspace/crystal" = 1,
|
||||
"/obj/item/weapon/stock_parts/console_screen" = 1,
|
||||
"/obj/item/stack/cable_coil" = 5)
|
||||
|
||||
//////////////////////////////////////
|
||||
// RUST Fuel Injector board
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_injector
|
||||
name = "Internal circuitry (RUST fuel injector)"
|
||||
build_path = "/obj/machinery/power/rust_fuel_injector"
|
||||
board_type = "machine"
|
||||
origin_tech = list(TECH_POWER = 3, TECH_ENGINERING = 4, TECH_PHORON = 4, TECH_MATERIAL = 6)
|
||||
req_components = list(
|
||||
"/obj/item/weapon/stock_parts/manipulator/pico" = 2,
|
||||
"/obj/item/weapon/stock_parts/scanning_module/phasic" = 1,
|
||||
"/obj/item/weapon/stock_parts/matter_bin/super" = 1,
|
||||
"/obj/item/weapon/stock_parts/console_screen" = 1,
|
||||
"/obj/item/stack/cable_coil" = 5)
|
||||
@@ -1,143 +0,0 @@
|
||||
|
||||
/obj/machinery/computer/rust_core_control
|
||||
name = "RUST Core Control"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "core_control"
|
||||
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
|
||||
@@ -1,437 +0,0 @@
|
||||
//the em field is where the fun happens
|
||||
/*
|
||||
Deuterium-deuterium fusion : 40 x 10^7 K
|
||||
Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
*/
|
||||
|
||||
//#DEFINE MAX_STORED_ENERGY (held_phoron.phoron * held_phoron.phoron * SPECIFIC_HEAT_TOXIN)
|
||||
|
||||
/obj/effect/rust_em_field
|
||||
name = "EM Field"
|
||||
desc = "A coruscating, barely visible field of energy. It is shaped like a slightly flattened torus."
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "emfield_s1"
|
||||
//
|
||||
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
|
||||
var/frequency = 1
|
||||
var/field_strength = 0.01 //in teslas, max is 50T
|
||||
|
||||
var/obj/machinery/rust/rad_source/radiator
|
||||
var/datum/gas_mixture/held_phoron = new
|
||||
var/particle_catchers[13]
|
||||
|
||||
var/emp_overload = 0
|
||||
|
||||
/obj/effect/rust_em_field/New()
|
||||
..()
|
||||
//create radiator
|
||||
for(var/obj/machinery/rust/rad_source/rad in range(0))
|
||||
radiator = rad
|
||||
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)
|
||||
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)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x+1,src.y,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(3)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y+1,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(3)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y-1,src.z))
|
||||
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)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x+2,src.y,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(5)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y+2,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(5)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y-2,src.z))
|
||||
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)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x+3,src.y,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(7)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y+3,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(7)
|
||||
particle_catchers.Add(catcher)
|
||||
catcher = new (locate(src.x,src.y-3,src.z))
|
||||
catcher.parent = src
|
||||
catcher.SetSize(7)
|
||||
particle_catchers.Add(catcher)
|
||||
|
||||
//init values
|
||||
major_radius = field_strength * 0.21875// max = 8.75
|
||||
minor_radius = field_strength * 0.2125// max = 8.625
|
||||
volume_covered = M_PI * major_radius * minor_radius * 2.5 * 2.5 * 1000
|
||||
|
||||
processing_objects.Add(src)
|
||||
|
||||
/obj/effect/rust_em_field/process()
|
||||
//make sure the field generator is still intact
|
||||
if(!owned_core)
|
||||
qdel(src)
|
||||
|
||||
//handle radiation
|
||||
if(!radiator)
|
||||
radiator = new /obj/machinery/rust/rad_source()
|
||||
radiator.mega_energy += radiation
|
||||
radiator.source_alive++
|
||||
radiation = 0
|
||||
|
||||
//update values
|
||||
var/transfer_ratio = field_strength / 50 //higher field strength will result in faster phoron aggregation
|
||||
major_radius = field_strength * 0.21875// max = 8.75m
|
||||
minor_radius = field_strength * 0.2125// max = 8.625m
|
||||
volume_covered = M_PI * major_radius * minor_radius * 2.5 * 2.5 * 2.5 * 7 * 7 * transfer_ratio //one tile = 2.5m*2.5m*2.5m
|
||||
|
||||
//add phoron from the surrounding environment
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
//hack in some stuff to remove phoron from the air because SCIENCE
|
||||
//the amount of phoron pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
|
||||
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
|
||||
//have a max of 1000 moles suspended
|
||||
if(held_phoron.gas["phoron"] < transfer_ratio * 1000)
|
||||
var/moles_covered = environment.return_pressure()*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
//world << "\blue moles_covered: [moles_covered]"
|
||||
//
|
||||
var/datum/gas_mixture/gas_covered = environment.remove(moles_covered)
|
||||
var/datum/gas_mixture/phoron_captured = new /datum/gas_mixture()
|
||||
//
|
||||
phoron_captured.gas["phoron"] = round(gas_covered.gas["phoron"] * transfer_ratio)
|
||||
//world << "\blue[phoron_captured.phoron] moles of phoron captured"
|
||||
phoron_captured.temperature = gas_covered.temperature
|
||||
phoron_captured.update_values()
|
||||
//
|
||||
gas_covered.adjust_gas("phoron", -phoron_captured.gas["phoron"])
|
||||
//
|
||||
held_phoron.merge(phoron_captured)
|
||||
//
|
||||
environment.merge(gas_covered)
|
||||
|
||||
//let the particles inside the field react
|
||||
React()
|
||||
|
||||
//forcibly radiate any excess energy
|
||||
/*var/energy_max = transfer_ratio * 100000
|
||||
if(mega_energy > energy_max)
|
||||
var/energy_lost = rand( 1.5 * (mega_energy - energy_max), 2.5 * (mega_energy - energy_max) )
|
||||
mega_energy -= energy_lost
|
||||
radiation += energy_lost*/
|
||||
|
||||
//change held phoron temp according to energy levels
|
||||
//SPECIFIC_HEAT_TOXIN
|
||||
if(mega_energy > 0 && held_phoron.gas["phoron"])
|
||||
var/heat_capacity = held_phoron.heat_capacity()//200 * number of phoron moles
|
||||
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
|
||||
held_phoron.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
|
||||
|
||||
//if there is too much phoron in the field, lose some
|
||||
/*if( held_phoron.phoron > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) )
|
||||
LosePhoron()*/
|
||||
if(held_phoron.gas["phoron"] > 1)
|
||||
//lose a random amount of phoron back into the air, increased by the field strength (want to switch this over to frequency eventually)
|
||||
var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength))
|
||||
//world << "lost [loss_ratio*100]% of held phoron"
|
||||
//
|
||||
var/datum/gas_mixture/phoron_lost = new
|
||||
phoron_lost.temperature = held_phoron.temperature
|
||||
//
|
||||
phoron_lost.gas["phoron"] = held_phoron.gas["phoron"] * loss_ratio
|
||||
//phoron_lost.update_values()
|
||||
held_phoron.gas["phoron"] -= held_phoron.gas["phoron"] * loss_ratio
|
||||
//held_phoron.update_values()
|
||||
//
|
||||
environment.merge(phoron_lost)
|
||||
radiation += loss_ratio * mega_energy * 0.1
|
||||
mega_energy -= loss_ratio * mega_energy * 0.1
|
||||
else
|
||||
held_phoron.gas["phoron"] = null
|
||||
//held_phoron.update_values()
|
||||
|
||||
//handle some reactants formatting
|
||||
for(var/reactant in dormant_reactant_quantities)
|
||||
var/amount = dormant_reactant_quantities[reactant]
|
||||
if(amount < 1)
|
||||
dormant_reactant_quantities.Remove(reactant)
|
||||
else if(amount >= 1000000)
|
||||
var/radiate = rand(3 * amount / 4, amount / 4)
|
||||
dormant_reactant_quantities[reactant] -= radiate
|
||||
radiation += radiate
|
||||
|
||||
return 1
|
||||
|
||||
/obj/effect/rust_em_field/proc/ChangeFieldStrength(var/new_strength)
|
||||
var/calc_size = 1
|
||||
emp_overload = 0
|
||||
if(new_strength <= 50)
|
||||
calc_size = 1
|
||||
else if(new_strength <= 200)
|
||||
calc_size = 3
|
||||
else if(new_strength <= 500)
|
||||
calc_size = 5
|
||||
else
|
||||
calc_size = 7
|
||||
if(new_strength > 900)
|
||||
emp_overload = 1
|
||||
//
|
||||
field_strength = new_strength
|
||||
change_size(calc_size)
|
||||
|
||||
/obj/effect/rust_em_field/proc/ChangeFieldFrequency(var/new_frequency)
|
||||
frequency = new_frequency
|
||||
|
||||
/obj/effect/rust_em_field/proc/AddEnergy(var/a_energy, var/a_mega_energy, var/a_frequency)
|
||||
var/energy_loss_ratio = 0
|
||||
if(a_frequency != src.frequency)
|
||||
energy_loss_ratio = 1 / abs(a_frequency - src.frequency)
|
||||
energy += a_energy - a_energy * energy_loss_ratio
|
||||
mega_energy += a_mega_energy - a_mega_energy * energy_loss_ratio
|
||||
|
||||
while(energy > 100000)
|
||||
energy -= 100000
|
||||
mega_energy += 0.1
|
||||
|
||||
/obj/effect/rust_em_field/proc/AddParticles(var/name, var/quantity = 1)
|
||||
if(name in dormant_reactant_quantities)
|
||||
dormant_reactant_quantities[name] += quantity
|
||||
else if(name != "proton" && name != "electron" && name != "neutron")
|
||||
dormant_reactant_quantities.Add(name)
|
||||
dormant_reactant_quantities[name] = quantity
|
||||
|
||||
/obj/effect/rust_em_field/proc/RadiateAll(var/ratio_lost = 1)
|
||||
for(var/particle in dormant_reactant_quantities)
|
||||
radiation += dormant_reactant_quantities[particle]
|
||||
dormant_reactant_quantities.Remove(particle)
|
||||
radiation += mega_energy
|
||||
mega_energy = 0
|
||||
|
||||
//lose all held phoron back into the air
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
environment.merge(held_phoron)
|
||||
|
||||
/obj/effect/rust_em_field/proc/change_size(var/newsize = 1)
|
||||
//
|
||||
var/changed = 0
|
||||
switch(newsize)
|
||||
if(1)
|
||||
size = 1
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "emfield_s1"
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
//
|
||||
changed = 1
|
||||
if(3)
|
||||
size = 3
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
icon_state = "emfield_s3"
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
//
|
||||
changed = 3
|
||||
if(5)
|
||||
size = 5
|
||||
icon = 'icons/effects/160x160.dmi'
|
||||
icon_state = "emfield_s5"
|
||||
pixel_x = -64
|
||||
pixel_y = -64
|
||||
//
|
||||
changed = 5
|
||||
if(7)
|
||||
size = 7
|
||||
icon = 'icons/effects/224x224.dmi'
|
||||
icon_state = "emfield_s7"
|
||||
pixel_x = -96
|
||||
pixel_y = -96
|
||||
//
|
||||
changed = 7
|
||||
|
||||
for(var/obj/effect/rust_particle_catcher/catcher in particle_catchers)
|
||||
catcher.UpdateSize()
|
||||
return changed
|
||||
|
||||
//the !!fun!! part
|
||||
/obj/effect/rust_em_field/proc/React()
|
||||
//loop through the reactants in random order
|
||||
var/list/reactants_reacting_pool = dormant_reactant_quantities.Copy()
|
||||
/*
|
||||
for(var/reagent in dormant_reactant_quantities)
|
||||
world << " before: [reagent]: [dormant_reactant_quantities[reagent]]"
|
||||
*/
|
||||
|
||||
//cant have any reactions if there aren't any reactants present
|
||||
if(reactants_reacting_pool.len)
|
||||
//determine a random amount to actually react this cycle, and remove it from the standard pool
|
||||
//this is a hack, and quite nonrealistic :(
|
||||
for(var/reactant in reactants_reacting_pool)
|
||||
reactants_reacting_pool[reactant] = rand(0,reactants_reacting_pool[reactant])
|
||||
dormant_reactant_quantities[reactant] -= reactants_reacting_pool[reactant]
|
||||
if(!reactants_reacting_pool[reactant])
|
||||
reactants_reacting_pool -= reactant
|
||||
|
||||
//loop through all the reacting reagents, picking out random reactions for them
|
||||
var/list/produced_reactants = new/list
|
||||
var/list/primary_reactant_pool = reactants_reacting_pool.Copy()
|
||||
while(primary_reactant_pool.len)
|
||||
//pick one of the unprocessed reacting reagents randomly
|
||||
var/cur_primary_reactant = pick(primary_reactant_pool)
|
||||
primary_reactant_pool.Remove(cur_primary_reactant)
|
||||
//world << "\blue primary reactant chosen: [cur_primary_reactant]"
|
||||
|
||||
//grab all the possible reactants to have a reaction with
|
||||
var/list/possible_secondary_reactants = reactants_reacting_pool.Copy()
|
||||
//if there is only one of a particular reactant, then it can not react with itself so remove it
|
||||
possible_secondary_reactants[cur_primary_reactant] -= 1
|
||||
if(possible_secondary_reactants[cur_primary_reactant] < 1)
|
||||
possible_secondary_reactants.Remove(cur_primary_reactant)
|
||||
|
||||
//loop through and work out all the possible reactions
|
||||
var/list/possible_reactions = new/list
|
||||
for(var/cur_secondary_reactant in possible_secondary_reactants)
|
||||
if(possible_secondary_reactants[cur_secondary_reactant] < 1)
|
||||
continue
|
||||
var/datum/fusion_reaction/cur_reaction = get_fusion_reaction(cur_primary_reactant, cur_secondary_reactant)
|
||||
if(cur_reaction)
|
||||
//world << "\blue secondary reactant: [cur_secondary_reactant], [reaction_products.len]"
|
||||
possible_reactions.Add(cur_reaction)
|
||||
|
||||
//if there are no possible reactions here, abandon this primary reactant and move on
|
||||
if(!possible_reactions.len)
|
||||
//world << "\blue no reactions"
|
||||
continue
|
||||
|
||||
//split up the reacting atoms between the possible reactions
|
||||
while(possible_reactions.len)
|
||||
//pick a random substance to react with
|
||||
var/datum/fusion_reaction/cur_reaction = pick(possible_reactions)
|
||||
possible_reactions.Remove(cur_reaction)
|
||||
|
||||
//set the randmax to be the lower of the two involved reactants
|
||||
var/max_num_reactants = reactants_reacting_pool[cur_reaction.primary_reactant] > reactants_reacting_pool[cur_reaction.secondary_reactant] ? \
|
||||
reactants_reacting_pool[cur_reaction.secondary_reactant] : reactants_reacting_pool[cur_reaction.primary_reactant]
|
||||
if(max_num_reactants < 1)
|
||||
continue
|
||||
|
||||
//make sure we have enough energy
|
||||
if(mega_energy < max_num_reactants * cur_reaction.energy_consumption)
|
||||
max_num_reactants = round(mega_energy / cur_reaction.energy_consumption)
|
||||
if(max_num_reactants < 1)
|
||||
continue
|
||||
|
||||
//randomly determined amount to react
|
||||
var/amount_reacting = rand(1, max_num_reactants)
|
||||
|
||||
//removing the reacting substances from the list of substances that are primed to react this cycle
|
||||
//if there aren't enough of that substance (there should be) then modify the reactant amounts accordingly
|
||||
if( reactants_reacting_pool[cur_reaction.primary_reactant] - amount_reacting >= 0 )
|
||||
reactants_reacting_pool[cur_reaction.primary_reactant] -= amount_reacting
|
||||
else
|
||||
amount_reacting = reactants_reacting_pool[cur_reaction.primary_reactant]
|
||||
reactants_reacting_pool[cur_reaction.primary_reactant] = 0
|
||||
//same again for secondary reactant
|
||||
if( reactants_reacting_pool[cur_reaction.secondary_reactant] - amount_reacting >= 0 )
|
||||
reactants_reacting_pool[cur_reaction.secondary_reactant] -= amount_reacting
|
||||
else
|
||||
reactants_reacting_pool[cur_reaction.primary_reactant] += amount_reacting - reactants_reacting_pool[cur_reaction.primary_reactant]
|
||||
amount_reacting = reactants_reacting_pool[cur_reaction.secondary_reactant]
|
||||
reactants_reacting_pool[cur_reaction.secondary_reactant] = 0
|
||||
|
||||
//remove the consumed energy
|
||||
mega_energy -= max_num_reactants * cur_reaction.energy_consumption
|
||||
|
||||
//add any produced energy
|
||||
mega_energy += max_num_reactants * cur_reaction.energy_production
|
||||
|
||||
//add any produced radiation
|
||||
radiation += max_num_reactants * cur_reaction.radiation
|
||||
|
||||
//create the reaction products
|
||||
for(var/reactant in cur_reaction.products)
|
||||
var/success = 0
|
||||
for(var/check_reactant in produced_reactants)
|
||||
if(check_reactant == reactant)
|
||||
produced_reactants[reactant] += cur_reaction.products[reactant] * amount_reacting
|
||||
success = 1
|
||||
break
|
||||
if(!success)
|
||||
produced_reactants[reactant] = cur_reaction.products[reactant] * amount_reacting
|
||||
|
||||
//this reaction is done, and can't be repeated this sub-cycle
|
||||
possible_reactions.Remove(cur_reaction.secondary_reactant)
|
||||
|
||||
//
|
||||
/*if(new_radiation)
|
||||
if(!radiating)
|
||||
radiating = 1
|
||||
PeriodicRadiate()*/
|
||||
|
||||
//loop through the newly produced reactants and add them to the pool
|
||||
//var/list/neutronic_radiation = new
|
||||
//var/list/protonic_radiation = new
|
||||
for(var/reactant in produced_reactants)
|
||||
AddParticles(reactant, produced_reactants[reactant])
|
||||
//world << "produced: [reactant], [dormant_reactant_quantities[reactant]]"
|
||||
|
||||
//check whether there are reactants left, and add them back to the pool
|
||||
for(var/reactant in reactants_reacting_pool)
|
||||
AddParticles(reactant, reactants_reacting_pool[reactant])
|
||||
//world << "retained: [reactant], [reactants_reacting_pool[reactant]]"
|
||||
|
||||
/obj/effect/rust_em_field/Destroy()
|
||||
//radiate everything in one giant burst
|
||||
for(var/obj/effect/rust_particle_catcher/catcher in particle_catchers)
|
||||
qdel (catcher)
|
||||
RadiateAll()
|
||||
|
||||
processing_objects.Remove(src)
|
||||
..()
|
||||
@@ -1,284 +0,0 @@
|
||||
//the core [tokamaka generator] big funky solenoid, it generates an EM field
|
||||
|
||||
/*
|
||||
when the core is turned on, it generates [creates] an electromagnetic field
|
||||
the em field attracts phoron, and suspends it in a controlled torus (doughnut) shape, oscillating around the core
|
||||
|
||||
the field strength is directly controllable by the user
|
||||
field strength = sqrt(energy used by the field generator)
|
||||
|
||||
the size of the EM field = field strength / k
|
||||
(k is an arbitrary constant to make the calculated size into tilewidths)
|
||||
|
||||
1 tilewidth = below 5T
|
||||
3 tilewidth = between 5T and 12T
|
||||
5 tilewidth = between 10T and 25T
|
||||
7 tilewidth = between 20T and 50T
|
||||
(can't go higher than 40T)
|
||||
|
||||
energy is added by a gyrotron, and lost when phoron escapes
|
||||
energy transferred from the gyrotron beams is reduced by how different the frequencies are (closer frequencies = more energy transferred)
|
||||
|
||||
frequency = field strength * (stored energy / stored moles of phoron) * x
|
||||
(where x is an arbitrary constant to make the frequency something realistic)
|
||||
the gyrotron beams' frequency and energy are hardcapped low enough that they won't heat the phoron much
|
||||
|
||||
energy is generated in considerable amounts by fusion reactions from injected particles
|
||||
fusion reactions only occur when the existing energy is above a certain level, and it's near the max operating level of the gyrotron. higher energy reactions only occur at higher energy levels
|
||||
a small amount of energy constantly bleeds off in the form of radiation
|
||||
|
||||
the field is constantly pulling in phoron from the surrounding [local] atmosphere
|
||||
at random intervals, the field releases a random percentage of stored phoron in addition to a percentage of energy as intense radiation
|
||||
|
||||
the amount of phoron is a percentage of the field strength, increased by frequency
|
||||
*/
|
||||
|
||||
/*
|
||||
- VALUES -
|
||||
|
||||
max volume of phoron storeable by the field = the total volume of a number of tiles equal to the (field tilewidth)^2
|
||||
|
||||
*/
|
||||
|
||||
#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 = 'icons/rust.dmi'
|
||||
icon_state = "core0"
|
||||
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 = 50
|
||||
active_power_usage = 500 //multiplied by field strength
|
||||
var/cached_power_avail = 0
|
||||
anchored = 0
|
||||
|
||||
var/state = 0
|
||||
var/locked = 1
|
||||
var/remote_access_enabled = 1
|
||||
|
||||
/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/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(owned_field)
|
||||
user << "Turn off [src] first."
|
||||
return
|
||||
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()
|
||||
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()
|
||||
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
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/power/rust_core/emag_act(var/remaining_charges, var/mob/user)
|
||||
if(!emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
|
||||
return 1
|
||||
|
||||
/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
|
||||
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)
|
||||
|
||||
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"
|
||||
qdel(owned_field)
|
||||
luminosity = 0
|
||||
use_power = 1
|
||||
|
||||
/obj/machinery/power/rust_core/proc/AddParticles(var/name, var/quantity = 1)
|
||||
if(owned_field)
|
||||
owned_field.AddParticles(name, quantity)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/rust_core/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(owned_field)
|
||||
return owned_field.bullet_act(Proj)
|
||||
return 0
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
/obj/item/weapon/fuel_assembly
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "fuel_assembly"
|
||||
name = "Fuel Rod Assembly"
|
||||
var/list/rod_quantities
|
||||
var/percent_depleted = 1
|
||||
layer = 3.1
|
||||
//
|
||||
New()
|
||||
rod_quantities = new/list
|
||||
|
||||
//these can be abstracted away for now
|
||||
/*
|
||||
/obj/item/weapon/fuel_rod
|
||||
/obj/item/weapon/control_rod
|
||||
*/
|
||||
@@ -1,102 +0,0 @@
|
||||
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port
|
||||
name = "Fuel Assembly Port"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "port2"
|
||||
density = 0
|
||||
var/obj/item/weapon/fuel_assembly/cur_assembly
|
||||
var/busy = 0
|
||||
anchored = 1
|
||||
|
||||
var/opened = 1 //0=closed, 1=opened
|
||||
var/has_electronics = 0 // 0 - none, bit 1 - circuitboard, bit 2 - wires
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I,/obj/item/weapon/fuel_assembly) && !opened)
|
||||
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"
|
||||
user << "\blue You insert [I] into [src]. Touch the panel again to insert [I] into the injector."
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER) || opened)
|
||||
return
|
||||
|
||||
if(cur_assembly)
|
||||
if(try_insert_assembly())
|
||||
user << "\blue \icon[src] [src] inserts it's fuel rod assembly into an injector."
|
||||
else
|
||||
if(eject_assembly())
|
||||
user << "\red \icon[src] [src] ejects it's fuel assembly. Check the fuel injector status."
|
||||
else if(try_draw_assembly())
|
||||
user << "\blue \icon[src] [src] draws a fuel rod assembly from an injector."
|
||||
else if(try_draw_assembly())
|
||||
user << "\blue \icon[src] [src] draws a fuel rod assembly from an injector."
|
||||
else
|
||||
user << "\red \icon[src] [src] was unable to draw a fuel rod assembly from an injector."
|
||||
|
||||
/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
|
||||
if(I.state != 2)
|
||||
break
|
||||
|
||||
I.cur_assembly = cur_assembly
|
||||
cur_assembly.loc = I
|
||||
cur_assembly = null
|
||||
icon_state = "port0"
|
||||
success = 1
|
||||
|
||||
return success
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/proc/eject_assembly()
|
||||
if(cur_assembly)
|
||||
cur_assembly.loc = src.loc//get_step(get_turf(src), src.dir)
|
||||
cur_assembly = null
|
||||
icon_state = "port0"
|
||||
return 1
|
||||
|
||||
/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.state != 2)
|
||||
break
|
||||
|
||||
cur_assembly = I.cur_assembly
|
||||
cur_assembly.loc = src
|
||||
I.cur_assembly = null
|
||||
icon_state = "port1"
|
||||
success = 1
|
||||
break
|
||||
|
||||
return success
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/verb/eject_assembly_verb()
|
||||
set name = "Eject assembly from port"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
eject_assembly()
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
//construction steps
|
||||
/obj/machinery/rust_fuel_assembly_port/New(turf/loc, var/ndir, var/building=0)
|
||||
..()
|
||||
|
||||
// offset 24 pixels in direction of dir
|
||||
// this allows the APC to be embedded in a wall, yet still inside an area
|
||||
if (building)
|
||||
set_dir(ndir)
|
||||
else
|
||||
has_electronics = 3
|
||||
opened = 0
|
||||
icon_state = "port0"
|
||||
|
||||
//20% easier to read than apc code
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? 32 : -32)
|
||||
pixel_y = (dir & 3)? (dir ==1 ? 32 : -32) : 0
|
||||
|
||||
/obj/machinery/rust_fuel_assembly_port/attackby(obj/item/W, mob/user)
|
||||
|
||||
if (istype(user, /mob/living/silicon) && get_dist(src,user)>1)
|
||||
return src.attack_hand(user)
|
||||
if (istype(W, /obj/item/weapon/crowbar))
|
||||
if(opened)
|
||||
if(has_electronics & 1)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
user << "You begin removing the circuitboard" //lpeters - fixed grammar issues
|
||||
if(do_after(user, 50))
|
||||
user.visible_message(\
|
||||
"\red [user.name] has removed the circuitboard from [src.name]!",\
|
||||
"\blue You remove the circuitboard.")
|
||||
has_electronics = 0
|
||||
new /obj/item/weapon/module/rust_fuel_port(loc)
|
||||
has_electronics &= ~1
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "port0"
|
||||
user << "\blue You close the maintenance cover."
|
||||
else
|
||||
if(cur_assembly)
|
||||
user << "\red You cannot open the cover while there is a fuel assembly inside."
|
||||
else
|
||||
opened = 1
|
||||
user << "\blue You open the maintenance cover."
|
||||
icon_state = "port2"
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/stack/cable_coil) && opened && !(has_electronics & 2))
|
||||
var/obj/item/stack/cable_coil/C = W
|
||||
if(C.amount < 10)
|
||||
user << "\red You need more wires."
|
||||
return
|
||||
user << "You start adding cables to the frame..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 20) && C.amount >= 10)
|
||||
C.use(10)
|
||||
user.visible_message(\
|
||||
"\red [user.name] has added cables to the port frame!",\
|
||||
"You add cables to the port frame.")
|
||||
has_electronics &= 2
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/wirecutters) && opened && (has_electronics & 2))
|
||||
user << "You begin to cut the cables..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
new /obj/item/stack/cable_coil(loc,10)
|
||||
user.visible_message(\
|
||||
"\red [user.name] cut the cabling inside the port.",\
|
||||
"You cut the cabling inside the port.")
|
||||
has_electronics &= ~2
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/module/rust_fuel_port) && opened && !(has_electronics & 1))
|
||||
user << "You trying to insert the port control board into the frame..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 10))
|
||||
has_electronics &= 1
|
||||
user << "You place the port control board inside the frame."
|
||||
qdel(W)
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/weldingtool) && opened && !has_electronics)
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.get_fuel() < 3)
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
user << "You start welding the port frame..."
|
||||
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
if(!src || !WT.remove_fuel(3, user)) return
|
||||
new /obj/item/frame/rust/assembly(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut away from the wall by [user.name].",\
|
||||
"You detached the port frame.",\
|
||||
"\red You hear welding.")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
..()
|
||||
@@ -1,116 +0,0 @@
|
||||
var/const/max_assembly_amount = 300
|
||||
|
||||
/obj/machinery/rust_fuel_compressor
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "fuel_compressor1"
|
||||
name = "Fuel Compressor"
|
||||
var/list/new_assembly_quantities = list("Deuterium" = 150,"Tritium" = 150,"Rodinium-6" = 0,"Stravium-7" = 0, "Pergium" = 0, "Dilithium" = 0)
|
||||
var/compressed_matter = 0
|
||||
anchored = 1
|
||||
layer = 2.9
|
||||
|
||||
var/opened = 1 //0=closed, 1=opened
|
||||
var/locked = 0
|
||||
var/has_electronics = 0 // 0 - none, bit 1 - circuitboard, bit 2 - wires
|
||||
|
||||
/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/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if (istype(W, /obj/item/weapon/rcd_ammo))
|
||||
compressed_matter += 10
|
||||
qdel(W)
|
||||
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.unset_machine()
|
||||
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>"
|
||||
if(locked)
|
||||
t += "Swipe your ID to unlock this console."
|
||||
else
|
||||
t += "Compressed matter in storage: [compressed_matter] <A href='?src=\ref[src];eject_matter=1'>\[Eject all\]</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];change_reagent=[reagent]'>Modify</A>\]<br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
|
||||
user << browse(t, "window=fuelcomp;size=500x300")
|
||||
user.set_machine(src)
|
||||
|
||||
//var/locked
|
||||
//var/coverlocked
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=fuelcomp")
|
||||
usr.machine = null
|
||||
|
||||
if( href_list["eject_matter"] )
|
||||
var/ejected = 0
|
||||
while(compressed_matter > 10)
|
||||
new /obj/item/weapon/rcd_ammo(get_step(get_turf(src), src.dir))
|
||||
compressed_matter -= 10
|
||||
ejected = 1
|
||||
if(ejected)
|
||||
usr << "\blue \icon[src] [src] ejects some compressed matter units."
|
||||
else
|
||||
usr << "\red \icon[src] there are no more compressed matter units in [src]."
|
||||
|
||||
if( href_list["activate"] )
|
||||
//world << "\blue New fuel rod assembly"
|
||||
var/obj/item/weapon/fuel_assembly/F = new(src)
|
||||
var/fail = 0
|
||||
var/old_matter = compressed_matter
|
||||
for(var/reagent in new_assembly_quantities)
|
||||
var/req_matter = round(new_assembly_quantities[reagent] / 30)
|
||||
//world << "[reagent] matter: [req_matter]/[compressed_matter]"
|
||||
if(req_matter <= compressed_matter)
|
||||
F.rod_quantities[reagent] = new_assembly_quantities[reagent]
|
||||
compressed_matter -= req_matter
|
||||
if(compressed_matter < 1)
|
||||
compressed_matter = 0
|
||||
else
|
||||
/*world << "bad reagent: [reagent], [req_matter > compressed_matter ? "req_matter > compressed_matter"\
|
||||
: (req_matter < compressed_matter ? "req_matter < compressed_matter" : "req_matter == compressed_matter")]"*/
|
||||
fail = 1
|
||||
break
|
||||
//world << "\blue [reagent]: new_assembly_quantities[reagent]<br>"
|
||||
if(fail)
|
||||
qdel(F)
|
||||
compressed_matter = old_matter
|
||||
usr << "\red \icon[src] [src] flashes red: \'Out of matter.\'"
|
||||
else
|
||||
F.loc = src.loc//get_step(get_turf(src), src.dir)
|
||||
F.percent_depleted = 0
|
||||
if(compressed_matter < 0.034)
|
||||
compressed_matter = 0
|
||||
|
||||
if( href_list["change_reagent"] )
|
||||
var/cur_reagent = href_list["change_reagent"]
|
||||
var/avail_rods = 300
|
||||
for(var/rod in new_assembly_quantities)
|
||||
avail_rods -= new_assembly_quantities[rod]
|
||||
avail_rods += new_assembly_quantities[cur_reagent]
|
||||
avail_rods = max(avail_rods, 0)
|
||||
|
||||
var/new_amount = min(input("Enter new [cur_reagent] rod amount (max [avail_rods])", "Fuel Assembly Rod Composition ([cur_reagent])") as num, avail_rods)
|
||||
new_assembly_quantities[cur_reagent] = new_amount
|
||||
|
||||
updateDialog()
|
||||
@@ -1,125 +0,0 @@
|
||||
/obj/machinery/rust_fuel_compressor/New(turf/loc, var/ndir, var/building=0)
|
||||
..()
|
||||
|
||||
// offset 24 pixels in direction of dir
|
||||
// this allows the APC to be embedded in a wall, yet still inside an area
|
||||
if (building)
|
||||
set_dir(ndir)
|
||||
else
|
||||
has_electronics = 3
|
||||
opened = 0
|
||||
locked = 0
|
||||
icon_state = "fuel_compressor1"
|
||||
|
||||
//20% easier to read than apc code
|
||||
pixel_x = (dir & 3)? 0 : (dir == 4 ? 32 : -32)
|
||||
pixel_y = (dir & 3)? (dir ==1 ? 32 : -32) : 0
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/emag_act(var/remaining_charges, var/mob/user)
|
||||
if (!emagged)
|
||||
if(opened)
|
||||
user << "You must close the cover to swipe an ID card."
|
||||
else
|
||||
flick("apc-spark", src)
|
||||
if (do_after(user,6))
|
||||
if(prob(50))
|
||||
emagged = 1
|
||||
locked = 0
|
||||
user << "You emag the port interface."
|
||||
else
|
||||
user << "You fail to [ locked ? "unlock" : "lock"] the compressor interface."
|
||||
return 1
|
||||
|
||||
/obj/machinery/rust_fuel_compressor/attackby(obj/item/W, mob/user)
|
||||
|
||||
if (istype(user, /mob/living/silicon) && get_dist(src,user)>1)
|
||||
return src.attack_hand(user)
|
||||
if (istype(W, /obj/item/weapon/crowbar))
|
||||
if(opened)
|
||||
if(has_electronics & 1)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
user << "You begin removing the circuitboard" //lpeters - fixed grammar issues
|
||||
if(do_after(user, 50))
|
||||
user.visible_message(\
|
||||
"\red [user.name] has removed the circuitboard from [src.name]!",\
|
||||
"\blue You remove the circuitboard board.")
|
||||
has_electronics = 0
|
||||
new /obj/item/weapon/module/rust_fuel_compressor(loc)
|
||||
has_electronics &= ~1
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "fuel_compressor0"
|
||||
user << "\blue You close the maintenance cover."
|
||||
else
|
||||
if(compressed_matter > 0)
|
||||
user << "\red You cannot open the cover while there is compressed matter inside."
|
||||
else
|
||||
opened = 1
|
||||
user << "\blue You open the maintenance cover."
|
||||
icon_state = "fuel_compressor1"
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
|
||||
if(opened)
|
||||
user << "You must close the cover to swipe an ID card."
|
||||
else
|
||||
if(src.allowed(usr))
|
||||
locked = !locked
|
||||
user << "You [ locked ? "lock" : "unlock"] the compressor interface."
|
||||
update_icon()
|
||||
else
|
||||
user << "\red Access denied."
|
||||
return
|
||||
else if (istype(W, /obj/item/stack/cable_coil) && opened && !(has_electronics & 2))
|
||||
var/obj/item/stack/cable_coil/C = W
|
||||
if(C.amount < 10)
|
||||
user << "\red You need more wires."
|
||||
return
|
||||
user << "You start adding cables to the compressor frame..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 20) && C.amount >= 10)
|
||||
C.use(10)
|
||||
user.visible_message(\
|
||||
"\red [user.name] has added cables to the compressor frame!",\
|
||||
"You add cables to the port frame.")
|
||||
has_electronics &= 2
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/wirecutters) && opened && (has_electronics & 2))
|
||||
user << "You begin to cut the cables..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
new /obj/item/stack/cable_coil(loc,10)
|
||||
user.visible_message(\
|
||||
"\red [user.name] cut the cabling inside the compressor.",\
|
||||
"You cut the cabling inside the port.")
|
||||
has_electronics &= ~2
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/module/rust_fuel_compressor) && opened && !(has_electronics & 1))
|
||||
user << "You trying to insert the circuitboard into the frame..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 10))
|
||||
has_electronics &= 1
|
||||
user << "You place the circuitboard inside the frame."
|
||||
qdel(W)
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/weldingtool) && opened && !has_electronics)
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.get_fuel() < 3)
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return
|
||||
user << "You start welding the compressor frame..."
|
||||
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
|
||||
if(do_after(user, 50))
|
||||
if(!src || !WT.remove_fuel(3, user)) return
|
||||
new /obj/item/frame/rust(loc)
|
||||
user.visible_message(\
|
||||
"\red [src] has been cut away from the wall by [user.name].",\
|
||||
"You detached the compressor frame.",\
|
||||
"\red You hear welding.")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
..()
|
||||
@@ -1,192 +0,0 @@
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control
|
||||
name = "RUST Fuel Injection Control"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "fuel"
|
||||
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/scan_range = 25
|
||||
var/ticks_this_stage = 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
|
||||
|
||||
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
|
||||
|
||||
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)*/
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control/attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/computer/rust_fuel_control/interact(mob/user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_control")
|
||||
return
|
||||
|
||||
if (!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=fuel_control")
|
||||
return
|
||||
|
||||
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,308 +0,0 @@
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector
|
||||
name = "Fuel Injector"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "injector0"
|
||||
|
||||
density = 1
|
||||
anchored = 0
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
req_access = list(access_engine)
|
||||
|
||||
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/trying_to_swap_fuel = 0
|
||||
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 500
|
||||
var/remote_access_enabled = 1
|
||||
var/cached_power_avail = 0
|
||||
var/emergency_insert_ready = 0
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/process()
|
||||
if(injecting)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
StopInjecting()
|
||||
else
|
||||
Inject()
|
||||
|
||||
cached_power_avail = avail()
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/attackby(obj/item/W, mob/user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(injecting)
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
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(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/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/emag_act(var/remaining_charges, var/mob/user)
|
||||
if(!emagged)
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
|
||||
return 1
|
||||
|
||||
/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 (stat & NOPOWER || 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"] )
|
||||
attempt_fuel_swap()
|
||||
|
||||
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].")
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/verb/rotate_clock()
|
||||
set category = "Object"
|
||||
set name = "Rotate Generator (Clockwise)"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
|
||||
/obj/machinery/power/rust_fuel_injector/verb/rotate_anticlock()
|
||||
set category = "Object"
|
||||
set name = "Rotate Generator (Counterclockwise)"
|
||||
set src in view(1)
|
||||
|
||||
if (usr.stat || usr.restrained() || anchored)
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, -90))
|
||||
@@ -1,160 +0,0 @@
|
||||
|
||||
datum/fusion_reaction
|
||||
var/primary_reactant = ""
|
||||
var/secondary_reactant = ""
|
||||
var/energy_consumption = 0
|
||||
var/energy_production = 0
|
||||
var/radiation = 0
|
||||
var/list/products = list()
|
||||
|
||||
/datum/controller/game_controller/var/list/fusion_reactions
|
||||
|
||||
proc/get_fusion_reaction(var/primary_reactant, var/secondary_reactant)
|
||||
if(!master_controller.fusion_reactions)
|
||||
populate_fusion_reactions()
|
||||
if(master_controller.fusion_reactions.Find(primary_reactant))
|
||||
var/list/secondary_reactions = master_controller.fusion_reactions[primary_reactant]
|
||||
if(secondary_reactions.Find(secondary_reactant))
|
||||
return master_controller.fusion_reactions[primary_reactant][secondary_reactant]
|
||||
|
||||
proc/populate_fusion_reactions()
|
||||
if(!master_controller.fusion_reactions)
|
||||
master_controller.fusion_reactions = list()
|
||||
for(var/cur_reaction_type in typesof(/datum/fusion_reaction) - /datum/fusion_reaction)
|
||||
var/datum/fusion_reaction/cur_reaction = new cur_reaction_type()
|
||||
if(!master_controller.fusion_reactions[cur_reaction.primary_reactant])
|
||||
master_controller.fusion_reactions[cur_reaction.primary_reactant] = list()
|
||||
master_controller.fusion_reactions[cur_reaction.primary_reactant][cur_reaction.secondary_reactant] = cur_reaction
|
||||
if(!master_controller.fusion_reactions[cur_reaction.secondary_reactant])
|
||||
master_controller.fusion_reactions[cur_reaction.secondary_reactant] = list()
|
||||
master_controller.fusion_reactions[cur_reaction.secondary_reactant][cur_reaction.primary_reactant] = cur_reaction
|
||||
|
||||
//Fake elements and fake reactions, but its nicer gameplay-wise
|
||||
//Deuterium
|
||||
//Tritium
|
||||
//Uridium-3
|
||||
//Obdurium
|
||||
//Solonium
|
||||
//Rodinium-6
|
||||
//Dilithium
|
||||
//Trilithium
|
||||
//Pergium
|
||||
//Stravium-7
|
||||
|
||||
//Primary Production Reactions
|
||||
|
||||
datum/fusion_reaction/tritium_deuterium
|
||||
primary_reactant = "Tritium"
|
||||
secondary_reactant = "Deuterium"
|
||||
energy_consumption = 1
|
||||
energy_production = 5
|
||||
radiation = 0
|
||||
|
||||
//Secondary Production Reactions
|
||||
|
||||
datum/fusion_reaction/deuterium_deuterium
|
||||
primary_reactant = "Deuterium"
|
||||
secondary_reactant = "Deuterium"
|
||||
energy_consumption = 1
|
||||
energy_production = 4
|
||||
radiation = 1
|
||||
products = list("Obdurium" = 2)
|
||||
|
||||
datum/fusion_reaction/tritium_tritium
|
||||
primary_reactant = "Tritium"
|
||||
secondary_reactant = "Tritium"
|
||||
energy_consumption = 1
|
||||
energy_production = 4
|
||||
radiation = 1
|
||||
products = list("Solonium" = 2)
|
||||
|
||||
//Cleanup Reactions
|
||||
|
||||
datum/fusion_reaction/rodinium6_obdurium
|
||||
primary_reactant = "Rodinium-6"
|
||||
secondary_reactant = "Obdurium"
|
||||
energy_consumption = 1
|
||||
energy_production = 2
|
||||
radiation = 2
|
||||
|
||||
datum/fusion_reaction/rodinium6_solonium
|
||||
primary_reactant = "Rodinium-6"
|
||||
secondary_reactant = "Solonium"
|
||||
energy_consumption = 1
|
||||
energy_production = 2
|
||||
radiation = 2
|
||||
|
||||
//Breeder Reactions
|
||||
|
||||
datum/fusion_reaction/dilithium_obdurium
|
||||
primary_reactant = "Dilithium"
|
||||
secondary_reactant = "Obdurium"
|
||||
energy_consumption = 1
|
||||
energy_production = 1
|
||||
radiation = 3
|
||||
products = list("Deuterium" = 1, "Dilithium" = 1)
|
||||
|
||||
datum/fusion_reaction/dilithium_solonium
|
||||
primary_reactant = "Dilithium"
|
||||
secondary_reactant = "Solonium"
|
||||
energy_consumption = 1
|
||||
energy_production = 1
|
||||
radiation = 3
|
||||
products = list("Tritium" = 1, "Dilithium" = 1)
|
||||
|
||||
//Breeder Inhibitor Reactions
|
||||
|
||||
datum/fusion_reaction/stravium7_dilithium
|
||||
primary_reactant = "Stravium-7"
|
||||
secondary_reactant = "Dilithium"
|
||||
energy_consumption = 2
|
||||
energy_production = 1
|
||||
radiation = 4
|
||||
|
||||
//Enhanced Breeder Reactions
|
||||
|
||||
datum/fusion_reaction/trilithium_obdurium
|
||||
primary_reactant = "Trilithium"
|
||||
secondary_reactant = "Obdurium"
|
||||
energy_consumption = 1
|
||||
energy_production = 2
|
||||
radiation = 5
|
||||
products = list("Dilithium" = 1, "Trilithium" = 1, "Deuterium" = 1)
|
||||
|
||||
datum/fusion_reaction/trilithium_solonium
|
||||
primary_reactant = "Trilithium"
|
||||
secondary_reactant = "Solonium"
|
||||
energy_consumption = 1
|
||||
energy_production = 2
|
||||
radiation = 5
|
||||
products = list("Dilithium" = 1, "Trilithium" = 1, "Tritium" = 1)
|
||||
|
||||
//Control Reactions
|
||||
|
||||
datum/fusion_reaction/pergium_deuterium
|
||||
primary_reactant = "Pergium"
|
||||
secondary_reactant = "Deuterium"
|
||||
energy_consumption = 5
|
||||
energy_production = 0
|
||||
radiation = 5
|
||||
|
||||
datum/fusion_reaction/pergium_tritium
|
||||
primary_reactant = "Pergium"
|
||||
secondary_reactant = "Tritium"
|
||||
energy_consumption = 5
|
||||
energy_production = 0
|
||||
radiation = 5
|
||||
|
||||
datum/fusion_reaction/pergium_obdurium
|
||||
primary_reactant = "Pergium"
|
||||
secondary_reactant = "Obdurium"
|
||||
energy_consumption = 5
|
||||
energy_production = 0
|
||||
radiation = 5
|
||||
|
||||
datum/fusion_reaction/pergium_solonium
|
||||
primary_reactant = "Pergium"
|
||||
secondary_reactant = "Solonium"
|
||||
energy_consumption = 5
|
||||
energy_production = 0
|
||||
radiation = 5
|
||||
@@ -1,188 +0,0 @@
|
||||
|
||||
//high frequency photon (laser beam)
|
||||
/obj/item/projectile/beam/ehf_beam
|
||||
|
||||
/obj/machinery/rust/gyrotron
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "emitter-off"
|
||||
name = "Gyrotron"
|
||||
anchored = 1
|
||||
density = 0
|
||||
layer = 4
|
||||
var/frequency = 1
|
||||
var/emitting = 0
|
||||
var/rate = 10
|
||||
var/mega_energy = 0.001
|
||||
var/on = 1
|
||||
var/remoteenabled = 1
|
||||
//
|
||||
req_access = list(access_engine)
|
||||
//
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 300
|
||||
|
||||
New()
|
||||
..()
|
||||
//pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
|
||||
//pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=gyro_monitor")
|
||||
usr.machine = null
|
||||
return
|
||||
if( href_list["modifypower"] )
|
||||
var/new_val = text2num(input("Enter new emission power level (0.001 - 0.01)", "Modifying power level (MeV)", mega_energy))
|
||||
if(!new_val)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_val = min(new_val,0.01)
|
||||
new_val = max(new_val,0.001)
|
||||
mega_energy = new_val
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["modifyrate"] )
|
||||
var/new_val = text2num(input("Enter new emission rate (1 - 10)", "Modifying emission rate (sec)", rate))
|
||||
if(!new_val)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_val = min(new_val,1)
|
||||
new_val = max(new_val,10)
|
||||
rate = new_val
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["modifyfreq"] )
|
||||
var/new_val = text2num(input("Enter new emission frequency (1 - 50000)", "Modifying emission frequency (GHz)", frequency))
|
||||
if(!new_val)
|
||||
usr << "\red That's not a valid number."
|
||||
return
|
||||
new_val = min(new_val,1)
|
||||
new_val = max(new_val,50000)
|
||||
frequency = new_val
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["activate"] )
|
||||
emitting = 1
|
||||
spawn(rate)
|
||||
Emit()
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["deactivate"] )
|
||||
emitting = 0
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["enableremote"] )
|
||||
remoteenabled = 1
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
if( href_list["disableremote"] )
|
||||
remoteenabled = 0
|
||||
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
|
||||
comp.updateDialog()
|
||||
return
|
||||
/*
|
||||
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
|
||||
playsound(src.loc, 'sound/weapons/emitter.ogg', 25, 1)
|
||||
if(prob(35))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
A.set_dir(src.dir)
|
||||
if(src.dir == 1)//Up
|
||||
A.yo = 20
|
||||
A.xo = 0
|
||||
else if(src.dir == 2)//Down
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
else if(src.dir == 4)//Right
|
||||
A.yo = 0
|
||||
A.xo = 20
|
||||
else if(src.dir == 8)//Left
|
||||
A.yo = 0
|
||||
A.xo = -20
|
||||
else // Any other
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
A.fired()
|
||||
*/
|
||||
proc/Emit()
|
||||
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
|
||||
A.frequency = frequency
|
||||
A.damage = mega_energy * 500
|
||||
//
|
||||
A.icon_state = "emitter"
|
||||
playsound(src.loc, 'sound/weapons/emitter.ogg', 25, 1)
|
||||
use_power(100 * mega_energy + 500)
|
||||
/*if(prob(35))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()*/
|
||||
A.set_dir(src.dir)
|
||||
if(src.dir == 1)//Up
|
||||
A.yo = 20
|
||||
A.xo = 0
|
||||
else if(src.dir == 2)//Down
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
else if(src.dir == 4)//Right
|
||||
A.yo = 0
|
||||
A.xo = 20
|
||||
else if(src.dir == 8)//Left
|
||||
A.yo = 0
|
||||
A.xo = -20
|
||||
else // Any other
|
||||
A.yo = -20
|
||||
A.xo = 0
|
||||
A.process()
|
||||
//
|
||||
flick("emitter-active",src)
|
||||
if(emitting)
|
||||
spawn(rate)
|
||||
Emit()
|
||||
|
||||
proc/UpdateIcon()
|
||||
if(on)
|
||||
icon_state = "emitter-on"
|
||||
else
|
||||
icon_state = "emitter-off"
|
||||
|
||||
/obj/machinery/rust/gyrotron/control_panel
|
||||
icon_state = "control_panel"
|
||||
name = "Control panel"
|
||||
var/obj/machinery/rust/gyrotron/owned_gyrotron
|
||||
New()
|
||||
..()
|
||||
pixel_x = -pixel_x
|
||||
pixel_y = -pixel_y
|
||||
|
||||
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=gyro_monitor")
|
||||
return
|
||||
var/t = "<B>Free electron MASER (Gyrotron) Control Panel</B><BR>"
|
||||
if(owned_gyrotron && owned_gyrotron.on)
|
||||
t += "<font color=green>Gyrotron operational</font><br>"
|
||||
t += "Operational mode: <font color=blue>"
|
||||
if(owned_gyrotron.emitting)
|
||||
t += "Emitting</font> <a href='?src=\ref[owned_gyrotron];deactivate=1'>\[Deactivate\]</a><br>"
|
||||
else
|
||||
t += "Not emitting</font> <a href='?src=\ref[owned_gyrotron];activate=1'>\[Activate\]</a><br>"
|
||||
t += "Emission rate: [owned_gyrotron.rate] <a href='?src=\ref[owned_gyrotron];modifyrate=1'>\[Modify\]</a><br>"
|
||||
t += "Beam frequency: [owned_gyrotron.frequency] <a href='?src=\ref[owned_gyrotron];modifyfreq=1'>\[Modify\]</a><br>"
|
||||
t += "Beam power: [owned_gyrotron.mega_energy] <a href='?src=\ref[owned_gyrotron];modifypower=1'>\[Modify\]</a><br>"
|
||||
else
|
||||
t += "<b><font color=red>Gyrotron unresponsive</font></b>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=gyro_monitor;size=500x800")
|
||||
user.machine = src
|
||||
@@ -1,88 +0,0 @@
|
||||
|
||||
/obj/machinery/computer/rust_gyrotron_controller
|
||||
name = "Gyrotron Remote Controller"
|
||||
icon = 'icons/rust.dmi'
|
||||
icon_state = "engine"
|
||||
var/updating = 1
|
||||
|
||||
New()
|
||||
..()
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=gyrotron_controller")
|
||||
usr.machine = null
|
||||
return
|
||||
if( href_list["target"] )
|
||||
var/obj/machinery/rust/gyrotron/gyro = locate(href_list["target"])
|
||||
gyro.Topic(href, href_list)
|
||||
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=gyrotron_controller")
|
||||
return
|
||||
var/t = "<B>Gyrotron Remote Control Console</B><BR>"
|
||||
t += "<hr>"
|
||||
for(var/obj/machinery/rust/gyrotron/gyro in world)
|
||||
if(gyro.remoteenabled && gyro.on)
|
||||
t += "<font color=green>Gyrotron operational</font><br>"
|
||||
t += "Operational mode: <font color=blue>"
|
||||
if(gyro.emitting)
|
||||
t += "Emitting</font> <a href='?src=\ref[gyro];deactivate=1'>\[Deactivate\]</a><br>"
|
||||
else
|
||||
t += "Not emitting</font> <a href='?src=\ref[gyro];activate=1'>\[Activate\]</a><br>"
|
||||
t += "Emission rate: [gyro.rate] <a href='?src=\ref[gyro];modifyrate=1'>\[Modify\]</a><br>"
|
||||
t += "Beam frequency: [gyro.frequency] <a href='?src=\ref[gyro];modifyfreq=1'>\[Modify\]</a><br>"
|
||||
t += "Beam power: [gyro.mega_energy] <a href='?src=\ref[gyro];modifypower=1'>\[Modify\]</a><br>"
|
||||
else
|
||||
t += "<b><font color=red>Gyrotron unresponsive</font></b>"
|
||||
t += "<hr>"
|
||||
/*
|
||||
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 ? "[Injector.owned_assembly_port.cur_assembly.amount_depleted*100]%" : ""]</td>"
|
||||
t += "</tr>"
|
||||
t += "</table>"
|
||||
*/
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=gyrotron_controller;size=500x400")
|
||||
user.machine = src
|
||||
@@ -1,74 +0,0 @@
|
||||
|
||||
/obj/machinery/rust/rad_source
|
||||
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)
|
||||
qdel(src)
|
||||
|
||||
//radiate mobs nearby here
|
||||
//
|
||||
|
||||
/*
|
||||
/obj/machinery/rust
|
||||
proc/RadiateParticle(var/energy, var/ionizing, var/dir = 0)
|
||||
if(!dir)
|
||||
RadiateParticleRand(energy, ionizing)
|
||||
var/obj/effect/accelerated_particle/particle = new
|
||||
particle.set_dir(dir)
|
||||
particle.ionizing = ionizing
|
||||
if(energy)
|
||||
particle.energy = energy
|
||||
//particle.invisibility = 2
|
||||
//
|
||||
return particle
|
||||
|
||||
proc/RadiateParticleRand(var/energy, var/ionizing)
|
||||
var/turf/target
|
||||
var/particle_range = 3 * round(energy) + rand(3,20)
|
||||
if(energy > 1)
|
||||
//for penetrating radiation
|
||||
for(var/mob/M in range(particle_range))
|
||||
var/dist_ratio = particle_range / get_dist(M, src)
|
||||
//particles are more likely to hit a person if the person is closer
|
||||
// 1/8 = 12.5% (closest)
|
||||
// 1/360 = 0.27% (furthest)
|
||||
// variation of 12.2%
|
||||
if( rand() < (0.25 + dist_ratio * 12.5) )
|
||||
target = get_turf(M)
|
||||
break
|
||||
if(!target)
|
||||
target = pick(range(particle_range))
|
||||
else
|
||||
//for slower, non-penetrating radiation
|
||||
for(var/mob/M in view(particle_range))
|
||||
var/dist_ratio = particle_range / get_dist(M, src)
|
||||
if( rand() < (0.25 + dist_ratio * 12.5) )
|
||||
target = get_turf(M)
|
||||
break
|
||||
if(!target)
|
||||
target = pick(view(particle_range))
|
||||
var/obj/effect/accelerated_particle/particle = new
|
||||
particle.target = target
|
||||
particle.ionizing = ionizing
|
||||
if(energy)
|
||||
particle.energy = energy
|
||||
//particle.invisibility = 2
|
||||
//
|
||||
return particle
|
||||
*/
|
||||
|
||||
/obj/machinery/computer/rust_radiation_monitor
|
||||
name = "Radiation Monitor"
|
||||
icon_state = "power"
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
//gimmicky hack to collect particles and direct them into the field
|
||||
/obj/effect/rust_particle_catcher
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
density = 0
|
||||
anchored = 1
|
||||
layer = 4
|
||||
var/obj/effect/rust_em_field/parent
|
||||
var/mysize = 0
|
||||
|
||||
invisibility = 101
|
||||
|
||||
/*/obj/effect/rust_particle_catcher/New()
|
||||
for(var/obj/machinery/rust/em_field/field in range(6))
|
||||
parent = field
|
||||
if(!parent)
|
||||
qdel(src)*/
|
||||
|
||||
/obj/effect/rust_particle_catcher/process()
|
||||
if(!parent)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/rust_particle_catcher/proc/SetSize(var/newsize)
|
||||
name = "collector [newsize]"
|
||||
mysize = newsize
|
||||
UpdateSize()
|
||||
|
||||
/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
|
||||
|
||||
/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"
|
||||
|
||||
/obj/effect/rust_particle_catcher/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.check_armour != "bullet" && parent)
|
||||
parent.AddEnergy(Proj.damage * 20, 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,20 +43,6 @@
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/)))
|
||||
A:energy += energy
|
||||
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)
|
||||
qdel(src)
|
||||
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
|
||||
collided_core.owned_field.mega_energy += mega_energy - mega_energy * energy_loss_ratio
|
||||
collided_core.owned_field.energy += energy - energy * energy_loss_ratio
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user