mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-06 23:42:27 +00:00
Breaker Box update
- Added suggestions by mwerezak and comma - Directions list is now in variable - Type changed to /obj/machinery/power/breakerbox - Instead of using loop visible_message() is used now.
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
// Humans need 30 seconds (AI is faster when it comes to complex electronics)
|
||||
// Used for advanced grid control (read: Substations)
|
||||
|
||||
/obj/structure/breakerbox
|
||||
/obj/machinery/power/breakerbox
|
||||
name = "Breaker Box"
|
||||
desc = "Large panel with breakers used to control connected power circuits."
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "bbox_off"
|
||||
var/icon_state_on = "bbox_on"
|
||||
@@ -16,16 +15,16 @@
|
||||
anchored = 1
|
||||
var/on = 0
|
||||
var/busy = 0
|
||||
var/directions = list(1,2,4,8,5,6,9,10)
|
||||
|
||||
/obj/structure/breakerbox/examine()
|
||||
..()
|
||||
/obj/machinery/power/breakerbox/examine()
|
||||
usr << "Large machine with heavy duty switching circuits used for advanced grid control"
|
||||
if(on)
|
||||
usr << "\green It seems to be online."
|
||||
else
|
||||
usr << "\red It seems to be offline"
|
||||
|
||||
/obj/structure/breakerbox/attack_ai(mob/user)
|
||||
/obj/machinery/power/breakerbox/attack_ai(mob/user)
|
||||
if(busy)
|
||||
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
|
||||
return
|
||||
@@ -40,7 +39,7 @@
|
||||
busy = 0
|
||||
|
||||
|
||||
/obj/structure/breakerbox/attack_hand(mob/user)
|
||||
/obj/machinery/power/breakerbox/attack_hand(mob/user)
|
||||
|
||||
if(busy)
|
||||
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
|
||||
@@ -54,16 +53,17 @@
|
||||
|
||||
if(do_after(user, 300)) // 30s for non-AIs as humans have to manually reprogram it and rapid switching may cause some lag / powernet updates flood. If AIs spam it they can be easily traced.
|
||||
set_state(!on)
|
||||
for(var/mob/O in viewers(user))
|
||||
O.show_message(text("\red [user] finished reprogramming the [src]!"), 1)
|
||||
user.visible_message(\
|
||||
"<span class='notice'>[user.name] [on ? "enabled" : "disabled"] the breaker box!</span>",\
|
||||
"<span class='notice'>You [on ? "enabled" : "disabled"] the breaker box!</span>")
|
||||
busy = 0
|
||||
|
||||
/obj/structure/breakerbox/proc/set_state(var/state)
|
||||
/obj/machinery/power/breakerbox/proc/set_state(var/state)
|
||||
on = state
|
||||
if(on)
|
||||
icon_state = icon_state_on
|
||||
var/list/connection_dirs = list()
|
||||
for(var/direction in list(1,2,4,8,5,6,9,10))
|
||||
for(var/direction in directions)
|
||||
for(var/obj/structure/cable/C in get_step(src,direction))
|
||||
if(C.d1 == turn(direction, 180) || C.d2 == turn(direction, 180))
|
||||
connection_dirs += direction
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
var/d2 = 1
|
||||
layer = 2.44 //Just below unary stuff, which is at 2.45 and above pipes, which are at 2.4
|
||||
color = COLOR_RED
|
||||
var/obj/structure/breakerbox/breaker_box
|
||||
var/obj/machinery/power/breakerbox/breaker_box
|
||||
|
||||
/obj/structure/cable/yellow
|
||||
color = COLOR_YELLOW
|
||||
|
||||
Reference in New Issue
Block a user