Skip to content

asledgehammer/PipeWrench-Events

Repository files navigation

PipeWrench-Events

Description

PipeWrench-Events is an extension for the PipeWrench library, packaging Project Zomboid's events in an API that takes advantage of the TypeScript environment. EventEmitters and EventConsumers , are provided as events and their associated consumer types for listeners.

Custom EventEmitters

import * as Events from 'PipeWrench-Events';

// Example consumer type
export type MusicTrackUpdateListener = (
    track: string,
    volume: number
) => void;

// Example EventEmitter.
const MusicTrackUpdate = new Events.EventEmitter<MusicTrackUpdateListener>('MusicTrackUpdate');

// Example implementation.
MusicTrackUpdate.addListener((track: string, volume: number) => {
  print(`Playing Track: ${track} (Volume: ${volume})`);
});

Setup

Notes

  • The documentation is transcribed from pzwiki.net

Support

Discord Server

https://discord.gg/u3vWvcPX8f

If you like what I do and helped your community a lot, feel free to buy me a coffee! https://ko-fi.com/jabdoesthings https://www.paypal.com/paypalme/JabJabJab

About

PipeWrench Typing for PZ Events

Resources

License

Stars

Watchers

Forks

Languages