{"id":"dooougs/solar-system","name":"solar-system","scope":"dooougs","platform":"roblox","description":"A real sun, moon and planets over any place on Earth from a shared clock, plus optional Roblox Lighting driver","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"85acfc727dfa7fe18fbb5458ff9c7f39932a2a70274d94f9a0fd74c4169324a2","likes":0,"downloads":0,"install":"forest install dooougs/solar-system","url":"https://forest.dev/p/roblox/dooougs/solar-system","files":"https://api.forest.dev/ai/package/roblox/dooougs/solar-system/files","readme":"# SolarSystem\r\n\r\nA real sun, moon and planets over any place on Earth, worked out from a shared\r\nUTC clock, for Roblox. Every server and client computes the same sky with\r\nnothing sent over the network. Optional client driver moves Roblox's own sun\r\nto match and eases the lighting through night, dawn, day and dusk.\r\n\r\nExtracted from Plant World.\r\n\r\n## Install\r\n\r\n```toml\r\n[dependencies]\r\nSolarSystem = \"dooougs/solar-system@0.1.0\"\r\n```\r\n\r\n## Use\r\n\r\n```lua\r\nlocal SolarSystem = require(ReplicatedStorage.Packages.SolarSystem)\r\n\r\nlocal sky = SolarSystem.new({\r\n    location = { lat = 55.95, lon = -3.19 }, -- or function() return lat, lon end\r\n})\r\n\r\nprint(sky:phase(), sky:daylight(), sky:state().sunrise)\r\nsky:onPhaseChanged(function(phase, state) print(\"now\", phase) end)\r\n\r\n-- client only\r\nSolarSystem.Lighting.start(sky, { indoor = nil, updateEvery = 0.5 })\r\n```\r\n\r\n### `SolarSystem.new(options)`\r\n\r\n| option | default | |\r\n|---|---|---|\r\n| `location` | required | `{lat, lon}` or `function() -> lat, lon` (lazy, may yield) |\r\n| `clock` | `workspace:GetServerTimeNow` | `function() -> unix seconds` |\r\n| `offsetAttribute` | `\"SolarHourOffset\"` | attribute with a test hour offset; `false` turns it off |\r\n| `offsetHolder` | `ReplicatedStorage` | instance holding that attribute |\r\n| `dayAbove` / `nightBelow` | `6` / `-6` | sun heights (degrees) bounding day and night |\r\n| `horizon` | `-0.833` | sunrise/sunset height |\r\n| `watchInterval` | `0.5` | seconds between phase checks |\r\n| `phaseEvents` | `true` | `false` and `onPhaseChanged` never fires |\r\n\r\n### `SolarSystem.Lighting.start(sky, options)` (client)\r\n\r\n| option | default | |\r\n|---|---|---|\r\n| `placeSun` | `true` | move Roblox's sun (ClockTime + GeographicLatitude) to the real sun |\r\n| `blendLooks` | `true` | blend Brightness, ambient, colour shift by sun height |\r\n| `looks` | `DEFAULT_LOOKS` | `{ {at = degrees, look = {...}} }`, last is the day |\r\n| `dayLookFromPlace` | `true` | read the day look from the place's own Lighting |\r\n| `dayLookDelay` | `0` | seconds to wait before reading it |\r\n| `atmosphere` / `colorCorrection` / `sunRays` | `true` | which effects to tint |\r\n| `updateEvery` | `0.5` | seconds between updates |\r\n| `indoor` | `nil` | `function() -> {inside, dark?, tint?, bright?}` for indoor light |\r\n| `connect` | `signal:Connect` | `function(signal, label, fn)` to hook a frame budgeter |\r\n\r\n### Pure maths\r\n\r\n`SolarSystem.Astro` (subsolar point, moon, `sunAt(lat, lon, t)`),\r\n`SolarSystem.Geo` (lat/lon <-> globe vectors), `SolarSystem.Planets.sky(t)`,\r\n`SolarSystem.MoonMap` (Moon brightness tiles).\r\n","readmeTruncated":false}