Makes solars auto-track again (#13278)

* Makes solars auto-track again

* Forgot this
This commit is contained in:
AffectedArc07
2020-04-11 15:46:09 -06:00
committed by GitHub
parent 925ffa7584
commit 42da9918d7
3 changed files with 18 additions and 6 deletions
+1
View File
@@ -66,6 +66,7 @@
#define INIT_ORDER_TIMER 1
#define INIT_ORDER_DEFAULT 0
#define INIT_ORDER_AIR -1
#define INIT_ORDER_SUN -2
#define INIT_ORDER_MINIMAP -3
#define INIT_ORDER_ASSETS -4
#define INIT_ORDER_ICON_SMOOTHING -5
+11 -2
View File
@@ -1,19 +1,28 @@
SUBSYSTEM_DEF(sun)
name = "Sun"
wait = 600
flags = SS_NO_TICK_CHECK|SS_NO_INIT
flags = SS_NO_TICK_CHECK
init_order = INIT_ORDER_SUN
var/angle
var/dx
var/dy
var/rate
var/list/solars = list()
/datum/controller/subsystem/sun/PreInit()
/datum/controller/subsystem/sun/Initialize(start_timeofday)
// Lets work out an angle for the "sun" to rotate around the station
angle = rand (0,360) // the station position to the sun is randomised at round start
rate = rand(50,200)/100 // 50% - 200% of standard rotation
if(prob(50)) // same chance to rotate clockwise than counter-clockwise
rate = -rate
// Solar consoles need to load after machines init, so this handles that
for(var/obj/machinery/power/solar_control/SC in solars)
SC.setup()
return ..()
/datum/controller/subsystem/sun/stat_entry(msg)
..("P:[solars.len]")
+6 -4
View File
@@ -285,13 +285,15 @@
autostart = 1 // Automatically start
/obj/machinery/power/solar_control/Initialize()
..()
if(!powernet)
return
SSsun.solars |= src
setup()
. = ..()
/obj/machinery/power/solar_control/proc/setup()
connect_to_network()
set_panels(cdir)
if(autostart)
src.search_for_connected()
search_for_connected()
if(connected_tracker && track == 2)
connected_tracker.set_angle(SSsun.angle)
set_panels(cdir)