avatar
capn_crusty
REGULAR
0Issues
0Score
  • capn_crustycommented on [DZG-2429](edited)
    capn_crustycommented on [DZG-2429](edited)

    Confirmed and reproduced on a vanilla server with no mods (1.30 Stable, Nasdara). It happens on every server restart, not at random.

    Reproduction

    1. Pick a Land_House_1M4 (other houses with rebuildable doors should behave the same).

    2. Rebuild an interior door from inside the room, then put a Digital Code Lock on it. The keypad goes on the side you built from, which is correct.

    3. Restart the server.

    4. The keypad is now on the other side of the door. From the side without the keypad the door opens with no code.

    Result in my test: all 3 code locks on interior doors flipped after one restart. The code lock on the exterior door stayed correct.

    Cause (from the 1.30 scripts)

    - DigitalCodeLock.m_Reversed (which side the keypad is on) is not saved with the lock.

    - It is only set in DigitalCodeLock.SetDoorInfoFromSlot(), called from OnWasAttached(), which reads it from the door's ConstructionPartRebuildReversibleDoor (IsReversedLocal()).

    - When the server loads, the lock attaches to the house before the house's door build state has loaded, so IsReversedLocal() returns false and every lock falls back to the default side.

    - Calling SetDoorInfoFromSlot() again a few seconds after load gives the correct side, so the data is there and only the load order is wrong.

    Impact

    The side without the keypad needs no code, by design. When the lock flips, that free side faces outward, so every base door built from the non-default side is unlocked from outside after each restart.

    Suggested fix: save m_Reversed with the lock, or re-run SetDoorInfoFromSlot() after the building's construction state has loaded.