Setting Turret Muzzles
I'm working on a mod that adds many new types of turrets. One challenge has been figuring out how to set the turret's rotation and muzzle offset for the purposes of spawning projectiles, beams, streams, etc. It seems each type of turret uses a different set of properties and they work slightly differently. I suspect that they even work differently based on the turret-type and Attack Parameters type, eg an ammo-turret that shoots beams defines the muzzle differently from an electric-turret that shoots beams. To make things more confusing, artillery turrets define these properties completely differently from the others.
Can you please document how to set these values?
Here's what I've figured out after hours of experimentation:
ProjectileAttackParameters
projectile_center - Sets the gun barrel's rotation axis, however, unlike all the other turret types, this one is offset from the attacking animation's shift value
projectile_creation_distance - Sets the length of the gun barrel. Note that projectile turrets cannot shoot off-center (eg have a right hand with a gun)
BeamAttackParameters
source_direction_count - Sets how many discrete angles the turret can shoot from
source_offset - Sets the gun barrel's length and offset from the center of the turret's rotation axis. Unlike all other turret types, beams can shoot from the right hand of a turret
ammo_type.action.action_delivery.source_offset - Sets the turret's rotation axis with respect to the entity's position. Unlike the others, this one is several layers deep in the AttackParameters
StreamAttackParameters
gun_center_shift - Sets the turret's rotation axis
gun_barrel_length - Sets the length of the gun barrel
CircularProjectileCreationSpecification
I think vanilla base defender worms define the launch point using CircularProjectileCreationSpecification. I can't tell from the documentation or by looking at the entity definitions what this means. I would need to serpent.block the property, plot the results to a graph, then compare it to the sprites to figure out what it's doing. Can you please add some more description here?
ArtilleryTurret
Artillery turrets set these through the related "gun" entity's attack_parameters. I have not figured out how to set the muzzle location for artilleries. Setting the projectile_creation_parameters to nil makes it use the standard ProjectileAttackParameters but the shift values are interpreted differently.
Setting Turret Muzzles
-
- Inserter
- Posts: 45
- Joined: Tue Mar 26, 2019 4:43 am
- Contact:
Re: Setting Turret Muzzles
Partially already in the docs, see wiki contributions: https://wiki.factorio.com/Special:Contr ... rrypuppies
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.