rock-mod
Version:
Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.
32 lines (31 loc) • 1.23 kB
JavaScript
/**
* CCMP implementation of the rock-mod client RPC registry.
*
* The current gamemod routes UI RPC through the event bridge:
* `window.ccmp.emitClient(...)` -> `ccmp.on(...)` -> NetworkRPCService.
* `register` therefore keeps the same public contract as RageMP's
* `mp.events.addProc` without emitting noisy startup warnings.
*
* Native client->server RPC is still intentionally unsupported here. The
* gamemod uses its correlation-id protocol over `net.events` for that path.
*/
export class CCMPRPCManager {
constructor() {
this._uiHandlers = new Map();
}
register(rpcName, handler) {
this._uiHandlers.set(String(rpcName), handler);
}
unregister(rpcName) {
this._uiHandlers.delete(String(rpcName));
}
emitServer(rpcName, ...args) {
void args;
return Promise.reject(new Error(`CCMPRPCManager.emitServer(${String(rpcName)}): native client→server ` +
`RPC не реализован под CCMP. Используй net.events с собственным ` +
`correlationId-протоколом (как делает rock-mod-rpc-caller.adapter).`));
}
getHandler(name) {
return this._uiHandlers.get(name);
}
}