Merge branch 'bleeding-edge-freeze' of https://github.com/Baystation12/Baystation12 into xenoarch

Conflicts:
	baystation12.dme
	code/WorkInProgress/Cael_Aislinn/ShieldGen/energy_field.dm
	icons/obj/device.dmi

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2013-02-25 14:30:00 +10:00
141 changed files with 10412 additions and 8264 deletions
@@ -2,6 +2,7 @@ var/global/current_date_string
var/global/num_financial_terminals = 1
var/global/datum/money_account/station_account
var/global/next_account_number = 0
var/global/obj/machinery/account_database/centcomm_account_db
/proc/create_station_account()
if(!station_account)
@@ -11,13 +12,13 @@ var/global/next_account_number = 0
station_account.owner_name = "[station_name()] Station Account"
station_account.account_number = rand(111111, 999999)
station_account.remote_access_pin = rand(1111, 111111)
station_account.money = 10000
station_account.money = 75000
//create an entry in the account transaction log for when it was created
var/datum/transaction/T = new()
T.target_name = station_account.owner_name
T.purpose = "Account creation"
T.amount = 10000
T.amount = 75000
T.date = "2nd April, 2555"
T.time = "11:24"
T.source_terminal = "Biesel GalaxyNet Terminal #277"
@@ -266,11 +267,12 @@ var/global/next_account_number = 0
R.overlays += stampoverlay
R.stamps += "<HR><i>This paper has been stamped by the Accounts Database.</i>"
//add the account
M.transaction_log.Add(T)
accounts.Add(M)
return M
/obj/machinery/account_database/proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount)
for(var/datum/money_account/D in accounts)
if(D.account_number == attempt_account_number)
@@ -1,8 +1,8 @@
/obj/item/weapon/eftpos
/obj/item/device/eftpos
name = "EFTPOS scanner"
desc = "Swipe your ID card to pay electronically."
icon = 'icons/obj/library.dmi'
icon_state = "scanner"
desc = "Swipe your ID card to make purchases electronically."
icon = 'icons/obj/device.dmi'
icon_state = "eftpos"
var/machine_id = ""
var/eftpos_name = "Default EFTPOS scanner"
var/transaction_locked = 0
@@ -13,23 +13,24 @@
var/obj/machinery/account_database/linked_db
var/datum/money_account/linked_account
/obj/item/weapon/eftpos/New()
/obj/item/device/eftpos/New()
..()
machine_id = "[station_name()] EFTPOS #[num_financial_terminals++]"
access_code = rand(1111,111111)
reconnect_database()
print_reference()
spawn(0)
print_reference()
//by default, connect to the station account
//the user of the EFTPOS device can change the target account though, and no-one will be the wiser (except whoever's being charged)
linked_account = station_account
/obj/item/weapon/eftpos/proc/print_reference()
var/obj/item/weapon/paper/R = new(get_turf(src))
/obj/item/device/eftpos/proc/print_reference()
var/obj/item/weapon/paper/R = new(src.loc)
R.name = "Reference: [eftpos_name]"
R.info = "<b>[eftpos_name] reference</b><br><br>"
R.info += "Access code: [access_code]<br><br>"
R.info += "<b>Do not lose this code, or the device will have to be replaced.</b><br>"
R.info += "<b>Do not lose or misplace this code.</b><br>"
//stamp the paper
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
@@ -39,14 +40,18 @@
R.stamped += /obj/item/weapon/stamp
R.overlays += stampoverlay
R.stamps += "<HR><i>This paper has been stamped by the EFTPOS device.</i>"
var/obj/item/smallDelivery/D = new(R.loc)
R.loc = D
D.wrapped = R
D.name = "small parcel - 'EFTPOS access code'"
/obj/item/weapon/eftpos/proc/reconnect_database()
/obj/item/device/eftpos/proc/reconnect_database()
for(var/obj/machinery/account_database/DB in world)
if(DB.z == src.z)
linked_db = DB
break
/obj/item/weapon/eftpos/attack_self(mob/user as mob)
/obj/item/device/eftpos/attack_self(mob/user as mob)
if(get_dist(src,user) <= 1)
var/dat = "<b>[eftpos_name]</b><br>"
dat += "<i>This terminal is</i> [machine_id]. <i>Report this code when contacting NanoTrasen IT Support</i><br>"
@@ -67,48 +72,62 @@
dat += "Transaction purpose: <a href='?src=\ref[src];choice=trans_purpose'>[transaction_purpose]</a><br>"
dat += "Value: <a href='?src=\ref[src];choice=trans_value'>$[transaction_amount]</a><br>"
dat += "Linked account: <a href='?src=\ref[src];choice=link_account'>[linked_account ? linked_account.owner_name : "None"]</a><hr>"
dat += "<a href='?src=\ref[src];choice=change_code'>Change access code</a>"
dat += "<a href='?src=\ref[src];choice=change_code'>Change access code</a><br>"
dat += "<a href='?src=\ref[src];choice=change_id'>Change EFTPOS ID</a><br>"
dat += "Scan card to reset access code <a href='?src=\ref[src];choice=reset'>\[------\]</a>"
user << browse(dat,"window=eftpos")
else
user << browse(null,"window=eftpos")
/obj/item/weapon/eftpos/attackby(O as obj, user as mob)
/obj/item/device/eftpos/attackby(O as obj, user as mob)
if(istype(O, /obj/item/weapon/card))
//attempt to connect to a new db, and if that doesn't work then fail
if(!linked_db)
reconnect_database()
if(linked_db && linked_account)
var/obj/item/weapon/card/I = O
scan_card(I)
if(linked_db)
if(linked_account)
var/obj/item/weapon/card/I = O
scan_card(I)
else
usr << "\icon[src]<span class='warning'>Unable to connect to linked account.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to connect to accounts database.</span>"
else
..()
/obj/item/weapon/eftpos/Topic(var/href, var/href_list)
/obj/item/device/eftpos/Topic(var/href, var/href_list)
if(href_list["choice"])
switch(href_list["choice"])
if("change_code")
var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm old EFTPOS code"))
var/attempt_code = input("Re-enter the current EFTPOS access code", "Confirm old EFTPOS code") as num
if(attempt_code == access_code)
access_code = text2num(input("Enter a new access code for this device", "Enter new EFTPOS code"))
access_code = input("Enter a new access code for this device", "Enter new EFTPOS code") as num
print_reference()
else
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
if("change_id")
var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code"))
if(attempt_code == access_code)
eftpos_name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") + " EFTPOS scanner"
print_reference()
else
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
if("link_account")
if(!linked_db)
reconnect_database()
if(linked_db)
var/attempt_account_num = text2num(input("Enter account number to pay EFTPOS charges into", "New account number"))
var/attempt_pin = text2num(input("Enter pin code", "Account pin"))
var/attempt_account_num = input("Enter account number to pay EFTPOS charges into", "New account number") as num
var/attempt_pin = input("Enter pin code", "Account pin") as num
linked_account = linked_db.attempt_account_access(attempt_account_num, attempt_pin, 1)
else
usr << "<span class='warning'>Unable to connect to accounts database.</span>"
usr << "\icon[src]<span class='warning'>Unable to connect to accounts database.</span>"
if("trans_purpose")
transaction_purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose")
if("trans_value")
transaction_amount = max(text2num(input("Enter amount for EFTPOS transaction", "Transaction amount")),0)
transaction_amount = input("Enter amount for EFTPOS transaction", "Transaction amount") as num
if("toggle_lock")
if(transaction_locked)
var/attempt_code = text2num(input("Enter EFTPOS access code", "Reset Transaction"))
var/attempt_code = input("Enter EFTPOS access code", "Reset Transaction") as num
if(attempt_code == access_code)
transaction_locked = 0
transaction_paid = 0
@@ -126,16 +145,27 @@
scan_card(I)
else
usr << "\icon[src]<span class='warning'>Unable to link accounts.</span>"
if("reset")
//reset the access code - requires HoP/captain access
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card))
var/obj/item/weapon/card/id/C = I
if(access_cent_captain in C.access || access_hop in C.access || access_captain in C.access)
access_code = 0
usr << "\icon[src]<span class='info'>Access code reset to 0.</span>"
else if (istype(I, /obj/item/weapon/card/emag))
access_code = 0
usr << "\icon[src]<span class='info'>Access code reset to 0.</span>"
src.attack_self(usr)
/obj/item/weapon/eftpos/proc/scan_card(var/obj/item/weapon/card/I)
/obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I)
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
if(transaction_locked && !transaction_paid)
if(linked_account)
var/attempt_pin = text2num(input("Enter pin code", "EFTPOS transaction"))
var/attempt_pin = input("Enter pin code", "EFTPOS transaction") as num
var/datum/money_account/D = linked_db.attempt_account_access(C.associated_account_number, attempt_pin, 2)
if(D)
if(transaction_amount <= D.money)
@@ -149,9 +179,12 @@
//create entries in the two account transaction logs
var/datum/transaction/T = new()
T.target_name = "[linked_account.owner_name] ([eftpos_name])"
T.target_name = "[linked_account.owner_name] (via [eftpos_name])"
T.purpose = transaction_purpose
T.amount = "([transaction_amount])"
if(transaction_amount > 0)
T.amount = "([transaction_amount])"
else
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
@@ -168,9 +201,9 @@
else
usr << "\icon[src]<span class='warning'>You don't have that much money!<span>"
else
usr << "\icon[src]<span class='warning'>EFTPOS is not connected to an account.<span>"
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
usr << "\icon[src]<span class='warning'>EFTPOS is not connected to an account.<span>"
else
..()
@@ -0,0 +1,120 @@
//////////////////////////////////////
// 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 = "programming=3;engineering=4"
datum/design/rust_core_control
name = "Circuit Design (RUST core controller)"
desc = "Allows for the construction of circuit boards used to build a core control console for the RUST fusion engine."
id = "rust_core_control"
req_tech = list("programming" = 3, "engineering" = 4)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20)
build_path = "/obj/item/weapon/circuitboard/rust_core_control"
//////////////////////////////////////
// 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 = "programming=3;engineering=4"
datum/design/rust_fuel_control
name = "Circuit Design (RUST fuel controller)"
desc = "Allows for the construction of circuit boards used to build a fuel injector control console for the RUST fusion engine."
id = "rust_fuel_control"
req_tech = list("programming" = 3, "engineering" = 4)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20)
build_path = "/obj/item/weapon/circuitboard/rust_fuel_control"
//////////////////////////////////////
// RUST Fuel Port board
/obj/item/weapon/module/rust_fuel_port
name = "Internal circuitry (RUST fuel port)"
icon_state = "card_mod"
origin_tech = "engineering=4;materials=5"
datum/design/rust_fuel_port
name = "Internal circuitry (RUST fuel port)"
desc = "Allows for the construction of circuit boards used to build a fuel injection port for the RUST fusion engine."
id = "rust_fuel_port"
req_tech = list("engineering" = 4, "materials" = 5)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20, "$uranium" = 3000)
build_path = "/obj/item/weapon/module/rust_fuel_port"
//////////////////////////////////////
// RUST Fuel Compressor board
/obj/item/weapon/module/rust_fuel_compressor
name = "Internal circuitry (RUST fuel compressor)"
icon_state = "card_mod"
origin_tech = "materials=7;plasmatech=4"
datum/design/rust_fuel_compressor
name = "Circuit Design (RUST fuel compressor)"
desc = "Allows for the construction of circuit boards used to build a fuel compressor of the RUST fusion engine."
id = "rust_fuel_compressor"
req_tech = list("materials" = 7, "plasmatech" = 4)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20, "$plasma" = 3000, "$diamond" = 1000)
build_path = "/obj/item/weapon/module/rust_fuel_compressor"
//////////////////////////////////////
// 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 = "bluespace=3;plasmatech=4;magnets=5;materials=6;powerstorage=6"
frame_desc = "Requires 2 Pico Manipulators, 1 Ultra Micro-Laser, 5 Pieces of Cable, 1 Subspace Crystal and 1 Console Screen."
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/weapon/cable_coil" = 5)
datum/design/rust_core
name = "Internal circuitry (RUST tokamak core)"
desc = "The circuit board that for a RUST-pattern tokamak fusion core."
id = "pacman"
req_tech = list(bluespace = 3, plasmatech = 4, magnets = 5, materials = 6, powerstorage = 6)
build_type = IMPRINTER
reliability_base = 79
materials = list("$glass" = 2000, "sacid" = 20, "$plasma" = 3000, "$diamond" = 2000)
build_path = "/obj/item/weapon/circuitboard/rust_core"
//////////////////////////////////////
// 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 = "powerstorage=3;engineering=4;plasmatech=4;materials=6"
frame_desc = "Requires 2 Pico Manipulators, 1 Phasic Scanning Module, 1 Super Matter Bin, 1 Console Screen and 5 Pieces of Cable."
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/weapon/cable_coil" = 5)
datum/design/rust_injector
name = "Internal circuitry (RUST tokamak core)"
desc = "The circuit board that for a RUST-pattern particle accelerator."
id = "pacman"
req_tech = list(powerstorage = 3, engineering = 4, plasmatech = 4, materials = 6)
build_type = IMPRINTER
reliability_base = 79
materials = list("$glass" = 2000, "sacid" = 20, "$plasma" = 3000, "$uranium" = 2000)
build_path = "/obj/item/weapon/circuitboard/rust_core"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,142 @@
/obj/machinery/computer/rust_core_control
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core"
var/list/connected_devices = list()
var/id_tag = "allan remember to update this before you leave"
var/scan_range = 25
//currently viewed
var/obj/machinery/power/rust_core/cur_viewed_device
/obj/machinery/computer/rust_core_control/process()
if(stat & (BROKEN|NOPOWER))
return
/obj/machinery/computer/rust_core_control/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/computer/rust_core_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/rust_core_control/interact(mob/user)
if(stat & BROKEN)
user.unset_machine()
user << browse(null, "window=core_control")
return
if (!istype(user, /mob/living/silicon) && (get_dist(src, user) > 1 ))
user.unset_machine()
user << browse(null, "window=core_control")
return
var/dat = ""
if(stat & NOPOWER)
dat += "<i>The console is dark and nonresponsive.</i>"
else
dat += "<B>Reactor Core Primary Monitor</B><BR>"
if(cur_viewed_device && cur_viewed_device.stat & (BROKEN|NOPOWER))
cur_viewed_device = null
if(cur_viewed_device && !cur_viewed_device.remote_access_enabled)
cur_viewed_device = null
if(cur_viewed_device)
dat += "<b>Device tag:</b> [cur_viewed_device.id_tag ? cur_viewed_device.id_tag : "UNSET"]<br>"
dat += "<font color=blue>Device [cur_viewed_device.owned_field ? "activated" : "deactivated"].</font><br>"
dat += "<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];toggle_active=1'>\[Bring field [cur_viewed_device.owned_field ? "offline" : "online"]\]</a><br>"
dat += "<b>Device [cur_viewed_device.anchored ? "secured" : "unsecured"].</b><br>"
dat += "<hr>"
dat += "<b>Field encumbrance:</b> [cur_viewed_device.owned_field ? 0 : "NA"]<br>"
dat += "<b>Field strength:</b> [cur_viewed_device.field_strength] Wm^3<br>"
dat += "<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-1000'>\[----\]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-100'>\[--- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-10'>\[-- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=-1'>\[- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=1'>\[+ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=10'>\[++ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=100'>\[+++ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];str=1000'>\[++++\]</a><br>"
dat += "<b>Field frequency:</b> [cur_viewed_device.field_frequency] MHz<br>"
dat += "<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-1000'>\[----\]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-100'>\[--- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-10'>\[-- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=-1'>\[- \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=1'>\[+ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=10'>\[++ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=100'>\[+++ \]</a> \
<a href='?src=\ref[cur_viewed_device];extern_update=\ref[src];freq=1000'>\[++++\]</a><br>"
var/power_stat = "Good"
if(cur_viewed_device.cached_power_avail < cur_viewed_device.active_power_usage)
power_stat = "Insufficient"
else if(cur_viewed_device.cached_power_avail < cur_viewed_device.active_power_usage * 2)
power_stat = "Check"
dat += "<b>Power status:</b> [power_stat]<br>"
else
dat += "<a href='?src=\ref[src];scan=1'>\[Refresh device list\]</a><br><br>"
if(connected_devices.len)
dat += "<table width='100%' border=1>"
dat += "<tr>"
dat += "<td><b>Device tag</b></td>"
dat += "<td></td>"
dat += "</tr>"
for(var/obj/machinery/power/rust_core/C in connected_devices)
if(!check_core_status(C))
connected_devices.Remove(C)
continue
dat += "<tr>"
dat += "<td>[C.id_tag]</td>"
dat += "<td><a href='?src=\ref[src];manage_individual=\ref[C]'>\[Manage\]</a></td>"
dat += "</tr>"
dat += "</table>"
else
dat += "No devices connected.<br>"
dat += "<hr>"
dat += "<a href='?src=\ref[src];refresh=1'>Refresh</a> "
dat += "<a href='?src=\ref[src];close=1'>Close</a>"
user << browse(dat, "window=core_control;size=500x400")
onclose(user, "core_control")
user.set_machine(src)
/obj/machinery/computer/rust_core_control/Topic(href, href_list)
..()
if( href_list["goto_scanlist"] )
cur_viewed_device = null
if( href_list["manage_individual"] )
cur_viewed_device = locate(href_list["manage_individual"])
if( href_list["scan"] )
connected_devices = list()
for(var/obj/machinery/power/rust_core/C in range(scan_range, src))
if(check_core_status(C))
connected_devices.Add(C)
if( href_list["startup"] )
if(cur_viewed_device)
cur_viewed_device.Startup()
if( href_list["shutdown"] )
if(cur_viewed_device)
cur_viewed_device.Shutdown()
if( href_list["close"] )
usr << browse(null, "window=core_control")
usr.unset_machine()
updateDialog()
/obj/machinery/computer/rust_core_control/proc/check_core_status(var/obj/machinery/power/rust_core/C)
if(!C)
return 0
if(C.stat & (BROKEN|NOPOWER) || !C.remote_access_enabled || !C.id_tag)
if(connected_devices.Find(C))
connected_devices.Remove(C)
return 0
return 1
File diff suppressed because it is too large Load Diff
+226 -59
View File
@@ -40,80 +40,247 @@ max volume of plasma storeable by the field = the total volume of a number of ti
*/
/obj/machinery/rust/core
name = "Tokamak core"
#define MAX_FIELD_FREQ 1000
#define MIN_FIELD_FREQ 1
#define MAX_FIELD_STR 1000
#define MIN_FIELD_STR 1
/obj/machinery/power/rust_core
name = "RUST Tokamak core"
desc = "Enormous solenoid for generating extremely high power electromagnetic fields"
icon = 'core.dmi'
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "core0"
anchored = 1
var/on = 0
var/obj/machinery/rust/em_field/owned_field
var/field_strength = 0.01
//
density = 1
var/obj/effect/rust_em_field/owned_field
var/field_strength = 1//0.01
var/field_frequency = 1
var/id_tag = "allan, don't forget to set the ID of this one too"
req_access = list(access_engine)
//
use_power = 1
idle_power_usage = 10
active_power_usage = 300
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
var/cached_power_avail = 0
directwired = 1
var/state = 0
var/locked = 0
var/remote_access_enabled = 1
Topic(href, href_list)
..()
if( href_list["startup"] )
Startup()
return
if( href_list["shutdown"] )
Shutdown()
return
if( href_list["modify_field_strength"] )
var/new_field_str = text2num(input("Enter new field strength", "Modifying field strength", owned_field.field_strength))
if(!new_field_str)
usr << "\red That's not a valid number."
return
field_strength = max(new_field_str,0.1)
field_strength = min(new_field_str,50)
if(owned_field)
owned_field.ChangeFieldStrength(field_strength)
return
/obj/machinery/power/rust_core/process()
if(stat & BROKEN || !powernet)
Shutdown()
proc/Startup()
cached_power_avail = avail()
//luminosity = round(owned_field.field_strength/10)
//luminosity = max(luminosity,1)
/obj/machinery/power/rust_core/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench))
if(owned_field)
user << "Turn off [src] first."
return
on = 1
owned_field = new(src.loc)
switch(state)
if(0)
state = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear a ratchet")
src.anchored = 1
if(1)
state = 0
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear a ratchet")
src.anchored = 0
if(2)
user << "\red The [src.name] needs to be unwelded from the floor."
return
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(owned_field)
user << "Turn off the [src] first."
return
switch(state)
if(0)
user << "\red The [src.name] needs to be wrenched to the floor."
if(1)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 2
user << "You weld the [src] to the floor."
connect_to_network()
src.directwired = 1
else
user << "\red You need more welding fuel to complete this task."
if(2)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 1
user << "You cut the [src] free from the floor."
disconnect_from_network()
src.directwired = 0
else
user << "\red You need more welding fuel to complete this task."
return
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
if(emagged)
user << "\red The lock seems to be broken"
return
if(src.allowed(user))
if(owned_field)
src.locked = !src.locked
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
src.locked = 0 //just in case it somehow gets locked
user << "\red The controls can only be locked when the [src] is online"
else
user << "\red Access denied."
return
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
locked = 0
emagged = 1
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
return
..()
return
/obj/machinery/power/rust_core/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/power/rust_core/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/power/rust_core/interact(mob/user)
if(stat & BROKEN)
user.unset_machine()
user << browse(null, "window=core_gen")
return
if(!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
user.unset_machine()
user << browse(null, "window=core_gen")
return
var/dat = ""
if(!powernet || locked)
dat += "<i>The console is dark and nonresponsive.</i>"
else
dat += "<b>RUST Tokamak pattern Electromagnetic Field Generator</b><br>"
dat += "<b>Device ID tag: </b> [id_tag ? id_tag : "UNSET"] <a href='?src=\ref[src];new_id_tag=1'>\[Modify\]</a><br>"
dat += "<a href='?src=\ref[src];toggle_active=1'>\[[owned_field ? "Deactivate" : "Activate"]\]</a><br>"
dat += "<a href='?src=\ref[src];toggle_remote=1'>\[[remote_access_enabled ? "Disable remote access to this device" : "Enable remote access to this device"]\]</a><br>"
dat += "<hr>"
dat += "<b>Field strength:</b> [field_strength]Wm^3<br>"
dat += "<a href='?src=\ref[src];str=-1000'>\[----\]</a> \
<a href='?src=\ref[src];str=-100'>\[--- \]</a> \
<a href='?src=\ref[src];str=-10'>\[-- \]</a> \
<a href='?src=\ref[src];str=-1'>\[- \]</a> \
<a href='?src=\ref[src];str=1'>\[+ \]</a> \
<a href='?src=\ref[src];str=10'>\[++ \]</a> \
<a href='?src=\ref[src];str=100'>\[+++ \]</a> \
<a href='?src=\ref[src];str=1000'>\[++++\]</a><br>"
dat += "<b>Field frequency:</b> [field_frequency]MHz<br>"
dat += "<a href='?src=\ref[src];freq=-1000'>\[----\]</a> \
<a href='?src=\ref[src];freq=-100'>\[--- \]</a> \
<a href='?src=\ref[src];freq=-10'>\[-- \]</a> \
<a href='?src=\ref[src];freq=-1'>\[- \]</a> \
<a href='?src=\ref[src];freq=1'>\[+ \]</a> \
<a href='?src=\ref[src];freq=10'>\[++ \]</a> \
<a href='?src=\ref[src];freq=100'>\[+++ \]</a> \
<a href='?src=\ref[src];freq=1000'>\[++++\]</a><br>"
var/font_colour = "green"
if(cached_power_avail < active_power_usage)
font_colour = "red"
else if(cached_power_avail < active_power_usage * 2)
font_colour = "orange"
dat += "<b>Power status:</b> <font color=[font_colour]>[active_power_usage]/[cached_power_avail] W</font><br>"
user << browse(dat, "window=core_gen;size=500x300")
onclose(user, "core_gen")
user.set_machine(src)
/obj/machinery/power/rust_core/Topic(href, href_list)
if(href_list["str"])
var/dif = text2num(href_list["str"])
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)
active_power_usage = 5 * field_strength //change to 500 later
if(owned_field)
owned_field.ChangeFieldStrength(field_strength)
icon_state = "core1"
luminosity = 1
return 1
proc/Shutdown()
if(href_list["freq"])
var/dif = text2num(href_list["freq"])
field_frequency = min(max(field_frequency + dif, MIN_FIELD_FREQ), MAX_FIELD_FREQ)
if(owned_field)
owned_field.ChangeFieldFrequency(field_frequency)
if(href_list["toggle_active"])
if(!Startup())
Shutdown()
if( href_list["toggle_remote"] )
remote_access_enabled = !remote_access_enabled
if(href_list["new_id_tag"])
if(usr)
id_tag = input("Enter a new ID tag", "Tokamak core ID tag", id_tag) as text|null
if(href_list["close"])
usr << browse(null, "window=core_gen")
usr.unset_machine()
if(href_list["extern_update"])
var/obj/machinery/computer/rust_core_control/C = locate(href_list["extern_update"])
if(C)
C.updateDialog()
src.updateDialog()
/obj/machinery/power/rust_core/proc/Startup()
if(owned_field)
return
owned_field = new(src.loc)
owned_field.ChangeFieldStrength(field_strength)
owned_field.ChangeFieldFrequency(field_frequency)
icon_state = "core1"
luminosity = 1
use_power = 2
return 1
/obj/machinery/power/rust_core/proc/Shutdown()
//todo: safety checks for field status
if(owned_field)
icon_state = "core0"
on = 0
del(owned_field)
luminosity = 0
use_power = 1
proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
owned_field.AddParticles(name, quantity)
return 1
return 0
/obj/machinery/power/rust_core/proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
owned_field.AddParticles(name, quantity)
return 1
return 0
process()
..()
use_power(100 * field_strength + 500)
if(on && !owned_field)
Shutdown()
return
//
luminosity = round(owned_field.field_strength/10)
luminosity = max(luminosity,1)
//
if(stat & (NOPOWER|BROKEN))
Shutdown()
bullet_act(var/obj/item/projectile/Proj)
if(Proj.flag != "bullet" && owned_field)
var/obj/item/projectile/beam/laserbeam = Proj
owned_field.AddEnergy(0, laserbeam.damage / 5000, laserbeam.frequency)
return 0
/obj/machinery/power/rust_core/bullet_act(var/obj/item/projectile/Proj)
if(Proj.flag != "bullet" && owned_field)
owned_field.AddEnergy(Proj.damage, 0, 1)
return 0
@@ -1,77 +0,0 @@
/obj/machinery/computer/rust/radiation_monitor
name = "Core Radiation Monitor"
/obj/machinery/computer/rust/energy_monitor
name = "Core Primary Monitor"
icon_state = "power"
var/obj/machinery/rust/core/core_generator = null
var/updating = 1
New()
..()
spawn(0)
core_generator = locate() in world
Topic(href, href_list)
..()
if( href_list["shutdown"] )
updating = 0
core_generator.Topic(href, href_list)
updateDialog()
updating = 1
return
if( href_list["startup"] )
updating = 0
core_generator.Topic(href, href_list)
updateDialog()
updating = 1
return
if( href_list["modify_field_strength"] )
updating = 0
core_generator.Topic(href, href_list)
updateDialog()
updating = 1
return
if( href_list["close"] )
usr << browse(null, "window=core_monitor")
usr.machine = null
return
process()
..()
if(updating)
src.updateDialog()
interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=core_monitor")
return
var/t = "<B>Reactor Core Primary Monitor</B><BR>"
if(core_generator)
t += "<font color=blue>[core_generator.on ? "Core Generator connected" : "Core Generator operational"]</font><br>"
if(core_generator.owned_field)
t += "<font color=green>Core suspension field online</font> <a href='?src=\ref[src];shutdown=1'>\[Bring field offline\]</a><br>"
t += "Electromagnetic plasma suspension field status:<br>"
t += " <font color=blue>Strength (T): [core_generator.owned_field.field_strength]</font> <a href='?src=\ref[src];modify_field_strength=1'>\[Modify\]</a><br>"
t += " <font color=blue>Energy levels (MeV): [core_generator.owned_field.mega_energy]</font><br>"
t += " <font color=blue>Core frequency: [core_generator.owned_field.frequency]</font><br>"
t += " <font color=blue>Moles of plasma: [core_generator.owned_field.held_plasma.toxins]</font><br>"
t += " <font color=blue>Core temperature: [core_generator.owned_field.held_plasma.temperature]</font><br>"
t += "<hr>"
t += "<b>Core atomic and subatomic constituents:</font></b><br>"
if(core_generator.owned_field.dormant_reactant_quantities && core_generator.owned_field.dormant_reactant_quantities.len)
for(var/reagent in core_generator.owned_field.dormant_reactant_quantities)
t += " <font color=green>[reagent]:</font> [core_generator.owned_field.dormant_reactant_quantities[reagent]]<br>"
else
t += " <font color=blue>No reactants present.</font><br>"
else
t += "<font color=red>Core suspension field offline</font> <a href='?src=\ref[src];startup=1'>\[Bring field online\]</a><br>"
else
t += "<b><font color=red>Core Generator unresponsive</font></b><br>"
t += "<hr>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=core_monitor;size=500x400")
user.machine = src
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

@@ -1,10 +1,10 @@
/obj/item/weapon/fuel_assembly
icon = 'fuel_assembly.dmi'
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "fuel_assembly"
name = "Fuel Rod Assembly"
var/list/rod_quantities
var/percent_depleted = 0
var/percent_depleted = 1
//
New()
rod_quantities = new/list
Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

@@ -1,31 +1,130 @@
/obj/machinery/rust/fuel_assembly_port
/obj/machinery/rust_fuel_assembly_port
name = "Fuel Assembly Port"
icon = 'fuel_assembly_port.dmi'
icon_state = "port0"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "port2"
density = 0
var/obj/item/weapon/fuel_assembly/cur_assembly = null
var/obj/item/weapon/fuel_assembly/cur_assembly
layer = 4
var/busy = 0
anchored = 1
attackby(var/obj/item/I, var/mob/user)
if(istype(I,/obj/item/weapon/fuel_assembly))
if(cur_assembly)
del cur_assembly
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"
attack_hand(mob/user)
add_fingerprint(user)
/*if(stat & (BROKEN|NOPOWER))
return*/
/obj/machinery/rust_fuel_assembly_port/attack_hand(mob/user)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER) || opened)
return
if(!busy)
busy = 1
if(cur_assembly)
cur_assembly.loc = src.loc
spawn(30)
if(!try_insert_assembly())
spawn(30)
eject_assembly()
busy = 0
else
busy = 0
else
spawn(30)
try_draw_assembly()
busy = 0
/obj/machinery/rust_fuel_assembly_port/proc/try_insert_assembly()
var/success = 0
if(cur_assembly)
var/turf/check_turf = get_step(get_turf(src), src.dir)
check_turf = get_step(check_turf, src.dir)
for(var/obj/machinery/power/rust_fuel_injector/I in check_turf)
if(I.stat & (BROKEN|NOPOWER))
break
if(I.cur_assembly)
break
I.cur_assembly = cur_assembly
cur_assembly.loc = I
cur_assembly = null
icon_state = "port0"
success = 1
New()
//embed the fuel port into a wall
pixel_x = (dir & 3)? 0 : (dir == 4 ? 24 : -24)
pixel_y = (dir & 3)? (dir ==1 ? 24 : -24) : 0
if(success)
src.visible_message("\blue \icon[src] a green light flashes on [src] as it inserts it's fuel rod assembly into an injector.")
else
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to insert it's fuel rod assembly into an injector.")
return success
/obj/machinery/rust_fuel_assembly_port/proc/eject_assembly()
if(cur_assembly)
var/turf/check_turf = get_step(get_turf(src), src.dir)
cur_assembly.loc = check_turf
cur_assembly = null
icon_state = "port0"
return 1
else
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to eject it's fuel rod assembly.")
/obj/machinery/rust_fuel_assembly_port/proc/try_draw_assembly()
var/success = 0
if(cur_assembly)
var/turf/check_turf = get_step(get_turf(src), src.dir)
check_turf = get_step(check_turf, src.dir)
for(var/obj/machinery/power/rust_fuel_injector/I in check_turf)
if(I.stat & (BROKEN|NOPOWER))
break
if(!I.cur_assembly)
break
if(I.injecting)
break
if(I.stat != 2)
break
cur_assembly = I.cur_assembly
cur_assembly.loc = src
I.cur_assembly = null
icon_state = "port1"
success = 1
if(success)
src.visible_message("\icon[src] a blue light flashes on [src] as it draws a fuel rod assembly from an injector.")
else
src.visible_message("\red \icon[src] a red light flashes on [src] as it attempts to draw a fuel rod assembly from an injector.")
return success
/*
/obj/machinery/rust_fuel_assembly_port/verb/try_insert_assembly_verb()
set name = "Attempt to insert assembly from port into injector"
set category = "Object"
set src in oview(1)
if(!busy)
try_insert_assembly()
/obj/machinery/rust_fuel_assembly_port/verb/eject_assembly_verb()
set name = "Attempt to eject assembly from port"
set category = "Object"
set src in oview(1)
if(!busy)
eject_assembly()
/obj/machinery/rust_fuel_assembly_port/verb/try_draw_assembly_verb()
set name = "Draw assembly from injector"
set category = "Object"
set src in oview(1)
if(!busy)
try_draw_assembly()
*/
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,133 @@
//frame assembly
/obj/item/rust_fuel_assembly_port_frame
name = "Fuel Assembly Port frame"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "port2"
w_class = 4
flags = FPRINT | TABLEPASS| CONDUCT
/obj/item/rust_fuel_assembly_port_frame/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/wrench))
new /obj/item/stack/sheet/plasteel( get_turf(src.loc), 12 )
del(src)
return
..()
/obj/item/rust_fuel_assembly_port_frame/proc/try_build(turf/on_wall)
if (get_dist(on_wall,usr)>1)
return
var/ndir = get_dir(usr,on_wall)
if (!(ndir in cardinal))
return
var/turf/loc = get_turf(usr)
var/area/A = loc.loc
if (!istype(loc, /turf/simulated/floor))
usr << "\red Port cannot be placed on this spot."
return
if (A.requires_power == 0 || A.name == "Space")
usr << "\red Port cannot be placed in this area."
return
new /obj/machinery/rust_fuel_assembly_port(loc, ndir, 1)
del(src)
//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)
dir = ndir
else
has_electronics = 3
opened = 1
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/weapon/cable_coil) && opened && !(has_electronics & 2))
var/obj/item/weapon/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/weapon/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."
del(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/rust_fuel_assembly_port_frame(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.")
del(src)
return
..()
@@ -1,87 +1,113 @@
var/const/max_assembly_amount = 300
/obj/machinery/rust/fuel_compressor
icon = 'fuel_compressor.dmi'
icon_state = "fuel_compressor"
/obj/machinery/rust_fuel_compressor
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "fuel_compressor0"
name = "Fuel Compressor"
var/list/new_assembly_quantities
//
New()
new_assembly_quantities = new/list
spawn(0)
new_assembly_quantities["Deuterium"] = 200
new_assembly_quantities["Tritium"] = 100
//
new_assembly_quantities["Helium-3"] = 0
new_assembly_quantities["Lithium-6"] = 0
new_assembly_quantities["Silver"] = 0
var/compressed_matter = 0
anchored = 1
attack_ai(mob/user)
attack_hand(user)
var/opened = 1 //0=closed, 1=opened
var/locked = 0
var/has_electronics = 0 // 0 - none, bit 1 - circuitboard, bit 2 - wires
attack_hand(mob/user)
add_fingerprint(user)
/*if(stat & (BROKEN|NOPOWER))
return*/
interact(user)
/*power_change()
if(stat & BROKEN)
icon_state = "broken"
else
if( powered() )
icon_state = initial(icon_state)
stat &= ~NOPOWER
else
spawn(rand(0, 15))
src.icon_state = "c_unpowered"
stat |= NOPOWER*/
Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=fuelcomp")
usr.machine = null
return
/obj/machinery/rust_fuel_compressor/New()
new_assembly_quantities = new/list
spawn(0)
new_assembly_quantities["Deuterium"] = 200
new_assembly_quantities["Tritium"] = 100
//
for(var/reagent in new_assembly_quantities)
if(href_list[reagent])
var/new_amount = text2num(input("Enter new rod amount", "Fuel Assembly Rod Composition ([reagent])", new_assembly_quantities[reagent]) as text|null)
if(!new_amount)
usr << "\red That's not a valid number."
return
var/sum_reactants = new_amount - new_assembly_quantities[reagent]
for(var/rod in new_assembly_quantities)
sum_reactants += new_assembly_quantities[rod]
if(sum_reactants > max_assembly_amount)
usr << "\red You have entered too many rods."
else
new_assembly_quantities[reagent] = new_amount
updateDialog()
return
if( href_list["activate"] )
var/obj/item/weapon/fuel_assembly/F = new(src)
//world << "\blue New fuel rod assembly"
for(var/reagent in new_assembly_quantities)
F.rod_quantities[reagent] = new_assembly_quantities[reagent]
//world << "\blue [reagent]: new_assembly_quantities[reagent]<br>"
F.loc = src.loc
new_assembly_quantities["Helium-3"] = 0
new_assembly_quantities["Lithium-6"] = 0
new_assembly_quantities["Silver"] = 0
/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
del(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
interact(mob/user)
/*if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=fuelcomp")
return*/
var/t = "<B>Reactor Fuel Rod Compressor / Assembler</B><BR>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
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>"
t += "<A href='?src=\ref[src];activate=1'><b>Activate Fuel Synthesis</b></A><BR> (fuel assemblies require no more than [max_assembly_amount] rods).<br>"
t += "<hr>"
t += "- New fuel assembly constituents:- <br>"
for(var/reagent in new_assembly_quantities)
t += " [reagent] rods: [new_assembly_quantities[reagent]] \[<A href='?src=\ref[src];reagent=1'>Modify</A>\]<br>"
t += "<hr>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=fuelcomp;size=500x800")
user.machine = src
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"] )
while(compressed_matter > 10)
new /obj/item/weapon/rcd_ammo(src.loc)
compressed_matter -= 10
src.visible_message("\blue \icon[src] [src] ejects some compressed matter units.")
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 = F.rod_quantities[reagent] / 10
if(req_matter <= compressed_matter)
F.rod_quantities[reagent] = new_assembly_quantities[reagent]
compressed_matter -= req_matter
else
fail = 1
break
//world << "\blue [reagent]: new_assembly_quantities[reagent]<br>"
if(fail)
del(F)
compressed_matter = old_matter
src.visible_message("\red \icon[src] [src] flashes red: \'Out of matter.\'")
else
F.loc = src.loc
F.percent_depleted = 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()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

@@ -0,0 +1,160 @@
//frame assembly
/obj/item/rust_fuel_compressor_frame
name = "Fuel Compressor frame"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "fuel_compressor0"
w_class = 4
flags = FPRINT | TABLEPASS| CONDUCT
/obj/item/rust_fuel_compressor_frame/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/wrench))
new /obj/item/stack/sheet/plasteel( get_turf(src.loc), 12 )
del(src)
return
..()
/obj/item/rust_fuel_compressor_frame/proc/try_build(turf/on_wall)
if (get_dist(on_wall,usr)>1)
return
var/ndir = get_dir(usr,on_wall)
if (!(ndir in cardinal))
return
var/turf/loc = get_turf(usr)
var/area/A = loc.loc
if (!istype(loc, /turf/simulated/floor))
usr << "\red Compressor cannot be placed on this spot."
return
if (A.requires_power == 0 || A.name == "Space")
usr << "\red Compressor cannot be placed in this area."
return
new /obj/machinery/rust_fuel_assembly_port(loc, ndir, 1)
del(src)
//construction steps
/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)
dir = ndir
else
has_electronics = 3
opened = 1
locked = 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_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/weapon/card/emag) && !emagged) // trying to unlock with an emag card
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
else if (istype(W, /obj/item/weapon/cable_coil) && opened && !(has_electronics & 2))
var/obj/item/weapon/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/weapon/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."
del(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/rust_fuel_assembly_port_frame(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.")
del(src)
return
..()
@@ -1,172 +1,192 @@
/obj/machinery/computer/rust/fuel_control
/obj/machinery/computer/rust_fuel_control
name = "Fuel Injection Control"
icon_state = "power"
var/list/fuel_injectors
var/list/stage_status
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/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/obj/machinery/rust/fuel_injector/Injector = null
New()
..()
//these are the only three stages we can accept
//we have another console for SCRAM
fuel_injectors = new/list
stage_status = new/list
var/scan_range = 25
var/ticks_this_stage = 0
fuel_injectors.Add("One")
fuel_injectors["One"] = new/list
stage_status.Add("One")
stage_status["One"] = 0
fuel_injectors.Add("Two")
fuel_injectors["Two"] = new/list
stage_status.Add("Two")
stage_status["Two"] = 0
fuel_injectors.Add("Three")
fuel_injectors["Three"] = new/list
stage_status.Add("Three")
stage_status["Three"] = 0
fuel_injectors.Add("SCRAM")
fuel_injectors["SCRAM"] = new/list
stage_status.Add("SCRAM")
stage_status["SCRAM"] = 0
/*/obj/machinery/computer/rust_fuel_control/New()
..()
//these are the only three stages we can accept
//we have another console for SCRAM
fuel_injectors = new/list
stage_status = new/list
spawn(0)
for(var/obj/machinery/rust/fuel_injector/Injector in world)
if(Injector.stage in fuel_injectors)
var/list/targetlist = fuel_injectors[Injector.stage]
targetlist.Add(Injector)
fuel_injectors.Add("One")
fuel_injectors["One"] = new/list
stage_status.Add("One")
stage_status["One"] = 0
fuel_injectors.Add("Two")
fuel_injectors["Two"] = new/list
stage_status.Add("Two")
stage_status["Two"] = 0
fuel_injectors.Add("Three")
fuel_injectors["Three"] = new/list
stage_status.Add("Three")
stage_status["Three"] = 0
fuel_injectors.Add("SCRAM")
fuel_injectors["SCRAM"] = new/list
stage_status.Add("SCRAM")
stage_status["SCRAM"] = 0
attack_ai(mob/user)
attack_hand(user)
spawn(0)
for(var/obj/machinery/power/rust_fuel_injector/Injector in world)
if(Injector.stage in fuel_injectors)
var/list/targetlist = fuel_injectors[Injector.stage]
targetlist.Add(Injector)*/
attack_hand(mob/user)
add_fingerprint(user)
/*if(stat & (BROKEN|NOPOWER))
return*/
interact(user)
/obj/machinery/computer/rust_fuel_control/attack_ai(mob/user)
attack_hand(user)
/*updateDialog()
for(var/mob/M in range(1))
if(M.machine == src)
interact(m)*/
/obj/machinery/computer/rust_fuel_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=fuel_monitor")
usr.machine = null
return
if( href_list["beginstage"] )
var/stage_name = href_list["beginstage"]
if(stage_name in fuel_injectors)
var/success = 1
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
if(!Injector.BeginInjecting())
success = 0
if(!success) //may still partially complete
usr << "\red Unable to complete command."
stage_status[stage_name] = 1
updateDialog()
return
if( href_list["begincool"] )
var/stage_name = href_list["begincool"]
if(stage_name in fuel_injectors)
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
Injector.StopInjecting()
stage_status[stage_name] = 0
updateDialog()
return
if( href_list["restart"] )
updateDialog()
return
if( href_list["cooldown"] )
for(var/stage_name in fuel_injectors)
for(var/obj/machinery/rust/fuel_injector/Injector in fuel_injectors[stage_name])
Injector.StopInjecting()
stage_status[stage_name] = 0
updateDialog()
return
if( href_list["update"] )
updateDialog()
return
//
if( href_list["disable_fueldepletion"] )
announce_fueldepletion = 0
updateDialog()
return
if( href_list["announce_fueldepletion"] )
announce_fueldepletion = 1
updateDialog()
return
if( href_list["broadcast_fueldepletion"] )
announce_fueldepletion = 2
updateDialog()
return
//
if( href_list["disable_stageprogression"] )
announce_stageprogression = 0
updateDialog()
return
if( href_list["announce_stageprogression"] )
announce_stageprogression = 1
updateDialog()
return
if( href_list["broadcast_stageprogression"] )
announce_stageprogression = 2
updateDialog()
return
/obj/machinery/computer/rust_fuel_control/interact(mob/user)
if(stat & (BROKEN|NOPOWER))
user.unset_machine()
user << browse(null, "window=fuel_control")
return
process()
..()
src.updateDialog()
if (!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
user.unset_machine()
user << browse(null, "window=fuel_control")
return
interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=fuel_monitor")
return
var/t = "<B>Reactor Core Fuel Control</B><BR>"
var/cooling = 0
for(var/stage in stage_status)
if(stage_status[stage])
t += "Fuel injection: <font color=blue>Active</font><br>"
t += "<a href='?src=\ref[src];cooldown=1;'>Enter cooldown phase</a><br>"
cooling = 1
break
if(!cooling)
t += "Fuel injection: <font color=blue>Cooling</font><br>"
t += "----<br>"
//
t += "Fuel depletion announcement: "
t += "[announce_fueldepletion ? "<a href='?src=\ref[src];disable_fueldepletion=1'>Disable</a>" : "<b>Disabled</b>"] "
t += "[announce_fueldepletion == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_fueldepletion=1'>Announce</a>"] "
t += "[announce_fueldepletion == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_fueldepletion=1'>Broadcast</a>"]<br>"
t += "Stage progression announcement: "
t += "[announce_stageprogression ? "<a href='?src=\ref[src];disable_stageprogression=1'>Disable</a>" : "<b>Disabled</b>"] "
t += "[announce_stageprogression == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_stageprogression=1'>Announce</a>"] "
t += "[announce_stageprogression == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_stageprogression=1'>Broadcast</a>"] "
t += "<hr>"
t += "<table border=1><tr>"
t += "<td><b>Injector Status</b></td>"
t += "<td><b>Injection interval (sec)</b></td>"
t += "<td><b>Assembly consumption per injection</b></td>"
t += "<td><b>Fuel Assembly Port</b></td>"
t += "<td><b>Assembly depletion percentage</b></td>"
t += "</tr>"
for(var/stage_name in fuel_injectors)
var/list/cur_stage = fuel_injectors[stage_name]
t += "<tr><td colspan=5><b>Fuel Injection Stage:</b> [stage_name]</font>, [stage_status[stage_name] ? "<font color=green>Active</font> <a href='?src=\ref[src];begincool=[stage_name]'>\[Enter cooldown\]</a>" : "Cooling <a href='?src=\ref[src];beginstage=[stage_name]'>\[Begin injection\]</a>"]</td></tr>"
for(var/obj/machinery/rust/fuel_injector/Injector in cur_stage)
t += "<tr>"
t += "<td>[Injector.on && Injector.remote_enabled ? "<font color=green>Operational</font>" : "<font color=red>Unresponsive</font>"]</td>"
t += "<td>[Injector.rate/10] <a href='?src=\ref[Injector];cyclerate=1'>Modify</a></td>"
t += "<td>[Injector.fuel_usage*100]% <a href='?src=\ref[Injector];fuel_usage=1'>Modify</a></td>"
t += "<td>[Injector.owned_assembly_port ? "[Injector.owned_assembly_port.cur_assembly ? "<font color=green>Loaded</font>": "<font color=blue>Empty</font>"]" : "<font color=red>Disconnected</font>" ]</td>"
t += "<td>[Injector.owned_assembly_port && Injector.owned_assembly_port.cur_assembly ? "[Injector.owned_assembly_port.cur_assembly.percent_depleted]%" : ""]</td>"
t += "</tr>"
t += "</table>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=fuel_monitor;size=500x600")
user.machine = src
var/dat = "<B>Reactor Core Fuel Control</B><BR>"
/*dat += "<b>Fuel depletion announcement:</b> "
dat += "[announce_fueldepletion == 0 ? "Disabled" : "<a href='?src=\ref[src];announce_fueldepletion=0'>\[Disable\]</a>"] "
dat += "[announce_fueldepletion == 1 ? "Announcing" : "<a href='?src=\ref[src];announce_fueldepletion=1'>\[Announce\]</a>"] "
dat += "[announce_fueldepletion == 2 ? "Broadcasting" : "<a href='?src=\ref[src];announce_fueldepletion=2'>\[Broadcast\]</a>"]<br>"
dat += "<b>Stage progression announcement:</b> "
dat += "[announce_stageprogression == 0 ? "Disabled" : "<a href='?src=\ref[src];announce_stageprogression=0'>\[Disable\]</a>"] "
dat += "[announce_stageprogression == 1 ? "Announcing" : "<a href='?src=\ref[src];announce_stageprogression=1'>\[Announce\]</a>"] "
dat += "[announce_stageprogression == 2 ? "Broadcasting" : "<a href='?src=\ref[src];announce_stageprogression=2'>\[Broadcast\]</a>"]<br>"*/
dat += "<hr>"
dat += "<b>Detected devices</b> <a href='?src=\ref[src];scan=1'>\[Refresh list\]</a>"
dat += "<table border=1 width='100%'>"
dat += "<tr>"
dat += "<td><b>ID</b></td>"
dat += "<td><b>Assembly</b></td>"
dat += "<td><b>Consumption</b></td>"
dat += "<td><b>Depletion</b></td>"
dat += "<td><b>Duration</b></td>"
dat += "<td><b>Next stage</b></td>"
dat += "<td></td>"
dat += "<td></td>"
dat += "</tr>"
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
dat += "<tr>"
dat += "<td>[I.id_tag]</td>"
if(I.cur_assembly)
dat += "<td><a href='?src=\ref[I];toggle_injecting=1;update_extern=\ref[src]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
else
dat += "<td>None</td>"
dat += "<td>[I.fuel_usage * 100]%</td>"
if(I.cur_assembly)
dat += "<td>[I.cur_assembly.percent_depleted * 100]%</td>"
else
dat += "<td>NA</td>"
if(stage_times.Find(I.id_tag))
dat += "<td>[ticks_this_stage]/[stage_times[I.id_tag]]s <a href='?src=\ref[src];stage_time=[I.id_tag]'>Modify</td>"
else
dat += "<td>[ticks_this_stage]s <a href='?src=\ref[src];stage_time=[I.id_tag]'>Set</td>"
if(proceeding_stages.Find(I.id_tag))
dat += "<td><a href='?src=\ref[src];set_next_stage=[I.id_tag]'>[proceeding_stages[I.id_tag]]</a></td>"
else
dat += "<td>None <a href='?src=\ref[src];set_next_stage=[I.id_tag]'>\[modify\]</a></td>"
dat += "<td><a href='?src=\ref[src];toggle_stage=[I.id_tag]'>\[[active_stages.Find(I.id_tag) ? "Deactivate stage" : "Activate stage "] \]</a></td>"
dat += "</tr>"
dat += "</table>"
dat += "<hr>"
dat += "<A href='?src=\ref[src];refresh=1'>Refresh</A> "
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(dat, "window=fuel_control;size=800x400")
user.set_machine(src)
/obj/machinery/computer/rust_fuel_control/Topic(href, href_list)
..()
if( href_list["scan"] )
connected_injectors = list()
for(var/obj/machinery/power/rust_fuel_injector/I in range(scan_range, src))
if(check_injector_status(I))
connected_injectors.Add(I)
if( href_list["toggle_stage"] )
var/cur_stage = href_list["toggle_stage"]
if(active_stages.Find(cur_stage))
active_stages.Remove(cur_stage)
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
if(I.id_tag == cur_stage && check_injector_status(I))
I.StopInjecting()
else
active_stages.Add(cur_stage)
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
if(I.id_tag == cur_stage && check_injector_status(I))
I.BeginInjecting()
if( href_list["cooldown"] )
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
if(check_injector_status(I))
I.StopInjecting()
active_stages = list()
if( href_list["warmup"] )
for(var/obj/machinery/power/rust_fuel_injector/I in connected_injectors)
if(check_injector_status(I))
I.BeginInjecting()
if(!active_stages.Find(I.id_tag))
active_stages.Add(I.id_tag)
if( href_list["stage_time"] )
var/cur_stage = href_list["stage_time"]
var/new_duration = input("Enter new stage duration in seconds", "Stage duration") as num
if(new_duration)
stage_times[cur_stage] = new_duration
else if(stage_times.Find(cur_stage))
stage_times.Remove(cur_stage)
if( href_list["announce_fueldepletion"] )
announce_fueldepletion = text2num(href_list["announce_fueldepletion"])
if( href_list["announce_stageprogression"] )
announce_stageprogression = text2num(href_list["announce_stageprogression"])
if( href_list["close"] )
usr << browse(null, "window=fuel_control")
usr.unset_machine()
if( href_list["set_next_stage"] )
var/cur_stage = href_list["set_next_stage"]
if(!proceeding_stages.Find(cur_stage))
proceeding_stages.Add(cur_stage)
var/next_stage = input("Enter next stage ID", "Automated stage procession") as text|null
if(next_stage)
proceeding_stages[cur_stage] = next_stage
else
proceeding_stages.Remove(cur_stage)
updateDialog()
/obj/machinery/computer/rust_fuel_control/proc/check_injector_status(var/obj/machinery/power/rust_fuel_injector/I)
if(!I)
return 0
if(I.stat & (BROKEN|NOPOWER) || !I.remote_access_enabled || !I.id_tag)
if(connected_injectors.Find(I))
connected_injectors.Remove(I)
return 0
return 1
@@ -1,210 +1,289 @@
/obj/machinery/rust/fuel_injector
/obj/machinery/power/rust_fuel_injector
name = "Fuel Injector"
icon = 'fuel_injector.dmi'
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "injector0"
anchored = 1
density = 1
var/obj/machinery/rust/fuel_assembly_port/owned_assembly_port
//var/list/stageone_assemblyports
//var/list/stagetwo_assemblyports
//var/list/scram_assemblyports
var/obj/machinery/rust/reactor_vessel/Vessel = null
var/rate = 10 //microseconds between each cycle
var/fuel_usage = 0.0001 //percentage of available fuel to use per cycle
var/on = 1
var/remote_enabled = 1
var/state = 0
var/locked = 0
var/obj/item/weapon/fuel_assembly/cur_assembly
var/fuel_usage = 0.0001 //percentage of available fuel to use per cycle
var/id_tag = "One"
var/injecting = 0
var/stage = "One"
var/targetting_field = 0
layer = 4
var/trying_to_swap_fuel = 0
//
req_access = list(access_engine)
//
use_power = 1
idle_power_usage = 10
active_power_usage = 300
active_power_usage = 500
var/remote_access_enabled = 1
var/cached_power_avail = 0
var/emergency_insert_ready = 0
//fuel assembly should be embedded into the wall behind the injector
New()
..()
name = "Stage [stage] Fuel Injector"
//pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
//pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
/*
stageone_assemblyports = new/list()
stagetwo_assemblyports = new/list()
scram_assemblyports = new/list()
spawn(1)
Vessel = locate() in range(6,src)
for(var/obj/machinery/rust/fuel_assembly_port/S in range(6,src))
switch(S.stage)
if("One")
stageone_assemblyports.Add(S)
if("Two")
stagetwo_assemblyports.Add(S)
if("SCRAM")
scram_assemblyports.Add(S)
*/
spawn(1)
var/rev_dir = reverse_direction(dir)
var/turf/mid = get_step(src, rev_dir)
for(var/obj/machinery/rust/fuel_assembly_port/port in get_step(mid, rev_dir))
owned_assembly_port = port
//
Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=fuel_injector")
usr.machine = null
return
if( href_list["begin_injecting"] )
BeginInjecting()
updateDialog()
return
if( href_list["end_injecting"] )
/obj/machinery/power/rust_fuel_injector/process()
if(injecting)
if(stat & BROKEN || !powernet)
StopInjecting()
updateDialog()
return
if( href_list["cyclerate"] )
var/new_rate = text2num(input("Enter new injection rate (0.1 - 10 sec)", "Modifying injection rate", rate/10))
if(!new_rate)
usr << "\red That's not a valid number."
return
new_rate = min(new_rate,0.1)
new_rate = max(new_rate,10)
rate = new_rate * 10
updateDialog()
return
if( href_list["fuel_usage"] )
var/new_rate = text2num(input("Enter new fuel usage (1 - 100%)", "Modifying fuel usage", rate/10))
if(!new_rate)
usr << "\red That's not a valid number."
return
new_rate = min(new_rate,0.1)
new_rate = max(new_rate,10)
rate = new_rate * 10
updateDialog()
return
attack_ai(mob/user)
attack_hand(user)
attack_hand(mob/user)
add_fingerprint(user)
/*if(stat & (BROKEN|NOPOWER))
return*/
interact(user)
interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=fuel_injector")
return
var/t = "<B>Reactor Core Fuel Injector</B><hr>"
t += "<b>Stage:</b> <font color=blue>[stage]</font><br>"
t += "<b>Status:</b> [injecting ? "<font color=green>Active</font> <a href='?src=\ref[src];end_injecting=1'>\[Disable\]</a>" : "<font color=blue>Standby</font> <a href='?src=\ref[src];begin_injecting=1'>\[Enable\]</a>"]<br>"
t += "<b>Interval (sec):</b> <font color=blue>[rate/10]</font> <a href='?src=\ref[src];cyclerate=1'>\[Modify\]</a><br>"
t += "<b>Fuel usage:</b> [fuel_usage*100]% <a href='?src=\ref[src];fuel_usage=1'>\[Modify\]</a><br>"
/*
var/t = "<B>Reactor Core Fuel Control</B><BR>"
t += "Current fuel injection stage: [active_stage]<br>"
if(active_stage == "Cooling")
//t += "<a href='?src=\ref[src];restart=1;'>Restart injection cycle</a><br>"
t += "----<br>"
else
t += "<a href='?src=\ref[src];cooldown=1;'>Enter cooldown phase</a><br>"
t += "Fuel depletion announcement: "
t += "[announce_fueldepletion ? "<a href='?src=\ref[src];disable_fueldepletion=1'>Disable</a>" : "<b>Disabled</b>"] "
t += "[announce_fueldepletion == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_fueldepletion=1'>Announce</a>"] "
t += "[announce_fueldepletion == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_fueldepletion=1'>Broadcast</a>"]<br>"
t += "Stage progression announcement: "
t += "[announce_stageprogression ? "<a href='?src=\ref[src];disable_stageprogression=1'>Disable</a>" : "<b>Disabled</b>"] "
t += "[announce_stageprogression == 1 ? "<b>Announcing</b>" : "<a href='?src=\ref[src];announce_stageprogression=1'>Announce</a>"] "
t += "[announce_stageprogression == 2 ? "<b>Broadcasting</b>" : "<a href='?src=\ref[src];broadcast_stageprogression=1'>Broadcast</a>"] "
t += "<hr>"
t += "<table border=1><tr>"
t += "<td><b>Injector Status</b></td>"
t += "<td><b>Injection interval (sec)</b></td>"
t += "<td><b>Assembly consumption per injection</b></td>"
t += "<td><b>Fuel Assembly Port</b></td>"
t += "<td><b>Assembly depletion percentage</b></td>"
t += "</tr>"
for(var/stage in fuel_injectors)
var/list/cur_stage = fuel_injectors[stage]
t += "<tr><td colspan=5><b>Fuel Injection Stage:</b> <font color=blue>[stage]</font> [active_stage == stage ? "<font color=green> (Currently active)</font>" : "<a href='?src=\ref[src];beginstage=[stage]'>Activate</a>"]</td></tr>"
for(var/obj/machinery/rust/fuel_injector/Injector in cur_stage)
t += "<tr>"
t += "<td>[Injector.on && Injector.remote_enabled ? "<font color=green>Operational</font>" : "<font color=red>Unresponsive</font>"]</td>"
t += "<td>[Injector.rate/10] <a href='?src=\ref[Injector];cyclerate=1'>Modify</a></td>"
t += "<td>[Injector.fuel_usage*100]% <a href='?src=\ref[Injector];fuel_usage=1'>Modify</a></td>"
t += "<td>[Injector.owned_assembly_port ? "[Injector.owned_assembly_port.cur_assembly ? "<font color=green>Loaded</font>": "<font color=blue>Empty</font>"]" : "<font color=red>Disconnected</font>" ]</td>"
t += "<td>[Injector.owned_assembly_port && Injector.owned_assembly_port.cur_assembly ? "[100 - Injector.owned_assembly_port.cur_assembly.amount_depleted*100]%" : ""]</td>"
t += "</tr>"
t += "</table>"
*/
t += "<hr>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=fuel_injector;size=500x800")
user.machine = src
Inject()
proc/BeginInjecting()
if(!injecting && owned_assembly_port && owned_assembly_port.cur_assembly)
icon_state = "injector1"
injecting = 1
spawn(rate)
Inject()
return 1
return 0
cached_power_avail = avail()
proc/StopInjecting()
/obj/machinery/power/rust_fuel_injector/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench))
if(injecting)
injecting = 0
icon_state = "injector0"
return 1
return 0
proc/Inject()
if(!injecting)
user << "Turn off the [src] first."
return
if(owned_assembly_port.cur_assembly)
var/obj/machinery/rust/em_field/target_field
if(targetting_field)
for(var/obj/machinery/rust/em_field/field in range(15))
target_field = field
var/amount_left = 0
for(var/reagent in owned_assembly_port.cur_assembly.rod_quantities)
//world << "checking [reagent]"
if(owned_assembly_port.cur_assembly.rod_quantities[reagent] > 0)
//world << " rods left: [owned_assembly_port.cur_assembly.rod_quantities[reagent]]"
var/amount = owned_assembly_port.cur_assembly.rod_quantities[reagent] * fuel_usage
var/numparticles = round(amount * 1000)
if(numparticles < 1)
numparticles = 1
//world << " amount: [amount]"
//world << " numparticles: [numparticles]"
//
var/obj/effect/accelerated_particle/particle = new/obj/effect/accelerated_particle(src.loc, src.dir)
particle.particle_type = reagent
particle.energy = 0
particle.icon_state = "particle"
particle.additional_particles = numparticles - 1
particle.target = target_field
//
owned_assembly_port.cur_assembly.rod_quantities[reagent] -= amount
amount_left += owned_assembly_port.cur_assembly.rod_quantities[reagent]
owned_assembly_port.cur_assembly.percent_depleted = amount_left / 300
flick("injector-emitting",src)
use_power(fuel_usage * 10000 + 100) //0.0001
if(injecting)
spawn(rate)
Inject()
else
injecting = 0
switch(state)
if(0)
state = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear a ratchet")
src.anchored = 1
if(1)
state = 0
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear a ratchet")
src.anchored = 0
if(2)
user << "\red The [src.name] needs to be unwelded from the floor."
return
process()
..()
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(injecting)
user << "Turn off the [src] first."
return
switch(state)
if(0)
user << "\red The [src.name] needs to be wrenched to the floor."
if(1)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 2
user << "You weld the [src] to the floor."
connect_to_network()
src.directwired = 1
else
user << "\red You need more welding fuel to complete this task."
if(2)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if(!src || !WT.isOn()) return
state = 1
user << "You cut the [src] free from the floor."
disconnect_from_network()
src.directwired = 0
else
user << "\red You need more welding fuel to complete this task."
return
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
if(emagged)
user << "\red The lock seems to be broken"
return
if(src.allowed(user))
src.locked = !src.locked
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
user << "\red Access denied."
return
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
locked = 0
emagged = 1
user.visible_message("[user.name] emags the [src.name].","\red You short out the lock.")
return
if(istype(W, /obj/item/weapon/fuel_assembly) && !cur_assembly)
if(emergency_insert_ready)
cur_assembly = W
user.drop_item()
W.loc = src
emergency_insert_ready = 0
return
..()
return
/obj/machinery/power/rust_fuel_injector/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/power/rust_fuel_injector/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/power/rust_fuel_injector/interact(mob/user)
if(stat & BROKEN)
user.unset_machine()
user << browse(null, "window=fuel_injector")
return
if(get_dist(src, user) > 1 )
if (!istype(user, /mob/living/silicon))
user.unset_machine()
user << browse(null, "window=fuel_injector")
return
var/dat = ""
if (!powernet || locked || state != 2)
dat += "<i>The console is dark and nonresponsive.</i>"
else
dat += "<B>Reactor Core Fuel Injector</B><hr>"
dat += "<b>Device ID tag:</b> [id_tag] <a href='?src=\ref[src];modify_tag=1'>\[Modify\]</a><br>"
dat += "<b>Status:</b> [injecting ? "<font color=green>Active</font> <a href='?src=\ref[src];toggle_injecting=1'>\[Disable\]</a>" : "<font color=blue>Standby</font> <a href='?src=\ref[src];toggle_injecting=1'>\[Enable\]</a>"]<br>"
dat += "<b>Fuel usage:</b> [fuel_usage*100]% <a href='?src=\ref[src];fuel_usage=1'>\[Modify\]</a><br>"
dat += "<b>Fuel assembly port:</b> "
dat += "<a href='?src=\ref[src];fuel_assembly=1'>\[[cur_assembly ? "Eject assembly to port" : "Draw assembly from port"]\]</a> "
if(cur_assembly)
dat += "<a href='?src=\ref[src];emergency_fuel_assembly=1'>\[Emergency eject\]</a><br>"
else
dat += "<a href='?src=\ref[src];emergency_fuel_assembly=1'>\[[emergency_insert_ready ? "Cancel emergency insertion" : "Emergency insert"]\]</a><br>"
var/font_colour = "green"
if(cached_power_avail < active_power_usage)
font_colour = "red"
else if(cached_power_avail < active_power_usage * 2)
font_colour = "orange"
dat += "<b>Power status:</b> <font color=[font_colour]>[active_power_usage]/[cached_power_avail] W</font><br>"
dat += "<a href='?src=\ref[src];toggle_remote=1'>\[[remote_access_enabled ? "Disable remote access" : "Enable remote access"]\]</a><br>"
dat += "<hr>"
dat += "<A href='?src=\ref[src];refresh=1'>Refresh</A> "
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(dat, "window=fuel_injector;size=500x300")
onclose(user, "fuel_injector")
user.set_machine(src)
/obj/machinery/power/rust_fuel_injector/Topic(href, href_list)
..()
if( href_list["modify_tag"] )
id_tag = input("Enter new ID tag", "Modifying ID tag") as text|null
if( href_list["fuel_assembly"] )
if(!trying_to_swap_fuel)
trying_to_swap_fuel = 1
spawn(50)
attempt_fuel_swap()
trying_to_swap_fuel = 0
if( href_list["emergency_fuel_assembly"] )
if(cur_assembly)
cur_assembly.loc = src.loc
cur_assembly = null
//irradiate!
else
emergency_insert_ready = !emergency_insert_ready
if( href_list["toggle_injecting"] )
if(injecting)
StopInjecting()
else
BeginInjecting()
if( href_list["toggle_remote"] )
remote_access_enabled = !remote_access_enabled
if( href_list["fuel_usage"] )
var/new_usage = text2num(input("Enter new fuel usage (0.01% - 100%)", "Modifying fuel usage", fuel_usage * 100))
if(!new_usage)
usr << "\red That's not a valid number."
return
new_usage = max(new_usage, 0.01)
new_usage = min(new_usage, 100)
fuel_usage = new_usage / 100
active_power_usage = 500 + 1000 * fuel_usage
if( href_list["update_extern"] )
var/obj/machinery/computer/rust_fuel_control/C = locate(href_list["update_extern"])
if(C)
C.updateDialog()
if( href_list["close"] )
usr << browse(null, "window=fuel_injector")
usr.unset_machine()
updateDialog()
/obj/machinery/power/rust_fuel_injector/proc/BeginInjecting()
if(!injecting && cur_assembly)
icon_state = "injector1"
injecting = 1
use_power = 1
/obj/machinery/power/rust_fuel_injector/proc/StopInjecting()
if(injecting)
injecting = 0
icon_state = "injector0"
use_power = 0
/obj/machinery/power/rust_fuel_injector/proc/Inject()
if(!injecting)
return
if(cur_assembly)
var/amount_left = 0
for(var/reagent in cur_assembly.rod_quantities)
//world << "checking [reagent]"
if(cur_assembly.rod_quantities[reagent] > 0)
//world << " rods left: [cur_assembly.rod_quantities[reagent]]"
var/amount = cur_assembly.rod_quantities[reagent] * fuel_usage
var/numparticles = round(amount * 1000)
if(numparticles < 1)
numparticles = 1
//world << " amount: [amount]"
//world << " numparticles: [numparticles]"
//
var/obj/effect/accelerated_particle/A = new/obj/effect/accelerated_particle(get_turf(src), dir)
A.particle_type = reagent
A.additional_particles = numparticles - 1
//A.target = target_field
//
cur_assembly.rod_quantities[reagent] -= amount
amount_left += cur_assembly.rod_quantities[reagent]
cur_assembly.percent_depleted = amount_left / 300
flick("injector-emitting",src)
else
StopInjecting()
/obj/machinery/power/rust_fuel_injector/proc/attempt_fuel_swap()
var/rev_dir = reverse_direction(dir)
var/turf/mid = get_step(src, rev_dir)
var/success = 0
for(var/obj/machinery/rust_fuel_assembly_port/check_port in get_step(mid, rev_dir))
if(cur_assembly)
if(!check_port.cur_assembly)
check_port.cur_assembly = cur_assembly
cur_assembly.loc = check_port
cur_assembly = null
check_port.icon_state = "port1"
success = 1
else
if(check_port.cur_assembly)
cur_assembly = check_port.cur_assembly
cur_assembly.loc = src
check_port.cur_assembly = null
check_port.icon_state = "port0"
success = 1
break
if(success)
src.visible_message("\blue \icon[src] a green light flashes on [src].")
updateDialog()
//
else
src.visible_message("\red \icon[src] a red light flashes on [src].")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

@@ -3,7 +3,7 @@
/obj/item/projectile/beam/ehf_beam
/obj/machinery/rust/gyrotron
icon = 'gyrotron.dmi'
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "emitter-off"
name = "Gyrotron"
anchored = 1
@@ -41,7 +41,7 @@
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))
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
comp.updateDialog()
return
if( href_list["modifyrate"] )
@@ -52,7 +52,7 @@
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))
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
comp.updateDialog()
return
if( href_list["modifyfreq"] )
@@ -63,29 +63,29 @@
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))
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))
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))
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))
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))
for(var/obj/machinery/computer/rust_gyrotron_controller/comp in range(25))
comp.updateDialog()
return
/*
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

@@ -1,7 +1,8 @@
/obj/machinery/computer/rust/gyrotron_controller
/obj/machinery/computer/rust_gyrotron_controller
name = "Gyrotron Remote Controller"
icon_state = "power"
icon = 'code/WorkInProgress/Cael_Aislinn/Rust/rust.dmi'
icon_state = "engine"
var/updating = 1
New()
@@ -67,4 +67,8 @@
//particle.invisibility = 2
//
return particle
*/
*/
/obj/machinery/computer/rust_radiation_monitor
name = "Radiation Monitor"
icon_state = "power"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

@@ -1,49 +1,53 @@
//gimmicky hack to collect particles and direct them into the field
//byond multitiles are basically... shit
/obj/machinery/rust/particle_catcher
invisibility = 101
/obj/effect/rust_particle_catcher
icon = 'effects.dmi'
icon_state = "energynet"
density = 0
anchored = 1
var/obj/machinery/rust/em_field/parent
invisibility = 101
layer = 4
var/obj/effect/rust_em_field/parent
var/mysize = 0
/*New()
for(var/obj/machinery/rust/em_field/field in range(6))
parent = field
if(!parent)
del(src)*/
/*/obj/effect/rust_particle_catcher/New()
for(var/obj/machinery/rust/em_field/field in range(6))
parent = field
if(!parent)
del(src)*/
proc/SetSize(var/newsize)
name = "collector [newsize]"
mysize = newsize
UpdateSize()
/obj/effect/rust_particle_catcher/process()
if(!parent)
del(src)
proc/AddParticles(var/name, var/quantity = 1)
if(parent && parent.size >= mysize)
parent.AddParticles(name, quantity)
return 1
return 0
/obj/effect/rust_particle_catcher/proc/SetSize(var/newsize)
name = "collector [newsize]"
mysize = newsize
UpdateSize()
proc/UpdateSize()
if(parent.size >= mysize)
density = 1
//invisibility = 101
name = "collector [mysize] ON"
else
density = 0
name = "collector [mysize] OFF"
//invisibility = 101
/obj/effect/rust_particle_catcher/proc/AddParticles(var/name, var/quantity = 1)
if(parent && parent.size >= mysize)
parent.AddParticles(name, quantity)
return 1
return 0
bullet_act(var/obj/item/projectile/Proj)
if(Proj.flag != "bullet" && parent)
var/obj/item/projectile/beam/laserbeam = Proj
parent.AddEnergy(0, laserbeam.damage / 5000, laserbeam.frequency)
return 0
/obj/effect/rust_particle_catcher/proc/UpdateSize()
if(parent.size >= mysize)
density = 1
invisibility = 0
name = "collector [mysize] ON"
else
density = 0
invisibility = 101
name = "collector [mysize] OFF"
process()
..()
if(!parent)
del(src)
/obj/effect/rust_particle_catcher/bullet_act(var/obj/item/projectile/Proj)
if(Proj.flag != "bullet" && parent)
parent.AddEnergy(Proj.damage, 0, 1)
update_icon()
return 0
/obj/effect/rust_particle_catcher/Bumped(atom/AM)
if(ismob(AM) && density && prob(10))
AM << "\red A powerful force pushes you back."
..()
@@ -0,0 +1,52 @@
////////////////////////////////////////
// Shield Generator
/obj/item/weapon/circuitboard/shield_gen
name = "Circuit board (Experimental shield generator)"
board_type = "machine"
build_path = "/obj/machinery/shield_gen/external"
origin_tech = "bluespace=4;plasmatech=3"
frame_desc = "Requires 2 Pico Manipulators, 1 Subspace Transmitter, 5 Pieces of cable, 1 Subspace Crystal, 1 Subspace Amplifier and 1 Console Screen."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator/pico" = 2,
"/obj/item/weapon/stock_parts/subspace/transmitter" = 1,
"/obj/item/weapon/stock_parts/subspace/crystal" = 1,
"/obj/item/weapon/stock_parts/subspace/amplifier" = 1,
"/obj/item/weapon/stock_parts/console_screen" = 1,
"/obj/item/weapon/cable_coil" = 5)
datum/design/shield_gen
name = "Circuit Design (Experimental hull shield generator)"
desc = "Allows for the construction of circuit boards used to build an experimental hull shield generator."
id = "shield_gen"
req_tech = list("bluespace" = 4, "plasmatech" = 3)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20, "$plasma" = 10000, "$diamond" = 5000, "$gold" = 10000)
build_path = "/obj/machinery/shield_gen/external"
////////////////////////////////////////
// Shield Capacitor
/obj/item/weapon/circuitboard/shield_cap
name = "Circuit board (Experimental shield capacitor)"
board_type = "machine"
build_path = "/obj/machinery/shield_capacitor"
origin_tech = "magnets=3;powerstorage=4"
frame_desc = "Requires 2 Pico Manipulators, 1 Subspace Filter, 5 Pieces of cable, 1 Subspace Treatment disk, 1 Subspace Analyzer and 1 Console Screen."
req_components = list(
"/obj/item/weapon/stock_parts/manipulator/pico" = 2,
"/obj/item/weapon/stock_parts/subspace/filter" = 1,
"/obj/item/weapon/stock_parts/subspace/treatment" = 1,
"/obj/item/weapon/stock_parts/subspace/analyzer" = 1,
"/obj/item/weapon/stock_parts/console_screen" = 1,
"/obj/item/weapon/cable_coil" = 5)
datum/design/shield_cap
name = "Circuit Design (Experimental shield capacitor)"
desc = "Allows for the construction of circuit boards used to build an experimental shielding capacitor."
id = "shield_cap"
req_tech = list("magnets" = 3, "powerstorage" = 4)
build_type = IMPRINTER
materials = list("$glass" = 2000, "sacid" = 20, "$plasma" = 10000, "$diamond" = 5000, "$silver" = 10000)
build_path = "/obj/machinery/shield_gen/external"
@@ -8,7 +8,7 @@
icon_state = "shieldsparkles"
anchored = 1
layer = 2.1
density = 1
density = 0
invisibility = 2
var/strength = 0
var/obj/machinery/shield_gen/parent
@@ -31,7 +31,7 @@
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
if(strength < 1)
invisibility = 101
invisibility = 2
density = 0
/obj/effect/energy_field/proc/Strengthen(var/severity)
@@ -41,7 +41,7 @@
if(strength > 1)
invisibility = 0
density = 1
/*
/obj/effect/energy_field/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
//Purpose: Determines if the object (or airflow) can pass this atom.
//Called by: Movement, airflow.
@@ -49,5 +49,4 @@
//Outputs: Boolean if can pass.
//return (!density || !height || air_group)
return !density
*/
return density
@@ -1,36 +1,36 @@
//---------- external shield generator
//generates an energy field that loops around any built up area in space (is useless inside) halts movement and airflow, is blocked by walls, windows, airlocks etc
/obj/machinery/shield_gen/external/New()
..()
/obj/machinery/shield_gen/external/get_shielded_turfs()
var
list
open = list(get_turf(src))
closed = list()
while(open.len)
for(var/turf/T in open)
for(var/turf/O in orange(1, T))
if(get_dist(O,src) > field_radius)
continue
var/add_this_turf = 0
if(istype(O,/turf/space))
for(var/turf/simulated/G in orange(1, O))
add_this_turf = 1
break
for(var/obj/structure/S in orange(1, O))
add_this_turf = 1
break
for(var/obj/structure/S in O)
add_this_turf = 0
break
if(add_this_turf && !(O in open) && !(O in closed))
open += O
open -= T
closed += T
return closed
//---------- external shield generator
//generates an energy field that loops around any built up area in space (is useless inside) halts movement and airflow, is blocked by walls, windows, airlocks etc
/obj/machinery/shield_gen/external/New()
..()
/obj/machinery/shield_gen/external/get_shielded_turfs()
var
list
open = list(get_turf(src))
closed = list()
while(open.len)
for(var/turf/T in open)
for(var/turf/O in orange(1, T))
if(get_dist(O,src) > field_radius)
continue
var/add_this_turf = 0
if(istype(O,/turf/space))
for(var/turf/simulated/G in orange(1, O))
add_this_turf = 1
break
for(var/obj/structure/S in orange(1, O))
add_this_turf = 1
break
for(var/obj/structure/S in O)
add_this_turf = 0
break
if(add_this_turf && !(O in open) && !(O in closed))
open += O
open -= T
closed += T
return closed
@@ -1,158 +1,159 @@
//---------- shield capacitor
//pulls energy out of a power net and charges an adjacent generator
/obj/machinery/shield_capacitor
name = "shield capacitor"
desc = "Machine that charges a shield generator."
icon = 'shielding.dmi'
icon_state = "capacitor"
var/active = 1
density = 1
anchored = 1
var/obj/machinery/shield_gen/target_generator
var/stored_charge = 0
var/time_since_fail = 100
var/max_charge = 1000000
var/max_charge_rate = 100000
var/min_charge_rate = 0
var/locked = 0
//
use_power = 1 //0 use nothing
//1 use idle power
//2 use active power
idle_power_usage = 10
active_power_usage = 100
var/charge_rate = 100
/obj/machinery/shield_capacitor/New()
spawn(10)
for(var/obj/machinery/shield_gen/possible_gen in range(1, src))
if(get_dir(src, possible_gen) == src.dir)
target_generator = possible_gen
possible_gen.owned_capacitor = src
break
..()
/obj/machinery/shield_capacitor/verb/rotate()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
usr << "It is fastened to the floor!"
return 0
src.dir = turn(src.dir, 270)
target_generator = locate() in get_step(src,dir)
if(target_generator && !target_generator.owned_capacitor)
target_generator.owned_capacitor = src
return 1
/obj/machinery/shield_capacitor/power_change()
if(stat & BROKEN)
icon_state = "broke"
else
if( powered() )
if (src.active)
icon_state = "capacitor"
else
icon_state = "capacitor"
stat &= ~NOPOWER
else
spawn(rand(0, 15))
src.icon_state = "capacitor"
stat |= NOPOWER
/obj/machinery/shield_capacitor/process()
//
if(active)
use_power = 2
if(stored_charge + charge_rate > max_charge)
active_power_usage = max_charge - stored_charge
else
active_power_usage = charge_rate
stored_charge += active_power_usage
else
use_power = 1
time_since_fail++
if(stored_charge < active_power_usage * 1.5)
time_since_fail = 0
//
updateDialog()
/obj/machinery/shield_capacitor/attackby(obj/item/W, mob/user)
/*if(istype(W, /obj/item/weapon/wrench))
if(active)
user << "Turn off the field generator first."
return
else if(state == 0)
state = 1
playsound(src.loc, 'Ratchet.ogg', 75, 1)
user << "You secure the external reinforcing bolts to the floor."
src.anchored = 1
return
else if(state == 1)
state = 0
playsound(src.loc, 'Ratchet.ogg', 75, 1)
user << "You undo the external reinforcing bolts."
src.anchored = 0
return*/
if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (src.allowed(user))
src.locked = !src.locked
user << "Controls are now [src.locked ? "locked." : "unlocked."]"
else
user << "\red Access denied."
else if(istype(W, /obj/item/weapon/wrench))
src.anchored = !src.anchored
src.visible_message("\blue \icon[src] [src] has been [anchored ? "bolted to the floor" : "unbolted from the floor"] by [user].")
else
src.add_fingerprint(user)
user << "\red You hit the [src.name] with your [W.name]!"
for(var/mob/M in viewers(src))
if(M == user) continue
M.show_message("\red The [src.name] has been hit with the [W.name] by [user.name]!")
/obj/machinery/shield_capacitor/Topic(href, href_list[])
..()
if( href_list["close"] )
usr << browse(null, "window=shield_capacitor")
usr.machine = null
return
if( href_list["toggle"] )
active = !active
if(active)
use_power = 2
else
use_power = 1
if( href_list["charge_rate"] )
charge_rate += text2num(href_list["charge_rate"])
if(charge_rate > max_charge_rate)
charge_rate = max_charge_rate
else if(charge_rate < min_charge_rate)
charge_rate = min_charge_rate
//
updateDialog()
/obj/machinery/shield_capacitor/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=shield_capacitor")
return
var/t = "<B>Shield Capacitor Control Console</B><BR>"
t += "[target_generator ? "<font color=green>Shield generator connected.</font>" : "<font color=red>Unable to locate shield generator!</font>"]<br>"
t += "This capacitor is: [active ? "<font color=green>Online</font>" : "<font color=red>Offline</font>" ] <a href='?src=\ref[src];toggle=1'>[active ? "\[Deactivate\]" : "\[Activate\]"]</a><br>"
t += "[time_since_fail > 2 ? "<font color=green>Charging stable.</font>" : "<font color=red>Warning, low charge!</font>"]<br>"
t += "Capacitor charge: [stored_charge] Watts ([100 * stored_charge/max_charge]%)<br>"
t += "Capacitor charge rate (approx): <a href='?src=\ref[src];charge_rate=[-max_charge_rate]'>\[min\]</a> <a href='?src=\ref[src];charge_rate=-1000'>\[--\]</a> <a href='?src=\ref[src];charge_rate=-100'>\[-\]</a>[charge_rate] Watts/sec <a href='?src=\ref[src];charge_rate=100'>\[+\]</a> <a href='?src=\ref[src];charge_rate=1000'>\[++\]</a> <a href='?src=\ref[src];charge_rate=[max_charge_rate]'>\[max\]</a><br>"
t += "<hr>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=shield_capacitor;size=500x800")
user.machine = src
//---------- shield capacitor
//pulls energy out of a power net and charges an adjacent generator
/obj/machinery/shield_capacitor
name = "shield capacitor"
desc = "Machine that charges a shield generator."
icon = 'shielding.dmi'
icon_state = "capacitor"
var/active = 1
density = 1
anchored = 1
var/obj/machinery/shield_gen/target_generator
var/stored_charge = 0
var/time_since_fail = 100
var/max_charge = 1000000
var/max_charge_rate = 100000
var/min_charge_rate = 0
var/locked = 0
//
use_power = 1 //0 use nothing
//1 use idle power
//2 use active power
idle_power_usage = 10
active_power_usage = 100
var/charge_rate = 100
/obj/machinery/shield_capacitor/New()
spawn(10)
for(var/obj/machinery/shield_gen/possible_gen in range(1, src))
if(get_dir(src, possible_gen) == src.dir)
target_generator = possible_gen
possible_gen.owned_capacitor = src
break
..()
/obj/machinery/shield_capacitor/verb/rotate()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
usr << "It is fastened to the floor!"
return 0
src.dir = turn(src.dir, 270)
target_generator = locate() in get_step(src,dir)
if(target_generator && !target_generator.owned_capacitor)
target_generator.owned_capacitor = src
return 1
/obj/machinery/shield_capacitor/power_change()
if(stat & BROKEN)
icon_state = "broke"
else
if( powered() )
if (src.active)
icon_state = "capacitor"
else
icon_state = "capacitor"
stat &= ~NOPOWER
else
spawn(rand(0, 15))
src.icon_state = "capacitor"
stat |= NOPOWER
/obj/machinery/shield_capacitor/process()
//
if(active)
use_power = 2
if(stored_charge + charge_rate > max_charge)
active_power_usage = max_charge - stored_charge
else
active_power_usage = charge_rate
stored_charge += active_power_usage
else
use_power = 1
time_since_fail++
if(stored_charge < active_power_usage * 1.5)
time_since_fail = 0
//
updateDialog()
/obj/machinery/shield_capacitor/attackby(obj/item/W, mob/user)
/*if(istype(W, /obj/item/weapon/wrench))
if(active)
user << "Turn off the field generator first."
return
else if(state == 0)
state = 1
playsound(src.loc, 'Ratchet.ogg', 75, 1)
user << "You secure the external reinforcing bolts to the floor."
src.anchored = 1
return
else if(state == 1)
state = 0
playsound(src.loc, 'Ratchet.ogg', 75, 1)
user << "You undo the external reinforcing bolts."
src.anchored = 0
return*/
if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (src.allowed(user))
src.locked = !src.locked
user << "Controls are now [src.locked ? "locked." : "unlocked."]"
else
user << "\red Access denied."
else if(istype(W, /obj/item/weapon/wrench))
src.anchored = !src.anchored
src.visible_message("\blue \icon[src] [src] has been [anchored ? "bolted to the floor" : "unbolted from the floor"] by [user].")
else
src.add_fingerprint(user)
user << "\red You hit the [src.name] with your [W.name]!"
for(var/mob/M in viewers(src))
if(M == user) continue
M.show_message("\red The [src.name] has been hit with the [W.name] by [user.name]!")
/obj/machinery/shield_capacitor/Topic(href, href_list[])
..()
if( href_list["close"] )
usr << browse(null, "window=shield_capacitor")
usr.machine = null
return
if( href_list["toggle"] )
active = !active
if(active)
use_power = 2
else
use_power = 1
if( href_list["charge_rate"] )
charge_rate += text2num(href_list["charge_rate"])
if(charge_rate > max_charge_rate)
charge_rate = max_charge_rate
else if(charge_rate < min_charge_rate)
charge_rate = min_charge_rate
//
updateDialog()
/obj/machinery/shield_capacitor/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=shield_capacitor")
return
var/t = "<B>Shield Capacitor Control Console</B><BR>"
t += "[target_generator ? "<font color=green>Shield generator connected.</font>" : "<font color=red>Unable to locate shield generator!</font>"]<br>"
t += "This capacitor is: [active ? "<font color=green>Online</font>" : "<font color=red>Offline</font>" ] <a href='?src=\ref[src];toggle=1'>[active ? "\[Deactivate\]" : "\[Activate\]"]</a><br>"
t += "[time_since_fail > 2 ? "<font color=green>Charging stable.</font>" : "<font color=red>Warning, low charge!</font>"]<br>"
t += "Capacitor charge: [stored_charge] Watts ([100 * stored_charge/max_charge]%)<br>"
t += "Capacitor charge rate (approx): <a href='?src=\ref[src];charge_rate=[-max_charge_rate]'>\[min\]</a> <a href='?src=\ref[src];charge_rate=-1000'>\[--\]</a> <a href='?src=\ref[src];charge_rate=-100'>\[-\]</a>[charge_rate] Watts/sec <a href='?src=\ref[src];charge_rate=100'>\[+\]</a> <a href='?src=\ref[src];charge_rate=1000'>\[++\]</a> <a href='?src=\ref[src];charge_rate=[max_charge_rate]'>\[max\]</a><br>"
t += "<hr>"
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
user << browse(t, "window=shield_capacitor;size=500x800")
user.machine = src

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

+8 -26
View File
@@ -24,13 +24,18 @@
side_effects += M
/mob/living/carbon/human/proc/handle_medical_side_effects()
if(src.reagents.has_reagent("bicaridine") || src.reagents.has_reagent("tricordrazine") || src.reagents.has_reagent("cryoxadone"))
if(src.reagents.has_reagent("cryoxadone") || src.reagents.get_reagent_amount("bicaridine") >= 15 || src.reagents.get_reagent_amount("tricordrazine") >= 15)
src.add_side_effect("Headache")
if(src.reagents.has_reagent("kelotane") || src.reagents.has_reagent("dermaline"))
if(src.reagents.get_reagent_amount("kelotane") >= 30 || src.reagents.get_reagent_amount("dermaline") >= 15)
src.add_side_effect("Bad Stomach")
if(src.reagents.get_reagent_amount("tramadol") >= 16 || src.reagents.get_reagent_amount("anti_toxin") >= 30)
src.add_side_effect("Cramps")
if(src.reagents.get_reagent_amount("space_drugs") >= 10)
src.add_side_effect("Itch")
// One full cycle(in terms of strength) every 10 minutes
var/strength_percent = sin(life_tick / 2)
@@ -46,29 +51,6 @@
// Effect slowly growing stronger
M.strength+=0.08
// HEADACHE
// ========
/datum/medical_effect/headache/name = "Headache"
/datum/medical_effect/headache/on_life(mob/living/carbon/human/H, strength)
switch(strength)
if(1 to 10)
H.custom_pain("You feel a light pain in your head.",0)
if(11 to 30)
H.custom_pain("You feel a throbbing pain in your head!",1)
if(31 to 99)
H.custom_pain("You feel an excrutiating pain in your head!",1)
H.adjustBrainLoss(1)
if(99 to INFINITY)
H.custom_pain("It feels like your head is about to split open!",1)
H.adjustBrainLoss(3)
var/datum/organ/external/O = H.organs_by_name["head"]
O.take_damage(0, 1, 0, "Headache")
/datum/medical_effect/headache/cure(mob/living/carbon/human/H)
if(H.reagents.has_reagent("alkysine"))
return 1
return 0
// HEADACHE
// ========
/datum/medical_effect/headache/name = "Headache"
+3 -3
View File
@@ -114,11 +114,11 @@ log transactions
switch(view_screen)
if(CHANGE_SECURITY_LEVEL)
dat += "Select a new security level for this account:<br><hr>"
var/text = "Zero - Only account number or card is required to access this account. EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct."
var/text = "Zero - Either the account number or card is required to access this account. EFTPOS transactions will require a card and ask for a pin, but not verify the pin is correct."
if(authenticated_account.security_level != 0)
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=0'>[text]</a>"
dat += "[text]<hr>"
text = "One - Both an account number and pin is required to access this account and process transactions."
text = "One - An account number and pin must be manually entered to access this account and process transactions."
if(authenticated_account.security_level != 1)
text = "<A href='?src=\ref[src];choice=change_security_level;new_security_level=1'>[text]</a>"
dat += "[text]<hr>"
@@ -185,7 +185,7 @@ log transactions
dat += "<span class='warning'>Unable to connect to accounts database, please retry and if the issue persists contact NanoTrasen IT support.</span>"
reconnect_database()
user << browse(dat,"window=atm;size=500x650")
user << browse(dat,"window=atm;size=550x650")
else
user << browse(null,"window=atm")