[Linux-only] basically bloxstap for sober
at dev 56 lines 1.6 kB view raw
1import type { 2 PlrJoinLeaveAction, 3 GameJoinAction, 4 BloxstrapRPCAction 5} from "./types"; 6import { eventCollector } from "./EventCollector"; 7 8/** 9 * @deprecated Use plugin.on(), eventCollector.emitGameJoin(), eventCollector.emitGameLeave(), etc. 10 */ 11export function hookRobloxLogAction( 12 hookableThing: "JOIN_LEAVE", 13 func: (a: PlrJoinLeaveAction) => any 14): void; 15export function hookRobloxLogAction( 16 hookableThing: "GAME_JOIN", 17 func: (a: GameJoinAction) => any 18): void; 19export function hookRobloxLogAction( 20 hookableThing: "GAME_LEAVE", 21 func: () => any 22): void; 23export function hookRobloxLogAction( 24 hookableThing: "BLOXSTRAP", 25 func: (a: BloxstrapRPCAction) => any 26): void; 27 28export function hookRobloxLogAction( 29 hookableThing: "JOIN_LEAVE" | "GAME_JOIN" | "GAME_LEAVE" | "BLOXSTRAP", 30 func: 31 | ((a: PlrJoinLeaveAction) => any) 32 | ((a: GameJoinAction) => any) 33 | ((a: BloxstrapRPCAction) => any) 34 | (() => any) 35): void { 36 // console.warn("hookRobloxLogAction is deprecated. Use the new event system instead."); 37 38 // For backward compatibility, we'll still register the callback 39 // but it's recommended to use the new event system 40 switch (hookableThing) { 41 case "GAME_JOIN": 42 eventCollector.on("GAME_JOIN", func as any); 43 break; 44 case "GAME_LEAVE": 45 eventCollector.on("GAME_LEAVE", func as any); 46 break; 47 case "JOIN_LEAVE": 48 // Subscribe to both player join and leave events 49 eventCollector.on("PLAYER_JOIN", func as any); 50 eventCollector.on("PLAYER_LEAVE", func as any); 51 break; 52 case "BLOXSTRAP": 53 eventCollector.on("BLOXSTRAP_RPC", func as any); 54 break; 55 } 56}