- Java 94.6%
- Shell 3%
- Python 2.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Build against the Update 8 Part 4 pre-release server (0.8.0-pre.5) and declare the matching compatibility range. - useVersion 0.8.0-pre.5 (pre-release patchline) - ServerVersion lower bound moved to 0.8.0-pre.5, keeping the 0.9.0 upper bound so the range stays inside the 0.8 line - mod Version 1.8.5 No source changes were needed: the pre.5 plugin-facing changes (the new TaskRegistry scheduler replacing World.scheduleAfter, the BlockMapMarkersResource getMarkersCopy()/get() renames, and the netty stream priority deprecation) do not touch code this mod uses. The mod keeps its own executor and builds and enables cleanly against pre.5. |
||
| bin/main | ||
| docs | ||
| gradle/wrapper | ||
| src/main | ||
| tools | ||
| .gitignore | ||
| build.gradle.kts | ||
| extract_light_sources.sh | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle.kts | ||
| thumbnail.png | ||
LightAutomation
A Hytale mod for automating lighting systems. We've all been there, having to go around the whole world at dawn and dusk just to turn lights on and off.
Features
- Automatic Street Lights: Lights turn on at dusk and off at dawn
- Smart Time Detection: Uses sunlight factor to detect precise dawn/dusk transitions
- Player Light Tracking: Automatically tracks player-placed light sources
- Persistence: Saves tracked lights across server restarts
- Configurable Timing: Adjust when lights activate/deactivate
- Your config is yours: an existing configuration file is never rewritten; your edits survive restarts
- Outdoor lights only: Lights placed indoors/in caves etc will not be automated
Installation
- Place the LightAutomation.jar file in your Hytale server's
mods/directory - Start your server
- A configuration file is created on first run (
LightAutomationConfig.jsonin the plugin's data directory, next to the jar's mod folder) - Edit the configuration as needed
The mod creates that file on first run and never rewrites it on startup or shutdown, so your
edits stay exactly as you left them across restarts. The lights types commands below are the
exception: they rewrite the file from the settings the mod knows about. If the file cannot be
read (for example a duplicated entry), it is moved aside to
LightAutomationConfig.invalid-<timestamp>.json, the log says why, and the mod runs on defaults
- the server still boots.
Player usage
Depending on the DefaultLogic configuration option all lights placed outdoors will either be automated by default, or not. A player can choose to interact with the light (turn it on, or off, depending on its state) once during the first 10 seconds it has been placed to either opt out of automation, or opt-in, again depending on what the default value is.
(This might seem complicated, but I found no way of detecting when a player changes the state of just any light in the current Hytale API)
Why are torches not automated by default?
Most players probably assume torches won't go on and off, even if they're outdoors, so every
torch is in StaticLightTypes in the shipped defaults. That is only the default: move any ID
to the other list in your own config (or with /lightautomation lights types add <id>), and the
mod will automate it.
Configuration Options
The mod supports the following configuration options:
EnableLightAutomation: Enable/disable light automation functionality (true/false)DefaultLogic: Whether placed lights are automated by default, or vice versa (on/off)LoggingLevel: Level of logging detail (off, processing, debug)DawnThreshold: Percentage of sunlight required to turn off lights (>0.000 and <1.000)DuskThreshold: Percentage of sunlight required to turn on lights (>0.000 and <1.000)ToggleableLightTypes: Array containing lights the mod should automateStaticLightTypes: Array containing lights the mod should not automate
Notes:
- Block type IDs are matched case-insensitively, so
deco_lanternandDeco_Lanternare the same entry. - Unknown top-level keys are ignored and reported in the server log; restarts leave the file
alone.
$Commentkeys are accepted as metadata while reading. Alights typeswrite command rewrites the file from the known settings only, so anything else in it (including$Comment) is dropped at that point - keep long-lived notes outside the file. - An ID in both lists is reported in the log and by
lights types check. - The arrays are authoritative: an empty array means "automate nothing", not "use the built-in defaults".
Caveat regarding dusk: Currently the Hytale API reports 0 sunlight well before the sun actually sets. I assume this to be a bug, but until it's fixed you'll likely want this to be 0.004 or something in that range.
Commands
Every action is a subcommand:
/lightautomation- displays available commands/lightautomation version- displays version/lightautomation reload- reloads and applies updated configuration/lightautomation config- displays current configuration settings/lightautomation save- manually saves tracked lights/lightautomation clear- clears all tracked lights/lightautomation info- shows persistence information/lightautomation lights- shows the tracked lights summary/lightautomation lights list [<type>] [--all]- lists tracked lights grouped by type; give a type to drill into it,--alllifts the 20-row cap/lightautomation lights types list- lists both configured lists (unknown IDs are marked*)/lightautomation lights types check- checks configured IDs against the game and the shipped defaults/lightautomation lights types add <blockTypeId> [--static]- add an ID to the toggleable (default) or static list/lightautomation lights types remove <blockTypeId>- remove an ID from both lists and stop tracking existing lights of that type/lightautomation lights types defaults- add shipped defaults that are missing from your config
reload, save, clear and the lights types write commands require the permission
defxor.lightautomation.config (admin-only in practice). Their changes are saved to the config
file and apply to lights placed from now on; already placed lights are not rescanned.
remove does stop tracking the lights of that type that are already tracked.
Deprecated flags
The old flag spellings still work in this release and are removed in the next one:
| Flag | Use instead |
|---|---|
--version |
version |
--reload |
reload |
--config |
config |
--save |
save |
--clear |
clear |
--info |
info |
--lights |
lights |
Older READMEs also listed /lightautomation --lights list, --lights count and
--lights types. Those were never implemented - the flags are booleans, so the extra word
only produced a usage error. Their real equivalents are lights list, lights and
lights types list.
Upgrade notes
- Existing configs are left as they are. Restarts never rewrite the file. The shipped
defaults only apply to new installs (or to a key you deleted).
lights types checkshows which shipped defaults your config is missing, andlights types defaultsadds them on request. It only adds: it never moves an ID between lists and never removes one, so a deliberate deletion stays deleted. - An emptied list now means empty. Earlier versions silently fell back to the built-in
lists when an array was empty; now an empty
ToggleableLightTypesreally does disable automation for every type. - A broken config no longer takes the server down. Duplicate entries used to crash the server at boot; the file is now moved aside and the mod runs on defaults.
- Classification changes are reported, not applied. If an ID you keep in one list is
shipped in the other (for example a torch you kept toggleable),
checksays so and leaves your choice alone.
Updating the defaults after a game update
The default lists are generated from the game assets. With a local Assets.zip (the script
defaults to ~/hytale/Assets.zip, override with ASSETS_ZIP):
python3 tools/scan_light_types.py # print the two lists
python3 tools/scan_light_types.py --check src/main/java/dev/defxor/lightautomation/config/LightAutomationConfig.java
Paste the printed lists into LightAutomationConfig and run --check to confirm. A server
admin does not need this: lights types check and lights types defaults cover the upgrade
without touching source.
License
Creative Commons Zero