miniMAXIme: Character scaler and selector

by Pi-C

The player stands like a giant near the vehicles. Now you can adjust the size of your character -- and you can change your appearance at any time if you've other mods that provide extra characters!

Tweaks
11 days ago
0.16 - 2.0
26.4K

b [Not a minime bug/Fixed] Breaks far reach mods

4 years ago

Since 0.0.17, this mod breaks far reach mods, even when the option that does something to the reach distance is off.

4 years ago

What exactly is breaking? Any actual errors, or is it just not working as expected? Can you provide a saved game so I can reproduce the problem?

4 years ago

No errors, it's not working as expected. The far reach mod is set to extend the player's reach, the reach option on minime is disabled. A save with just the far reach mod and minime can be downloaded here: https://patriot1911.stackstorage.com/s/9m2IiQshhAt405rO

4 years ago
(updated 4 years ago)

I'm sorry, but I can't reproduce that. I've loaded your saved game (with sync). The character is where it was, next to the crashed space ship. I've zoomed out as far as possible, and without changing the character position, I was able to mine stone from the patch southwest of the player, and trees southwest of the stone patch.

Actually, it doesn't really make sense that minime should interfere with Far reach! While it may seem that they change the same thing (mining distance), that isn't the case. Here's what minime does:

if mining_distance then
  character.reach_resource_distance = character.reach_resource_distance * scale_factor
end

And this is what Far reach does:

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

More simply put: minime scales the base value, Far reach allows you to change what's added to the base value. Even if I'd set reach_resource_distance = 0, you would be able to reach tiles that are character_resource_reach_distance_bonus tiles away. Moreover, with only one character in the game, the GUI isn't active and event handlers are turned off in control.lua, so everything that minime changes happens in the data stage.

Perhaps I just don't understand what exactly isn't as it should be, but could you try again, please?

4 years ago
(updated 4 years ago)

That.. is really weird. I understand your explanation fully, and it certainly seems like it would be impossible to interact in that way. Yet, it does happen. I've created a video so you can see the problem is actually happening on my side: https://youtu.be/X2BO1AdK2h0 (edit: the blown out colors are an HDR-thing, I think, it looks normal on my HDR monitor). I've also checked to see if it wasn't Far reach that was in some way broken, if I load the same map without minime I can mine the stone south west of my position just fine (I didn't make a video of that though, so you'll have to take my word for it).

You can see that the main part of the wreckage is the only thing that actually starts a mining process. No other mods than Far reach and minime have been activated..

4 years ago

I don't know what I did different this time, but I could reproduce this now. Not sure what happens there, but I'll dig around. :-)

4 years ago

It's getting weirder: I deactivated minime and used just Far reach. On loading your saved game, I could mine the rocks. But after starting a new game, the mining distance bonus was gone. Mind you, minime wasn't active at the time, it was Far reach on its own that didn't work! I've a suspicion the cut scene may have to do with that …

4 years ago

Let me tell you what has happened:

I've put some debugging lines into control.lua of "Far reach". Then I've started a new game with minime and Far reach enabled:

29.048 Loading level.dat: 1062667 bytes.
29.049 Info Scenario.cpp:187: Map version 1.0.0-0
29.070 Checksum for script /home/pc/GOG_Games/Factorio/test/temp/currently-playing/control.lua: 3931528263
29.073 Checksum for script __minime__/control.lua: 2634133821
29.074 Checksum for script __far-reach__/control.lua: 2366829378
29.074 Script @__minime__/common.lua:95: Entered script.on_init()
29.074 Script @__minime__/common.lua:95: Character selector is disabled -- nothing to do!
29.074 Script @__minime__/common.lua:95: End of script.on_init()
29.074 Script @__far-reach__/control.lua:21: Entered on_init()
29.074 Script @__far-reach__/control.lua:3: Entered far_reach_apply_settings()
29.074 Script @__far-reach__/control.lua:5: Number of players: 0
29.074 Script @__far-reach__/control.lua:17: Leaving far_reach_apply_settings()
29.074 Script @__far-reach__/control.lua:23: Leaving on_init()
29.086 Script @__far-reach__/control.lua:36: event: {
name = 43,
player_index = 1,
tick = 0
}
29.086 Script @__far-reach__/control.lua:3: Entered far_reach_apply_settings()
29.086 Script @__far-reach__/control.lua:5: Number of players: 1
29.086 Script @__far-reach__/control.lua:7: Player 1 (Pi-C)
29.086 Script @__far-reach__/control.lua:14: Player doesn't have a character
29.086 Script @__far-reach__/control.lua:17: Leaving far_reach_apply_settings()
72.304 Info AppManagerStates.cpp:1837: Saving finished

As you can see, minime doesn't do anything. Far reach tries to apply its settings when the game is started (on_init); there's no player yet, so it doesn't do anything. Then on_player_joined_game is triggered, again Far reach tries to apply its settings, but because the cut scene is still playing, the player doesn't have a character yet, so the settings aren't applied.

Now I've removed minime:

24.223 Loading map /home/pc/GOG_Games/Factorio/test/saves/far_reach_issue.zip: 1342007 bytes.
24.241 Loading level.dat: 1324616 bytes.
24.247 Info Scenario.cpp:187: Map version 1.0.0-0
24.309 Loading script.dat: 478 bytes.
24.312 Checksum for script /home/pc/GOG_Games/Factorio/test/temp/currently-playing/control.lua: 3931528263
24.312 Checksum for script __far-reach__/control.lua: 2366829378
24.313 Script @__far-reach__/control.lua:28: Entered on_configuration_changed
24.313 Script @__far-reach__/control.lua:3: Entered far_reach_apply_settings()
24.313 Script @__far-reach__/control.lua:5: Number of players: 1
24.313 Script @__far-reach__/control.lua:7: Player 1 (Pi-C)
24.313 Script @__far-reach__/control.lua:9: Player has character
24.313 Script @__far-reach__/control.lua:17: Leaving far_reach_apply_settings()
24.313 Script @__far-reach__/control.lua:30: Leaving on_configuration_changed

Because minime was removed, on_configuration_changed triggers. Far reach tries once again to apply its settings. This time, the player already has a character, so it succeeds.

"Far reach" has given you far reach because "minime" was removed -- but it would have done the same thing if you'd added or removed some other mod. So, this isn't a bug in minime, but in Far reach. Never judge by the symptoms! :-D

(I'll have to do check minime's code as well, however. I'm afraid it's also affected by the cut scene.)

4 years ago
(updated 4 years ago)

Ah, I see, so it is indeed the new cutscene throwing things off. I'd imagine this might actually cause issues for more than a handful of mods, woops!

Is this something you would like to submit to the Far Reach mod's author, since you did all the legwork? Or would you rather have me do that?

edit: nvm, I didn't check to see if you already notified the author!

edit2: In case you didn't already read this post, and also didn't check the forums yet: https://forums.factorio.com/viewtopic.php?f=25&t=87938 seems to suggest that defines.events.on_cutscene_cancelled is the event to use.

4 years ago

Is this something you would like to submit to the Far Reach mod's author, since you did all the legwork? Or would you rather have me do that?

Already posted here. The fix is quite easy: add on_cutscene_cancelled and on_cutscene_waypoint_reached to the events that trigger player initialization.

4 years ago

Hi Pi-C,
I don't quite understand why in this case removing minime allows far reach to work.
If there is an issue with the cutscenes, that should persist with or without minime?

Still, it's weird that the on_player_created event is unable to apply my settings correctly - will investigate.

4 years ago

Hi Pi-C,
I don't quite understand why in this case removing minime allows far reach to work.
If there is an issue with the cutscenes, that should persist with or without minime?

Because the removal (or addition, presumably) of a mod calls on_configuration_changed in which the Far Reach effect is reapplied. So basically any change to the configuration will also trigger the 'fix' (which is something that was already established in the topic on your mod's page).

Still, it's weird that the on_player_created event is unable to apply my settings correctly - will investigate.

See this topic, basically the creation of the player doesn't actually guarantee that there is a character. Any mod that assumed that stopped working with 1.0.

4 years ago

I was able to repair far reach by triggering far_reach_apply_settings on the event on_cutscene_cancelled (which apparently is also called when the cutscene completes, not only when it is cancelled)

4 years ago

… on_cutscene_cancelled (which apparently is also called when the cutscene completes, not only when it is cancelled)

Yes, that works with a vanilla game. But we're going by symptoms here, which isn't always correct (judging by the symptom that Far reach worked after minime had been removed, it was a bug in minime that Far reach didn't work; digging deeper showed that symptom and actual bug were independent of each other). That's why I've been wondering if this will always work. It may be necessary to add additional checks for on_cutscene_waypoint_reached for compatibility with other mods. Of course, you could also decide to wait for reports of such a mod breaking yours again -- I honestly don't know if there is or will be any mod like that around yet. :-)

New response