Modrules.lua - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki
Location
modrules.lua
is a file in the Gamedata/
directory of a Spring game.
Purpose
This file controls various global parameters of the game, for example how fast units gain experience, what unit types can be transported, how fine grained the LOS system is, etc.
Source
The engine source code which parses the data from this file is viewable here:
Data Types
Details
Modrules.lua
is divided into several sub-tables containing tags
specific to each section, as follows:
capture
construction
experience
featureLOS
fireAtDead
flankingBonus
los
movement
paralyze
reclaim
repair
resurrect
sensors
system
or -1
- disabled.
transportability
Examples
Empty
modrules.lua
can simply return an empty table like this:
return {}
If you do this, Spring will use the default values.
Configurable by modoptions
Interestingly modrules.lua
can read
modoptions, so these parameters can be
scripted to be configurable from the lobby. For example to allow
selecting either legacy default pathfinder or QTPFS
via a modoption:
system = {
pathFinderSystem = (Spring.GetModOptions() and (Spring.GetModOptions().qtpfs == "1") and 1) or 0,
},