merge from master
This commit is contained in:
@@ -833,7 +833,7 @@
|
||||
|
||||
// attack with hand - remove cell (if cover open) or interact with the APC
|
||||
|
||||
/obj/machinery/power/apc/attack_hand(mob/user)
|
||||
/obj/machinery/power/apc/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
@@ -849,17 +849,12 @@
|
||||
if((stat & MAINT) && !opened) //no board; no interface
|
||||
return
|
||||
|
||||
/obj/machinery/power/apc/oui_canview(mob/user)
|
||||
if(area.hasSiliconAccessInArea(user)) //some APCs are mapped outside their assigned area, so this is required.
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "apc", name, 450, 460, master_ui, state)
|
||||
ui = new(user, src, ui_key, "Apc", name, 480, 460, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/apc/ui_data(mob/user)
|
||||
@@ -868,7 +863,7 @@
|
||||
if (H && !H.stealthmode && H.toggled)
|
||||
abilitiesavail = TRUE
|
||||
var/list/data = list(
|
||||
"locked" = locked && !(integration_cog && is_servant_of_ratvar(user)) && !area.hasSiliconAccessInArea(user, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE),
|
||||
"locked" = locked,
|
||||
"lock_nightshift" = nightshift_requires_auth,
|
||||
"failTime" = failure_timer,
|
||||
"isOperating" = operating,
|
||||
@@ -986,7 +981,7 @@
|
||||
failure_timer = 0
|
||||
update_icon()
|
||||
update()
|
||||
if (action == "hijack" && can_use(usr, 1)) //don't need auth for hijack button
|
||||
if(action == "hijack" && can_use(usr, 1)) //don't need auth for hijack button
|
||||
hijack(usr)
|
||||
return
|
||||
var/authorized = (!locked || area.hasSiliconAccessInArea(usr, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE) || (integration_cog && (is_servant_of_ratvar(usr))))
|
||||
|
||||
@@ -564,7 +564,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
icon_state = "[initial(item_state)][amount < 3 ? amount : ""]"
|
||||
name = "cable [amount < 3 ? "piece" : "coil"]"
|
||||
|
||||
/obj/item/stack/cable_coil/attack_hand(mob/user)
|
||||
/obj/item/stack/cable_coil/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/item/stock_parts/cell/vv_edit_var(var_name, var_value)
|
||||
switch(var_name)
|
||||
if("self_recharge")
|
||||
if(NAMEOF(src, self_recharge))
|
||||
if(var_value)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
else
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/floodlight/attack_hand(mob/user)
|
||||
/obj/machinery/power/floodlight/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
@@ -113,4 +113,4 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/power/floodlight/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
|
||||
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
|
||||
|
||||
@@ -28,7 +28,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
var/sprite_number = 0
|
||||
|
||||
/obj/machinery/gravity_generator/safe_throw_at()
|
||||
/obj/machinery/gravity_generator/safe_throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/gravity_generator/ex_act(severity, target)
|
||||
@@ -56,7 +56,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/gravity_generator/proc/set_broken()
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
|
||||
/obj/machinery/gravity_generator/proc/set_fix()
|
||||
stat &= ~BROKEN
|
||||
@@ -80,7 +80,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/part/get_status()
|
||||
return main_part?.get_status()
|
||||
|
||||
/obj/machinery/gravity_generator/part/attack_hand(mob/user)
|
||||
/obj/machinery/gravity_generator/part/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
return main_part.attack_hand(user)
|
||||
|
||||
/obj/machinery/gravity_generator/part/set_broken()
|
||||
@@ -116,6 +116,8 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
sprite_number = 8
|
||||
use_power = IDLE_POWER_USE
|
||||
interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE
|
||||
ui_x = 400
|
||||
ui_y = 165
|
||||
var/on = TRUE
|
||||
var/breaker = TRUE
|
||||
var/list/parts = list()
|
||||
@@ -187,14 +189,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/main/attackby(obj/item/I, mob/user, params)
|
||||
switch(broken_state)
|
||||
if(GRAV_NEEDS_SCREWDRIVER)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
if(I.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
to_chat(user, "<span class='notice'>You secure the screws of the framework.</span>")
|
||||
I.play_tool_sound(src)
|
||||
broken_state++
|
||||
update_icon()
|
||||
return
|
||||
if(GRAV_NEEDS_WELDING)
|
||||
if(istype(I, /obj/item/weldingtool))
|
||||
if(I.tool_behaviour == TOOL_WELDER)
|
||||
if(I.use_tool(src, user, 0, volume=50, amount=1))
|
||||
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
|
||||
broken_state++
|
||||
@@ -206,14 +208,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
if(PS.get_amount() >= 10)
|
||||
PS.use(10)
|
||||
to_chat(user, "<span class='notice'>You add the plating to the framework.</span>")
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 75, 1)
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
|
||||
broken_state++
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need 10 sheets of plasteel!</span>")
|
||||
return
|
||||
if(GRAV_NEEDS_WRENCH)
|
||||
if(istype(I, /obj/item/wrench))
|
||||
if(I.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You secure the plating to the framework.</span>")
|
||||
I.play_tool_sound(src)
|
||||
set_fix()
|
||||
@@ -224,7 +226,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "gravity_generator", name, 400, 200, master_ui, state)
|
||||
ui = new(user, src, ui_key, "GravityGenerator", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/gravity_generator/main/ui_data(mob/user)
|
||||
@@ -241,16 +243,18 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/main/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("gentoggle")
|
||||
breaker = !breaker
|
||||
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", INVESTIGATE_GRAVITY)
|
||||
set_power()
|
||||
. = TRUE
|
||||
|
||||
// Power and Icon States
|
||||
|
||||
/obj/machinery/gravity_generator/main/power_change()
|
||||
..()
|
||||
. = ..()
|
||||
investigate_log("has [stat & NOPOWER ? "lost" : "regained"] power.", INVESTIGATE_GRAVITY)
|
||||
set_power()
|
||||
|
||||
@@ -313,7 +317,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
charge_count -= 2
|
||||
|
||||
if(charge_count % 4 == 0 && prob(75)) // Let them know it is charging/discharging.
|
||||
playsound(src.loc, 'sound/effects/empulse.ogg', 100, 1)
|
||||
playsound(src.loc, 'sound/effects/empulse.ogg', 100, TRUE)
|
||||
|
||||
updateDialog()
|
||||
if(prob(25)) // To help stop "Your clothes feel warm." spam.
|
||||
@@ -390,16 +394,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
// Misc
|
||||
|
||||
/obj/item/paper/guides/jobs/engi/gravity_gen
|
||||
name = "paper- 'Generate your own gravity!'"
|
||||
info = {"<h1>Gravity Generator Instructions For Dummies</h1>
|
||||
<p>Surprisingly, gravity isn't that hard to make! All you have to do is inject deadly radioactive minerals into a ball of
|
||||
energy and you have yourself gravity! You can turn the machine on or off when required but you must remember that the generator
|
||||
will EMIT RADIATION when charging or discharging, you can tell it is charging or discharging by the noise it makes, so please WEAR PROTECTIVE CLOTHING.</p>
|
||||
<br>
|
||||
<h3>It blew up!</h3>
|
||||
<p>Don't panic! The gravity generator was designed to be easily repaired. If, somehow, the sturdy framework did not survive then
|
||||
please proceed to panic; otherwise follow these steps.</p><ol>
|
||||
<li>Secure the screws of the framework with a screwdriver.</li>
|
||||
<li>Mend the damaged framework with a welding tool.</li>
|
||||
<li>Add additional plasteel plating.</li>
|
||||
<li>Secure the additional plating with a wrench.</li></ol>"}
|
||||
info = {"
|
||||
# Gravity Generator Instructions For Dummies
|
||||
Surprisingly, gravity isn't that hard to make! All you have to do is inject deadly radioactive minerals into a ball of energy and you have yourself gravity! You can turn the machine on or off when required but you must remember that the generator will EMIT RADIATION when charging or discharging, you can tell it is charging or discharging by the noise it makes, so please WEAR PROTECTIVE CLOTHING.</p>
|
||||
### It blew up!
|
||||
Don't panic! The gravity generator was designed to be easily repaired. If, somehow, the sturdy framework did not survive then please proceed to panic; otherwise follow these steps.
|
||||
1. Secure the screws of the framework with a screwdriver.
|
||||
2. Mend the damaged framework with a welding tool.
|
||||
3. Add additional plasteel plating.
|
||||
4. Secure the additional plating with a wrench.
|
||||
"}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
idle_power_usage = 20
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor
|
||||
tgui_id = "PowerMonitor"
|
||||
ui_x = 550
|
||||
ui_y = 700
|
||||
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
@@ -19,8 +22,6 @@
|
||||
var/record_interval = 50
|
||||
var/next_record = 0
|
||||
var/is_secret_monitor = FALSE
|
||||
tgui_id = "power_monitor"
|
||||
ui_style = "ntos"
|
||||
|
||||
/obj/machinery/computer/monitor/secret //Hides the power monitor (such as ones on ruins & CentCom) from PDA's to prevent metagaming.
|
||||
name = "outdated power monitoring console"
|
||||
@@ -87,7 +88,7 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, tgui_id, name, 550, 700, master_ui, state)
|
||||
ui = new(user, src, ui_key, "PowerMonitor", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/monitor/ui_data()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
//Baseline portable generator. Has all the default handling. Not intended to be used on it's own (since it generates unlimited power).
|
||||
/obj/machinery/power/port_gen
|
||||
name = "portable generator"
|
||||
@@ -8,10 +7,11 @@
|
||||
density = TRUE
|
||||
anchored = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
ui_x = 450
|
||||
ui_y = 340
|
||||
|
||||
var/active = 0
|
||||
var/active = FALSE
|
||||
var/power_gen = 5000
|
||||
var/recent_fault = 0
|
||||
var/power_output = 1
|
||||
var/consumption = 0
|
||||
var/base_icon = "portgen0"
|
||||
@@ -27,8 +27,13 @@
|
||||
QDEL_NULL(soundloop)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/port_gen/connect_to_network()
|
||||
if(!anchored)
|
||||
return FALSE
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/port_gen/proc/HasFuel() //Placeholder for fuel check.
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/proc/UseFuel() //Placeholder for fuel use.
|
||||
return
|
||||
@@ -39,26 +44,38 @@
|
||||
/obj/machinery/power/port_gen/proc/handleInactive()
|
||||
return
|
||||
|
||||
/obj/machinery/power/port_gen/proc/TogglePower()
|
||||
if(active)
|
||||
active = FALSE
|
||||
update_icon()
|
||||
soundloop.stop()
|
||||
else if(HasFuel())
|
||||
active = TRUE
|
||||
START_PROCESSING(SSmachines, src)
|
||||
update_icon()
|
||||
soundloop.start()
|
||||
|
||||
/obj/machinery/power/port_gen/update_icon_state()
|
||||
icon_state = "[base_icon]_[active]"
|
||||
|
||||
/obj/machinery/power/port_gen/process()
|
||||
if(active && HasFuel() && !crit_fail && anchored && powernet)
|
||||
add_avail(power_gen * power_output)
|
||||
if(active)
|
||||
if(!HasFuel() || !anchored)
|
||||
TogglePower()
|
||||
return
|
||||
if(powernet)
|
||||
add_avail(power_gen * power_output)
|
||||
UseFuel()
|
||||
src.updateDialog()
|
||||
soundloop.start()
|
||||
|
||||
else
|
||||
active = 0
|
||||
handleInactive()
|
||||
update_icon()
|
||||
soundloop.stop()
|
||||
|
||||
/obj/machinery/power/port_gen/examine(mob/user)
|
||||
. = ..()
|
||||
. += "It is[!active?"n't":""] running."
|
||||
|
||||
/////////////////
|
||||
// P.A.C.M.A.N //
|
||||
/////////////////
|
||||
/obj/machinery/power/port_gen/pacman
|
||||
name = "\improper P.A.C.M.A.N.-type portable generator"
|
||||
circuit = /obj/item/circuitboard/machine/pacman
|
||||
@@ -78,8 +95,8 @@
|
||||
/obj/machinery/power/port_gen/pacman/Initialize()
|
||||
. = ..()
|
||||
|
||||
var/obj/sheet = new sheet_path(null)
|
||||
sheet_name = sheet.name
|
||||
var/obj/S = sheet_path
|
||||
sheet_name = initial(S.name)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/Destroy()
|
||||
DropFuel()
|
||||
@@ -100,16 +117,16 @@
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The generator has [sheets] units of [sheet_name] fuel left, producing [power_gen] per cycle.</span>"
|
||||
if(crit_fail)
|
||||
. += "<span class='danger'>The generator seems to have broken down.</span>"
|
||||
. += "<span class='notice'>The generator has [sheets] units of [sheet_name] fuel left, producing [DisplayPower(power_gen)] per cycle.</span>"
|
||||
if(anchored)
|
||||
. += "<span class='notice'>It is anchored to the ground.</span>"
|
||||
if(in_range(user, src) || isobserver(user))
|
||||
. += "<span class='notice'>The status display reads: Fuel efficiency increased by <b>[(consumption*100)-100]%</b>.</span>"
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/HasFuel()
|
||||
if(sheets >= 1 / (time_per_sheet / power_output) - sheet_left)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/DropFuel()
|
||||
if(sheets)
|
||||
@@ -145,13 +162,11 @@
|
||||
if (current_heat > 300)
|
||||
overheat()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/handleInactive()
|
||||
|
||||
if (current_heat > 0)
|
||||
current_heat = max(current_heat - 2, 0)
|
||||
src.updateDialog()
|
||||
current_heat = max(current_heat - 2, 0)
|
||||
if(current_heat == 0)
|
||||
STOP_PROCESSING(SSmachines, src)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/proc/overheat()
|
||||
explosion(src.loc, 2, 5, 2, -1)
|
||||
@@ -166,24 +181,21 @@
|
||||
to_chat(user, "<span class='notice'>You add [amount] sheets to the [src.name].</span>")
|
||||
sheets += amount
|
||||
addstack.use(amount)
|
||||
updateUsrDialog()
|
||||
return
|
||||
else if(!active)
|
||||
|
||||
if(istype(O, /obj/item/wrench))
|
||||
|
||||
if(O.tool_behaviour == TOOL_WRENCH)
|
||||
if(!anchored && !isinspace())
|
||||
anchored = TRUE
|
||||
connect_to_network()
|
||||
to_chat(user, "<span class='notice'>You secure the generator to the floor.</span>")
|
||||
anchored = TRUE
|
||||
else if(anchored)
|
||||
anchored = FALSE
|
||||
disconnect_from_network()
|
||||
to_chat(user, "<span class='notice'>You unsecure the generator from the floor.</span>")
|
||||
anchored = FALSE
|
||||
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
return
|
||||
else if(istype(O, /obj/item/screwdriver))
|
||||
else if(O.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
panel_open = !panel_open
|
||||
O.play_tool_sound(src)
|
||||
if(panel_open)
|
||||
@@ -196,12 +208,10 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
obj_flags |= EMAGGED
|
||||
emp_act(EMP_HEAVY)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/attack_ai(mob/user)
|
||||
interact(user)
|
||||
@@ -209,60 +219,52 @@
|
||||
/obj/machinery/power/port_gen/pacman/attack_paw(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if (get_dist(src, user) > 1 )
|
||||
if(!isAI(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=port_gen")
|
||||
return
|
||||
/obj/machinery/power/port_gen/pacman/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "PortableGenerator", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
var/dat = text("<b>[name]</b><br>")
|
||||
if (active)
|
||||
dat += text("Generator: <A href='?src=[REF(src)];action=disable'>On</A><br>")
|
||||
else
|
||||
dat += text("Generator: <A href='?src=[REF(src)];action=enable'>Off</A><br>")
|
||||
dat += text("[capitalize(sheet_name)]: [sheets] - <A href='?src=[REF(src)];action=eject'>Eject</A><br>")
|
||||
var/stack_percent = round(sheet_left * 100, 1)
|
||||
dat += text("Current stack: [stack_percent]% <br>")
|
||||
dat += text("Power output: <A href='?src=[REF(src)];action=lower_power'>-</A> [power_gen * power_output] <A href='?src=[REF(src)];action=higher_power'>+</A><br>")
|
||||
dat += text("Power current: [(powernet == null ? "Unconnected" : "[DisplayPower(avail())]")]<br>")
|
||||
dat += text("Heat: [current_heat]<br>")
|
||||
dat += "<br><A href='?src=[REF(src)];action=close'>Close</A>"
|
||||
user << browse(dat, "window=port_gen")
|
||||
onclose(user, "port_gen")
|
||||
/obj/machinery/power/port_gen/pacman/ui_data()
|
||||
var/data = list()
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/Topic(href, href_list)
|
||||
data["active"] = active
|
||||
data["sheet_name"] = capitalize(sheet_name)
|
||||
data["sheets"] = sheets
|
||||
data["stack_percent"] = round(sheet_left * 100, 0.1)
|
||||
|
||||
data["anchored"] = anchored
|
||||
data["connected"] = (powernet == null ? 0 : 1)
|
||||
data["ready_to_boot"] = anchored && HasFuel()
|
||||
data["power_generated"] = DisplayPower(power_gen)
|
||||
data["power_output"] = DisplayPower(power_gen * power_output)
|
||||
data["power_available"] = (powernet == null ? 0 : DisplayPower(avail()))
|
||||
data["current_heat"] = current_heat
|
||||
. = data
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
TogglePower()
|
||||
. = TRUE
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["action"])
|
||||
if(href_list["action"] == "enable")
|
||||
if(!active && HasFuel() && !crit_fail)
|
||||
active = 1
|
||||
src.updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["action"] == "disable")
|
||||
if (active)
|
||||
active = 0
|
||||
src.updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["action"] == "eject")
|
||||
if("eject")
|
||||
if(!active)
|
||||
DropFuel()
|
||||
src.updateUsrDialog()
|
||||
if(href_list["action"] == "lower_power")
|
||||
. = TRUE
|
||||
|
||||
if("lower_power")
|
||||
if (power_output > 1)
|
||||
power_output--
|
||||
src.updateUsrDialog()
|
||||
if (href_list["action"] == "higher_power")
|
||||
. = TRUE
|
||||
|
||||
if("higher_power")
|
||||
if (power_output < 4 || (obj_flags & EMAGGED))
|
||||
power_output++
|
||||
src.updateUsrDialog()
|
||||
if (href_list["action"] == "close")
|
||||
usr << browse(null, "window=port_gen")
|
||||
usr.unset_machine()
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/super
|
||||
name = "\improper S.U.P.E.R.P.A.C.M.A.N.-type portable generator"
|
||||
|
||||
@@ -386,4 +386,4 @@
|
||||
var/target = base_area ? base_area : src
|
||||
for(var/obj/machinery/power/apc/APC in GLOB.apcs_list)
|
||||
if(APC.area == target)
|
||||
return APC
|
||||
return APC
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
return ..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/machinery/field/containment/attack_hand(mob/user)
|
||||
/obj/machinery/field/containment/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if(get_dist(src, user) > 1)
|
||||
return FALSE
|
||||
else
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 10000
|
||||
dir = NORTH
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = 0
|
||||
var/strength = 0
|
||||
var/powered = 0
|
||||
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||
ui_x = 350
|
||||
ui_y = 185
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = TRUE
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = FALSE
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = FALSE
|
||||
var/strength = 0
|
||||
var/powered = FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Initialize()
|
||||
. = ..()
|
||||
@@ -34,30 +36,27 @@
|
||||
QDEL_NULL(wires)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user)
|
||||
/obj/machinery/particle_accelerator/control_box/multitool_act(mob/living/user, obj/item/I)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
interact(user)
|
||||
else if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/update_state()
|
||||
if(construction_state < PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = NO_POWER_USE
|
||||
assembled = 0
|
||||
active = 0
|
||||
assembled = FALSE
|
||||
active = FALSE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
connected_parts.Cut()
|
||||
return
|
||||
if(!part_scan())
|
||||
use_power = IDLE_POWER_USE
|
||||
active = 0
|
||||
active = FALSE
|
||||
connected_parts.Cut()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon_state()
|
||||
@@ -78,36 +77,6 @@
|
||||
else
|
||||
icon_state = "control_boxc"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!interface_control)
|
||||
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=pacontrol")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
if(!wires.is_cut(WIRE_POWER))
|
||||
toggle_power()
|
||||
|
||||
else if(href_list["scan"])
|
||||
part_scan()
|
||||
|
||||
else if(href_list["strengthup"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
add_strength()
|
||||
|
||||
else if(href_list["strengthdown"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
remove_strength()
|
||||
|
||||
updateDialog()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
@@ -123,7 +92,6 @@
|
||||
log_game("PA Control Computer increased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(s)
|
||||
if(assembled && (strength > 0))
|
||||
strength--
|
||||
@@ -133,11 +101,10 @@
|
||||
log_game("PA Control Computer decreased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
. = ..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
active = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
else if(!stat && construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = IDLE_POWER_USE
|
||||
@@ -160,49 +127,48 @@
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = loc
|
||||
|
||||
assembled = 0
|
||||
assembled = FALSE
|
||||
critical_machine = FALSE
|
||||
|
||||
var/obj/structure/particle_accelerator/fuel_chamber/F = locate() in orange(1,src)
|
||||
if(!F)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
setDir(F.dir)
|
||||
connected_parts.Cut()
|
||||
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/fuel_chamber))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,odir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/end_cap))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/power_box))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/center))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/left))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/right))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
assembled = 1
|
||||
assembled = TRUE
|
||||
critical_machine = TRUE //Only counts if the PA is actually assembled.
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/check_part(turf/T, type)
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && (PA.construction_state == PA_CONSTRUCTION_COMPLETE))
|
||||
if(PA.connect_master(src))
|
||||
connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
@@ -214,47 +180,16 @@
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = strength
|
||||
part.powered = 1
|
||||
part.powered = TRUE
|
||||
part.update_icon()
|
||||
else
|
||||
use_power = IDLE_POWER_USE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
|
||||
if(!issilicon(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=pacontrol")
|
||||
return
|
||||
|
||||
var/dat = ""
|
||||
dat += "<A href='?src=[REF(src)];close=1'>Close</A><BR><BR>"
|
||||
dat += "<h3>Status</h3>"
|
||||
if(!assembled)
|
||||
dat += "Unable to detect all parts!<BR>"
|
||||
dat += "<A href='?src=[REF(src)];scan=1'>Run Scan</A><BR><BR>"
|
||||
else
|
||||
dat += "All parts in place.<BR><BR>"
|
||||
dat += "Power:"
|
||||
if(active)
|
||||
dat += "On<BR>"
|
||||
else
|
||||
dat += "Off <BR>"
|
||||
dat += "<A href='?src=[REF(src)];togglep=1'>Toggle Power</A><BR><BR>"
|
||||
dat += "Particle Strength: [strength] "
|
||||
dat += "<A href='?src=[REF(src)];strengthdown=1'>--</A>|<A href='?src=[REF(src)];strengthup=1'>++</A><BR><BR>"
|
||||
|
||||
var/datum/browser/popup = new(user, "pacontrol", name, 420, 300)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -266,48 +201,47 @@
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
. += "The panel is open."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params)
|
||||
var/did_something = FALSE
|
||||
|
||||
switch(construction_state)
|
||||
if(PA_CONSTRUCTION_UNSECURED)
|
||||
if(istype(W, /obj/item/wrench) && !isinspace())
|
||||
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] secures the [name] to the floor.</span>", \
|
||||
"<span class='notice'>You secure the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_UNWIRED)
|
||||
if(istype(W, /obj/item/wrench))
|
||||
if(W.tool_behaviour == TOOL_WRENCH)
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] detaches the [name] from the floor.</span>", \
|
||||
"<span class='notice'>You remove the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/stack/cable_coil))
|
||||
if(W.use_tool(src, user, 0, 1))
|
||||
user.visible_message("[user.name] adds wires to the [name].", \
|
||||
"You add some wires.")
|
||||
user.visible_message("<span class='notice'>[user.name] adds wires to the [name].</span>", \
|
||||
"<span class='notice'>You add some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(istype(W, /obj/item/wirecutters))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [name].", \
|
||||
"You remove some wires.")
|
||||
if(W.tool_behaviour == TOOL_WIRECUTTER)//TODO:Shock user if its on?
|
||||
user.visible_message("<span class='notice'>[user.name] removes some wires from the [name].</span>", \
|
||||
"<span class='notice'>You remove some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] closes the [name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] closes the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You close the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_COMPLETE
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_COMPLETE)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] opens the [name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] opens the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You open the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
|
||||
@@ -323,6 +257,65 @@
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/interact(mob/user)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != PA_CONSTRUCTION_COMPLETE)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ParticleAccelerator", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
#undef PA_CONSTRUCTION_UNSECURED
|
||||
#undef PA_CONSTRUCTION_UNWIRED
|
||||
#undef PA_CONSTRUCTION_PANEL_OPEN
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
last_failed_movement = direct
|
||||
return 0
|
||||
|
||||
/obj/singularity/attack_hand(mob/user)
|
||||
/obj/singularity/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
consume(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
+28
-31
@@ -21,6 +21,9 @@
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
circuit = /obj/item/circuitboard/machine/smes
|
||||
ui_x = 340
|
||||
ui_y = 350
|
||||
|
||||
var/capacity = 5e6 // maximum charge
|
||||
var/charge = 0 // actual charge
|
||||
|
||||
@@ -54,7 +57,7 @@
|
||||
break dir_loop
|
||||
|
||||
if(!terminal)
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
terminal.master = src
|
||||
update_icon()
|
||||
@@ -123,22 +126,22 @@
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start building the power terminal...</span>")
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
|
||||
if(C.use_tool(src, user, 20, 10))
|
||||
var/obj/structure/cable/N = T.get_cable_node() //get the connecting node cable, if there's one
|
||||
if (prob(50) && electrocute_mob(usr, N, N, 1, TRUE)) //animate the electrocution if uncautious and unlucky
|
||||
do_sparks(5, TRUE, src)
|
||||
return
|
||||
if(!terminal)
|
||||
C.use(10)
|
||||
user.visible_message("<span class='notice'>[user.name] builds a power terminal.</span>",\
|
||||
"<span class='notice'>You build the power terminal.</span>")
|
||||
|
||||
user.visible_message(\
|
||||
"[user.name] has built a power terminal.",\
|
||||
"<span class='notice'>You build the power terminal.</span>")
|
||||
|
||||
//build the terminal and link it to the network
|
||||
make_terminal(T)
|
||||
terminal.connect_to_network()
|
||||
connect_to_network()
|
||||
//build the terminal and link it to the network
|
||||
make_terminal(T)
|
||||
terminal.connect_to_network()
|
||||
connect_to_network()
|
||||
return
|
||||
|
||||
//crowbarring it !
|
||||
@@ -148,13 +151,14 @@
|
||||
log_game("[src] has been deconstructed by [key_name(user)] at [AREACOORD(src)]")
|
||||
investigate_log("SMES deconstructed by [key_name(user)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
return
|
||||
else if(panel_open && istype(I, /obj/item/crowbar))
|
||||
else if(panel_open && I.tool_behaviour == TOOL_CROWBAR)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/smes/wirecutter_act(mob/living/user, obj/item/I)
|
||||
//disassembling the terminal
|
||||
. = ..()
|
||||
if(terminal && panel_open)
|
||||
terminal.dismantle(user, I)
|
||||
return TRUE
|
||||
@@ -193,7 +197,7 @@
|
||||
if(terminal)
|
||||
terminal.master = null
|
||||
terminal = null
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
|
||||
|
||||
/obj/machinery/power/smes/update_overlays()
|
||||
@@ -201,6 +205,9 @@
|
||||
if((stat & BROKEN) || panel_open)
|
||||
return
|
||||
|
||||
if(panel_open)
|
||||
return
|
||||
|
||||
if(outputting)
|
||||
. += "smes-op1"
|
||||
else
|
||||
@@ -208,14 +215,14 @@
|
||||
|
||||
if(inputting)
|
||||
. += "smes-oc1"
|
||||
else
|
||||
if(input_attempt)
|
||||
. += "smes-oc0"
|
||||
else if(input_attempt)
|
||||
. += "smes-oc0"
|
||||
|
||||
var/clevel = chargedisplay()
|
||||
if(clevel>0)
|
||||
. += "smes-og[clevel]"
|
||||
|
||||
|
||||
/obj/machinery/power/smes/proc/chargedisplay()
|
||||
return clamp(round(5.5*charge/capacity),0,5)
|
||||
|
||||
@@ -315,28 +322,26 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "smes", name, 340, 440, master_ui, state)
|
||||
ui = new(user, src, ui_key, "Smes", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/smes/ui_data()
|
||||
var/list/data = list(
|
||||
"capacityPercent" = round(100*charge/capacity, 0.1),
|
||||
"capacity" = capacity,
|
||||
"capacityPercent" = round(100*charge/capacity, 0.1),
|
||||
"charge" = charge,
|
||||
|
||||
"inputAttempt" = input_attempt,
|
||||
"inputting" = inputting,
|
||||
"inputLevel" = input_level,
|
||||
"inputLevel_text" = DisplayPower(input_level),
|
||||
"inputLevelMax" = input_level_max,
|
||||
"inputAvailable" = DisplayPower(input_available),
|
||||
|
||||
"inputAvailable" = input_available,
|
||||
"outputAttempt" = output_attempt,
|
||||
"outputting" = outputting,
|
||||
"outputLevel" = output_level,
|
||||
"outputLevel_text" = DisplayPower(output_level),
|
||||
"outputLevelMax" = output_level_max,
|
||||
"outputUsed" = DisplayPower(output_used)
|
||||
"outputUsed" = output_used,
|
||||
)
|
||||
return data
|
||||
|
||||
@@ -357,11 +362,7 @@
|
||||
if("input")
|
||||
var/target = params["target"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(target == "input")
|
||||
target = input("New input target (0-[input_level_max]):", name, input_level) as num|null
|
||||
if(!isnull(target) && !..())
|
||||
. = TRUE
|
||||
else if(target == "min")
|
||||
if(target == "min")
|
||||
target = 0
|
||||
. = TRUE
|
||||
else if(target == "max")
|
||||
@@ -379,11 +380,7 @@
|
||||
if("output")
|
||||
var/target = params["target"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(target == "input")
|
||||
target = input("New output target (0-[output_level_max]):", name, output_level) as num|null
|
||||
if(!isnull(target) && !..())
|
||||
. = TRUE
|
||||
else if(target == "min")
|
||||
if(target == "min")
|
||||
target = 0
|
||||
. = TRUE
|
||||
else if(target == "max")
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "solar_control", name, 380, 230, master_ui, state)
|
||||
ui = new(user, src, ui_key, "SolarControl", name, 380, 230, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/solar_control/ui_data()
|
||||
@@ -481,8 +481,12 @@
|
||||
//
|
||||
|
||||
/obj/item/paper/guides/jobs/engi/solars
|
||||
name = "paper- 'Going green! Setup your own solar array instructions.'"
|
||||
info = "<h1>Welcome</h1><p>At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.</p><p>You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.</p><p>Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!</p>"
|
||||
info = {"
|
||||
# Welcome!
|
||||
At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.
|
||||
You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.
|
||||
Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!
|
||||
"}
|
||||
|
||||
#undef SOLAR_GEN_RATE
|
||||
#undef OCCLUSION_DISTANCE
|
||||
|
||||
@@ -571,7 +571,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
/obj/machinery/power/supermatter_crystal/attack_ai(mob/user)
|
||||
return
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/attack_hand(mob/living/user)
|
||||
/obj/machinery/power/supermatter_crystal/attack_hand(mob/living/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
var/comp_id = 0
|
||||
var/efficiency
|
||||
|
||||
/obj/machinery/power/compressor/Destroy()
|
||||
if(turbine && turbine.compressor == src)
|
||||
turbine.compressor = null
|
||||
turbine = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/turbine
|
||||
name = "gas turbine generator"
|
||||
@@ -51,12 +56,20 @@
|
||||
resistance_flags = FIRE_PROOF
|
||||
CanAtmosPass = ATMOS_PASS_DENSITY
|
||||
circuit = /obj/item/circuitboard/machine/power_turbine
|
||||
ui_x = 310
|
||||
ui_y = 150
|
||||
var/opened = 0
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/turf/outturf
|
||||
var/lastgen
|
||||
var/productivity = 1
|
||||
|
||||
/obj/machinery/power/turbine/Destroy()
|
||||
if(compressor && compressor.turbine == src)
|
||||
compressor.turbine = null
|
||||
compressor = null
|
||||
return ..()
|
||||
|
||||
// the inlet stage of the gas turbine electricity generator
|
||||
|
||||
/obj/machinery/power/compressor/Initialize()
|
||||
@@ -66,12 +79,10 @@
|
||||
inturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!turbine)
|
||||
stat |= BROKEN
|
||||
|
||||
obj_break()
|
||||
|
||||
#define COMPFRICTION 5e5
|
||||
|
||||
|
||||
/obj/machinery/power/compressor/locate_machinery()
|
||||
if(turbine)
|
||||
return
|
||||
@@ -103,7 +114,7 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Turbine not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
@@ -129,9 +140,9 @@
|
||||
|
||||
// RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy
|
||||
|
||||
rpm = min(rpm, (COMPFRICTION*efficiency)/2)
|
||||
rpm = max(0, rpm - (rpm*rpm)/(COMPFRICTION*efficiency))
|
||||
|
||||
|
||||
if(starter && !(stat & NOPOWER))
|
||||
use_power(2800)
|
||||
if(rpm<1000)
|
||||
@@ -140,8 +151,6 @@
|
||||
if(rpm<1000)
|
||||
rpmtarget = 0
|
||||
|
||||
|
||||
|
||||
if(rpm>50000)
|
||||
add_overlay(mutable_appearance(icon, "comp-o4", FLY_LAYER))
|
||||
else if(rpm>10000)
|
||||
@@ -164,7 +173,7 @@
|
||||
outturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!compressor)
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/turbine/RefreshParts()
|
||||
@@ -222,8 +231,6 @@
|
||||
if(lastgen > 100)
|
||||
add_overlay(mutable_appearance(icon, "turb-o", FLY_LAYER))
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/power/turbine/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), I))
|
||||
return
|
||||
@@ -237,53 +244,42 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Compressor not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/power/turbine/ui_interact(mob/user)
|
||||
/obj/machinery/power/turbine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
if(!Adjacent(user) || (stat & (NOPOWER|BROKEN)) && !issilicon(user))
|
||||
user.unset_machine(src)
|
||||
user << browse(null, "window=turbine")
|
||||
return
|
||||
/obj/machinery/power/turbine/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["compressor"] = compressor ? TRUE : FALSE
|
||||
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["turbine"] = compressor?.turbine ? TRUE : FALSE
|
||||
data["turbine_broke"] = (!compressor || !compressor.turbine || (compressor.turbine.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["online"] = compressor?.starter
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.return_temperature()
|
||||
return data
|
||||
|
||||
var/t = "<TT><B>Gas Turbine Generator</B><HR><PRE>"
|
||||
|
||||
t += "Generated power : [DisplayPower(lastgen)]<BR><BR>"
|
||||
|
||||
t += "Turbine: [round(compressor.rpm)] RPM<BR>"
|
||||
|
||||
t += "Starter: [ compressor.starter ? "<A href='?src=[REF(src)];str=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=[REF(src)];str=1'>On</A>"]"
|
||||
|
||||
t += "</PRE><HR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
|
||||
t += "</TT>"
|
||||
var/datum/browser/popup = new(user, "turbine", name)
|
||||
popup.set_content(t)
|
||||
popup.open()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/power/turbine/Topic(href, href_list)
|
||||
/obj/machinery/power/turbine/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=turbine")
|
||||
usr.unset_machine(src)
|
||||
return
|
||||
|
||||
else if( href_list["str"] )
|
||||
if(compressor)
|
||||
compressor.starter = !compressor.starter
|
||||
|
||||
updateDialog()
|
||||
|
||||
|
||||
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
compressor.starter = !compressor.starter
|
||||
. = TRUE
|
||||
if("reconnect")
|
||||
locate_machinery()
|
||||
. = TRUE
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -296,6 +292,8 @@
|
||||
icon_screen = "turbinecomp"
|
||||
icon_keyboard = "tech_key"
|
||||
circuit = /obj/item/circuitboard/computer/turbine_computer
|
||||
ui_x = 310
|
||||
ui_y = 150
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/id = 0
|
||||
|
||||
@@ -319,18 +317,16 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "turbine_computer", name, 300, 200, master_ui, state)
|
||||
ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["compressor"] = compressor ? TRUE : FALSE
|
||||
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["turbine"] = compressor?.turbine ? TRUE : FALSE
|
||||
data["turbine_broke"] = (!compressor || !compressor.turbine || (compressor.turbine.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["online"] = compressor?.starter
|
||||
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.return_temperature()
|
||||
@@ -340,6 +336,7 @@
|
||||
/obj/machinery/computer/turbine_computer/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
|
||||
Reference in New Issue
Block a user