Mod not applied when other mods are added/removed?
Posted: Sat Jan 13, 2018 4:22 pm
Hi,
As similar mods did not seem to be updated at that point, so when 0.16 was released I created the mod Far Reach which is a pretty simple mod that extends the reach of the character.
The distance is configurable.
For me, everyhing works fine, but I got several reports that the mod do not get applied when people add or remove mods from their games.
Basically I just have 3 settings: far-reach-build-distance-bonus, far-reach-reach-distance-bonus and far-reach-resource-reach-distance-bonus
They are applied by a function with the following body:
This function is called by on_init, and to make everything reconfigurable I also added calling the function to an event listener for defines.events.on_runtime_mod_setting_changed.
When the bug was reported, I thought I could fix that by also calling the function in script.on_configuration_changed, but this did not have the desired effect. As I'm running out of solutions, I hope someone here can help me out what I'm missing?
As people report, when they go to the mod settings, everything works again, so on_runtime_mod_setting_changed seems to work fine, but after the game is loaded, the settings are not applied.
As similar mods did not seem to be updated at that point, so when 0.16 was released I created the mod Far Reach which is a pretty simple mod that extends the reach of the character.
The distance is configurable.
For me, everyhing works fine, but I got several reports that the mod do not get applied when people add or remove mods from their games.
Basically I just have 3 settings: far-reach-build-distance-bonus, far-reach-reach-distance-bonus and far-reach-resource-reach-distance-bonus
They are applied by a function with the following body:
Code: Select all
function far_reach_apply_settings()
local settings = settings.global
local playerForce = game.forces["player"]
playerForce.character_build_distance_bonus = settings["far-reach-build-distance-bonus"].value
playerForce.character_reach_distance_bonus = settings["far-reach-reach-distance-bonus"].value
playerForce.character_resource_reach_distance_bonus = settings["far-reach-resource-reach-distance-bonus"].value
end
When the bug was reported, I thought I could fix that by also calling the function in script.on_configuration_changed, but this did not have the desired effect. As I'm running out of solutions, I hope someone here can help me out what I'm missing?
As people report, when they go to the mod settings, everything works again, so on_runtime_mod_setting_changed seems to work fine, but after the game is loaded, the settings are not applied.