-
Notifications
You must be signed in to change notification settings - Fork 4
Scripts
We won't get too deep into the how to program a script mod but to get started you need a couple of things:
- Some IDE like Visual Studio, a normal text editor does the job too but it's way harder.
- Unity (check your log file for the current version, it's one of the first lines).
- The SimAirport.Modding library (we currently have no binary, either download or clone this repository or reference it in the SimAirport_Data\Managed folder.).
The guts and will to do so.- Experience with c# class libraries and .net framework.
To get started up you'll need to create a Class library in .Net Framework, once loaded up add a reference to the SimAirport.Modding library found here:
https://www.nuget.org/packages/SimAirport.Modding/1.0.0
If you don't want to use or can't compile the SimAirport.Modding library, just reference SimAirport.Modding.Base
at steamapps\common\SimAirport\SimAirport_Data\Managed
for the current edge/default version.
Default Branch -
Your first class must derive from the BaseMod class we provide, only this class will be used as entry points for your mod. Set the necessary properties like mod name and author name.
Example of your derived BaseMod class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SimAirport.Modding.Base;
using SimAirport.Modding.Settings;
namespace SimAirport_Script_Mod_Example
{
public class Mod : BaseMod
{
public override string Name => "Example Mod"; // Script Name
public override string InternalName => "you!.ExampleMod"; // Script Internal Name
public override string Description => "An example script mod."; // Description
public override string Author => "you!"; // Author
public override SettingManager SettingManager { get; set; } // Leave this, game will sort this out.
public override void OnTick()
{
// Called once per frame
}
}
}
There are more methods that you can find out about.
For the InternalName property it is recommended to use something along the lines of <authorName>.<modName>
, it is used to identify the mod, conflicting names may lead to issues!
If you want a direct link to the game, and not the limited api. Refrence AssemblyCSharp.dll from the Steam\steamapps\common\SimAirport\SimAirport_Data\Managed
folder. Warning, this is unstable and makes your script non-compatible with default if you are on the edge version of the game and if you are on the default version... vice versa.
You can use the SimAirport.Modding.Settings classes to provide in game configurations for your mod. The settings will appear in the mod settings menu under settings.
Any setting is automatically saved by the game and loaded again when loading mods, you do not need to save them by yourself.
Proxies are classes that provide direct access to game variables, we won't list all methods here since each method is documented in code, see that documentation or ask us if you need guidance.
All proxy classes are Singletons and will be created by the game to ensure the internal methods are correctly applied.
If you think there's a proxy missing or a proxy needs an additional method for your mod please create an issue with a proposal for the Prox / Method(s), what value they should work on and why you'll need them.
- EventSystem: Events that happen in-game or change the game state.
- Game: General information about the current played game.
- GameTime: Information about the current time.
- Graphics: Access to the internal SpriteManager for internal and custom Sprites.
- Map: Information about the map.
- I18n: Access to the I18n system for translation.