Skip to content

Commit

Permalink
feat(core): event constant object.freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed Dec 2, 2023
1 parent fa53153 commit 8a589f0
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 27 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/controllers/gangzone/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const [onPlayerLeavePlayer] = defineEvent({
},
});

export const GangZoneEvent = {
export const GangZoneEvent = Object.freeze({
onPlayerEnterGlobal,
onPlayerLeaveGlobal,
onPlayerEnterPlayer,
onPlayerLeavePlayer,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/controllers/menu/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const [onPlayerSelectedRow] = defineEvent({
},
});

export const MenuEvent = {
export const MenuEvent = Object.freeze({
onPlayerExited,
onPlayerSelectedRow,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/controllers/npc/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const [onClientMessage] = defineEvent({
},
});

export const NpcEvent = {
export const NpcEvent = Object.freeze({
onConnect,
onDisconnect,
onModeInit,
onModeExit,
onSpawn,
onClientMessage,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/controllers/player/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { onCheckResponse } from "./entity";

export { Player } from "./entity";

export const PlayerEvent = {
export const PlayerEvent = Object.freeze({
onConnect,
onDisconnect,
onPause,
Expand Down Expand Up @@ -64,7 +64,7 @@ export const PlayerEvent = {
onCommandText: CmdBus.on,
offCommandText: CmdBus.off,
onDialogResponse,
};
});

export { Dialog };

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/controllers/textdraw/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ const [onPlayerClickPlayer] = defineEvent({
},
});

export const TextDrawEvent = { onPlayerClickGlobal, onPlayerClickPlayer };
export const TextDrawEvent = Object.freeze({
onPlayerClickGlobal,
onPlayerClickPlayer,
});
4 changes: 2 additions & 2 deletions packages/core/src/controllers/vehicle/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const [onTrailerUpdate] = defineEvent({
},
});

export const VehicleEvent = {
export const VehicleEvent = Object.freeze({
onDamageStatusUpdate,
onDeath,
onMod,
Expand All @@ -160,4 +160,4 @@ export const VehicleEvent = {
onNpcEnter,
onNpcExit,
onTrailerUpdate,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/3dtext/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ onItemStreamOut(({ type, id, forPlayer, next }) => {
return next();
});

export const Dynamic3DTextLabelEvent = {
export const Dynamic3DTextLabelEvent = Object.freeze({
onStreamIn,
onStreamOut,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/actor/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const [onPlayerGiveDamageDynamicActor] = defineEvent({
},
});

export const DynamicActorEvent = {
export const DynamicActorEvent = Object.freeze({
onStreamIn: onDynamicActorStreamIn,
onStreamOut: onDynamicActorStreamOut,
onPlayerGiveDamage: onPlayerGiveDamageDynamicActor,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/area/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const [onPlayerLeaveDynamicArea] = defineEvent({
},
});

export const DynamicAreaEvent = {
export const DynamicAreaEvent = Object.freeze({
onStreamIn,
onStreamOut,
onPlayerEnter: onPlayerEnterDynamicArea,
onPlayerLeave: onPlayerLeaveDynamicArea,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/checkpoint/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const [onPlayerLeaveDynamicCP] = defineEvent({
},
});

export const DynamicCheckPointEvent = {
export const DynamicCheckPointEvent = Object.freeze({
onPlayerEnter: onPlayerEnterDynamicCP,
onPlayerLeave: onPlayerLeaveDynamicCP,
onStreamIn,
onStreamOut,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/mapIcon/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ onItemStreamOut(({ type, id, forPlayer, next }) => {
return next();
});

export const DynamicMapIconEvent = {
export const DynamicMapIconEvent = Object.freeze({
onStreamIn,
onStreamOut,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/object/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ const [onPlayerEditAttachedObject] = defineEvent({
},
});

export const DynamicObjectEvent = {
export const DynamicObjectEvent = Object.freeze({
onMoved: onDynamicObjectMoved,
onPlayerEdit: onPlayerEditDynamicObject,
onPlayerSelect: onPlayerSelectDynamicObject,
onPlayerShoot: onPlayerShootDynamicObject,
onPlayerEditAttached: onPlayerEditAttachedObject,
onStreamIn,
onStreamOut,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/pickup/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const [onPlayerPickUpDynamicPickup] = defineEvent({
},
});

export const DynamicPickupEvent = {
export const DynamicPickupEvent = Object.freeze({
onPlayerPickUp: onPlayerPickUpDynamicPickup,
onStreamIn,
onStreamOut,
};
});
4 changes: 2 additions & 2 deletions packages/core/src/wrapper/streamer/raceCP/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const [onPlayerLeaveDynamicRaceCP] = defineEvent({
},
});

export const DynamicRaceCPEvent = {
export const DynamicRaceCPEvent = Object.freeze({
onPlayerEnter: onPlayerEnterDynamicRaceCP,
onPlayerLeave: onPlayerLeaveDynamicRaceCP,
onStreamIn,
onStreamOut,
};
});

0 comments on commit 8a589f0

Please sign in to comment.