Artur
2020-04-23 09:55:28 +03:00
parent 055606b81b
commit 80b47ec1c0
368 changed files with 29034 additions and 6568 deletions
+1 -1
View File
@@ -859,7 +859,7 @@
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, 450, 460, master_ui, state)
ui.open()
/obj/machinery/power/apc/ui_data(mob/user)
+13 -9
View File
@@ -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
@@ -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.
+4 -3
View File
@@ -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()
+82 -77
View File
@@ -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,16 @@
QDEL_NULL(soundloop)
return ..()
/obj/machinery/power/port_gen/should_have_node()
return anchored
/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 +47,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 +98,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 +120,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 +165,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 +184,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 +211,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 +222,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"
@@ -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,49 +201,48 @@
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))
var/obj/item/stack/cable_coil/CC = W
if(CC.use(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
@@ -324,6 +258,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
+1 -1
View File
@@ -313,7 +313,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, "smes", name, 340, 440, master_ui, state)
ui = new(user, src, ui_key, "Smes", name, 340, 440, master_ui, state)
ui.open()
/obj/machinery/power/smes/ui_data()
+1 -1
View File
@@ -352,7 +352,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()
+48 -52
View File
@@ -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.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,27 +317,25 @@
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.temperature
return data
/obj/machinery/computer/turbine_computer/ui_act(action, params)
if(..())
return
switch(action)
if("toggle_power")
if(compressor && compressor.turbine)