Far Reach

by Fexx

Build, interact and mine on the entire screen. Distances are customizable. Substitute for non-maintained mods like Long Reach.

Utilities
7 months ago
0.16 - 1.1
156K

g Losing far reach

4 years ago

Hello. When using the mod Space exploration, when I hop into a jetpack I lose the far reach, forcing me to go to settings and change the reach value to enable it again.

Is there anyway to fix this?

4 years ago

Hi!
Probably Space exploration overwrites the reach setting when you enter the jetpack.
I'll try to have a look when I find the time.

4 years ago

Couldn't reproduce. I didn't find an item called Jetpack in Space Exploration, only a thruster suit. If I put it on, far reach keeps working.

If you still have this issue, please give me the steps needed to reproduce.

4 years ago

Hey All,

I'm having a similar problem using Jetpack (by the same author as Space Exploration). It looks like jetpacks (specifically the armor grid item, not the jump suit) is overriding reach settings upon activation/deactivation.

I was able to temporarily fix this by adding the following event to the list of events that trigger an update.
Within control.lua (Line: 21)

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},

to

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, defines.events.on_gui_opened},

While this does refresh the settings whenever we open the inventory, it doesn't resolve the underlying issue caused by the other mod. Additionally there is another side effect in which these settings are now force overriding other mods like "Cargo Ships" that adjusts the settings when a 'water rail' is in hand (normally holding water items grants 10x reach distance to allow you to create shipping paths far in the water.

Again this is a hack/bandaid at best, the real solution is to have jetpack simply pass through existing values rather than reset them, but I figured it was worth sharing. The authors of Jetpack were made aware of the issue, so hopefully after an update from them everything will be fine.

4 years ago

Hey zelitz,
thanks for getting into that. I will see if the issue is fixed in jetpack, otherwise see what I can do myself.

3 years ago
(updated 3 years ago)

I looked into how/what jetpack was doing, and they are cloning-and-swapping the player, as part of this they have a "raise event" thing that supposedly informs other mods that this happened. probably a better call to have someone poke the Jetpack mod to preserve player bonuses properly, but I don't understand enough factorio modding to supply a patch that way... I do know enough to let far-reach know about the player swap though! Their code isn't properly preserving character bonuses, but I don't know how to properly (1) detect when it is proper to update/copy them or not (or what the full list is like, something something LuaCharacter != LuaPlayer?) nor (2) how to properly report a bug to the Jetpack author since discord for bug reports is poor :/

My change is-was thus https://gist.github.com/admalledd/9462a6debc494d3ecce46aea00acd829 :

if script.active_mods["jetpack"] then
remote.add_interface("far-reach",
{
on_character_swapped = function(event)
far_reach_apply_settings()
end
}
)
end

(github gist linked just in case formatting eats it.)

3 years ago
(updated 3 years ago)

Hey mate, thanks for that. I released it with your fix.

In general I agree that it sounds like instead this should be fixed in the jetpack mod so that the character is cloned properly including the reach bonus, but I don't know all the details of the cloning, maybe it's not as simple as copying a couple of values.
Anyway, as zelitz pointed out he reported the bug, but nothing happened, so I'll use your code, thanks again.

3 years ago

Thank you! I can certify that the updated version Works On My Machine(TM)

3 years ago

Hey, I'm also playing with space exploration and I noticed that you loose far reach when dying.
If you have time you could maybe look into this ;)

3 years ago

Same as CrushedIce, dying in space exploration causes far reach to stop working.

3 years ago

Yup - Same here. On death (using SE) Far Reach stops working.
Workaround: Touch one of the values in the mod - And it works again.

3 years ago

Hi, thanks for your reports!
Actually, the mod reapplies itself in case a player respawns. Maybe Space Exploration changes the respawn behaviour andinstead creates a new player, which bypasses the mod. I'll try to find a factorio event to fix that as well.

3 years ago

Yup - Same here. On death (using SE) Far Reach stops working.
Workaround: Touch one of the values in the mod - And it works again.

What was the value that you changed, because I'm having the same issue now.

2 years ago

@YashedP or anyone else who finds their way here later.
I ran into the same issue. While in-game I went:
Menu > Settings > Mod Settings > Map
Then scrolled down to Far Reach and changed the bonuses from 123 to 124 and hit Confirm and it started working again. I think changing those values at all will fix the issue.

2 years ago

Hi all, I will add better compatibility with Space Exploration today.
Sorry it took me a while, and thanks again for reporting.

This thread has been locked.