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 : [BuildingMeta]
Ran : When Zombie Attacks Something
Args : [SpecificData (instaKill info), EntityMeta]
Ran : When day / night changes
Args : None
Ran : When an entity is created
Args : [EntityMeta]
Ran : When an entity is destroyed
Args : [EntityMeta]
Ran : When an entity gets a new component
Args : [EntityMeta]
Ran : Before an entity is destroyed
Args : [EntityMeta]
Ran : (Not known - Might only be used in MP)
Args : Unknown
Ran : When game ends
Args : None
Ran : (Not known - Invalid sync token / anticheat or mods)
Args : Unknown
Ran : When game is restored from sync
Args : None
Ran : (Not known)
Args : Unknown
Ran : When game is synced with server
Args : None
Ran : When map theme is fully loaded
Args : None
Ran : Every frame
Args : [DrawParameters (Canvas - Mod Ui, Root, Zoom)]
Ran : When rendering at world space
Args : [DrawParameters (Canvas, Root, Zoom)]
Ran : Every tick
Args : None
Ran : When new building is unlocked
Args : [SpecificDataArray (Building Name)]
Ran : When the code needs to use async
Args : [CallBackFunction?, Name]
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, Height]
Ran : When the skills are changed
Args : None
Ran : Never (There is nothing using this signal and it is never called)
Args : Unknown
Ran : (Not known)
Args : Unknown
Ran : When a structure is destroyed
Args : [BuildingMeta]
Ran : When a structure is enhanced (not upgraded)
Args : [EntityMeta]
Ran : When a structure is placed
Args : [BuildingMeta]
Ran : When a structure is upgraded
Args : [BuildingMeta, UpgradeMeta]