Files
Polaris/code/modules/planet/planet.dm
Anewbe 2d94e00267 Clones merc simple_animal mobs into the simple_mob format (#5363)
* Planet controller startup delay

* Fix the New() on this interfering with my work!

* Creates SSplanets subsystem

For SPEEDYNESS

It probably works. I mean it's hard to sit there for 8 hours and test it. But it seems to work okay. At worst if it doesn't you'll have weather that doesn't make sense. ;v

* Reworks weather to fit the faster weather ticker

* Allows AIs to produce and control maint/construction/mining drones. (#5282)

* Allows AIs to control maint/construction drones.

* Radio control online.

* Things Not Saving

* Drone control respects intellicores.

* Config control, AI drones are disableable if the AI isn't an antag.

* There's a diff so it must have saved. Right?

* No un/wrenching of the core.

* Complies to Replies.

* Folders props, and adds the laser prism, receptor, and sealed doors. (#5337)

* Re-bases props, and adds the laser prism.

* Ver 1 of Puzzle Lock and Doors

* Doors

* Fix door hiccup I made, modify Prism

* Converts merc simple_animal to simple_mob
2018-06-21 00:19:29 -07:00

55 lines
2.0 KiB
Plaintext

// This holds information about a specific 'planetside' area, such as its time, weather, etc. This will most likely be used to model Sif,
// but away missions may also have use for this.
/datum/planet
var/name = "a rock"
var/desc = "Someone neglected to write a nice description for this poor rock."
var/datum/time/current_time = new() // Holds the current time for sun positioning. Note that we assume day and night is the same length because simplicity.
var/sun_process_interval = 1 HOUR
var/sun_last_process = null // world.time
var/datum/weather_holder/weather_holder
var/sun_position = 0 // 0 means midnight, 1 means noon.
var/list/sun = list("range","brightness","color","lum_r","lum_g","lum_b")
var/list/datum/lighting_corner/sunlit_corners = list()
var/expected_z_levels = list()
var/turf/unsimulated/wall/planetary/planetary_wall_type = /turf/unsimulated/wall/planetary
var/list/turf/simulated/floor/planet_floors = list()
var/list/turf/unsimulated/wall/planetary/planet_walls = list()
var/needs_work = 0 // Bitflags to signal to the planet controller these need (properly deferrable) work. Flags defined in controller.
/datum/planet/New()
..()
weather_holder = new(src)
current_time = current_time.make_random_time()
update_sun()
/datum/planet/proc/process(last_fire)
if(current_time)
var/difference = world.time - last_fire
current_time = current_time.add_seconds(difference SECONDS)
update_weather() // We update this first, because some weather types decease the brightness of the sun.
if(sun_last_process <= world.time - sun_process_interval)
update_sun()
// This changes the position of the sun on the planet.
/datum/planet/proc/update_sun()
sun_last_process = world.time
/datum/planet/proc/update_weather()
if(weather_holder)
weather_holder.process()
/datum/planet/proc/update_sun_deferred(var/new_range, var/new_brightness, var/new_color)
sun["range"] = new_range
sun["brightness"] = new_brightness
sun["color"] = new_color
needs_work |= PLANET_PROCESS_SUN