Cannon Turret

by VortiK

Adds a cannon mounted turret and specific cannon shell magazine ammunition that behave like the tank shells without friendly fire colliding. Bonus setting use vanilla cannon shells and to make custom ammo explosions not do friendly damage.

Content
a day ago
0.15 - 2.0
23.2K
Combat

g Converting Turret to Vanilla Ammo Usage

4 years ago
(updated 4 years ago)

How might one go about editing your cannon turret such that it can use any of the regular cannon shells as ammo, without needing to convert/assemble them into magazines first, essentially, using the Vanilla Tank's code for ammo-management as an example?

4 years ago

Hello,

The reason why I made a different ammo was to be able to make it not collide with friendly entities and building. If you use normal tank projectile ammo, you will have friendly fire, for exemple you won't be able to put wall in front of cannon turrets.

The production is very cheap as it use the same number of shells with a small other resource to build. Normal cannon shell ammo is only used in the tank in vanilla so making a dedicated logistic supply system for turrets cannon-shell-magazine like gun ammo shouldn't be a problem as you don't have a normal cannon shell supply system for you base that would become redundant with turrets.

Anyway if you want to change the ammo the turrets can use, you just have to change the entity attack_parameters ammo_category here :

attack_parameters =
{
type = "projectile",
ammo_category = "cannon-shell-magazine",

You might want to keep the not colliding with friendly entities behaviour but that means changing the vanilla cannon shell behaviour which I didn't want to.

4 years ago

Thanks for the info, I'll have a look into this. One thing that intrigues me is that Rseding91 maintains that such a friendly-fire collision parameter isn't used in the base game, but I may have my wires crossed somehow.

4 years ago

By default projectiles will collide with anything, but you can make them not collide with same forces like this :

force_condition = "not-same",

It has been added only for mods, it's not used in vanilla factorio.

New response