Skip to content

Clients stuck at 100% loading on dedicated server - writeMaintenanceData scope mismatch #47

@XelaNull

Description

@XelaNull

Bug Report

Reported by: @HamiltonLockhart42 (originally posted in #38)

Description

When joining a dedicated server, clients become stuck at the 100% loading screen. The server log reveals a Lua error in the UsedPlusMaintenance specialization during the network synchronization phase.

Error Log

2026-03-21 03:27:25.281 Warning: StreamWriteTimestamp only is allowed to be called before any other write calls.
2026-03-21 03:27:25.317 Error: Running LUA method 'update'.
profile/mods/FS25_UsedPlus/src/specializations/UsedPlusMaintenance.lua:1284: attempt to call missing method 'writeMaintenanceData' of table

Technical Analysis (from reporter)

The error is caused by a scope mismatch in the networking lifecycle functions. In UsedPlusMaintenance.lua, the helper functions readMaintenanceData and writeMaintenanceData are defined within the UsedPlusMaintenance table. However, in the event listeners (onReadStream, onWriteStream, onReadUpdateStream, onWriteUpdateStream), the code attempts to call these functions as methods of the vehicle instance using self:writeMaintenanceData(streamId). Because these functions are not injected into the vehicle's metatable, the vehicle instance does not recognize them.

Proposed Fix (from reporter)

Update the synchronization functions to reference the UsedPlusMaintenance table directly:

-- Instead of: self:writeMaintenanceData(streamId)
-- Use: UsedPlusMaintenance.writeMaintenanceData(self, streamId)

This applies to onReadStream, onWriteStream, onReadUpdateStream, and onWriteUpdateStream (approx. lines 1250-1290).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguser-repliedLast reply was from a user (awaiting owner response)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions