mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-27 18:41:59 +00:00
moved shield files to folder, made circuitry for shielding gens/caps researchable, various tweaks and balances to the research requirements, made shield gens/capacitors orderable via cargo
Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -5,15 +5,15 @@
|
||||
/obj/item/weapon/circuitboard/rust_core_control
|
||||
name = "Circuit board (RUST core controller)"
|
||||
build_path = "/obj/machinery/computer/rust_core_control"
|
||||
origin_tech = "programming=4;engineering=5;power=6"
|
||||
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" = 4, "engineering" = 5, "power" = 6)
|
||||
req_tech = list("programming" = 3, "engineering" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 2000, "sacid" = 20, "$gold" = 2000)
|
||||
materials = list("$glass" = 2000, "sacid" = 20)
|
||||
build_path = "/obj/item/weapon/circuitboard/rust_core_control"
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -22,30 +22,30 @@ datum/design/rust_core_control
|
||||
/obj/item/weapon/circuitboard/rust_fuel_control
|
||||
name = "Circuit board (RUST fuel controller)"
|
||||
build_path = "/obj/machinery/computer/rust_fuel_control"
|
||||
origin_tech = "programming=4;engineering=5;power=6"
|
||||
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" = 4, "engineering" = 5, "power" = 6)
|
||||
req_tech = list("programming" = 3, "engineering" = 4)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 2000, "sacid" = 20, "$silver" = 2000)
|
||||
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 = "Circuit board (RUST fuel port)"
|
||||
name = "Internal circuitry (RUST fuel port)"
|
||||
icon_state = "card_mod"
|
||||
origin_tech = "engineering=3;power=4"
|
||||
origin_tech = "engineering=4;materials=5"
|
||||
|
||||
datum/design/rust_fuel_port
|
||||
name = "Circuit 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("programming" = 4, "engineering" = 5, "magnets" = 6)
|
||||
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"
|
||||
@@ -54,15 +54,15 @@ datum/design/rust_fuel_port
|
||||
// RUST Fuel Compressor board
|
||||
|
||||
/obj/item/weapon/module/rust_fuel_compressor
|
||||
name = "Circuit board (RUST fuel compressor)"
|
||||
name = "Internal circuitry (RUST fuel compressor)"
|
||||
icon_state = "card_mod"
|
||||
origin_tech = "power=4;engineering=5;plasmatech=6"
|
||||
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("power" = 4, "engineering" = 5, "plasmatech" = 6)
|
||||
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"
|
||||
@@ -71,10 +71,10 @@ datum/design/rust_fuel_compressor
|
||||
// RUST Tokamak Core board
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_core
|
||||
name = "Circuit Design (RUST tokamak core)"
|
||||
name = "Internal circuitry (RUST tokamak core)"
|
||||
build_path = "/obj/machinery/power/rust_core"
|
||||
board_type = "machine"
|
||||
origin_tech = "bluespace=3;engineering=4;plasmatech=5;magnets=6;power=7"
|
||||
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,
|
||||
@@ -84,10 +84,10 @@ datum/design/rust_fuel_compressor
|
||||
"/obj/item/weapon/cable_coil" = 5)
|
||||
|
||||
datum/design/rust_core
|
||||
name = "Circuit board (RUST tokamak 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, engineering = 4, plasmatech = 5, magnets = 6, power = 7)
|
||||
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)
|
||||
@@ -97,10 +97,10 @@ datum/design/rust_core
|
||||
// RUST Fuel Injector board
|
||||
|
||||
/obj/item/weapon/circuitboard/rust_injector
|
||||
name = "Circuit Design (RUST fuel injector)"
|
||||
name = "Internal circuitry (RUST fuel injector)"
|
||||
build_path = "/obj/machinery/power/rust_fuel_injector"
|
||||
board_type = "machine"
|
||||
origin_tech = "power=3;engineering=4;plasmatech=5;magnets=6;materials=7"
|
||||
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,
|
||||
@@ -110,10 +110,10 @@ datum/design/rust_core
|
||||
"/obj/item/weapon/cable_coil" = 5)
|
||||
|
||||
datum/design/rust_injector
|
||||
name = "Circuit board (RUST tokamak core)"
|
||||
name = "Internal circuitry (RUST tokamak core)"
|
||||
desc = "The circuit board that for a RUST-pattern particle accelerator."
|
||||
id = "pacman"
|
||||
req_tech = list(power = 3, engineering = 4, plasmatech = 5, magnets = 6, materials = 7)
|
||||
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)
|
||||
|
||||
@@ -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"
|
||||
@@ -1,52 +1,52 @@
|
||||
|
||||
//---------- actual energy field
|
||||
|
||||
/obj/effect/energy_field
|
||||
name = "energy field"
|
||||
desc = "Impenetrable field of energy, capable of blocking anything as long as it's active."
|
||||
icon = 'shielding.dmi'
|
||||
icon_state = "shieldsparkles"
|
||||
anchored = 1
|
||||
layer = 2.1
|
||||
density = 0
|
||||
invisibility = 2
|
||||
var/strength = 0
|
||||
var/obj/machinery/shield_gen/parent
|
||||
var/stress = 0
|
||||
|
||||
/obj/effect/energy_field/ex_act(var/severity)
|
||||
Stress(0.5 + severity)
|
||||
|
||||
/obj/effect/energy_field/bullet_act(var/obj/item/projectile/Proj)
|
||||
Stress(1 + 1 * (Proj.damage / 100))
|
||||
|
||||
|
||||
/obj/effect/energy_field/meteorhit(obj/effect/meteor/M as obj)
|
||||
if(M)
|
||||
walk(M,0)
|
||||
|
||||
/obj/effect/energy_field/proc/Stress(var/severity)
|
||||
strength -= severity
|
||||
stress += severity
|
||||
|
||||
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
|
||||
if(strength < 1)
|
||||
invisibility = 2
|
||||
density = 0
|
||||
|
||||
/obj/effect/energy_field/proc/Strengthen(var/severity)
|
||||
strength += severity
|
||||
|
||||
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
|
||||
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.
|
||||
//Inputs: The moving atom (optional), target turf, "height" and air group
|
||||
//Outputs: Boolean if can pass.
|
||||
|
||||
//return (!density || !height || air_group)
|
||||
return density
|
||||
|
||||
//---------- actual energy field
|
||||
|
||||
/obj/effect/energy_field
|
||||
name = "energy field"
|
||||
desc = "Impenetrable field of energy, capable of blocking anything as long as it's active."
|
||||
icon = 'shielding.dmi'
|
||||
icon_state = "shieldsparkles"
|
||||
anchored = 1
|
||||
layer = 2.1
|
||||
density = 0
|
||||
invisibility = 2
|
||||
var/strength = 0
|
||||
var/obj/machinery/shield_gen/parent
|
||||
var/stress = 0
|
||||
|
||||
/obj/effect/energy_field/ex_act(var/severity)
|
||||
Stress(0.5 + severity)
|
||||
|
||||
/obj/effect/energy_field/bullet_act(var/obj/item/projectile/Proj)
|
||||
Stress(1 + 1 * (Proj.damage / 100))
|
||||
|
||||
|
||||
/obj/effect/energy_field/meteorhit(obj/effect/meteor/M as obj)
|
||||
if(M)
|
||||
walk(M,0)
|
||||
|
||||
/obj/effect/energy_field/proc/Stress(var/severity)
|
||||
strength -= severity
|
||||
stress += severity
|
||||
|
||||
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
|
||||
if(strength < 1)
|
||||
invisibility = 2
|
||||
density = 0
|
||||
|
||||
/obj/effect/energy_field/proc/Strengthen(var/severity)
|
||||
strength += severity
|
||||
|
||||
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
|
||||
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.
|
||||
//Inputs: The moving atom (optional), target turf, "height" and air group
|
||||
//Outputs: Boolean if can pass.
|
||||
|
||||
//return (!density || !height || air_group)
|
||||
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 |
Reference in New Issue
Block a user