Map Injector is a very simple mod. For users, the only thing it does is add an extra light in the Cabin shelter that illuminates the bed and nightstand.
For developers, it provides a common API to inject custom PackedScenes into the game's maps at load time, allowing additional objects, geometry, etc. to be added without overriding the entire map .tscn.
Vostok Map Injector should always be loaded before any other mod that depends on it!
Its default priority is -999, which should put it at the top of the load order.
API
Map Injector provides a single public API function, accessible via its autoload object. Consequently, Map Injector should always load before any mods that use it.
To register a map extension, simply call the RegisterMapExtension(map_name: String, extension: PackedScene) function on the Map Injector object. Here's an example:
# In my_mod_entry.gdvar MyScene = preload("res://Mods/MyMod/Scenes/MyScene.tscn")
@onready var MapInjector = $/root/ModLoader/MapInjector
func _ready():
MapInjector.RegisterMapExtension("Village", MyScene)
Technical Note
Map Injector processes map additions at the time of the SceneTree.scene_changed signal. There is no guarantee that any of the game's scripts which iterate items in the scene will run before (or after) scene additions are injected.
Map Injector does not currently support overriding or replacing items in the scene. It uses a purely additive load process.