Autodrive

by Pi-C

Car equipment for train avoidance, logistic network integration, circuit network connectivity, fuel refill, ammo reload, vehicle repair, radio control, enemy targeting, and gate control.

Content
a month ago
0.17 - 1.1
2.97K
Transportation Combat Logistic network Circuit network

g Secondary Weapon Control?

4 years ago

Hi! Love the mod! My favorite part is vehicles automatically targeting enemies with the Enemy Sensor.

What I'm wondering is: is there any way to make it so that the Enemy Sensor uses secondary vehicle weapons while allowing the player to take control of primary weapons while driving manually?

For example, in Schall Tank Platoon, the Light Tank has a 20mm autocannon and a machine gun. By default, you have to choose which weapon is active, and Autodrive then targets and fires that weapon automatically (but not the other). What I would love to have happen is instead that I control the active weapon (the autocannon for example), while Autodrive defends me with the machine gun, independently.

Is this possible? Or within the scope of Autodrive at all?

4 years ago
(updated 4 years ago)

If I understand correctly how the game works, that's not possible in Factorio. Factorio allows up to 2 players to ride in the same vehicle (driver and passenger). There's a switch where you can toggle which player is in control of the guns: it's either the driver or the passenger. This can also be toggled by mods (which Autodrive already does if only one player is in the vehicle who does the driving; it creates a dummy character if enemies are detected who operates the gun in that case).

Autodrive checks each vehicle on each tick and automatically fires the chosen weapon if the dummy passenger is in control of the gun. I certainly could assign a target to the dummy passenger, then set driver_is_gunner to true and choose the second gun. But that would automatically take gun control away from the passenger, so the vehicle would still use one gun only.

There might be a workaround, but it's such a dirty hack that I wouldn't dare to try it (also, it probably would lead to an UPS load that would be insane): Remove all but the first gun from the vehicle, create a second vehicle that gets the secondary weapon (perhaps even a third vehicle for the tertiary weapon --> tanks!) on top of the first, place another dummy in it and let it be the gunner. There now would be two (or three) vehicles that could shoot independently. But this would also mean I'd have to keep track of the second vehicle all the time, change the code for reloading so that the other vehicles will reload from the trunk of the first, and keep track of the damage all vehicles take so that the vehicle doesn't magically get double or triple health. I guess it could be done, but it clearly is a straight road to insanity which I'm not willing to take. Moreover, things would break everywhere, and the toll on UPS would be way to high. (Also, I can already see the requests coming in for extending this to the fourth or fifth guns other mods may have given to their vehicles -- where would it end?)

4 years ago

Oof, yeah, that does sound pretty hacky. Schall has a workaround for it already, in the form of gun equipment pods that can be mounted in vehicle equipment grids. They're a bit hacky as well, in the way they have to consume ammo, since there's no real concession for ammo consumption in equipment in the game (it converts it to Electricity and back).

So I guess I can just think of the two or more weapons already on the vehicle as the "main gun" options, and then mount gun pods for point defense. Thanks for the answer, though!

4 years ago

Oof, yeah, that does sound pretty hacky. Schall has a workaround for it already, in the form of gun equipment pods that can be mounted in vehicle equipment grids. They're a bit hacky as well, in the way they have to consume ammo, since there's no real concession for ammo consumption in equipment in the game (it converts it to Electricity and back).

Good to know that! So I won't try to enable reloading equipment from trunk (like I did for refueling equipment from trunk).

So I guess I can just think of the two or more weapons already on the vehicle as the "main gun" options, and then mount gun pods for point defense. Thanks for the answer, though!

I hope it works for you that way! Oh, and you're welcome. :-)

New response