Package mindustry.type
Class Weapon
java.lang.Object
mindustry.type.Weapon
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BuildWeapon,MineWeapon,PointDefenseBulletWeapon,PointDefenseWeapon,RepairBeamWeapon
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanwhether this weapon can be automatically aimed by the unitfloatSpeed at which the turret can change its bullet "aim" distance.booleanwhether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = truebooleanwhether this weapon uses continuous fire without reloading; implies continuous = truebooleanwhether this weapon is always shooting, regardless of targets ore conebooleanwhether to automatically target relevant units in update(); only works when controllable = false.floatrotation at which this weapon starts at.bullet shotarc.graphics.g2d.TextureRegioncell region, must be same size as region (optional)arc.audio.Soundsound used for weapons that have a delaybooleanwhether to hold the bullet in place while firing; it will still require reload.booleanwhether this weapon can be aimed manually by playersfloatticks to cool down the heat regionbooleanwhether weapon should appear in the stats of a unit with this weaponshell ejection effectfloatextra velocity that is added as a fractionbooleanwhether to flip the weapon's sprite when rendering.arc.graphics.Colorheat region tintarc.graphics.g2d.TextureRegionheat region, must be same size as region (optional)booleanwhether shooter rotation is ignored when shooting.floatinaccuracy of degrees of each shotfloatdraw Z offset relative to the default valuebooleanIf true, shoot warmup is linear instead of a curve.floatmin velocity required for this weapon to shootfloatminimum weapon warmup before firing (this is not linear, do NOT use 1!)booleanwhether to create a flipped copy of this weapon upon initialization.arc.func.Func<Weapon,WeaponMount> type of weapon mount to be useddisplayed weapon regionarc.audio.Soundsound played when there is nothing to shootbooleanIf true, this weapon cannot be used to attack targets.intinternal value used for alternation - do not change!arc.graphics.g2d.TextureRegionoutline region to display if top is falsebooleanshould the shoot effects follow the unit (effects need followParent set to true for this to work)arc.struct.Seq<DrawPart>extra animated partsbooleanwhether to perform target trajectory predictionfloatvisual weapon knockback.floatpower curve applied to visual recoilintNumber of additional counters for recoil.floattime taken for weapon to return to starting position in ticks.arc.graphics.g2d.TextureRegiondisplayed region (autoloaded)floatweapon reload in framesbooleanwhether to rotate toward the target independently of unitfloatrotation speed of weapon when rotation is enabled, in degrees/tfloatCone in which the weapon can rotate relative to its mount.floatradius of shadow drawn under the weapon; <0 to disablefloatintensity and duration of each shot's screen shakepattern used for bulletsfloatThe half-radius of the cone in which shooting will start.booleanwhether this weapon should fire when its owner diesarc.audio.Soundsound used for shootingstatus effect applied when shootingfloatstatus effect duration when shotfloatlerp speed for shoot warmup, only used for partsfloatprojectile/effect offsets from center of weaponfloatprojectile/effect offsets from center of weaponbooleanWhether to show the sprite of the weapon in the database.floatlerp speed for shoot warmup, only used for partsfloatrandom sound pitch rangefloatrandom sound pitch rangefloatticks to wait in-between targetsfloatticks to wait in-between targetsbooleanwhether to draw the outline on top.booleanwhether to consume ammo when ammo is enabled in rulesbooleanif true, this weapon is used for attack range calculationsfloatfraction of velocity that is randomfloatoffsets of weapon position on unitfloatRandom spread on the X/Y axis.floatoffsets of weapon position on unitfloatRandom spread on the X/Y axis. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidbullet(mindustry.gen.Unit unit, WeaponMount mount, float xOffset, float yOffset, float angleOffset, Mover mover) protected floatbulletRotation(mindustry.gen.Unit unit, WeaponMount mount, float bulletX, float bulletY) protected booleancheckTarget(mindustry.gen.Unit unit, mindustry.gen.Teamc target, float x, float y, float range) copy()floatdps()voiddraw(mindustry.gen.Unit unit, WeaponMount mount) voiddrawOutline(mindustry.gen.Unit unit, WeaponMount mount) protected mindustry.gen.TeamcfindTarget(mindustry.gen.Unit unit, float x, float y, float range, boolean air, boolean ground) voidflip()protected voidhandleBullet(mindustry.gen.Unit unit, WeaponMount mount, mindustry.gen.Bullet bullet) booleanvoidinit()voidload()floatrange()protected voidshoot(mindustry.gen.Unit unit, WeaponMount mount, float shootX, float shootY, float rotation) floattoString()voidupdate(mindustry.gen.Unit unit, WeaponMount mount)
-
Field Details
-
name
displayed weapon region -
bullet
bullet shot -
ejectEffect
shell ejection effect -
display
public boolean displaywhether weapon should appear in the stats of a unit with this weapon -
useAmmo
public boolean useAmmowhether to consume ammo when ammo is enabled in rules -
mirror
public boolean mirrorwhether to create a flipped copy of this weapon upon initialization. default: true -
flipSprite
public boolean flipSpritewhether to flip the weapon's sprite when rendering. internal use only - do not set! -
alternate
public boolean alternatewhether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = true -
rotate
public boolean rotatewhether to rotate toward the target independently of unit -
showStatSprite
public boolean showStatSpriteWhether to show the sprite of the weapon in the database. -
baseRotation
public float baseRotationrotation at which this weapon starts at. -
top
public boolean topwhether to draw the outline on top. -
continuous
public boolean continuouswhether to hold the bullet in place while firing; it will still require reload. -
alwaysContinuous
public boolean alwaysContinuouswhether this weapon uses continuous fire without reloading; implies continuous = true -
aimChangeSpeed
public float aimChangeSpeedSpeed at which the turret can change its bullet "aim" distance. This is only used for point laser bullets. -
controllable
public boolean controllablewhether this weapon can be aimed manually by players -
aiControllable
public boolean aiControllablewhether this weapon can be automatically aimed by the unit -
alwaysShooting
public boolean alwaysShootingwhether this weapon is always shooting, regardless of targets ore cone -
autoTarget
public boolean autoTargetwhether to automatically target relevant units in update(); only works when controllable = false. -
predictTarget
public boolean predictTargetwhether to perform target trajectory prediction -
useAttackRange
public boolean useAttackRangeif true, this weapon is used for attack range calculations -
targetInterval
public float targetIntervalticks to wait in-between targets -
targetSwitchInterval
public float targetSwitchIntervalticks to wait in-between targets -
rotateSpeed
public float rotateSpeedrotation speed of weapon when rotation is enabled, in degrees/t -
reload
public float reloadweapon reload in frames -
inaccuracy
public float inaccuracyinaccuracy of degrees of each shot -
shake
public float shakeintensity and duration of each shot's screen shake -
recoil
public float recoilvisual weapon knockback. -
recoils
public int recoilsNumber of additional counters for recoil. -
recoilTime
public float recoilTimetime taken for weapon to return to starting position in ticks. uses reload time by default -
recoilPow
public float recoilPowpower curve applied to visual recoil -
cooldownTime
public float cooldownTimeticks to cool down the heat region -
shootX
public float shootXprojectile/effect offsets from center of weapon -
shootY
public float shootYprojectile/effect offsets from center of weapon -
x
public float xoffsets of weapon position on unit -
y
public float yoffsets of weapon position on unit -
xRand
public float xRandRandom spread on the X/Y axis. -
yRand
public float yRandRandom spread on the X/Y axis. -
shoot
pattern used for bullets -
shadow
public float shadowradius of shadow drawn under the weapon; <0 to disable -
velocityRnd
public float velocityRndfraction of velocity that is random -
extraVelocity
public float extraVelocityextra velocity that is added as a fraction -
shootCone
public float shootConeThe half-radius of the cone in which shooting will start. -
rotationLimit
public float rotationLimitCone in which the weapon can rotate relative to its mount. -
minWarmup
public float minWarmupminimum weapon warmup before firing (this is not linear, do NOT use 1!) -
shootWarmupSpeed
public float shootWarmupSpeedlerp speed for shoot warmup, only used for parts -
smoothReloadSpeed
public float smoothReloadSpeedlerp speed for shoot warmup, only used for parts -
linearWarmup
public boolean linearWarmupIf true, shoot warmup is linear instead of a curve. -
soundPitchMin
public float soundPitchMinrandom sound pitch range -
soundPitchMax
public float soundPitchMaxrandom sound pitch range -
ignoreRotation
public boolean ignoreRotationwhether shooter rotation is ignored when shooting. -
noAttack
public boolean noAttackIf true, this weapon cannot be used to attack targets. -
minShootVelocity
public float minShootVelocitymin velocity required for this weapon to shoot -
parentizeEffects
public boolean parentizeEffectsshould the shoot effects follow the unit (effects need followParent set to true for this to work) -
otherSide
public int otherSideinternal value used for alternation - do not change! -
layerOffset
public float layerOffsetdraw Z offset relative to the default value -
shootSound
public arc.audio.Sound shootSoundsound used for shooting -
chargeSound
public arc.audio.Sound chargeSoundsound used for weapons that have a delay -
noAmmoSound
public arc.audio.Sound noAmmoSoundsound played when there is nothing to shoot -
region
public arc.graphics.g2d.TextureRegion regiondisplayed region (autoloaded) -
heatRegion
public arc.graphics.g2d.TextureRegion heatRegionheat region, must be same size as region (optional) -
cellRegion
public arc.graphics.g2d.TextureRegion cellRegioncell region, must be same size as region (optional) -
outlineRegion
public arc.graphics.g2d.TextureRegion outlineRegionoutline region to display if top is false -
heatColor
public arc.graphics.Color heatColorheat region tint -
shootStatus
status effect applied when shooting -
mountType
type of weapon mount to be used -
shootStatusDuration
public float shootStatusDurationstatus effect duration when shot -
shootOnDeath
public boolean shootOnDeathwhether this weapon should fire when its owner dies -
parts
extra animated parts
-
-
Constructor Details
-
Weapon
-
Weapon
public Weapon()
-
-
Method Details
-
hasStats
-
addStats
-
dps
public float dps() -
shotsPerSec
public float shotsPerSec() -
drawOutline
-
draw
-
range
public float range() -
update
-
findTarget
protected mindustry.gen.Teamc findTarget(mindustry.gen.Unit unit, float x, float y, float range, boolean air, boolean ground) -
checkTarget
protected boolean checkTarget(mindustry.gen.Unit unit, mindustry.gen.Teamc target, float x, float y, float range) -
bulletRotation
protected float bulletRotation(mindustry.gen.Unit unit, WeaponMount mount, float bulletX, float bulletY) -
shoot
protected void shoot(mindustry.gen.Unit unit, WeaponMount mount, float shootX, float shootY, float rotation) -
bullet
protected void bullet(mindustry.gen.Unit unit, WeaponMount mount, float xOffset, float yOffset, float angleOffset, Mover mover) -
handleBullet
protected void handleBullet(mindustry.gen.Unit unit, WeaponMount mount, mindustry.gen.Bullet bullet) -
flip
public void flip() -
copy
-
init
public void init() -
load
public void load() -
toString
-