Desire Paths


The earth under trafficked areas will wear down, creating natural paths wherever you walk or drive Cars (automobiles and tanks). These paths are temporary and will eventually regenerate. The "decay" of the soil is a function of the speed and weight of your vehicle.

Tweaks
3 years ago
1.0 - 1.1
1.63K

g AI Enemy and Vehicle Hooks

3 years ago

Could you enable the desire pathing feature to additionally apply to AI units such as enemy/ally biters as well as mod added ai units such as vehicles from AAI Vehicles and other mobile assets like the robots from Robot Army? obviously this may increase demands on the computer but i think at least having the option to enable/disable this feature may be appreciated by this mod's fans.

As it stands the desire pathing is only triggered by the player character and vehicles occupied by them... but not when traveling in reverse or if its an ai unit. could you also make this function an option not enabled by default to avoid conflicts with other mods and/or performance issues leaving the function to the discretion of the user? thx.

3 years ago

I love the idea, but don't know off the top of my head how to accomplish. My mind has not been on the modding scene lately, so I can't tell you if it's possible, though it probably is possible, or when it might be done.

However, the minute I can turn my focus to this project again, this will be on my list of todos. Sorry I can't commit more ATM. Thanks so much for pointing out the missing functionality 🙏

3 years ago

I have done some investigation and unfortunately this feature is not easily supported.

Please see this line of code: https://github.com/adamwong246/Desire-Paths/blob/e3a9dc1c87f04d614a22a45fe170a9c65718961d/control.lua#L295
This mod takes advantage of a hook that fires when a player moves. You can find the entire list of such events here https://lua-api.factorio.com/latest/events.html Sadly, there is no event that corresponds with the feature you are requesting. __If there were a hypothetical event, lets say, "defines.events.on_entity_changed_position" the work could proceed but since none exists, you are at a brick wall unless you petition the Wube devs for it and that is unlikely. Such a hook would not be good for the UPS at all!

With a more heroic effort, perhaps you could achieve your result but it would be quite an overhaul of this very simple mod. In order to do this, you'd need to do several things
1) create a hook that registers every existing and new entity that can possibly cause soil erosion by moving.
2) use that hook to register entities into a list
3) Every n ticks, check the items in the last for changed positions
4) if a thing has moved, chart a line from its past and present positions.
5) Make that line into a series of "degraded tiles" and add those degraded tiles to its OWN list.
6) Paint those degraded tiles over the landscape
7) Every N Ticks, remove "degraded tiles" so that the landscape gradually returns to normal AND keeping the collection within memory constraints.

Not impossible, or even really that difficult, but it would very much be an entirely new project.

3 years ago

Please take a look at https://mods.factorio.com/mod/VehicleTrails, it may provide what you are looking for

New response