mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
## About The Pull Request This is a whopper, will need @MrStonedOne to review. In theory this flag shouldn't be needed and my own testing didn't find any issues, but I'd feel better with a lengthy test merge. ## Why It's Good For The Game Might make nightshift subsystem lag less, MC loop has less stuff to check.
32 lines
911 B
Plaintext
32 lines
911 B
Plaintext
SUBSYSTEM_DEF(sun)
|
|
name = "Sun"
|
|
wait = 1 MINUTES
|
|
|
|
var/azimuth = 0 ///clockwise, top-down rotation from 0 (north) to 359
|
|
var/azimuth_mod = 1 ///multiplier against base_rotation
|
|
var/base_rotation = 6 ///base rotation in degrees per fire
|
|
|
|
/datum/controller/subsystem/sun/Initialize(start_timeofday)
|
|
azimuth = rand(0, 359)
|
|
azimuth_mod = round(rand(50, 200)/100, 0.01) // 50% - 200% of standard rotation
|
|
if(prob(50))
|
|
azimuth_mod *= -1
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/sun/fire(resumed = FALSE)
|
|
azimuth += azimuth_mod * base_rotation
|
|
azimuth = round(azimuth, 0.01)
|
|
if(azimuth >= 360)
|
|
azimuth -= 360
|
|
if(azimuth < 0)
|
|
azimuth += 360
|
|
complete_movement()
|
|
|
|
/datum/controller/subsystem/sun/proc/complete_movement()
|
|
SEND_SIGNAL(src, COMSIG_SUN_MOVED, azimuth)
|
|
|
|
/datum/controller/subsystem/sun/vv_edit_var(var_name, var_value)
|
|
. = ..()
|
|
if(var_name == NAMEOF(src, azimuth))
|
|
complete_movement()
|