Reply To: Simple modding

Home Forums Wayward Simple modding Reply To: Simple modding

#5384

Really cool work here. I hate to say it, but your hard work here won’t be transferable over to 2.0. The good news though, is that what you want to do should be available without all the hardship.

Spacetech, one of our programmers has spent a couple days working directly with modding and has implemented an API for Wayward mods with all the hooks you would need to customize most portions of the game. It won’t be 100%, but we hope to continually work on getting everything easy to mod. Here’s an example of a new item mod:

´╗┐class ArgusMod extends Mods.BaseMod implements Mods.IMod {
    public getName(): string {
        return "Argus";
    }

    public getVersion(): string {
        return "1.0.0";
    }

    public getCompatibleMinorVersions(): number[] {
        return [0];
    }

    public getReleaseDate(): string {
        return "4/11/2015";
    }

    public getAuthor(): string {
        return "Spacetech";
    }

    public getDescription(): string {
        return "Adds a new item called Argus into the game";
    }

    public getHooks(): Mods.Hook[] {
        return null;
    }

    public onLoad(): void {
        this.addItem({
            tX: 33,
            tY: 1,
            description: "The all seeing eye.",
            name: "Argus",
            weight: 2,
            attack: 1,
            damageType: DamageType.Blunt,
            equip: EquipType.Held,
            onEquip: this.onEquip,
            onUnequip: this.onUnequip,
            recipe: {
                requires: [
                    [ObjectType.SharpenedItem, 1, 0],
                    [ObjectType.Lens, 2, 2, 2],
                    [ObjectType.Log, 1, 1, 1],
                    [ObjectType.String, 1, 1, 1]
                ],
                skill: SkillType.Tinkering,
                level: RecipeLevel.Advanced
            },
            disassemble: true,
            durability: 500
        });
    }

    public onUnload(): void {
        
    }

    public onEquip(invId: number, item: IItem) {
        game.fov.disabled = true;
        game.fov.compute();
        game.updateGame();
    }

    public onUnequip(invId: number, item: IItem) {
        game.fov.disabled = false;
        game.fov.compute();
        game.updateGame();
    }
}