RitnLib¶
Classes and functions library for Ritn Factorio mods.
Get started¶
New here? Start with:
- 📦 Getting started — install + first mod in 5 minutes
- 🧩 The 4-layer architecture — how the mod is organized
- ⚠ Temporary wrappers golden rule — read before using runtime classes
Guides¶
Task-oriented tutorials:
- Installation
- Your first prototype
- Your first runtime handler
- Complete GUI pattern
- Inventory snapshot & restore
- Building a setting
- Remote interfaces
Class reference¶
Overview¶
Runtime classes (control stage)¶
| Class | Wraps | Use |
|---|---|---|
RitnLibEvent |
any Factorio event | payload normalization |
RitnLibPlayer |
LuaPlayer |
fast access |
RitnLibSurface |
LuaSurface |
entity search |
RitnLibForce |
LuaForce |
recipes/techs/stats |
RitnLibEntity |
LuaEntity |
entity manipulation |
RitnLibRecipe |
LuaRecipe |
runtime activation |
RitnLibTechnology |
LuaTechnology |
research-finished hook |
RitnLibInventory |
LuaPlayer + storage |
snapshot/restore |
RitnLibGui |
GUI event | click dispatcher |
RitnLibInformatron |
Informatron event | page integration |
RitnLibGuiElement |
add{...} payload |
fluent builder |
RitnLibStyle |
LuaStyle |
style presets |
Data classes (data stage)¶
| Class | Manipulates |
|---|---|
RitnPrototype |
base of all manipulators |
RitnProtoEntity |
data.raw[entity-type] |
RitnProtoItem |
data.raw[item-type] |
RitnProtoRecipe |
data.raw.recipe |
RitnProtoTech |
data.raw.technology |
RitnProtoOre |
data.raw.resource + autoplace |
RitnProtoSprite |
data.raw.sprite |
RitnProtoStyle |
data.raw['gui-style'] |
RitnProtoItemGroup |
data.raw['item-group'] |
RitnProtoItemSubgroup |
data.raw['item-subgroup'] |
RitnProtoRecipeCategory |
data.raw['recipe-category'] |
RitnProtoFuelCategory |
data.raw['fuel-category'] |
RitnProtoCustomInput |
data.raw['custom-input'] |
RitnProtoUtilityConst |
data.raw['utility-constants'] |
RitnIngredient |
ingredient normalization |
Settings stage¶
Utility libraries¶
lualib/other-functionslualib/table-functionslualib/string-functionslualib/json-functions— embeds rxi/json.lua (MIT)lualib/entity-functionslualib/gui-functionslualib/LuaStyle-functions⚠ deprecated
Vanilla helpers¶
Foundation layer¶
core/class.lua— Object-oriented class factorycore/constants.luacore/eventListener.lua— fork ⚠ experimentalcore/interfaces.lua
Concepts¶
- 4-layer architecture
- Life cycle (data → settings → control)
- Temporary wrappers (golden rule)
- Custom object-oriented class factory
- Event model
- Delegated persistence
- Consumer remote contract
Architecture decisions (ADR)¶
- ADR index
- ADR-0001 — Custom object-oriented class factory
- ADR-0002 —
_Gglobals vs returned modules - ADR-0003 — Status of the
eventListenerfork - ADR-0004 — FR + EN language strategy
Debt & migration¶
For maintainers¶
- 🏗 Internal architecture (FR only)