Tactical Construction


Tactical Construction provides a per-player toggle that - when enabled - prioritizes the local player's roboport for construction requests (as opposed to allowing construction requests to be satisfied by any statically-placed logistics network that overlaps inside the player's mobile roboport). CAUTION: This mod is still in BETA; you may still encounter crashes. (At this point I'm pretty sure there is minimal/no risk of save file corruption.)

6 months ago
0.18
354
Owner:
aaron311
Source:
accwebs/factorio-tacticalConstruction
Homepage:
https://github.com/accwebs/factorio-t...
License:
MIT
Created:
8 months ago
Latest Version:
0.2.4 (6 months ago)
Factorio version:
0.18
Downloaded:
354 times

Summary

Tactical Construction provides a per-player toggle that - when enabled - prioritizes the local player's roboport for construction requests (as opposed to allowing construction requests to be satisfied by any statically-placed logistics network that overlaps inside the player's mobile roboport).

CAUTION: This mod is still in BETA; you may still encounter crashes. (At this point I'm pretty sure there is minimal/no risk of save file corruption.)

PRETTY PLEASE: report any crashes or bugs to me via the mod portal or via Github issues :-)

How this Came to Be

My Factorio friends and I love construction robots. After all, who doesn't?

The great news is that the game seems to be pretty good at figuring out the different logistics networks and such and allocating jobs out to available robots. The bad news is that when building out your base, a constant annoyance to me and my friends is that once a construction job is 'assigned out' to the base network, even if the assigned robot is light-years away, the job won't get re-assigned to your local player. I get that that's probably a case of "it's not a bug, it's a feature", and I think I agree. However, the practical aspect of things is sometimes you just want your player's robots to finish the damn template next to you right away so you can get on with your life and build something else.

Rather than complain about it (okay, that's a lie, I complained about it incessantly), I decided to see if I could do something about it. So, after doing some investigation that cough might have involved a little bit of disassembling the native executable using the included PDB file for symbols (what can I say, I'm obsessive at times) I finally realized how the game's robot scheduling algorithm worked. Reviewing the various nested loops and calls, suddenly clicked to me that if I was to create a separate force in the game, the construction requests would be scheduled separately.

Hence this horrible idea of a mod was formed. When you toggle the button on, your player and any entities needing construction within your player's roboport, get moved to an alternate force. This has the effect of prioritizing your local roboport at the expense of causing various negative side effects. (So far they all seem to be temporary, although not sure.)

Usage Instructions

  1. Un-hide the Tactical Construction toggle button on your shortcut bar:
    1. On the top right of your shortcut bar, there is a small "..." button that lets you customize the bar. Click it to show the customization menu.
    2. Enable display of the custom shortcut button by clicking the checkbox next to it. If the checkbox will not enable, you may need to first uncheck something else to make room.
  2. Have a personal roboport in your player's armor, construction robots and supplies for building in inventory, etc. Just like normal.
  3. Keep the Tactical Construction button toggled off under regular play.
  4. Upon encountering an issue where your base's robot network is scheduled to build something that you want to build w your player, toggle the button on:
    1. When enabled, your player and any entities needing construction around you will be transported to an 'alternative' force in the game that is auto-created and - to the maximum extent possible - synced with your regular force.
    2. However, even allied forces don't fulfill each-other's construction requests. This means your player's robots will handle the construction despite your base's network overlapping.
    3. As you move, now-out-of-range entities are sent back to your base's primary force. And new in-range entities needing construction are moved to the alternative force.
  5. Once the construction is complete, toggle off the button. You will be sent back to your primary force and any as-yet alternate-force entities will be reverted along with you.

Considerations

  1. This mod auto-creates one alternative (allied) force per each player force. In most games there is one player force (thus, only one alternative force will be created); however, this mod tries to handle scenarios where there are multiple player forces (each getting its own alternate force).
  2. Due to the alternate force behavior, once you save your game with this mod active, it's probably not advisable to disable the mod on that save file moving forward. Tactical Construction makes a point to clean up any alternative forces when there are no longer any connected players that might use them; however, if you disable the mod, that logic will of course not be able to run to clean up any alternative forces that were still determined to be needed at the point of save.
    1. I may eventually add a console command that can be used to tell the mod to clean itself up and go into a permanent 'zombie' state. This could be run right before saving the game, after which the mod could be disabled. File a Github issue if something like this would be of use to you.

Limitations

  1. Base entity disco: At present, a force's "color" (i.e. the color applied to all entities on that force) appears to be automatically equivalent to the color of the first player member of the force. As a result, when player #1 in a multiplayer game toggles the feature (and gets moved to the alternative force), the primary force color will change to player #2's color. Upon player #1 toggling the feature off, the force color reverts. Thus, you get a sort of "light show" every time player #1 uses this feature.
    1. Enhancement request submitted here: https://forums.factorio.com/viewtopic.php?t=82644
    2. Workaround: Set player colors to the same value :-)
  2. Map fog-of-war: When players have the feature enabled, they are moved to a different force in the game. This means that the discovered areas of the map will be reset. I've enabled map sharing between the two forces, but it only seems to share scans of a sector upon next active scan. Thus, your map will likely be significantly-less explored while you have the feature on.
  3. Force weapon attributes: At present I don't sync a bunch of force damage attributes from the primary force over the the alternative one. So if you're gonna fight, maybe toggle the feature off first :-)

See the Github repo's readme for more information.