Skip to main content

PlayerMockUtils

Rx helpers over PlayerMock, split out so PlayerMock itself stays free of Nevermore dependencies (DI-less code like dummy-mode Remoting requires it directly).

Functions

observeMockedLocalPlayer

PlayerMockUtils.observeMockedLocalPlayer() → Observable<Player?>

Observes the mock designated as the local player (see PlayerMock.setMockedLocalPlayer), emitting the current designation on subscribe and again whenever it changes. This replaces one-shot reading PlayerMock.getMockedLocalPlayer, which goes stale when a test designates after the consumer initializes (designation is only required before bags Start, not before Init). Like the getter, this only ever emits the mock -- the real Players.LocalPlayer fallback stays an explicit read at the call site.

Re-designating from one mock to another emits nil in between: the designation is carried as a CollectionService tag on the mock, and the switch removes the old tag before adding the new one.

Show raw api
{
    "functions": [
        {
            "name": "observeMockedLocalPlayer",
            "desc": "Observes the mock designated as the local player (see [PlayerMock.setMockedLocalPlayer]),\nemitting the current designation on subscribe and again whenever it changes. This replaces\none-shot reading [PlayerMock.getMockedLocalPlayer], which goes stale when a test designates\nafter the consumer initializes (designation is only required before bags Start, not before\nInit). Like the getter, this only ever emits the mock -- the real `Players.LocalPlayer`\nfallback stays an explicit read at the call site.\n\nRe-designating from one mock to another emits nil in between: the designation is carried as a\nCollectionService tag on the mock, and the switch removes the old tag before adding the new one.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Player?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 32,
                "path": "src/player-mock/src/Shared/PlayerMockUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PlayerMockUtils",
    "desc": "Rx helpers over [PlayerMock], split out so PlayerMock itself stays free of Nevermore\ndependencies (DI-less code like dummy-mode Remoting requires it directly).",
    "source": {
        "line": 8,
        "path": "src/player-mock/src/Shared/PlayerMockUtils.lua"
    }
}