Skip to content

Re-anchor entities when loading apartment/room saves#1421

Merged
fenndragon merged 3 commits into
HardLightSector:masterfrom
Kronyxxx:fix/apartment-save-reanchor
Apr 24, 2026
Merged

Re-anchor entities when loading apartment/room saves#1421
fenndragon merged 3 commits into
HardLightSector:masterfrom
Kronyxxx:fix/apartment-save-reanchor

Conversation

@Kronyxxx
Copy link
Copy Markdown
Collaborator

About the PR

Apartment / room saves filter to anchored-only entities at serialization time, but
TransformComponent (and therefore the Anchored flag) is intentionally skipped
during serialization. Reconstructed entities were spawning with prototype defaults
and ending up loose on the floor — walls, lockers, machines, etc.

Why / Balance

Pure bug fix. Restores the original anchored state that the save already implicitly
required. Only touches ReconstructShipOnExistingGrid, which is exclusively called
by RoomGridSpawnerSystem; the regular full-ship ReconstructShip path is
untouched.

How

  • New TryReAnchorRoomEntity helper: defensive (existence/Transform/GridUid checks,
    try/catch with Debug log), no-ops on already-anchored or non-anchorable entities.
  • Called after each top-level non-contained spawn in both branches of
    ReconstructShipOnExistingGrid. Contained (in-container) entities are skipped.

Technical details

  • SerializeShipArea already filters to childTransform.Anchored == true, so
    every entity we re-anchor on load was anchored at save time.
  • AnchorEntity snaps the entity onto the snapgrid cell and sets BodyType.Static,
    matching the entity's pre-save physics state.

Media

N/A — bug fix, no visual change beyond "things stay anchored".

Requirements

  • Builds locally (dotnet build Content.Server/Content.Server.csproj).
  • Tested in-game by saving and reloading a room.

Breaking changes

None.

Changelog

🆑

  • fix: Loading an apartment/room save no longer leaves furniture, walls and other
    anchored entities unanchored on the floor.

Room saves filter to anchored-only entities at serialization time but
TransformComponent (and therefore the Anchored flag) is intentionally
skipped, so reconstructed entities were spawning with prototype defaults
and ending up loose on the floor.

Add a TryReAnchorRoomEntity helper that snaps top-level non-contained
entities back onto the snapgrid after spawn in ReconstructShipOnExistingGrid
(the only caller, used by RoomGridSpawnerSystem). Contained entities and
the full-ship ReconstructShip path are unaffected.

:cl:
- fix: Loading an apartment/room save no longer leaves furniture, walls
  and other anchored entities unanchored on the floor.
@fenndragon fenndragon merged commit e00e1c8 into HardLightSector:master Apr 24, 2026
10 of 11 checks passed
xemeraldwingx-dot added a commit that referenced this pull request Apr 24, 2026
NotLivyathan added a commit to NotLivyathan/HardLight that referenced this pull request May 19, 2026
fenndragon pushed a commit that referenced this pull request May 20, 2026
* Start Port Starlight Languages #1253

* add some missing newlines

* emergency fixes

* Continue Port Starlight Languages #1253

* additional fixes

* doing this one file at a time apparently

* guh

* Finish Port Starlight Languages #1253

* fix to make it work

* remaining necessary port + linter fix for makesentient refactor

* Port Starlight Language Fixes #1412

* Port Starlight Language Patch #1414

* Port Starlight PR #1416 & #1421

* Port Starlight Thaveyan Language + Thaven Speech Verbs PR #1440

* Port Starlight Language Tweaks #1446

* Port Starlight Silicon Language Base PR #1454

* Port Starlight Vulpkanin, Shadekin, & Vox Language Icons PR #1480

* Port Starlight PR #1512 & #1533

* Port Starlight Language Trait Tweaks #1599

* Port Starlight PR #1453, #1611, #1673, #1854, #2231, & #2291

* Port Starlight PR #1554, #1617, #2277, #2715

* Port Starlight PR #3019 & #3796

* two quick fixes

* Port Starlight Translator Refactor PR #4242

* some more fixes

* Port Starlight Animals Understand Common PR #4340

* Port Starlight PR #1509 + linter fix

* port necessary files from Starlight PR #2935 to make icons work

* minor optimization tweaks + enable chatbox icons + mouse language color

* no idea what I'm doing

* protogen tweak

* synth fix

* add language icon display toggle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants