mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
Merge pull request #14306 from Putnam3145/supernova
Adds a supernova event, with tweaks to allow this
This commit is contained in:
@@ -70,3 +70,8 @@ PROCESSING_SUBSYSTEM_DEF(weather)
|
||||
A = W
|
||||
break
|
||||
return A
|
||||
|
||||
/datum/controller/subsystem/processing/weather/proc/get_weather_by_type(datum/weather/weather_datum_type)
|
||||
for(var/V in processing)
|
||||
if(istype(V,weather_datum_type))
|
||||
return V
|
||||
|
||||
@@ -1,32 +1,63 @@
|
||||
#define OCCLUSION_DISTANCE 20
|
||||
|
||||
/datum/sun
|
||||
var/azimuth = 0 // clockwise, top-down rotation from 0 (north) to 359
|
||||
var/power_mod = 1 // how much power this sun is outputting relative to standard
|
||||
|
||||
|
||||
/datum/sun/vv_edit_var(var_name, var_value)
|
||||
. = ..()
|
||||
if(var_name == NAMEOF(src, azimuth))
|
||||
SSsun.complete_movement()
|
||||
|
||||
/atom/proc/check_obscured(datum/sun/sun, distance = OCCLUSION_DISTANCE)
|
||||
var/target_x = round(sin(sun.azimuth), 0.01)
|
||||
var/target_y = round(cos(sun.azimuth), 0.01)
|
||||
var/x_hit = x
|
||||
var/y_hit = y
|
||||
var/turf/hit
|
||||
|
||||
for(var/run in 1 to distance)
|
||||
x_hit += target_x
|
||||
y_hit += target_y
|
||||
hit = locate(round(x_hit, 1), round(y_hit, 1), z)
|
||||
if(hit.opacity)
|
||||
return TRUE
|
||||
if(hit.x == 1 || hit.x == world.maxx || hit.y == 1 || hit.y == world.maxy) //edge of the map
|
||||
break
|
||||
return FALSE
|
||||
|
||||
SUBSYSTEM_DEF(sun)
|
||||
name = "Sun"
|
||||
wait = 1 MINUTES
|
||||
flags = SS_NO_TICK_CHECK
|
||||
|
||||
var/azimuth = 0 ///clockwise, top-down rotation from 0 (north) to 359
|
||||
var/list/datum/sun/suns = list()
|
||||
var/datum/sun/primary_sun
|
||||
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)
|
||||
primary_sun = new
|
||||
suns += primary_sun
|
||||
primary_sun.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
|
||||
for(var/S in suns)
|
||||
var/datum/sun/sun = S
|
||||
sun.azimuth += azimuth_mod * base_rotation
|
||||
sun.azimuth = round(sun.azimuth, 0.01)
|
||||
if(sun.azimuth >= 360)
|
||||
sun.azimuth -= 360
|
||||
if(sun.azimuth < 0)
|
||||
sun.azimuth += 360
|
||||
complete_movement()
|
||||
|
||||
/datum/controller/subsystem/sun/proc/complete_movement()
|
||||
SEND_SIGNAL(src, COMSIG_SUN_MOVED, azimuth)
|
||||
SEND_SIGNAL(src, COMSIG_SUN_MOVED, primary_sun, suns)
|
||||
|
||||
/datum/controller/subsystem/sun/vv_edit_var(var_name, var_value)
|
||||
. = ..()
|
||||
if(var_name == NAMEOF(src, azimuth))
|
||||
complete_movement()
|
||||
#undef OCCLUSION_DISTANCE
|
||||
|
||||
Reference in New Issue
Block a user