Combat by Samuel + minus

by Pi-C

"Sniper and shotgun Turrets, Uranium shotgun ammo, a Sniper Gun, and more to come …" Sometimes, less is more! This mod adds options to "Combat by Samuel" that enable you to reduce range, damage modifier, maximum health, and resistances of sniper and shotgun turrets. This mod now includes the (updated) code from "Combat by Samuel" so you can continue playing with sniper turrets etc. in Factorio 0.18. I will revert this change once "Combat by Samuel" has been updated!

Content
3 years ago
0.17 - 1.1
1.60K
Combat

i [Implemented] Sniping Preference

3 years ago
(updated 3 years ago)

Wouldn't it be nice if the high damage outputting sniper turret would prioritize the big biters with more health first? Just add this line under attack_parameters.
health_penalty = -1

3 years ago

Thanks, that's a good idea! Naturally, I've made a setting for it, so health_penalty can be <0, 0, or >0. Default will be health_penalty = 0, which is the current behavior.

I'll upload later today, when I'm back home and have tested the changes. :-)

3 years ago

Please check out version 0.17.6/0.18.4!

3 years ago

It would be nice if this wasn't under startup so that it could be changed later on.

3 years ago

It would be nice if this wasn't under startup so that it could be changed later on.

Definitely! But it's impossible because health_penalty is a property that needs to be set in the data stage, where all of the prototypes are defined (i.e. from the time you start Factorio until you see the menu). We don't have write access to the prototypes in the control stage (once you've started a new game or loaded a saved game) anymore, so we can't change individual prototype properties once a game is running.

The only way I to accomplish this is quite expensive: I'd have to make duplicates of the shotgun and sniper turret prototypes with different values for health_penalty. When a game is loaded, I'd have to read the setting, and if it has changed, exchange every turret where the setting has changed. Now, turrets are not rocket-silos where you only have a few entities -- turrets are usually put up in bulk along the factory perimeter. If you have a huge factory, there may be a lot of turrets that need to be replaced. Imagine this happened in a multiplayer game where you have players on different forces! It would increase the loading time immensely.

But perhaps you just don't understand correctly what the term "startup setting" really means? It doesn't mean you can't change the setting once you've started a game -- it means Factorio must restart when such a setting has changed because it has to rebuild the prototypes. So if you start Factorio, change the setting, restart, and load your game, the turrets will automatically use the changed attack priority for all turrets of all forces. I think that really is the best way to do it.

3 years ago

Ah, sorry! I thought it was just reading the health of the enemies and deciding who to shoot. My bad!

3 years ago

I thought it was just reading the health of the enemies and deciding who to shoot.

That's basically what happens, but it's directly controlled by Factorio (thus running much faster than any Lua code could). The price to pay for this is the start-up setting.

New response