Skip to content

Latest commit

 

History

History
97 lines (68 loc) · 3.12 KB

CONTRIBUTING.md

File metadata and controls

97 lines (68 loc) · 3.12 KB

Contributing

Where do I go from here?

If you've noticed a bug or have a feature request, make sure to check our Issues if there's already an open issue addressing your concerns. If not, feel free to open a new one.

For Developers

Requirements

Before you start, make sure you have Node.js and either npm or yarn installed on your system.

How to Build

To build the project, follow these steps:

  1. Clone the repository to your local machine.
git clone https://github.com/EinS4ckZwiebeln/IcarusAdvancedAnticheat.git
  1. Navigate to the project directory.

  2. Install the project dependencies by running npm install or yarn install.

npm install
  1. To build the project, you can use either of the following commands:

For a one-time build.

npm run build

To continuously watch the project for changes and rebuild as necessary (recommended).

npm run watch

Adding Modules

To alter existing features, modify the corresponding module. If no module exists for the feature you wish to add, create a new module entirely.

export class ExampleModule extends Module {
    public void onLoad() {
        // Executes when the module is loaded.
    }
    public void onUnload() {
        // Executes when the module is unloaded.
    }
}

When creating a new module, please ensure that the module is registered by the module loader in the App.ts file. The new module also must have an entry in the config.lua file with an enabled = <boolean> property. Otherwise, the resource won't run.

// Add this below the other modules inside the App.ts file.
ModuleLoader.loadModule(new ExampleModule());
ExampleModule = {
    enabled = true
},

Subscribing to Events

In the ExampleModule class, you can see an example of how to subscribe and unsubscribe to events using the EventHandler class. The subscribe function allows you to register a callback function to be executed when a specific event occurs. The unsubscribe function removes the registered callback function from the event.

Function Parameters Retval
subscribe eventName: string | string[]; callback: Function | Function[]; void
unsubscribe eventName: string | string[]; callback: Function | Function[]; void

Here is an example of subscribing and unsubscribing to the entityCreating event:

export class ExampleModule extends Module {
    public void onLoad() {
        EventHandler.subscribe("entityCreating", this.onEvent.bind(this));
    }
    public void onUnload() {
        EventHandler.unsubscribe("entityCreating", this.onEvent.bind(this));
    }

    private void onEvent(entity: number) {
        console.log(`Creating: ${entity}`);
    }
}