Only_For_Developers_TOI_Setting_Sample

by suumani

Minimal test mod that sends a TOI difficulty override event after game start and after load.

2 hours ago
2.0
5
Owner:
suumani
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
9 hours ago
Latest Version:
0.0.2 (2 hours ago)
Factorio version:
2.0
Downloaded by:
5 users

Only For Developers: TOI Setting Sample

Summary

This mod is a sample integration mod for developers who want to send runtime difficulty overrides to The Other Invaders (TOI).

What this sample does

  • Gets TOI custom event id via remote interface
  • Sends a runtime difficulty override event
  • Demonstrates:
  • planet blacklist
  • invader supply multiplier
  • invader weapon roll table override

Important notes

  • This mod is for developers only
  • Runtime overrides are not persisted across save/load
  • Your mod must resend overrides after load
  • TOI may skip its first scheduler cycle after init/load to wait for override events

Logging

If you want detailed logs, use Manis_Logger together with TOI.

TOI can output logs through Manis_Logger when it is present.
Without Manis_Logger, TOI falls back to standard log() output, but detailed operational inspection is easier with Manis_Logger.

TOI remote interface

Interface name:
theotherinvaders

Function:
get_difficulty_override_event_id()

Example flow

  1. Get the event id from TOI remote interface
  2. Build override payload
  3. Send it with script.raise_event(event_id, payload)

Example payload

<<<CODEBLOCK START>>>
{
source_mod = "YourModName",
planet_blacklist = { "gleba" },
invader_level_supply = {
{ id = "toi_invader1", multiplier = 0.25 },
{ id = "toi_invader2", multiplier = 0.0 }
},
invader_level_weapon = {
{
id = "toi_invader1",
roll_table = {
{ variant = "gun", weight = 70 },
{ variant = "rocket", weight = 30 }
}
},
{
id = "toi_invader2",
roll_table = {}
}
}
}
<<<CODEBLOCK END>>>

Supported weapon variants

  • gun
  • flamethrower
  • tesla
  • rocket
  • cannon
  • artillery
  • railgun

Weapon roll table rules

  • total weight must be 0 to 100
  • total weight below 100 means remaining chance becomes no-spawn
  • total weight 0 means always no-spawn
  • total weight above 100 is invalid

Supply multiplier rules

  • multiplier must be 0 or greater
  • default is 1.0
  • 0 means no supply

Planet blacklist rules

  • blacklisted planets cannot receive:
  • base placement jobs
  • territory management jobs
  • virtual fleet planet entry
  • virtual fleet mid-route movement is still allowed

Save/load behavior

Overrides are runtime-only.
After loading a save, your mod must send the override event again.


note

0.0.2 readme updated