Semi-automatically generated modding documentation for Barotrauma

Turret

Attributes

Attribute Type Default value Description
BarrelPos Vector2 “0,0” The position of the barrel relative to the upper left corner of the base sprite (in pixels).
FiringOffset Vector2 “0,0” The projectile launching location relative to transformed barrel position (in pixels).
AlternatingFiringOffset bool false If enabled, the firing offset will alternate from left to right (i.e. flipping the x-component of the offset each shot.)
LaunchImpulse float 0 The impulse applied to the physics body of the projectile (the higher the impulse, the faster the projectiles are launched).
Reload float 5 The period of time the user has to wait between shots.
ShotsPerBurst int 1 How many projectiles needs to be shot before we add an extra break? Think of the double coilgun.
DelayBetweenBursts float 0 An extra delay between the bursts. Added to the reload.
RetractionDurationMultiplier float 1 Modifies the duration of retraction of the barrell after recoil to get back to the original position after shooting. Reload time affects this too.
RecoilTime float 0.1 How quickly the recoil moves the barrel after launching.
RetractionDelay float 0 How long the barrell stays in place after the recoil and before retracting back to the original position.
DamageMultiplier float 1 Multiplies the damage the turret deals by this amount.
ProjectileCount int 1 How many projectiles the weapon launches when fired once.
LaunchWithoutProjectile bool false Can the turret be fired without projectiles (causing it just to execute the OnUse effects and the firing animation without actually firing anything).
RotationLimits Vector2 “0.0,0.0” The range at which the barrel can rotate.
Spread float 0 Random spread applied to the firing angle of the projectiles (in degrees).
SpringStiffnessLowSkill float 5 How much torque is applied to rotate the barrel when the item is used by a character with insufficient skills to operate it. Higher values make the barrel rotate faster.
SpringStiffnessHighSkill float 2 How much torque is applied to rotate the barrel when the item is used by a character with sufficient skills to operate it. Higher values make the barrel rotate faster.
SpringDampingLowSkill float 50 How much torque is applied to resist the movement of the barrel when the item is used by a character with insufficient skills to operate it. Higher values make the aiming more “snappy”, stopping the barrel from swinging around the direction it’s being aimed at.
SpringDampingHighSkill float 10 How much torque is applied to resist the movement of the barrel when the item is used by a character with sufficient skills to operate it. Higher values make the aiming more “snappy”, stopping the barrel from swinging around the direction it’s being aimed at.
RotationSpeedLowSkill float 1 Maximum angular velocity of the barrel when used by a character with insufficient skills to operate it.
RotationSpeedHighSkill float 5 Maximum angular velocity of the barrel when used by a character with sufficient skills to operate it.
FiringRotationSpeedModifier float 1 How fast the turret can rotate while firing (for charged weapons).
SingleChargedShot bool false Whether the turret should always charge-up fully to shoot.
BaseRotation float 0 The angle of the turret’s base in degrees.
AIRange float 3000 How close to a target the turret has to be for an AI character to fire it.
MaxActiveProjectiles int -1 The turret won’t fire additional projectiles if the number of previously fired, still active projectiles reaches this limit. If set to -1, there is no limit to the number of projectiles.
MaxChargeTime float 0 The time required for a charge-type turret to charge up before able to fire.
AutoOperate bool false Should the turret operate automatically using AI targeting? Comes with some optional random movement that can be adjusted below.
RandomAimAmount float 0 [Auto Operate] How much the turret should adjust the aim off the target randomly instead of tracking the target perfectly? In Degrees.
RandomAimMinTime float 0 [Auto Operate] How often the turret should adjust the aim randomly instead of tracking the target perfectly? Minimum wait time, in seconds.
RandomAimMaxTime float 0 [Auto Operate] How often the turret should adjust the aim randomly instead of tracking the target perfectly? Maximum wait time, in seconds.
RandomMovement bool false [Auto Operate] Should the turret move randomly while idle?
AimDelay bool false [Auto Operate] Should the turret have a delay while targeting targets or always aim prefectly?
TargetCharacters bool true [Auto Operate] Should the turret target characters in general?
TargetMonsters bool true [Auto Operate] Should the turret target all monsters?
TargetHumans bool true [Auto Operate] Should the turret target all humans (or creatures in the same group, like pets)?
TargetSubmarines bool true [Auto Operate] Should the turret target other submarines?
TargetItems bool true [Auto Operate] Should the turret target items?
FriendlyTag Identifier ”” [Auto Operate] Group or SpeciesName that the AI ignores when the turret is operated automatically.
HudTint Color “0,0,0,0” Optional screen tint color when the item is being operated (R,G,B,A).
ShowChargeIndicator bool false Should the charge of the connected batteries/supercapacitors be shown at the top of the screen when operating the item.
ShowProjectileIndicator bool false Should the available ammunition be shown at the top of the screen when operating the item.
RecoilDistance float 0 How far the barrel “recoils back” when the turret is fired (in pixels).
SpinningBarrelDistance float 0 The distance in which the spinning barrels rotate. Only used if spinning barrels are created.

This component also supports the attributes defined in: Powered, ItemComponent

Example

<Item identifier="turrethardpoint" Tags="turret,hardpoint" showinstatusmonitor="false" category="Machine,Weapon" interactthroughwalls="true" Scale="0.5" interactdistance="10" spritecolor="1.0,1.0,1.0,1.0" linkable="true" allowedlinks="turretammosource">
  <Turret rotationlimits="180,360" projectilecount="0" canbeselected="false" characterusable="false" linkable="true" barrelpos="128,-50">
    <LightComponent LightColor="1.0,0.8,0.8,1.0" Flicker="0.0" range="2500" IsOn="true" drawbehindsubs="true" ignorecontinuoustoggle="true">
      <LightTexture texture="Content/Lights/alphaOne.png" />
    </LightComponent>
  </Turret>
  <ConnectionPanel selectkey="Action" canbeselected="true" msg="ItemMsgRewireScrewdriver" hudpriority="10">
    <GuiFrame relativesize="0.2,0.32" minsize="400,350" maxsize="480,420" anchor="Center" style="ConnectionPanel" />
    <RequiredItem items="screwdriver" type="Equipped" />
    <input name="power_in" displayname="connection.powerin" />
    <input name="position_in" displayname="connection.turretaimingin" />
    <input name="trigger_in" displayname="connection.turrettriggerin" />
    <input name="toggle_light" displayname="connection.togglelight" />
    <input name="set_light" displayname="connection.setlight" />
  </ConnectionPanel>
  [...]
</Item>