Skip to content

FS Script Library is a collection of new features and helpful utility classes for Farming Simulator 22 mods

Notifications You must be signed in to change notification settings

open-modding-alliance/ScriptLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

⚙️FS Script Library

The unofficial extension to the base game Lua library, adding new features and quality-of-life helper libraries, making this your one-stop-shop and starting point for all your mods.

With a non-intrusive opt-in approach running in the mod sandbox you can safely add this to any mod without any risk of version conflicts or bloating your mod. You choose what features to enable and to what extent you want to utilize the library.

If you have any suggestions, find an issue or maybe even have your own nifty functions you want to share with others, we gladly accept your contribution (see the Contribute section below for options and details).

Quick links: Installation | Getting Started | Script Reference

INSTALLATION

To install the FS Script Library you have three options:

A. Get The Bootstrap Mod

The quickest way to get started with a new mod is the Bootstrap Mod that is the foundation for a complete ready-to-run mod with FS Script Library already installed.

To add script library to an existing mod, the automatic (B) or manual installation (C) is recommended.

B. Automatic Installation [DISABLED]

C. Manual Installation

  1. Download the latest archive
  2. Unzip the zip archive to the root of your mod folder, it should look like this:
yourMod\
  scripts\
    scriptLibrary\
      ...
      scriptLibrary.lua
      ModHelper.lua
  YourMod.lua
  1. Follow the instructions in the Getting Started section.

GETTING STARTED

1. Install FS Script Library to your mod

2. Add the scriptLibrary.lua file to the <extraSourceFiles> section of your modDesc.xml:

<extraSourceFiles>
    <sourceFile filename="scripts/scriptLibrary/scriptLibrary.lua" />
</extraSourceFiles>`

3. Uncomment the files you want to include from the scriptLibrary.lua file, e.g:

-- ### Specializations (disabled by default) ###
source(g_scriptLibraryDir .. "defaultDisabled.lua")
--source(g_scriptLibraryDir .. "alsoDisabledByDefault.lua")

4. Create your main mod script file (e.g. MyMod.lua) and add it to the <extraSourceFiles> section of your modDesc.xml

5. [optional] Add the following snippet to your main mod script file:

-- Creates a new mod object (listening to mod events such as loadMap etc)
YourModName = Mod:init()

-- Executed when the map has finished loading, a good place to begin your mod initialization
function YourModName:loadMap(filename) 
  print("Map is loaded")
end 

6. Try your mod

Note: Using the Mod helper class in step 5 is optional, you can create the mod however you like, this is just the quick and easy way to get started.

REFERENCE

Folder File (.lua) Description
(no folder)
scriptLibrary This is the main script for the FS Script Library, this file contains a reference to all possible other files, uncomment the files you want to include.
ModHelper QoL wrapper and helper library to create your script mod, this serves as a good starting point for all mods, see documentation for all available functions and properties provided by the helper class.
ui UI/HUD related scripts
placeables Classes and utility scripts related to placeables
specializations Vehicle and placeable specializations
extensions General extension to base game classes
utils Helpers classes, e.g. to extend the string class or utilities for debugging
misc Other scripts not matching any of the above categories

About

FS Script Library is a collection of new features and helpful utility classes for Farming Simulator 22 mods

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages