-
-
Save admalledd/9462a6debc494d3ecce46aea00acd829 to your computer and use it in GitHub Desktop.
Full far-reach control.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function far_reach_apply_settings() | |
local settings = settings.global | |
for _,player in pairs(game.players) do | |
if player.character then | |
player.character_build_distance_bonus = settings["far-reach-build-distance-bonus"].value | |
player.character_reach_distance_bonus = settings["far-reach-reach-distance-bonus"].value | |
player.character_resource_reach_distance_bonus = settings["far-reach-resource-reach-distance-bonus"].value | |
end | |
end | |
end | |
script.on_init(far_reach_apply_settings) | |
script.on_configuration_changed( | |
function(data) | |
far_reach_apply_settings() | |
end | |
) | |
script.on_event({defines.events.on_runtime_mod_setting_changed, defines.events.on_player_joined_game, defines.events.on_player_changed_force, defines.events.on_player_respawned}, | |
function(event) | |
far_reach_apply_settings() | |
end | |
) | |
if script.active_mods["jetpack"] then | |
remote.add_interface("far-reach", | |
{ | |
on_character_swapped = function(event) | |
--https://mods.factorio.com/mod/jetpack looks for remote interface called "on_character_swapped" specifically | |
--{new_unit_number = uint, old_unit_number = uint, new_character = luaEntity, old_character = luaEntity} | |
far_reach_apply_settings() | |
end | |
} | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment