GZ-Diplomacy [Friendly/Neutral/Hostile Teams + Separate Start and Research]

by gz-mods

0.4.9 #TEAM_TERRITORY_AND_LAND_GRABS A fully featured Oarc-style multiplayer module for GIZMOD. Allows for multiple forces (teams) with their own tech trees, resources, spawn locations, private chat, and personalization settings per-team and per-player. Fully integrated with the GIZMOD modular ecosystem for maximum depth of gameplay and advanced multiplayer interaction.

Overhaul
4 hours ago
2.0
276

Changelog

Version: 0.5.55
Date: 2026-09-26
  Territory:
    - Replaced the 2x2-cell radius/enclosure territory model with direct 32x32 Factorio chunk ownership.
    - A qualifying player building now claims only the map chunk(s) physically touched by its bounding box; no border abstraction, enclosure fill, starter rectangle, or projected claim radius remains.
    - Claiming buildings may seed unclaimed chunks directly but cannot be placed across another team's claimed chunk.
    - Transit/mobile infrastructure such as belts, pipes, rails, poles, rail signals, trains/vehicles, robots, and land mines remains territory-exempt and does not paint claim corridors.
    - Territory Flags and Light Resource Outposts now claim their occupied chunk instead of projecting special claim areas.
    - Existing saves perform one simple configuration-change rescan of qualifying team buildings; old inferred/starter/enclosure territory is intentionally not preserved.
  Performance:
    - Removed synchronous enclosure reconstruction, direct-cell topology caches, trailing-edge territory batch commits, and projected flag-placement scans.
    - Territory ownership is now an event-driven per-chunk reference count updated by build and destruction events.
    - Map-color territory proxies are now one 32x32 proxy per claimed chunk and dirty rendering is processed one changed chunk at a time.
Version: 0.5.54
Date: 2026-09-26
  Documentation:
    - Added the root AGENTS.md integration charter with mod-specific authority rules and the canonical GIZMOD service/API guide.
Version: 0.5.53
Date: 2026-09-25
  Integration:
    - Registered Diplomacy with the GIZMOD Item Tabs API; items, fluids, and recipes created by this mod are grouped into its own row under the active MASTER tab.

Version: 0.5.52
Date: 2026-09-24
  Performance:
    - Removed synchronous territory-border reconstruction from offline-protection sync; player join/leave no longer forces a whole-map border scan.
    - Removed the 30-second global border-cache rebuild/audit path that produced periodic multi-second hitches on mature territory maps.
    - Offline teams now do no border-rebuild work and continue using their last completed border snapshot.
    - Stale snapshots for online teams are rebuilt atomically in the background through one shared traversal capped at 256 territory cells per tick.
    - Multiple online teams share the same bounded traversal, so one territory pass can refresh every stale online team without per-team blocking scans.
    - If a team goes offline before its replacement snapshot finishes, the incomplete staging copy is discarded, the previous completed snapshot remains active, and Gizmod records an explicit stale-cache event.
    - Preserved the pre-0.5.52 aggregate border cache as a migration fallback for teams already offline during upgrade.
  Diagnostics:
    - Split offline-protection runtime profiling into team-state sync, protect/restore, incremental border rebuild, cached border scan, and segmented-unit scan scopes.

Version: 0.5.51
Date: 2026-09-24
  Fixed:
    - Fixed continuous profiler output exceeding Factorio's 20-parameter LocalisedString limit when many runtime scopes were active in the same one-second window.
    - Runtime profile windows are now packed into a bounded nested LocalisedString tree, preserving one Gizmod profile write per window while safely rendering every scope's LuaProfiler value.
    - Broad event/tick/command/remote profiling from 0.5.50 remains unchanged; only profile output serialization was corrected.

Version: 0.5.50
Date: 2026-09-24
  Changes:
    - Replaced targeted-only profiling with continuous broad runtime profiling through the Gizmod debugger.
    - Automatically profiles every registered Diplomacy runtime event in one-second windows.
    - Added granular on_tick subsystem profiling for spawn preview, territory, offline protection, chunk culling, shared vision, diplomacy updates, UI refreshes, and statistics reporting.
    - Profiles all Diplomacy console commands and remote-interface entry points so external work cannot bypass diagnostics.
    - Added runtime-profiler heartbeat events to the structured Gizmod JSONL stream, including profile-write health.

Version: 0.5.49
Date: 2026-09-24
  Fixed:
    - Reworked prepared-spawn generation into a staged center/footprint pipeline: cheap spacing/protected-zone checks run before map generation, water candidates initially request only a 1-chunk radius, and full candidate validation/preview preparation uses a 4-chunk radius instead of the former radius-8 request.
    - Frozen each spawn attempt's seed offset and coordinates while it waits for chunks, preventing team-count changes from moving an in-progress attempt and wasting already-requested generation.
    - Spawn chunk requests are now one-shot per validation stage/radius with a slow retry instead of being re-issued every tick while a candidate is pending.
    - Prepared-candidate chunk readiness is now polled once per second after the preparation delay instead of scanning the full readiness footprint every tick.
    - Removed the second unfiltered entity scan from prepared-start cliff clearing; cliff cleanup now uses a single bounded cliff-type scan.
    - Bumped the prepared-spawn queue schema so upgrading clears stale in-progress candidates created by the old radius/coordinate logic.
  Diagnostics:
    - Added granular Gizmod debugger events for queue arming, candidate geometry, chunk requests/readiness, land/walkability, spacing/protected zones, landmass/resource validation, preparation, cleanup, preview launch, enemy sanitization, and final readiness.
    - Added per-resource, oil, water, and verification diagnostics during starter-resource stamping.
    - Routed real LuaProfiler values through Gizmod's profile debug stream instead of serializing the unusable literal "[LuaProfiler]" into JSON; timings are written to GIZMOD_logs/profile_gz-diplomacy.log with matching trace/attempt/stage identifiers.
    - Waiting states now emit throttled 10-second checkpoints rather than per-tick/per-second duplicate debug events, keeping the diagnostic stream useful without making logging itself a UPS problem.

Version: 0.5.48
Date: 2026-09-24
  Changes:
    - Replaced the Light Resource Outpost inventory icon with the new fortified steel-platform artwork featuring four corner turrets, four ramps, and the painted central flag.
    - Reports canonical Diplomacy team display names and membership metadata to Gizmod's shared Global Statistics registry.

Version: 0.5.47
Date: 2026-09-24
  Fixed:
    - Replaced the invalid LuaPlayer.cursor_position placement-preview path with Factorio-native cursor visualization plus an automatic exact-validity placement band.
    - Territory Flag placement now shows a neutral flag/12x12 footprint at the build cursor, while green ground shading appears only at build centers that pass both Factorio's cursor-build check and the same overlap/enemy-territory rule used by actual placement.
    - Removed the reachable call to the old repeating territory-flag stamps; no repeated flag pattern is drawn across owned territory.
    - Territory Flags remain explicitly exempt from GZ-Terra/Hardmode foundation requirements.
Version: 0.5.44
Date: 2026-09-23
  Changes:
    - Added a live Time until next cull readout to the admin Map Chunk Culling settings.

Version: 0.5.43
Date: 2026-09-21
  Changes:
    - GZ Ecology honeypots are exempt from Diplomacy territory placement restrictions and do not create territory claims.

Version: 0.5.42
Date: 2026-09-21
  Changes:
    - Separated admin navigation from Diplomacy team membership changes.
    - Admin Switch Force + Teleport and Teleport Only never clear inventory.
    - Admin force switching no longer creates or repairs team membership implicitly.
Version: 0.5.41
Date: 2026-09-21
  Changes:
    - Pure admin navigation teleports no longer participate in the team inventory-strip boundary.
    - Teleport Only and Go-to-player preserve the teleported player's inventory; normal leave, restart, assignment, Join + Teleport, and team switching still wipe inventory as before.
Version: 0.5.40
Date: 2026-09-21
  Changes:
    - Removed the wide spawn walkability search that could snap water candidates onto nearby coastlines.
    - New-team spawn candidates must now originate on land and may only move locally to clear ordinary collision.
    - Spawn previews now reject candidates unless the full canonical starter solid-resource ring fits on land, preventing coastal clipping of coal/other starter patches.
Version: 0.5.39
Date: 2026-09-20
  Changes:
    - Added persistent total play-time tracking for every player using Factorio's cumulative online-time counter.
    - Existing saves import historical player playtime on configuration change; connected players remain synchronized during play and on disconnect.
    - Added Play Time columns to team rosters and admin player/team management views.
Version: 0.5.38
Date: 2026-09-20
  Changes:
    - Removed spawn-spacing controls from the in-game Diplomacy Game Settings panel.
    - Spawn spacing now reads only the Map Settings values (4500 / 1200 / 7200 defaults).
    - Deleted obsolete stored spawn-spacing GUI overrides.

Version: 0.5.37
Date: 2026-09-20
  Changes:
    - Removed external/player-guide tabs from the Diplomacy window. The window now contains only Welcome and Diplomacy-owned tabs; Terra TL;DR remains in Terra's intro/guide.
Version: 0.5.36
Date: 2026-09-20
  Changes:
    - Added GZ-Chemistry saltpeter as an optional guaranteed team-start resource when the prototype is present.
    - Places saltpeter on a small second starter ring so it does not crowd the established six-resource cluster.
Version: 0.5.35
Date: 2026-09-19
  Changes:
    - Compressed the default separate-team spawn geometry to roughly 60% of the previous scale.
    - Default max distance from origin is now 4500 tiles, minimum team spacing 1200, and maximum nearest-team spacing 7200.
    - Existing saves still using the untouched old defaults migrate to the new spacing without overwriting explicit Diplomacy GUI overrides.

Version: 0.5.34
Date: 2026-09-20
  Changes:
    - Add player_start_resolved remote status so dependent GZ modules can distinguish spawn scouting from a committed team start.

Version: 0.5.33
Date: 2026-09-19
  Performance:
    - Reworked direct shared-vision radar/player refreshes into a chunk-budgeted queue. At most two recipient chunks are refreshed per tick instead of charting every shared radar/player region in one 10-second burst.
    - Deduplicated overlapping shared-vision chunks within each refresh cycle, so dense radar fields no longer repeatedly chart the same recipient chunks. If a very large refresh cannot finish within ten seconds, it continues at the bounded rate instead of starting another burst.
    - Moved segmented-unit offline-protection checks off the shared-vision phase. Only one relevant surface starts a segmented scan at a time, and at most eight segmented units are evaluated per tick instead of scanning every segmented unit on every surface in one frame.
    - Reduced the fallback full-radar audit from once per minute to once per ten minutes; normal radar construction remains event-driven.
Version: 0.5.32
Date: 2026-09-19
  Changes:
    - GZ Diplomacy-owned frames, tab panes, scroll panes, setup/diagnostic windows, and team cards now use Gizmod's per-player Glass UI styles instead of vanilla opaque gray GUI styles.
    - Special political-map and war-alert presentation styles are preserved. Vanilla Factorio GUI is not modified.
Version: 0.5.31
Date: 2026-09-19
  Fixed:
    - Replaced ineffective cross-force live radar proxy sharing with the established shared-radar workaround: direct recipients now have their chart refreshed every 10 seconds around the source team's powered radars and connected players.
    - Radar refresh range follows each radar prototype's nearby reveal radius, with the vanilla radar resolving to approximately the same 112-tile footprint used by shared-radar.
    - Added direct-refresh provenance suppression so refreshed chunks are never republished by a receiving team, preserving strict one-hop vision even on builds that emit chart events for LuaForce.chart().
    - Legacy invisible shared-vision radar/player helpers are cleaned up and no longer maintained; private source proxy forces remain only for clean one-hop historical chart propagation.
Version: 0.5.30
Date: 2026-09-18
  Fixed:
    - Fixed spawn-preview invulnerability leaking into newly founded teams. Preview scouting saves/restores the character's pre-preview destructibility state instead of leaving the founder indestructible after Keep.
    - Prevented the undecided-player mining lock from capturing temporary preview invulnerability as the player's baseline state.
    - Added a low-frequency enemy-relation audit so native enemy friendship/cease-fire state is repaired even if another mod rewrites force relations after the normal force-change events.
Version: 0.5.26
Date: 2026-09-18
  Changes:
    - Reworked shared vision to be strictly one-hop. Each source team now publishes only its own chart/live coverage through a private vision proxy force, so received intelligence is never daisy-chained to another recipient.
    - Added live shared radar coverage. Powered source radars are mirrored by invisible vision-only radar proxies, allowing direct recipients to use live/remote map view where the source has active radar coverage.
    - Added live player-area sharing. Connected source-team players contribute their normal nearby live reveal to direct vision recipients.
    - Existing radars are audited during migration and new radars are registered as they are built. Shared-vision helpers and proxy forces are cleaned up with team lifecycle changes.
    - Real Diplomacy team forces keep native share_chart disabled; only private vision proxy forces use native chart sharing.
    - Legacy team-force chart history is not blindly copied into the new proxy because old shared-vs-self provenance cannot be recovered safely; already revealed map remains known while clean one-hop chart history accumulates from 0.5.26 onward.

Version: 0.5.25
Date: 2026-09-17
  Fixed:
    - Wall enclosure size limits are now applied per sealed interior pocket instead of to the combined derived territory for the entire team/surface.
    - Internal divider walls can now split a large connected perimeter into independently recognized territory sections.
    - Oversized pockets are skipped individually without discarding valid smaller enclosures elsewhere in the same connected wall component.
Version: 0.5.24
Date: 2026-09-17
  Chunk culling / territory retention:
    - Culling now builds its 8-chunk retention buffer from every actually owned Diplomacy territory cell, including enclosure-derived territory, instead of only from direct claim-source rectangles.
    - Rail and Cargo Ships waterway infrastructure preserves only the exact chunk containing the rail; it does not receive an 8-chunk buffer.
    - Added elevated rail entity types to the exact-chunk rail protection scan.
    - Bumped the cull-plan schema so an in-progress older sweep cannot resume with the previous protection snapshot.
Version: 0.5.23
Date: 2026-09-17
  Chunk culling / Hellworm crash fix:
    - Removed the unsafe per-unit Hellworm destruction path introduced in 0.5.21. Diplomacy no longer calls LuaSegmentedUnit.destroy() during a cull.
    - Hellworm-only engine territories are now retired with LuaTerritory.destroy(), which atomically removes the territory and all segmented units guarding it before remote chunks are considered for deletion.
    - Hellworm territory retirement is throttled to two territories per tick instead of destroying every spawned Hellworm synchronously when the cull begins.
    - Added a one-tick settle phase after the final Hellworm territory retirement so delete_chunk is never called in the same tick as a territory destruction.
    - Restored a strict final safety gate: any chunk still associated with any live segmented unit, including a newly spawned Hellworm, is preserved for the current sweep rather than attempting an in-place cleanup.
    - Corrected Hellworm identification to use LuaSegmentedUnit.prototype.name rather than treating segmented units as LuaEntity objects.
Version: 0.5.22
Date: 2026-09-17
  Admin Teams:
    - Restored the previously orphaned admin team-management UI as a dedicated Admin Teams tab visible to server admins.
    - Added admin self-navigation for every active team: Join + Teleport uses normal team-switch/inventory-wipe rules, while Teleport Only moves the admin without changing membership.
    - Added per-player admin navigation with direct teleport-to-player and spectator controls for every connected player.
    - Admins may now enter spectator mode while already assigned to a team; returning restores their original team force/controller/body and reopens Admin Teams.
    - Admin spectator targeting also supports connected unassigned players and team members whose main spawn is unavailable.
    - Preserved the existing orphaned controls for Assign / Move, Assign + Teleport, Remove / Reset, Teleport to Selected Spawn, Respawn Starting Resources, direct-join open/close, display-name rename, and roster overview.
Version: 0.5.21
Date: 2026-09-17
  Chunk culling / Hellworms:
    - Scheduled and manual chunk culls now destroy all spawned GZ-Terra Hellworms before evaluating remote chunk deletion, allowing their engine segmented-unit territories to shrink and disappear with culled chunks.
    - The existing segmented-unit crash guard remains in place for vanilla demolishers and all non-Hellworm segmented units; those territories are still preserved while a live unit guards them.
    - Added a per-candidate Hellworm cleanup fallback so a Hellworm that respawns during a long cull is removed before its territory chunk is deleted.
    - Cull completion reports how many spawned Hellworms were removed.
Version: 0.5.20
Date: 2026-09-17
  Territory batching:
    - Replaced the old 1-tick quiet window + 60-tick commit throttle with a true 60-tick trailing-edge debounce. Territory topology/enclosure work now runs only after one full second with no further territory construction or deconstruction.
    - Valid player, robot, and script-built territory sources now start/touch their team+surface batch before claim mutation, so overlapping placements still participate in the active batch.
    - Tracked territory-source destruction is assigned to the owning batch immediately when the destruction event arrives, before bounded removal-queue processing. Each batch tracks outstanding removals and cannot commit until all removals assigned to it have been applied.
    - Continuous blueprint/bot activity now extends one batch rather than forcing a topology commit every second while construction is still in progress.
Version: 0.5.19
Date: 2026-09-17
  Starting flow:
    - The initial Diplomacy window now auto-opens only once and respects manual/ESC closure instead of reopening every 15 ticks and blocking access to Factorio's normal menu.
    - Undecided players are no longer immobilized while choosing a team; they may move normally and close/reopen Diplomacy as needed.
    - Direct player mining is locked until the player joins or founds a team, including during spawn scouting. The existing full freeze after a spawn-preview timer expires is preserved until the player keeps, rejects, or cancels the candidate.
Version: 0.5.18
Date: 2026-09-17
  Spectator view:
    - Spectators now temporarily use the viewed team's force while spectating so the map screen shows that team's complete explored chart instead of the default force's sparse chart fragments.
    - The temporary force assignment is explicitly excluded from team-membership repair and offline-protection online checks; returning to the starting screen restores the spectator's original force.
    - Spectate Existing Teams now provides separate Spectate buttons for each team's Main base and every team member, with offline players shown but disabled.
    - The in-spectator overlay now includes quick-jump buttons for Main base and all currently connected members of the viewed team.
Version: 0.5.17
Date: 2026-09-16
  Shared vision:
    - Replaced LuaForce.copy_chart bootstrap with additive per-chunk chart sharing, so enabling Shared Vision can never erase or replace map areas already explored by the receiving team.
    - Existing source-team chart is queued through the same one-chunk-per-tick propagation path used for live exploration instead of being copied wholesale.
    - Shared-chart queue entries now retain the source team and are discarded if that source stops sharing vision before the queued reveal is processed.
Version: 0.5.16
Date: 2026-09-16
  Performance:
    - Research announcements now use one native LocalisedString game.print broadcast instead of scheduling request_translation callbacks for every connected player.
    - Removed the per-player pending-translation state churn from the research-finished hot path while preserving each player's localized technology name and the team display name.
Version: 0.5.15
Date: 2026-09-16
  Team membership:
    - Joining, switching, leaving, admin-removing, or disbanding a player's team now enforces a hard carried-inventory wipe at the membership boundary.
    - Direct Join now supports switching from one team to another; the old team is left first, inventory is discarded, and the player is then assigned to the destination team.
  Administration:
    - Admins can rename a team's player-facing display name from the Diplomacy administration panel or /gzd-team-rename. Internal team IDs and force names are never changed.
Version: 0.5.14
Date: 2026-09-14
  Performance:
    - Eliminated whole-bounding-box Territory Flag stamp scans from the Show territory overlay; flag candidates are now visited only on rows containing owned territory, preventing distant/disconnected outposts from producing enormous empty-grid sweeps.
    - Replaced global own-territory overlay invalidation with per-team/per-surface revisions, so one team's claim change no longer forces every connected player's full overlay to rebuild.
    - Cached computed placement-overlay geometry per team/surface revision so teammates reuse the same territory runs and border geometry instead of rescanning/sorting the territory grid independently.
    - Added an incrementally maintained direct-claim cell index for enclosure reconstruction, removing the old whole-surface territory scan from each topology commit.
    - Territory batches now remember their own dirty chart blocks, avoiding a scan of every team's pending block table on each commit.
    - Added a pre-flood safety guard for extremely large enclosure component bounding boxes so pathological long-distance connected territory cannot create a single giant synchronous flood-fill hitch.
    - Offline protection no longer rescans every territory cell on its 30-second border-cache timer when territory and offline-team membership are unchanged; the cache is now revision-driven.
Version: 0.5.13
Date: 2026-09-06
  Chunk culling:
    - Fixed a Factorio hard crash caused by deleting generated chunks belonging to a live segmented-unit/demolisher territory.
    - The culler now refuses to delete any chunk whose LuaTerritory is currently guarded by one or more segmented units.
    - Added a second pre-delete guard for chunks physically occupied by segment/segmented-unit entities, including un-territoried segmented units.
    - Added a 32-candidate-per-tick scan budget so long runs of newly protected chunks cannot create a new culling UPS spike.
    - Bumped the cull-plan schema so any in-progress 0.5.12 deletion queue is discarded on upgrade.
Version: 0.5.12
Date: 2026-09-06
  Chunk culling:
    - Fixed a critical safety bug where a chunk cull could delete a connected player's physical character/chunk when the player's current controller/camera position differed from their physical position.
    - Player cull protection now anchors the physical controller position, attached/associated characters, and occupied vehicle with the normal 8-chunk safety buffer.
    - Added a final pre-delete failsafe that refuses to delete any chunk containing a character entity.
    - Bumped the cull-plan schema so any in-progress pre-fix deletion queue is discarded and rebuilt safely after upgrade.

Version: 0.5.11
Date: 2026-09-06
  Changes:
    - Batch construction and deconstruction territory topology updates until one full tick passes with no further changes.
    - Limit expensive enclosure/overlay topology commits to at most once per team/surface every 60 ticks.
    - Keep direct territory ownership updates immediate for placement legality while deferring chart/render/overlay invalidation.

Version: 0.5.10
Date: 2026-09-06
  Shared vision:
    - Fixed runaway east/south map charting after sharing vision by keeping queued force.chart() areas strictly inside the intended 32x32 chunk instead of ending on the neighbouring chunk boundary.
    - Shared-vision propagation now ignores chunks already pending Factorio chart requests as well as chunks already charted.
    - Clears the saved shared-chart queue once when upgrading GZ-Diplomacy so stale jobs from the old boundary logic cannot continue an existing runaway scan.
Version: 0.5.7
Date: 2026-09-05
  Performance:
    - Merged the 0.5.5 construction/tile-placement performance fix with the 0.5.6 deconstruction performance fix.
    - Keeps the cursor-stack territory overlay refresh disabled while retaining the bounded territory-source removal queue and topology-change coalescing.
Version: 0.5.6
Date: 2026-09-05
  Performance:
    - Deferred territory-source retraction from on_object_destroyed into a bounded eight-source-per-tick queue, preventing hand mining and construction-bot deconstruction bursts from doing unbounded claim removal work in one tick.
    - Coalesced enclosure recalculation more aggressively by marking an enclosure dirty only when a team's direct-claim cell topology actually changes; removing an overlapping claim that leaves another direct claim in place no longer schedules a full enclosure rebuild.
    - Added O(1)-amortized destruction-queue handling with occasional compaction instead of front-removing Lua arrays.
Version: 0.5.5
Date: 2026-09-05
  Performance:
    - Removed the runtime cursor-stack event hook that rebuilt the complete player territory overlay whenever the held stack changed.
    - Fixed severe UPS drops while painting concrete, stone paths, and other tiles; tile brushes can change cursor stack counts continuously, but territory rendering is not cursor-dependent.
    - Territory Flag placement previews remain unchanged because they use native prototype cursor visualizations rather than the retired Lua cursor helper.

Version: 0.5.4
Date: 2026-09-02
  Territory:
    - Territory Flags may now be placed as long as their 12x12 claim footprint overlaps at least one cell of the team's existing territory.
    - The physical 2x2 flag marker may sit on unclaimed land just beyond the border, but still cannot be planted directly on enemy-owned territory.
    - Updated the automatic flag placement preview to use the same overlap rule.

Version: 0.5.3
Date: 2026-09-02
  Changes:
    - Added spectator buttons for every active team with a prepared spawn on the Preparation/start screen.
    - Spectator mode cycles teams with a `Next team: [team name]` button and returns cleanly with `Return to starting screen`.
    - Spectating is onboarding-only, does not join or change the player's team/force, and restores the original controller and position.
    - Temporary spectator sessions are restored automatically on reconnect so players cannot become stuck outside the starting flow.

Version: 0.5.2
Date: 2026-09-02
  Territory:
    - Belts, underground belts, splitters/loaders, pipes, underground pipes, inline pumps, and offshore pumps are now territory-exempt.
    - These logistics/fluid entities may be placed through unclaimed or foreign territory and never create territory claims.

Version: 0.5.1
Date: 2026-09-02
  Bugfixes:
    - Fixed a crash when applying Game Settings: the settings panel no longer calls require() from an on_gui_click handler.
    - Wired the full player-panel refresh through a parse-time callback, preserving the existing refresh behavior without runtime module loading.
    - Removed three additional deferred require() calls from admin commands so those command paths cannot trigger the same Factorio runtime-require error.

Version: 0.5.0
Date: 2026-09-02
  Team Starts:
    - Each team now receives a one-time leader expansion kit containing 1 Light Resource Outpost and 10 Territory Flags.
    - New teams receive the kit when their founding leader is successfully assigned.
    - Existing active teams receive the kit once on migration to 0.5.0.
    - The grant is tracked per team, so changing leaders does not generate duplicate starter kits.
    - If the leader inventory is full, overflow is spilled safely at the leader's position.

Version: 0.4.98
Date: 2026-09-02
  Territory:
    - Increased each team's starting territory from 50x50 to 96x96 tiles.
    - Existing team starter claims are resized in place on configuration change without forcing a full territory-schema rebuild; overlapping structure/outpost claims are preserved.

Version: 0.4.97
Date: 2026-09-02
  Territory:
    - Fixed belts, underground belts, splitters/loaders, pipes, pipe-to-ground, pumps, and offshore pumps being able to survive placement outside the owning team's territory when their runtime placement metadata was incomplete.
    - Infrastructure classification is now type-authoritative and no longer depends on items_to_place_this/player-creation metadata before applying territory restrictions.
    - Pumps and offshore pumps are now non-claiming infrastructure like belts and pipes: they must be inside owned territory and do not extend the border.
    - Bumped the territory geometry schema so existing saves rebuild claims without legacy pump-based territory extension.

Version: 0.4.96
Date: 2026-09-01
  Administration:
    - Unified chunk culling into one admin checkbox: Enable chunk culling. Culling is enabled by default.
    - Removed the separate Enable automatic chunk culling checkbox; the single master control now governs scheduled culls, Skip next cull, and Cull now.
    - Preserved the warning that disabling culling will severely degrade performance on larger maps.
    - Existing saves migrate to culling enabled unless the explicit 0.4.95 master-disable option had been selected.
    - Kept the legacy set_enabled/status.enabled API as a compatibility alias for integrations, backed by the unified master state.

Version: 0.4.95
Date: 2026-09-01
  Administration:
    - Added a Skip next cull admin action that advances the next scheduled automatic chunk cull by one full configured interval.
    - Added a master Disable chunk culling entirely option. While enabled, both automatic scheduled sweeps and manual Cull now sweeps are blocked, and an active sweep is stopped immediately.
    - Added the warning: disabling culling will severely degrade performance on larger maps.
    - Automatic-culling enablement is preserved separately, so re-enabling the master culling switch resumes the schedule when automatic culling was previously enabled.

Version: 0.4.94
Date: 2026-08-30
  Territory:
    - All entity prototypes of type wall now act as compact territory anchors automatically, including modded wall varieties; gate prototypes are included so gates do not break a perimeter.
    - Walls/gates claim only the single territory grid cell they occupy and may advance outward only when adjacent to existing team territory.
    - Added derived enclosure territory: neutral land fully enclosed by one connected team's direct territory is automatically claimed by that team.
    - Enclosure detection uses four-way connectivity, so diagonal corners do not seal an area and mixed-team boundaries cannot award the interior.
    - Breaking a perimeter removes territory that existed only because of that enclosure; direct claims from flags, outposts, drills, furnaces, buildings, and walls remain authoritative.
  Performance:
    - Enclosure recalculation is event-driven and debounced after territory changes; at most one dirty team/surface is processed on a sparse 15-tick service interval, with no enclosure scan while territory is unchanged.
    - Disconnected direct territory islands are flood-filled independently to avoid scanning the rectangle between distant bases.
    - Derived enclosure claims are capped at 10,000 territory cells as a safety valve against accidental continent-scale loops.

Version: 0.4.93
Date: 2026-08-30
  Changes:
    - Added a generic external player-panel tab hook so dependent mods can inject onboarding pages without putting their copy or logic inside GZ-Diplomacy.
    - Added a Respawn Starting Resources admin action using the existing player dropdown; it rebuilds the selected player's team starter cluster at the team's actual spawn.
    - Added an external starter-resource repair callback path so GZ-Terra can restore Terra-owned starter resources such as graphite separately.

Version: 0.4.92
Date: 2026-08-29
  Fixes:
    - Restored new-team starter resources to the compact spawn-centered cluster used by earlier Diplomacy versions.
    - Canonical iron, copper, coal, stone, sand, and calcite patches now target a ~14-tile ring around the actual team spawn instead of searching progressively outward across the starting area.
    - Terrain fallback/repair stays local to the spawn cluster and terraforms a nearby compact patch rather than moving a missing resource tens of tiles away.
    - Commit-time resource repair now checks the immediate starter cluster instead of accepting unrelated natural ore up to 140 tiles away.
  Settings:
    - Repurposed Starting resource radius as Starting resource cluster radius, default 14 tiles with a 14-64 range.
    - Persisted legacy 96-1024 radius values are automatically treated as the restored 14-tile cluster radius.
Version: 0.4.91
Date: 2026-08-29
  Changes:
    - Permanently protected the central/default starting area from physical chunk culling.
    - Added a one-time migration repair that regenerates missing chunks within the 500-tile origin DMZ radius on upgraded saves.
    - Force-restamps the central DMZ floor, barrier, and terminal after the repair so deleted staging-area terrain is restored correctly.
    - Bumped the culling plan schema so any in-progress pre-0.4.91 sweep is discarded and rebuilt with origin protection.
Version: 0.4.90
Date: 2026-08-29
  Balance:
    - Light Resource Outpost now requires 10 raw fish instead of 5.
Version: 0.4.89
Date: 2026-08-29
  Balance:
    - Light Resource Outpost now requires 5 raw fish instead of 1.
Version: 0.4.88
Date: 2026-08-29
  Diplomacy UI:
    - Added Last active for every team in both the political roster and Team Relations cards.
    - Teams with any connected member show Last active: Now; fully offline teams show elapsed server-running time since their most recently disconnected member was active.
  Activity Tracking:
    - Fixed offline LuaPlayer lookups refreshing last_seen_tick merely because a UI or membership repair inspected the player.
    - last_seen_tick now advances through connected-player activity and the explicit disconnect event, so offline team activity timestamps remain stable.
Version: 0.4.87
Date: 2026-08-26
  Multiplayer:
    - Fixed an immediate player-join desync caused by Diplomacy diagnostic history persisting tostring(table) output.
    - on_player_joined_game sends a structured player table to Gizmod diagnostics; the old compact logger converted that table to a Lua runtime identity such as "table: 0x...", which can differ between peers while being written into synchronized storage.
    - Compact diagnostics now serialize structured player fields deterministically and never stringify table/userdata/function/thread identities.
    - Debug payload truncation now selects keys in deterministic sorted order instead of depending on pairs() traversal order.
    - storage_lib.debug now strips Lua reference-address strings as a second safety boundary before any diagnostic message is stored.
  Notes:
    - No team, territory, spawn, culling, war, or 512-tile Gizmod regeneration behavior changed.
Version: 0.4.86
Date: 2026-08-26
  Bugfixes:
    - Fixed gz-diplomacy.claimed_chunks_in_area failing with "Require can't be used outside of control.lua parsing".
    - Territory is now loaded once while scripts/gizmod_bridge.lua is parsed and the remote interface calls the already-loaded module table.
    - Fixed the same latent runtime-require bug in set_show_territory, set_show_flag_placement, and register_external_claim.
  Notes:
    - Territory ownership, the 512-tile Gizmod regeneration safety buffer, culling, claims, and team behavior are otherwise unchanged.
Version: 0.4.85
Date: 2026-08-26
  API:
    - Added gz-diplomacy.claimed_chunks_in_area, a read-only territory query that returns unique claimed chunk coordinates inside a supplied tile rectangle.
    - Intended for cross-mod safety buffers such as Gizmod enemy-base regeneration.
  Performance:
    - The query runs only when explicitly called; no polling or periodic territory work was added.
Version: 0.4.84
Date: 2026-08-25
  API:
    - Added active_team_count to the gz-diplomacy status snapshot.
    - No team, territory, spawn, or culling behavior changed.
Version: 0.4.83
Date: 2026-08-25
  Bugfixes:
    - Restored/hardened Light Resource Outpost item and recipe visibility.
    - Added a data-final-fixes guard so later compatibility mods cannot leave the outpost hidden or remove its Military 2 unlock effect.
    - Added a one-time bootstrap/configuration repair that enables the Light Resource Outpost recipe for any established force that already researched Military 2.
    - If Military 2 is absent because of another technology overhaul, the outpost recipe now enables as a compatibility fallback.
  Notes:
    - Light Resource Outpost territory behavior and balance are unchanged.
Version: 0.4.82
Date: 2026-08-25
  Features:
    - Added gz-diplomacy.register_external_claim(spec) for other GZ systems to register player/team-owned placeable entities as explicit territory claim anchors without hardcoding their prototype names into Diplomacy.
  Safety:
    - External claims are accepted only when the entity already sits inside territory owned by its force's Diplomacy team, so the API can extend a border but cannot bootstrap ownership in unclaimed or enemy territory.
    - External claims use stable unit-number source IDs and are automatically removed through on_object_destroyed.
Version: 0.4.81
Date: 2026-08-25
  Diagnostics:
    - Routed all 0.4.80 spawn/worldgen profiling through Gizmod's structured debug interface instead of raw Factorio log() calls.
    - Worldgen phases now emit structured worldgen_* events into the gz-diplomacy Gizmod debug module, including candidate position, attempts, profiler time, chunk wait ticks, cliff counts, and resource-stamp results.
    - These diagnostics now appear in GIZMOD_logs/current_gz-diplomacy.json, session_gz-diplomacy.jsonl, and Gizmod's live debug view whenever GZ-Diplomacy debug logging is enabled.
  Notes:
    - No world-generation, spawn queue, or culling behavior was changed.
Version: 0.4.80
Date: 2026-08-25
  Diagnostics:
    - Added targeted [GZ-Diplomacy][worldgen] timing logs around background spawn preparation.
    - Logs candidate scans/rescans, chunk-generation requests, asynchronous chunk wait duration, full-area readiness, cliff clearing, starter-resource stamping, and total candidate-area preparation time.
    - Synchronous phases use Factorio LuaProfiler timings; asynchronous chunk generation reports elapsed wait ticks.
  Notes:
    - No spawn-generation, culling, queue, or gameplay behavior was changed.
Version: 0.4.79
Date: 2026-08-25
  Changes:
    - Generated chunk culling now permanently preserves any chunk containing rail entities.
    - Cargo Ships waterways are automatically covered because straight, diagonal, curved, and legacy waterways use Factorio rail entity types.
  Performance:
    - Rail protection is snapshotted only when a cull begins; there is no new per-tick rail scanner or build/mining bookkeeping.
    - Rail entities are deduplicated by chunk before protection intervals are added.
  Migration:
    - Bumped the culling scan schema so an in-progress older sweep is discarded and rebuilt with rail/waterway protection.

Version: 0.4.78
Date: 2026-08-24
  Changes:
    - Stone furnaces now claim an exact 6x6 territory area and cost 20 stone each. Existing territory is rebuilt once so already-placed furnaces use the compact claim geometry.
  Fixes:
    - Hardened team-start resource generation so canonical resource patches are placed on separated deterministic positions instead of crowding the spawn ring.
    - Added bounded fallback terraforming/repair for resource patches that would otherwise fail on coastlines or unusual modded terrain.
    - Guaranteed the configured starter oil wells more aggressively and added a commit-time repair pass for prepared previews missing an entire required resource type.

Version: 0.4.77
Date: 2026-08-24
  Changes:
    - Reserve Sundry's cells around committed team starting areas through GZ-Economy's runtime API.
    - Existing Sundry's compounds in a new spawn cell or any adjacent cell are despawned and those cells are excluded from natural generation.
    - Reassert Sundry's exclusion around all existing team spawns on init/configuration changes; add optional GZ-Economy load ordering when present.

Version: 0.4.76
Date: 2026-08-24
  Fixes:
    - Territory rebuilds now recognize every existing claim-capable structure owned by a team, even when it belongs to a disconnected base or outpost separated from the initial spawn territory.
    - Removed the migration-only starter-connectivity requirement that caused separated factory sections to disappear from ownership after territory schema rebuilds.
    - Territory migration scans teams, surfaces, and existing claim anchors in stable order for deterministic multiplayer rebuilds.

Version: 0.4.75
Date: 2026-08-24
  Fixes:
    - Fixed a multiplayer desync when a player joined while generated-chunk culling was in progress.
    - Replaced the non-persisted cross-tick LuaChunkIterator with a deterministic sorted deletion queue stored in save state.
    - Existing iterator-based culls are cancelled and rescheduled during migration rather than resumed unsafely.

Version: 0.4.74
Date: 2026-08-23
  Changes:
    - Territory Flags now use a true 6-tile claim radius, covering a 12x12 area centered on the flag.
    - The native placement preview now shows the full 12x12 claim footprint while the Territory Flag is held.
    - Bumped the territory geometry schema so existing saves rebuild placed flag claims at the new radius on configuration change.

Version: 0.4.73
Date: 2026-08-23
  Changes:
    - Territory Flag placement now uses native cursor visualizations: a visible flag marker and the exact 6x6 claim footprint appear automatically while the flag is held.
    - Removed the Show flag placement checkbox and retired the old nearby-candidate helper overlay.
    - Show territory remains a player-owned construction helper and once again stamps the team flag across owned territory on a 20-tile grid.
    - Repeating territory flag stamps are only drawn when their complete 2x2 visual footprint is inside claimed territory.

Version: 0.4.72
Date: 2026-08-23
  Changes:
    - Changed scheduled culling from force-chart hiding to physical generated-chunk deletion for actual map/save performance reclamation.
    - Generated chunks more than 8 chunks from claimed player territory are deleted with LuaSurface.delete_chunk and can regenerate if explored again. Connected players and permanent team spawns keep the same 8-chunk safety buffer.
    - Chunk deletion is throttled across ticks and the 30/5/1-minute warnings now explicitly state that remote generated terrain will be deleted.
    - The compact GZ-Dock construction helpers now include Show territory for the player's own territory only and Show flag placement with the team's flag plus its 6x6 claim footprint.
  Fixes:
    - Updated the external set_show_territory bridge to control the player's own construction overlay instead of the retired foreign-territory overlay.
Version: 0.4.71
Date: 2026-08-23
  Changes:
    - Reworked the compact GZ-Dock territory controls as construction helpers. Show territory now displays only the player's own claimed territory and border; it no longer controls other teams' in-world territory overlays.
    - Added a Show flag placement checkbox to the compact GZ-Dock. It displays the team's actual flag art at recommended 6-tile-grid frontier placements and shades the full 6x6 claim area for each candidate.
    - Flag placement guides only appear where the complete 2x2 flag footprint is already inside the player's territory, matching the real placement rule, and are bounded around the player to keep rendering cost predictable.
  Fixes:
    - Existing foreign in-world territory overlays from older saves are cleared during bootstrap while permanent team flag markers and map/chart territory proxies remain intact.
Version: 0.4.70
Date: 2026-08-23
  Changes:
    - Reduced the chart-culling protected buffer from 20 chunks to 8 chunks around claimed player territory, connected players, and permanent team spawns.
  Fixes:
    - Hardened compact GZ-Dock discovery so Show territory can reattach on existing saves even when Gizmod's private Dock GUI name changed.
    - Added launcher-signature fallback detection for the stable G/D/E/C/T Dock controls, stale-control cleanup, immediate post-registration refresh, and the existing once-per-second reattach pass.
Version: 0.4.69
Date: 2026-08-23
  Features:
    - Moved the per-player Show territory toggle out of the expanded Diplomacy panel and into the permanent compact GZ-Dock for one-click access.
    - Added a dedicated Game Settings tab to the main Diplomacy window. Admins can manage chart culling, maximum teams, maximum players per team, spawn layout limits, and starting-resource options there.
    - Added a configurable 1-64 maximum players-per-team rule. Lowering the cap does not eject existing members; it blocks additional joins until the team is below the limit.
  Changes:
    - Moved chart-culling enable/disable, interval, status, and Cull now controls into Game Settings. The 120-720 minute interval bounds and 30/5/1 minute scheduled warnings are preserved.
    - Removed duplicate territory/culling controls from the expanded GZ-Dock Diplomacy panel.
Version: 0.4.68
Date: 2026-08-23
  Fixes:
    - Fixed the GZ-Dock integration manifest: the Diplomacy panel builder existed, but the registered panels list was empty, so GZ-Dock had nothing to display.
    - Registered the Diplomacy panel with GZ-Dock. This restores the per-player Show territory checkbox and the admin-only chart-culling controls (enable/disable, interval, Apply, Cull now).
Version: 0.4.67
Date: 2026-08-23
  Changes:
    - Added admin chart-culling controls directly to the GZ-Dock Diplomacy panel: enable/disable automatic culling, set a fixed interval in minutes, and Cull now.
    - Automatic culling intervals are validated to 120-720 minutes (2-12 hours), defaulting to 300 minutes; changing the interval starts a fresh countdown.
    - Scheduled culls retain the 30-minute, 5-minute, and 1-minute global warnings. Manual Cull now starts immediately and also works while automatic culling is disabled.
    - Disabling automatic culling cancels a scheduled sweep if one is currently running; manual sweeps are allowed to finish.
Version: 0.4.66
Date: 2026-08-23
  Changes:
    - Added scheduled force-chart cleanup every randomized 4-6 hours, with global 30-minute, 5-minute, and 1-minute warnings.
    - Chart cleanup forgets generated chunks more than 20 chunks from any claimed player territory while preserving current player locations and permanent team spawns as safety anchors.
    - Cleanup uses LuaForce.unchart_chunk only; generated map chunks, entities, resources, and terrain are never deleted.
    - The remote chart sweep is throttled across ticks to avoid a large one-tick server hitch and applies only to Diplomacy-managed player/team forces.
Version: 0.4.65
Date: 2026-08-23
  Changes:
    - Added a per-player "Show territory" checkbox directly to the GZ-Dock Diplomacy panel.
    - The Dock checkbox uses the existing territory-display preference and immediately shows/hides other teams' territory overlays and borders.
Version: 0.4.64
Date: 2026-08-23
  Fixes:
    - Replaced the invalid synchronous LuaPlayer.localise() research-name path with Factorio's supported request_translation() / on_string_translated flow.
    - Research milestones are now printed only after the technology name resolves to an actual string, with the internal technology name as a non-empty fallback.
    - Reasserts technology_notifications_enabled=false once per second to prevent another mod from restoring the native duplicate force-name research notification.
Version: 0.4.63
Date: 2026-08-23
  Fixes:
    - Research announcements now resolve the completed technology name per connected player's locale before composing the orange Magic-font message, preventing blank technology names in multiplayer.
    - Reasserts ownership of technology notifications when research starts/finishes so the native force-name notification stays disabled if another mod toggles it back on.
Version: 0.4.62
Date: 2026-08-23
  Changes:
    - Fixed the orange team research announcement so it explicitly includes the localized technology name instead of only printing "<team> researched."
Version: 0.4.61
Date: 2026-08-23
  Fixes:
    - Fixed an upgrade crash in the 0.4.60 block-based territory renderer when an existing save retained the territory runtime fast-path marker but did not yet have chart_proxy_blocks initialized.
    - Added a lightweight runtime-field revision migration plus defensive block-render initialization; existing territory claims are preserved and no geometry-schema reset is required.

Version: 0.4.60
Date: 2026-08-23
  Performance:
    - Replaced whole-team territory chart proxy rebuilds during normal claim changes with bounded 8x8-cell dirty-block rebuilds, processed one block per tick.
    - Shared-vision on_chunk_charted propagation is now queued and budgeted to one target chart operation per tick, preventing allied-force chart cascades from producing single-tick stalls.
    - Placement and foreign-territory rendering refreshes are player-staggered instead of rebuilding every connected player on one frame.
    - Migrates existing whole-surface chart proxies to the block renderer on configuration change.

Version: 0.4.59
Date: 2026-08-23
  Performance:
    - Removed the once-per-second full diplomacy relation scan; the 24-hour hostility maturity check now scans every ten seconds while its real-time clock remains exact.
    - Reduced automatic conflict-frame rebuilds from once per second to once per ten seconds; relation changes still refresh immediately.
    - Reduced political-map live refresh from once per second to once per five seconds.
    - Staggered territory rendering, placement/foreign overlays, border scans, segmented-unit scans, and team-panel maintenance onto different tick phases to avoid synchronized frame hitches.
Version: 0.4.58
Date: 2026-08-23
  Performance:
    - Made the common storage root accessor O(1); full schema/team repair now stays in init/configuration paths instead of running on every state lookup.
    - Added fast paths to territory/offline-protection state accessors so their schema normalization is not repeated every tick/event.
    - Reduced undecided-player/admin gate polling from every tick to four times/sec; entry/selection handlers still apply state immediately.
    - Reduced proactive offline-border scans from 96 chunk scans/sec to 24 chunk scans/sec while retaining immediate damage/build fallbacks.
    - Reduced segmented-unit offline sweeps from once/sec to once/5 sec.
    - Reduced expensive dirty territory chart-proxy rebuild cadence from 0.5 sec to 2 sec and foreign-overlay refresh cadence from 1 sec to 2 sec.
Version: 0.4.57
Date: 2026-08-22
  Changes:
    - Styled Diplomacy technology-achievement announcements in warm orange using Gizmod's Magic font (default-large-bold).

Version: 0.4.56
Date: 2026-08-22
  Fixes:
    - Replaced Factorio's built-in technology-completion notification with a Diplomacy-owned localized completion message so team achievements show the actual team display name instead of internal force IDs such as gz_diplomacy_team_002.
    - Internal force names remain unchanged and stable; only user-facing research-completion text is substituted.
Version: 0.4.55
Date: 2026-08-22
  Fixes:
    - Fixed territory chart/minimap proxy prototype load failure: map proxies now use simple-entity-with-owner, which supports runtime unit numbers required by the existing proxy cleanup/rebuild code.
    - Kept get-by-unit-number so proxy entities can be tracked and destroyed cleanly during territory redraws.
    - Explicitly marked map proxy entities as non-military targets.
Version: 0.4.54
Date: 2026-08-22
  Fixes:
    - Hardened native enemy hostility across the spawn-preview -> permanent-team force transition.
    - Team forces now reassert enemy friend=false and cease_fire=false after the player force assignment, not only before it.
    - Added on_player_changed_force, on_force_created, on_force_friends_changed, and on_force_cease_fire_changed guards for Diplomacy combat forces.
    - If another mod or event changes a Diplomacy team/preview relationship with the built-in enemy force, Diplomacy immediately restores hostility in both directions.
    - Force identity remains name-based (enemy vs gz_diplomacy_team_NNN); no numeric force-index aliasing is used.
Version: 0.4.53
Date: 2026-08-22
  Fixes:
    - Team forces now explicitly enforce hostile relations with Factorio's built-in enemy force in both directions: friend=false and cease_fire=false.
    - Spawn-preview force now enforces the same enemy hostility every time it is created or reused, preventing green/friendly native enemies while scouting a start.
    - Existing team/enemy relations are repaired automatically during the normal bootstrap/configuration repair pass.
Version: 0.4.52
Date: 2026-08-22
  Changes:
    - Replaced the permanent territory LuaRendering chart overlay with invisible native map-color proxy entities so claimed land is visible in the upper-right minimap as well as the full map.
    - Added fixed map-color proxies for all 12 team colors. Proxies are invisible, unselectable, non-colliding, indestructible, and exist only to feed Factorio's native map/minimap renderer.
    - Packed territory coverage into 16x16, 8x8, 4x4, and 2x2 proxy blocks to preserve exact borders while keeping proxy entity counts substantially below one entity per territory cell.
    - Existing territory is automatically queued for proxy-map rebuild after the configuration change.
Version: 0.4.51
Date: 2026-08-22
  Changes:
    - Reworked the permanent territory chart overlay to use chart-mode sprite fills instead of filled rendering rectangles.
    - Territory color overlays now use the same 32x32 white fill sprite as the in-world overlay, tinted per team, so they render through Factorio's map/minimap sprite path.
    - Pinned chart territory sprites to the chart-safe "arrow" render layer to avoid current 2.x chart-layer visibility issues.
    - Existing territory render IDs are automatically queued for replacement during the normal configuration-change bootstrap.
Version: 0.4.50
  Changes:
    - Fixed native Space Age demolisher territories not being culled around Diplomacy team starts unless GZ-Terra was installed.
    - Removed the incorrect GZ-Terra active-mod gate from segmented-unit territory cleanup.
    - Diplomacy now capability-checks LuaSurface territory APIs directly, so vanilla Space Age demolisher territory is handled independently of GZ-Terra.
    - Newly generated chunks inside already-sanitized team start zones now have demolisher territory culled without requiring GZ-Terra.
    - Added a one-time configuration migration that revisits existing prepared/team spawn zones and applies the missing territory/segmented-unit cleanup.
Version: 0.4.49
  Changes:
    - Territory Flags now use a 2x2 marker footprint and claim a 6x6 area.
    - Territory Flag logo rendering is reduced to a 2x2 visual footprint.
    - Territory Flags now cost 100 wood and 1 raw fish.
    - Light Resource Outpost is now an ammo-turret prototype instead of a radar.
    - Removed the radar head overlay from the Light Resource Outpost.
    - Light Resource Outpost now has 4 ammo slots and automated ammo capacity of 100.
    - Light Resource Outpost keeps the base gun-turret fire rate/range for this balance pass.
    - Light Resource Outpost now requires 1 raw fish.
    - Light Resource Outposts render the owning team's flag and color filter centered on the platform.
Version: 0.4.48
  Changes:
    - Added craftable Territory Flags: 20 wood, invisible/non-colliding 4x4 marker footprint, 16x16 territory claim, placement restricted to existing friendly territory.
    - Placed flags render the selected team logo directly above the ground with a subtle team-color filter.
    - Increased chart/minimap territory visibility and normalized render-only team colors against green so red/pink and other saturated colors have comparable on-screen brightness.
    - Removed automatic repeated territory-logo stamps; logos now correspond to actual placed Territory Flag markers.
Version: 0.4.47
Date: 2026-08-22
  Changes:
    - Fixed a join-time Diplomacy panel crash for undecided/teamless players caused by assigning nil to the Leave Team button enabled property.
    - Made team-card self-membership state explicitly boolean instead of relying on Lua's nil-producing `and` expression.
    - Hardened leader roster Remove/Go button enabled states against the same optional-value boolean edge case.

Version: 0.4.46
Date: 2026-08-21
  Changes:
    - Fixed the My Team panel build error caused by assigning FlowStyle.horizontal_spacing to a FrameStyle.
    - Preserved the intended spacing beside the team flag using a valid inner-flow margin instead.

Version: 0.4.45
Date: 2026-08-21
  Changes:
    - Fixed unreliable Keep Spawn / Pass clicks on multiplayer servers by stopping the spawn-preview GUI from being destroyed and rebuilt every second.
    - Preview countdown and prepared-start status now update their existing labels in place, keeping the action buttons stable between real state transitions.

Version: 0.4.44
Date: 2026-08-21
  Changes:
    - Changed the undecided-player "choose or join a team" freeze notification from a 10-second repeating reminder to a one-time prompt.
    - Kept the expired spawn-preview Keep/Reject/Cancel reminder repeating because that state requires action from the scouting player.

Version: 0.4.43
Date: 2026-08-21
  Changes:
    - Fixed a game-start crash in the 0.4.42 membership self-repair path caused by treating Factorio 2.x LuaPlayer userdata as a numeric player index.
    - Hardened player/index resolution in team repair, spawn-preview availability, and territory-overlay settings so runtime LuaPlayer userdata and test-table players are both handled correctly.
    - Preserved stable numeric player-index storage and custom team-name behavior from 0.4.42.

Version: 0.4.42
Date: 2026-08-21
  Changes:
    - Fixed team founding so the founder is assigned to the new team before Preparation/UI state is refreshed.
    - Team membership continues to use stable internal team IDs and force IDs; custom display names no longer participate in membership recognition.
    - Added automatic membership repair from the player record, team roster, or stable internal force so affected 0.4.41 saves self-heal when the player rejoins or Diplomacy checks their team.
    - Fixed the previously write-only Preparation refresh queue and made membership changes invalidate open player panels, preventing stale “not on a team” UI after founding/joining/leaving.

Version: 0.4.41
Date: 2026-08-21
  Changes:
    - Added a customizable team-name field to the Preparation screen when founding a new team.
    - Team names are validated for non-empty, unique names and are locked permanently once the team is founded.
    - Team names now travel with the existing spawn-preview selection so the chosen name is preserved through Keep/Reject scouting.

Version: 0.4.40
Date: 2026-08-21
  Changes:
    - Added automatic offline-team base protection inside each team's claimed territory and on that team's space platforms.
    - When a team's force has zero connected players, eligible team entities in protected locations become non-destructible and are restored when a teammate reconnects.
    - Added an offline border guard that incrementally scans a shallow guard band around claimed borders and ejects native enemies plus actively hostile team characters and combat vehicles that cross into protected territory.
    - Hostile players already inside a team border are ejected when that team goes offline; hostile attackers are also ejected immediately if they reach a protected base.
    - Added support for ejecting enemy segmented units such as demolishers from offline protected territory.
    - Normal combat remains unchanged while at least one player from the team is online.

Version: 0.4.39
Date: 2026-08-21
  Changes:
    - Added frontier extraction placement for electric mining drills, big mining drills, GZ asteroid mining drills, and pumpjacks.
    - Frontier extractors may be built on unclaimed land but remain blocked from enemy-owned territory.
    - Frontier extractors claim only a 3-tile range around their footprint instead of the normal 6-tile structure claim.
    - Migrated existing territory so previously placed qualifying extractors use the new frontier claim geometry.

Version: 0.4.38
Date: 2026-08-21
  Changes:
    - Set both persistent foreign-territory fill and build-placement territory preview to a true 30% opacity using premultiplied-alpha colors.
    - Kept territory borders and 50% flag stamps unchanged for readability.
    - Forced existing territory overlays to rebuild with the new opacity.

Version: 0.4.37
Date: 2026-08-21
  Changes:
    - Fixed territory overlay opacity by using premultiplied-alpha render colors.
    - Replaced game-world rectangle/line overlays with ground-layer sprites so territory visuals render above decoratives but below buildings and rail sprites.
    - Added repeating full-size 256x256 team flags to persistent foreign territory, matching the placement-preview flag treatment.
    - Forced placement and foreign overlays to rebuild after the rendering-style migration.

Version: 0.4.36
Date: 2026-08-20
  Changes:
    - Reduced the build-placement territory preview fill opacity by another 50%.
    - Moved both the placement preview and persistent foreign-territory overlays to the ground-patch-higher2 render layer, above decoratives but below normal buildings/entities.
    - Applied the same ground-level layering to placement-preview flags and territory borders.

Version: 0.4.35
Date: 2026-08-20
  Changes:
    - Reduced the persistent other-team territory fill opacity by 50% while leaving borders and placement previews unchanged.

Version: 0.4.34
Date: 2026-08-20
  Changes:
    - Added a My Team tab with team identity, roster, spawn details, leader controls, and live GZ Economy balance integration when available.
    - Added a Settings tab. The per-player option to show other teams' borders and territory is enabled by default.
    - Other teams' claimed territory now renders persistently in the game world for players who keep the visibility option enabled.
    - Moved admin team-management controls out of the Diplomacy tab and into Settings.
    - Moved team-leader roster controls into My Team.
    - Removed inline Admin Go/Admin Join buttons from diplomacy team cards; equivalent admin management remains in Settings.

Version: 0.4.33
Date: 2026-08-20
  Changes:
    - Restored territory visualization to placement-preview-only in the normal game world.
    - Placement preview fill is now about 30% of its previous opacity.
    - Added a thick white placement-boundary perimeter.
    - Added full-resolution 256x256 team flags at ~20-tile spacing, rendered at 50% opacity beneath the green placement tint.

Version: 0.4.32
Date: 2026-08-20
  Changes:
    - Fixed territory perimeter borders and team flag stamps so they render in the normal game world as well as map/chart view.
    - Permanent territory fill now renders in both views at the reduced 0.06 alpha.
    - Increased in-world flag stamp size while preserving the stable 20-tile lattice.

Version: 0.4.31
Date: 2026-08-20
  Changes:
    - Reduced territory overlay fill opacity to 30% of its previous intensity.
    - Added a thick white perimeter border around team territory.
    - Added repeating team-flag stamps across owned territory at approximately 20-tile spacing.

Version: 0.4.30
Date: 2026-08-20
  Changes:
    - Horizontally centered the spawn-preview decision dialog during the scouting period.
    - When the 60-second scouting timer expires and the player is frozen, the decision dialog now moves to the center of the screen until Keep, Reject, or Cancel is chosen.

Version: 0.4.29
Date: 2026-08-20
  Changes:
    - Spawn preview players are now frozen in place when the 60-second scouting timer expires.
    - Removed the old post-timeout teleport/snap-back behavior while waiting for Keep, Reject, or Cancel.

Version: 0.4.28
Date: 2026-08-20
  Changes:
    - Moved the spawn-preview countdown/decision overlay approximately 200 pixels higher on screen.

Version: 0.4.27
Date: 2026-08-20
  Changes:
    - Restored the new-team spawn preview dialogue as a persistent bottom-center screen overlay.
    - The preview overlay is no longer tied to player.opened, so ordinary GUI transitions cannot steal or hide it.
    - Keeping a spawn is available immediately; rejecting a spawn unlocks only after the mandatory 60-second scout period.
    - Cancelling during the first minute returns the candidate to the ready queue instead of rejecting it, preventing the timer from being bypassed.

Version: 0.4.26
Date: 2026-08-20
  Changes:
    - Train stops / rail stations are now fully exempt from territory ownership restrictions, alongside rail track and electric poles.
    - Rail signals and chain signals remain non-claiming but still require placement inside owned territory.

Version: 0.4.25
Date: 2026-08-20
  Changes:
    - Territory placement now fully exempts rail track and electric poles: they may cross owned, enemy, or unclaimed territory and never extend claims.
    - Rail signals, chain signals, train stops, and other rail infrastructure remain subject to normal territory placement rules.

Version: 0.4.24
Date: 2026-08-20
  Changes:
    - Reworked diplomacy cards so the displayed dispositions are: Allies (Defensive Pact + Vision), Friendly (Shared Vision), Neutral (Default), Cease-fire, Displeased, and Hostile.
    - Neutral, Cease-fire, and Displeased are the only directly selectable base dispositions.
    - Restored Share Vision, Propose Alliance, Propose Defensive Pact, and Declare Hostility (PVP) checkboxes.
    - Friendly is now derived from Shared Vision; Allies is derived from Defensive Pact + Vision; Hostile is derived from a formal hostility declaration.
    - Propose Alliance acts as a convenience package enabling Shared Vision + Defensive Pact; withdrawing it falls back to Friendly by retaining Shared Vision.
    - Added persistent base-disposition state beneath treaty-derived dispositions and migration from the 0.4.23 six-state stance model.
    - Preserved the 24-hour hostility declaration, conflict countdown window, bilateral cease-fire, and four-hour surrender rules.
    - Increased team-card height to comfortably fit the restored treaty/conflict controls.

Version: 0.4.23
Date: 2026-08-20
  Changes:
    - Added a persistent red-tinted conflict status window for every team involved in a pending hostility declaration or active war.
    - Pending declarations show live 24-hour server-running countdowns to PVP activation for both sides; the declaring team leader/admin can cancel before maturity, reverting that directional stance to Displeased.
    - Active-war windows show elapsed war time plus bilateral Propose/Accept Cease-fire controls. PVP ends only when both teams agree to the cease-fire.
    - Added unilateral Surrender after four hours of active war. Surrender immediately ends PVP and places both teams into the Ceasefire stance.
    - Added persistent current-war start timestamps and cease-fire proposal state, with migration support for active 0.4.22 wars.
    - Disabled normal stance changes while PVP is active so wars must end through cease-fire agreement or surrender.

Version: 0.4.22
Date: 2026-08-20
  Changes:
    - Added Ceasefire as a sixth directional diplomatic stance between Neutral and Displeased.
    - Ceasefire is mechanically identical to Neutral: cease-fire remains active and vision is not shared.
    - Ceasefire is only available to a pair of teams after a hostility declaration has matured into actual PVP at least once.
    - Added permanent pair-level war history so retracting a declaration before its 24-hour timer does not unlock Ceasefire, while completed wars do.
    - Updated team-card stance controls, status text, tooltips, migration, and hostility maturation to support post-war Ceasefire.

Version: 0.4.21
Date: 2026-08-20
  Changes:
    - Replaced separate treaty/conflict checkboxes with a five-state diplomatic stance: Allied, Friendly, Neutral, Displeased, Hostile.
    - Neutral is the default stance for all new team relationships.
    - Allied automatically requires shared vision and a defensive-pact proposal; mutual Allied activates the alliance.
    - Friendly automatically shares vision; mutual Friendly/Allied activates Factorio friendship.
    - Displeased is a warning state with cease-fire intact.
    - Hostile now starts a 24-hour real server-running declaration timer before PVP is enabled.
    - Declaration timing compensates for game.speed and pauses while the simulation/server is not running.
    - Added live hostility countdown/status text to team cards.
    - Existing 0.4.20 active hostilities are grandfathered as already matured during migration.

Version: 0.4.20
Date: 2026-08-20
  Changes:
    - Extended Diplomacy team cards with Share Vision, Propose Alliance, Propose Defensive Pact, and Declare Hostility (PVP) controls.
    - Diplomatic intent is now directional: either side may declare hostility, while alliances require mutual proposals.
    - Active alliances set Factorio force friendship and cease-fire; unilateral hostility disables friendship/cease-fire and enables PVP.
    - Share Vision copies existing chart data when enabled and propagates newly charted chunks to the selected team.
    - Defensive pact proposals are stored bilaterally and become active when both teams propose the pact.
    - Diplomacy-changing controls now require team-leader or admin authority.

Version: 0.4.19
Date: 2026-08-20
  Changes:
    - Restyled the Political Map to a black monitor/screen presentation with pale cyan axes.
    - Added a visible 1k-tile yellow grid to the Political Map.
    - Ensured player/team markers render in team colors while preserving online/offline marker shapes.

Version: 0.4.18
Date: 2026-08-20
  Changes:
    - Added a large abstract Political Map to the top of the Diplomacy tab, projecting player positions across a fixed -10,000..+10,000 X/Y political scale without rendering terrain or generated map chunks.
    - Added team-colored online/offline player markers with overlap tooltips, exact player coordinates, edge clamping for players beyond the political scale, and a parchment-style map background.
    - Added a compact Teams & Players roster beside the Political Map while retaining the full relation/action team cards below it.
    - Established team members now open GZ-Diplomacy directly to the Diplomacy/Political Map tab; undecided players still open on Welcome for onboarding.
    - Political map markers update once per second without rebuilding the full Diplomacy panel.
    - Increased the maximum Diplomacy window size on larger displays to better accommodate the political overview.
    - Added docs/political-map.md as the baseline for future political-map layers and interactions.
Version: 0.4.17
Date: 2026-08-20
  Changes:
    - Increased the main GZ-Diplomacy window height by roughly 100px where display resolution allows, giving the Diplomacy tab substantially more usable vertical space.
    - Increased Diplomacy team-card height and spacing so 96x96 team flags fit comfortably; widened the flag column and shifted player rosters farther right.
    - Added two-step Team Leader/Admin Disband Team controls to team cards. Disbanding resets members to the central staging flow, releases team territory, clears team relations, frees the flag/color, and merges the obsolete team force into the default player force while preserving its entities/items.
    - Added the admin recovery command /gzd-team-disband <team-id> confirm.
    - Added docs/map-culling-policy.md documenting the current spawn/enemy cleanup behavior and clarifying that Diplomacy does not currently delete generated map chunks for save-file size reduction.
Version: 0.4.16
Date: 2026-08-19
  Changes:
    - Moved the 60-second spawn-preview decision window from the center of the screen to a bottom-center HUD position.
    - Enlarged team-creation flags to 96x96 and arranged all 12 flags in two rows of six; widened the main Diplomacy window to accommodate the larger identity picker.
    - Active teams now reserve their chosen flag and color. Reserved identity choices are disabled/greyed in team creation and automatically become available again when the owning team is no longer active/present.
    - Rebuilt the Diplomacy team list as scrollable team cards with 96x96 flags, spawn coordinates, clickable GPS pings, player rosters, relation selectors, reciprocal relation display, invitation requests, direct join, and leave actions.
    - The Preparation tab is now vertically scrollable so the larger team-identity picker remains usable at lower resolutions.
Version: 0.4.15
Date: 2026-08-19
  Changes:
    - Enforced a single active start-location selector globally: while one player is scouting/choosing, all other New Team buttons remain disabled.
    - New Team only re-enables after the selector finishes and the prepared-start reserve has returned to the required threshold.
    - Made the live Preparation UI update New Team button availability/tooltip in place so stale open windows cannot advertise an unavailable start.
Version: 0.4.14
Date: 2026-08-19
  Changes:
    - Storage chests and container entities can still be placed inside owned territory but no longer extend the buildable territory border.
    - Bumped the territory schema so existing saves rebuild claims without legacy chest/container influence.
Version: 0.4.13
Date: 2026-08-19
  Changes:
    - Added Calcite to the compact curated starter-resource ring whenever the active mod stack provides the calcite resource prototype.
    - Reworked guaranteed starter oil into a compact 3-well field centered roughly 46 tiles from team spawn.
    - Starter oil now targets roughly 1200% combined yield at default resource richness by deriving well amounts from the crude-oil prototype's normal resource amount.
Version: 0.4.12
Date: 2026-08-19
  Changes:
    - Added vertical scrolling to the Welcome panel; the Diplomacy panel retains its existing scrollable layout.
    - Normal player chat is now mirrored to players on other forces, making chat global by default without duplicating messages for teammates.
    - Increased normal building territory extension from 3 tiles to 6 tiles and bumped the territory schema so existing saves rebuild building claims at the new radius.
  Bugfixes:
    - Fixed the Diplomacy close-key crash caused by assuming every LuaPlayer.opened object has a name field; equipment grids and other opened-object types are now handled safely.
    - Applied the same safe opened-object handling to the main Diplomacy panel and spawn-preview close paths.

Version: 0.4.11
Date: 2026-08-19
  Changes:
    - Show owned/buildable team territory as a translucent green ground overlay while holding a normal placeable building.
    - Illegal manual building placements are immediately bounced: the entity is removed and the exact consumed items are returned to the player, with an inventory-full ground-drop fallback rather than item loss.
    - Illegal robot placements now preserve the mined placement item even if the robot cargo inventory is full.
    - Resource Outposts remain exempt from the green owned-territory overlay because they are intentionally allowed to seed detached claims in unclaimed land.

Version: 0.4.10
Date: 2026-08-19
  Changes:
    - Moved candidate enemy cleanup from background spawn preparation to the moment a player selects a start for the 60-second inspection.
    - Uses the surface's configured starting-area radius as a guaranteed enemy-free zone for each inspected Diplomacy start.
    - Added a smooth 256-tile frontier gradient outside the safe radius that progressively trims enemy spawners and worms from nearly all at the inner edge to none at the outer edge.
    - Mobile enemy units are fully removed inside the guaranteed safe radius but are not culled in the outer frontier gradient.
    - Terra segmented-unit/Hellworm territory follows the same safe-radius and 256-tile thinning profile, with suppressed territory chunks prevented from regenerating.
    - Accepted team starts retain the enemy profile for newly generated chunks so later exploration does not reintroduce full-strength map-generated bases inside the intended starting frontier.

Version: 0.4.9
Date: 2026-08-18
  Changes:
    - Limited natural tree/resource clearing to the central join/staging area instead of clearing prepared team starts.
    - Added a 24-tile-wide lava barrier ring beginning roughly 100 tiles from the central staging origin, with deep-water fallback when lava is unavailable.
    - Replaced the small staging terminal with a large 4x4 display-panel terminal; uses Larger Display Panels' big display when available and falls back to a scaled vanilla display panel.
    - Tightened curated starter ore centers to roughly 14 tiles from team spawn and reduced default patch radius to 6 tiles for smaller, denser clusters.
    - Preview cleanup now removes only Diplomacy-stamped resources instead of wiping natural ore around a rejected candidate.
    - Increased primary Diplomacy UI text, headers, team flags, and team color selectors for readability.
    - Diplomacy now opens to the Welcome tab first for both players and hosts.

Version: 0.4.8
Date: 2026-08-18
  Changes:
    - Repacked Diplomacy starter resources into a tighter ring around each prepared team spawn.
    - Doubled the placed iron, copper, coal, and stone totals while keeping the compact dense patch footprint.
    - Guaranteed a nearby starter Sand patch whenever the active mod stack provides the Sand resource prototype.
    - Prepared team starts now clear natural resource entities and trees throughout the 200-tile starter preparation area before stamping the curated resource cluster.

Version: 0.4.7
Date: 2026-08-18
  Changes:
    - Updated mod metadata for Factorio 2.0 compatibility.

Version: 0.4.6
Date: 2026-08-18
  Changes:
    - Compacted Diplomacy starter ore patches to roughly half their former radius while preserving total ore, making them about four times denser.
    - Moved the guaranteed starter ore ring and oil pair closer to the team spawn so the starter resource kit is more tightly clustered.
    - When GZ-Terra/Terra Nauvis is active, prepared and accepted team starts now clear intersecting segmented-unit/Hellworm territories and suppress territory regeneration in the protected start area.

Version: 0.4.5
Date: 2026-08-18
  Bugfixes:
    - Fixed Light Resource Outpost load failure caused by hardcoded vanilla radar-shadow sprite-sheet frame dimensions.
    - The outpost now reuses and scales the current base-game radar sprite definition, avoiding fragile assumptions about radar sheet geometry.

Version: 0.4.4
Date: 2026-08-18
  Changes:
    - Added team territory with a 50x50 buildable starting claim around each accepted team spawn.
    - Most placed buildings now extend their team's territory about 3 tiles beyond their footprint.
    - Belts, pipes, poles, rails, walls, combinators, and similar infrastructure can be built inside territory but do not extend the border.
    - Light Resource Outposts can establish detached 32x32 territory claims in unclaimed land.
    - Added team-colored territory shading to chart/map view.
    - Territory influence retracts when claim-producing structures are removed or destroyed; overlapping claims remain until their supporting structures are gone.
    - Added a one-time migration pass for existing 0.4.3 saves so connected existing factories contribute territory after upgrading.

Version: 0.4.3
Date: 2026-08-18
  Changes:
    - Added the Light Resource Outpost prototype as a 4x4, 1500 HP fortified radar platform.
    - Added the supplied outpost platform/base artwork to the mod graphics assets.
    - Added a centered, scaled vanilla radar visual while keeping the corner gun emplacements cosmetic for now.
    - Added a modest early-game recipe unlocked by Military 2.

Version: 0.4.2
Date: 2026-08-17
  Changes:
    - Polished the first-run Welcome and Preparation text with concise host/player instructions.
    - Removed public-beta, scaffold, deferred-feature, and alpha wording from normal player-facing UI.
    - Hid unfinished Chat/Vision diplomacy columns until those features are implemented.
    - Disabled spawn diagnostics and the admin debug panel by default while retaining troubleshooting tools.
    - Simplified player-facing preparation and preview status messages.
    - Updated package metadata and fixed invalid trailing JSON syntax in info.json.

Version: 0.4.0
Date: 2026-08-04
  Changes:
    - Added automatic team leadership: the first successful member becomes leader.
    - Added per-team join-order tracking so leadership passes to the next person who joined when the leader leaves or is removed.
    - Added migration/reconciliation support for older 0.3.x saves without stored join-order data.
    - Added a team-leader Diplomacy GUI with own-team roster management, direct-join toggle, adding unassigned online players, removal, and spawn teleport tools.
    - Added an admin Diplomacy GUI for global player assignment, reassignment, removal/reset, teleportation, joinability controls, and team roster overviews.
    - Added admin team-management commands: /gzd-team-list, /gzd-team-assign, /gzd-team-remove, /gzd-team-teleport, and /gzd-team-joinable.
    - Centralized permission checks for admin/team-leader management actions.
    - Updated Gizmod registration capabilities and package metadata for the new management and leadership features.

Version: 0.3.15
Date: 2026-06-05
  Changes:
    - Public beta polish pass for the first visible mod portal release.
    - Added /gzd-support to print the GZ-Diplomacy bug report/support form link.
    - Added the support link to the player-facing Welcome text.
    - Updated package metadata/description for public beta scope.
    - No spawn, force, team, or relation logic changes.