Done.
This commit is contained in:
+45
-27
@@ -27,16 +27,15 @@
|
|||||||
|
|
||||||
/obj/machinery/power/solar/Initialize(mapload, obj/item/solar_assembly/S)
|
/obj/machinery/power/solar/Initialize(mapload, obj/item/solar_assembly/S)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!S)
|
panel = new()
|
||||||
assembly = new /obj/item/solar_assembly
|
#if DM_VERSION >= 513
|
||||||
assembly.glass_type = new /obj/item/stack/sheet/glass(null, 2)
|
panel.vis_flags = VIS_INHERIT_ID|VIS_INHERIT_ICON|VIS_INHERIT_PLANE
|
||||||
assembly.anchored = TRUE
|
vis_contents += panel
|
||||||
else
|
#endif
|
||||||
S.moveToNullspace()
|
panel.icon = icon
|
||||||
assembly = S
|
panel.icon_state = "solar_panel"
|
||||||
assembly.glass_type.on_solar_construction(src)
|
panel.layer = FLY_LAYER
|
||||||
obj_integrity = max_integrity
|
Make(S)
|
||||||
update_icon()
|
|
||||||
connect_to_network()
|
connect_to_network()
|
||||||
RegisterSignal(SSsun, COMSIG_SUN_MOVED, .proc/queue_update_solar_exposure)
|
RegisterSignal(SSsun, COMSIG_SUN_MOVED, .proc/queue_update_solar_exposure)
|
||||||
|
|
||||||
@@ -57,6 +56,18 @@
|
|||||||
control.connected_panels -= src
|
control.connected_panels -= src
|
||||||
control = null
|
control = null
|
||||||
|
|
||||||
|
/obj/machinery/power/solar/proc/Make(obj/item/solar_assembly/S)
|
||||||
|
if(!S)
|
||||||
|
assembly = new /obj/item/solar_assembly
|
||||||
|
assembly.glass_type = new /obj/item/stack/sheet/glass(null, 2)
|
||||||
|
assembly.anchored = TRUE
|
||||||
|
else
|
||||||
|
S.moveToNullspace()
|
||||||
|
assembly = S
|
||||||
|
assembly.glass_type.on_solar_construction(src)
|
||||||
|
obj_integrity = max_integrity
|
||||||
|
update_icon()
|
||||||
|
|
||||||
/obj/machinery/power/solar/crowbar_act(mob/user, obj/item/I)
|
/obj/machinery/power/solar/crowbar_act(mob/user, obj/item/I)
|
||||||
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
|
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
|
||||||
user.visible_message("<span class='notice'>[user] begins to take the glass off [src].</span>", "<span class='notice'>You begin to take the glass off [src]...</span>")
|
user.visible_message("<span class='notice'>[user] begins to take the glass off [src].</span>", "<span class='notice'>You begin to take the glass off [src]...</span>")
|
||||||
@@ -221,20 +232,20 @@
|
|||||||
|
|
||||||
|
|
||||||
/obj/item/solar_assembly/attackby(obj/item/W, mob/user, params)
|
/obj/item/solar_assembly/attackby(obj/item/W, mob/user, params)
|
||||||
if(W.tool_behaviour == TOOL_WRENCH && isturf(loc))
|
if(istype(W, /obj/item/wrench) && isturf(loc))
|
||||||
if(isinspace())
|
if(isinspace())
|
||||||
to_chat(user, "<span class='warning'>You can't secure [src] here.</span>")
|
to_chat(user, "<span class='warning'>You can't secure [src] here.</span>")
|
||||||
return
|
return
|
||||||
anchored = !anchored
|
anchored = !anchored
|
||||||
if(anchored)
|
if(anchored)
|
||||||
user.visible_message("<span class='notice'>[user] wrenches the solar assembly into place.</span>", "<span class='notice'>You wrench the solar assembly into place.</span>")
|
user.visible_message("[user] wrenches the solar assembly into place.", "<span class='notice'>You wrench the solar assembly into place.</span>")
|
||||||
W.play_tool_sound(src, 75)
|
W.play_tool_sound(src, 75)
|
||||||
else
|
else
|
||||||
user.visible_message("<span class='notice'>[user] unwrenches the solar assembly from its place.</span>", "<span class='notice'>You unwrench the solar assembly from its place.</span>")
|
user.visible_message("[user] unwrenches the solar assembly from its place.", "<span class='notice'>You unwrench the solar assembly from its place.</span>")
|
||||||
W.play_tool_sound(src, 75)
|
W.play_tool_sound(src, 75)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if(istype(W, /obj/item/stack/sheet/glass) || istype(W, /obj/item/stack/sheet/rglass))
|
if(is_type_in_typecache(W, allowed_sheets))
|
||||||
if(!anchored)
|
if(!anchored)
|
||||||
to_chat(user, "<span class='warning'>You need to secure the assembly before you can add glass.</span>")
|
to_chat(user, "<span class='warning'>You need to secure the assembly before you can add glass.</span>")
|
||||||
return
|
return
|
||||||
@@ -242,8 +253,8 @@
|
|||||||
var/obj/item/stack/sheet/G = S.change_stack(null, 2)
|
var/obj/item/stack/sheet/G = S.change_stack(null, 2)
|
||||||
if(G)
|
if(G)
|
||||||
glass_type = G
|
glass_type = G
|
||||||
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
|
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
|
||||||
user.visible_message("<span class='notice'>[user] places the glass on the solar assembly.</span>", "<span class='notice'>You place the glass on the solar assembly.</span>")
|
user.visible_message("[user] places the glass on the solar assembly.", "<span class='notice'>You place the glass on the solar assembly.</span>")
|
||||||
if(tracker)
|
if(tracker)
|
||||||
new /obj/machinery/power/tracker(get_turf(src), src)
|
new /obj/machinery/power/tracker(get_turf(src), src)
|
||||||
else
|
else
|
||||||
@@ -259,13 +270,13 @@
|
|||||||
return
|
return
|
||||||
tracker = 1
|
tracker = 1
|
||||||
qdel(W)
|
qdel(W)
|
||||||
user.visible_message("<span class='notice'>[user] inserts the electronics into the solar assembly.</span>", "<span class='notice'>You insert the electronics into the solar assembly.</span>")
|
user.visible_message("[user] inserts the electronics into the solar assembly.", "<span class='notice'>You insert the electronics into the solar assembly.</span>")
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
if(W.tool_behaviour == TOOL_CROWBAR)
|
if(istype(W, /obj/item/crowbar))
|
||||||
new /obj/item/electronics/tracker(src.loc)
|
new /obj/item/electronics/tracker(src.loc)
|
||||||
tracker = 0
|
tracker = 0
|
||||||
user.visible_message("<span class='notice'>[user] takes out the electronics from the solar assembly.</span>", "<span class='notice'>You take out the electronics from the solar assembly.</span>")
|
user.visible_message("[user] takes out the electronics from the solar assembly.", "<span class='notice'>You take out the electronics from the solar assembly.</span>")
|
||||||
return 1
|
return 1
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
@@ -325,13 +336,16 @@
|
|||||||
if(!T.control) //i.e unconnected
|
if(!T.control) //i.e unconnected
|
||||||
T.set_control(src)
|
T.set_control(src)
|
||||||
|
|
||||||
/obj/machinery/power/solar/update_icon()
|
/obj/machinery/power/solar_control/update_overlays()
|
||||||
..()
|
. = ..()
|
||||||
cut_overlays()
|
if(stat & NOPOWER)
|
||||||
|
. += mutable_appearance(icon, "[icon_keyboard]_off")
|
||||||
|
return
|
||||||
|
. += mutable_appearance(icon, icon_keyboard)
|
||||||
if(stat & BROKEN)
|
if(stat & BROKEN)
|
||||||
add_overlay(mutable_appearance(icon, "solar_panel-b", FLY_LAYER))
|
. += mutable_appearance(icon, "[icon_state]_broken")
|
||||||
else
|
else
|
||||||
add_overlay(mutable_appearance(icon, "solar_panel", FLY_LAYER))
|
. += mutable_appearance(icon, icon_screen)
|
||||||
|
|
||||||
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
/obj/machinery/power/solar_control/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)
|
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||||
@@ -389,13 +403,13 @@
|
|||||||
|
|
||||||
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
|
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
|
||||||
if(I.tool_behaviour == TOOL_SCREWDRIVER)
|
if(I.tool_behaviour == TOOL_SCREWDRIVER)
|
||||||
if(I.use_tool(src, user, 20, volume=50))
|
if(I.use_tool(src, user, 20, volume = 50))
|
||||||
if(src.stat & BROKEN)
|
if(src.stat & BROKEN)
|
||||||
to_chat(user, "<span class='notice'>The broken glass falls out.</span>")
|
to_chat(user, "<span class='notice'>The broken glass falls out.</span>")
|
||||||
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
|
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
|
||||||
new /obj/item/shard( src.loc )
|
new /obj/item/shard( src.loc )
|
||||||
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
|
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
|
||||||
for (var/obj/C in src)
|
for(var/obj/C in src)
|
||||||
C.forceMove(drop_location())
|
C.forceMove(drop_location())
|
||||||
A.circuit = M
|
A.circuit = M
|
||||||
A.state = 3
|
A.state = 3
|
||||||
@@ -406,7 +420,7 @@
|
|||||||
to_chat(user, "<span class='notice'>You disconnect the monitor.</span>")
|
to_chat(user, "<span class='notice'>You disconnect the monitor.</span>")
|
||||||
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
|
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
|
||||||
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
|
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
|
||||||
for (var/obj/C in src)
|
for(var/obj/C in src)
|
||||||
C.forceMove(drop_location())
|
C.forceMove(drop_location())
|
||||||
A.circuit = M
|
A.circuit = M
|
||||||
A.state = 4
|
A.state = 4
|
||||||
@@ -459,6 +473,10 @@
|
|||||||
for(var/obj/machinery/power/solar/S in connected_panels)
|
for(var/obj/machinery/power/solar/S in connected_panels)
|
||||||
S.queue_turn(azimuth)
|
S.queue_turn(azimuth)
|
||||||
|
|
||||||
|
/obj/machinery/power/solar_control/power_change()
|
||||||
|
..()
|
||||||
|
update_icon()
|
||||||
|
|
||||||
//
|
//
|
||||||
// MISC
|
// MISC
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user