Bigger Map Mod
No Fog Mod
Better Zombie Spawning
More Zoom Mod
These mods are all currently in use or are part of other mods, tobspr will not publish any of these to the mod gallery.
Getting started can be tricky!
The first thing you will need is the mod developer version of the game.
To get the mod dev version of the game use this link :
https://beta.yorg3.io/?xdev_modDeveloper=1
This version is needed to install custom mods.
It will check for a mod file at http://localhost:8000/mod.js
You are probably wondering how to host your mod file at that address.
You can either make a file hosting server or use one of the ones that have already been made (Check below this).
Node.js File Server : https://github.com/TristonStuart/Yorg3-Mod-Tools/tree/master/Mod.js%20File%20Server%20(nodejs)/ (Recomended)
Python File Server : https://github.com/tobspr/yorg.io-3-modding-docs/blob/master/sample_mod/mod_testing_server.py
ModBuild is a custom mod loader for mod developers.
It can :
- Merge multiple mod files into one
- Supports plugins
- Supports AML api
- Push mod projects to publishable mod
ModBuild is specifically designed for mod developers, to help make the creation of mods easier.
The app var is important for editing anything outside of the game variables.
Getting it is different across released and beta (as of 10/25/19), so 2 methods are shown.
The api variable must be accessible.
function getApp(api){return api.app;}
var app = api.app;
function getAppOld(api){return api.exportedVariables.Loader.app;}
var app = api.exportedVariables.Loader.app;
The api variable is needed as it is the mods connection point to the game, without it your mod can do nothing.
You will only need to register one mod function per mod.
The api variable is used for registering your mod implementation (check below) and also is your link to everything outside the game environment (aka main menu, settings, user details, and more).
function myMod(api){
console.log('I got the api!');
console.log(api);
}
window.registerMod(myMod);
Unlike when registering your mod to get the api (check above), your mod implementation will run everytime a game is started and will pass you the game variables through "root".
Any mod that wants to interact with the game will need to register a mod implementation.
function myMod(api){
console.log('myMod is registered!');
function modImplementation(root){
console.log('Game has started! Got root!');
}
api.registerModImplementation(modImplementation);
}
window.registerMod(myMod);
Signals are an important tool to hook certain functions to ingame events and processes.
Signals allow you to execute a function to draw something on screen (for example) everytime the game wants to draw a frame.
There are many signals :
aboutToDestruct consumerPrioManuallyChanged damageDispatched dayNightChanged entityAdded entityDestroyed entityGotNewComponent entityQueuedForDestroy fullGameResync gameOver gameRejectedFromServer gameRestored gameSaved gameSyncedWithServer mapThemeLoaded modDrawScreenSpace modDrawWorldSpace modUpdateTick newlyUnlockedBuildingsChanged performAsync postLoadHook readyToRender requireRoutingUpdate resized skillsChanged streetDestroyed streetPlaced structureDestroyed structureEnhanced structurePlaced structureUpgraded
Example of how to add a hook to a signal :
root.signals.postLoadHook.add(function(){
console.log('Game has fully loaded!');
});
Ran : Before Game Exits
Args : None
Ran : When building resource priority is changed
Args : [Building]
Ran : When Zombie Attacks Something
Args : [DamageForm, Entity]
Ran : When day / night changes
Args : None
Ran : When an entity is created
Args : [Entity]
Ran : When an entity is destroyed
Args : [Entity]
Ran : When an entity gets a new component
Args : [Entity]
Ran : Before an entity is destroyed
Args : [Entity]
Ran : In multiplayer when the server detected a simulation state mismatch, this resets the game to a previous point in time
Args : None
Ran : When game ends
Args : None
Ran : When the server does not accept the savegame (Invalid sync token / anticheat or mods)
Args : None
Ran : When game is restored (Called at the beginning when a savegame has been loaded)
Args : None
Ran : Unused
Args : None
Ran : When game was successfully synced with server
Args : None
Ran : When map theme is fully loaded
Args : None
Ran : Every frame
Args : [DrawParameters (contains e.g. the Canvas, Root and Zoom)]
Ran : When rendering at world space
Args : [DrawParameters (contains e.g. the Canvas, Root and Zoom)]
Ran : Every tick
Args : None
Ran : When new buildings are unlocked
Args : [Array<buildingId: string>]
Ran : When the code needs to use async methods, those will be executed after the current logic step
Args : [callback: function() : void, name?: string]
Ran : After game is loaded
Args : None
Ran : When game is ready to render
Args : None
Ran : When game needs to make a routing update
Args : None
Ran : When window is resized
Args : [width: number, height:number]
Ran : When the skills are changed
Args : None
Ran : Unused
Args : [x, number, y:number]
Ran : When a new street was placed
Args : [x: number, y:number]
Ran : When a structure is destroyed
Args : [Building]
Ran : When a structure is enhanced (not upgraded)
Args : [Entity]
Ran : When a structure is placed
Args : [Entity]
Ran : When a structure is upgraded
Args : [Entity, Upgrade]