Smart Artillery Wagons


Toggles auto-firing of artillery wagons when a circuit signal is received at a train stop.

Content
21 days ago
0.17 - 2.0
1.07K
Trains Combat Circuit network

b [fixed] Artillery wagons damaging when turned to manual mode

4 years ago

Factorio version: 1.0.0
SAW version: 0.2.0

It seems that in certain circumstances artillery wagons get damaged when switching modes, and the health gets restored when switching back.
In my case, if I switch the train to manual artillery mode, all artillery wagons (no other kind) gets a damage of 600/1000. If I repair it, switch to automatic mode, and then back to manual, the damage is there again, but if I do the same without repairing them, they don't get any additional damage, so they stay on 600/1000.

Test map: https://1drv.ms/u/s!ArvLKxtjzZnrv8lcO48CR_pfgxZXpA?e=A9WWE7
Not for the map: If you set the train to automatic mode, it'll go to the station with the artillery mode signal, and it'll turn off the automatic artillery mode

4 years ago

Do you have any other mods installed? This can happen if a mod loads after SAW and changes the main wagon health but not the alternate entity.

4 years ago

I have a few, and yes, you're right.. I don't know how I didn't notice this, but the automatic wagon has only 600 max health. The interesting thing that it's the first time it happened, even though I have changed the mode a few times (less than 10 times).

Is there something that I could do, or should I only use it as if it would have only 600 health?
I think at this point you could change the post type to discussion, if it's possible.

4 years ago
(updated 4 years ago)

This is easy to fix on my end by double-checking what health it should have after everything finishes loading.

I made this mod over a year ago as a dorky proof of concept, ao I'm not surprised it has bugs. Since you are one of the only people using it, is there anything else you would like me to look at when I revisit it?

Edit: can you post your mod list or factorio-current.log file, so that I know which ones to test with?

4 years ago

I added compatibility with Krastorio2 in the latest version. Let me know if there are other mods have the same issue.

4 years ago
(updated 4 years ago)

I made this mod over a year ago as a dorky proof of concept, ao I'm not surprised it has bugs.

Oh I have seen the code for saving and restoring as much of the wagon's state as possible, and it's incredible. It's like it's prepared for every use case :D

is there anything else you would like me to look at when I revisit it?

I think it could come handy if the train would listen for changes of the setting signal, instead of only checking it on arrival.
Though it could have a performance impact on larger bases, so I think it's only worth the convenience if it can be done with callbacks or if you could make a setting to how often check for the signal.
It could also be useful to have a cooldown for reading the signal (maybe a setting for that too, because it's hard to decide what value would be the best), because otherwise quickly changing circuit systems could tank the UPS

I see that it's basically a bigger change, so only do it if you can afford the time :) I usually keep my service train attached artilleries in manual mode because otherwise it would be dangerous to haul them everywhere I go, but it would be also more convenient to change the mode when needed (because I wouldn't need to send the train to an other stop with the signal), and it could serve as a conditional defense mechanism, like for turning on the automation everywhere, except in the depot.

mod list

I use these:
https://gist.github.com/MPeti1/b11d5f2a55b538437ab186a5c878e6d8

I added compatibility with Krastorio2 in the latest version

Thank you!

4 years ago
(updated 4 years ago)

[DUPLICATION]

4 years ago
(updated 4 years ago)

[DUPLICATION]

4 years ago

Well, I just noticed that the edit button and the response button are 2 different buttons. Sorry for the message duplication!

New response