From d8cf443cd9d5c25cd085ca6afc60a19f88c3c087 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 4 May 2022 23:10:42 -0400 Subject: [PATCH] Docs --- core/src/mindustry/entities/EntityGroup.java | 11 +-- .../mindustry/entities/bullet/BulletType.java | 68 ++++++++++++++++--- core/src/mindustry/world/Block.java | 10 ++- 3 files changed, 73 insertions(+), 16 deletions(-) diff --git a/core/src/mindustry/entities/EntityGroup.java b/core/src/mindustry/entities/EntityGroup.java index b7a16e21b2..51957e52e5 100644 --- a/core/src/mindustry/entities/EntityGroup.java +++ b/core/src/mindustry/entities/EntityGroup.java @@ -97,12 +97,13 @@ public class EntityGroup implements Iterable{ public void draw(Cons cons){ Core.camera.bounds(viewport); - each(e -> { - Drawc draw = (Drawc)e; - if(viewport.overlaps(draw.x() - draw.clipSize()/2f, draw.y() - draw.clipSize()/2f, draw.clipSize(), draw.clipSize())){ - cons.get(e); + for(index = 0; index < array.size; index++){ + Drawc draw = (Drawc)array.items[index]; + float clip = draw.clipSize(); + if(viewport.overlaps(draw.x() - clip/2f, draw.y() - clip/2f, clip, clip)){ + cons.get((T)draw); } - }); + } } public boolean useTree(){ diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 8be65f63c1..e3d344a3f0 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -25,7 +25,6 @@ import mindustry.world.blocks.defense.Wall.*; import static mindustry.Vars.*; -//TODO document public class BulletType extends Content implements Cloneable{ /** Lifetime in ticks. */ public float lifetime = 40f; @@ -144,6 +143,11 @@ public class BulletType extends Content implements Cloneable{ public boolean pierceArmor = false; /** Whether status and despawnHit should automatically be set. */ public boolean setDefaults = true; + /** Amount of shaking produced when this bullet hits something or despawns. */ + public float hitShake = 0f, despawnShake = 0f; + + /** Bullet type that is created when this bullet expires. */ + public @Nullable BulletType fragBullet = null; /** Degree spread range of fragmentation bullets. */ public float fragRandomSpread = 360f; /** Uniform spread between each frag bullet in degrees. */ @@ -152,69 +156,115 @@ public class BulletType extends Content implements Cloneable{ public float fragAngle = 0f; /** Number of fragmentation bullets created. */ public int fragBullets = 9; + /** Random range of frag velocity as a multiplier. */ + public float fragVelocityMin = 0.2f, fragVelocityMax = 1f; + /** Random range of frag lifetime as a multiplier. */ + public float fragLifeMin = 1f, fragLifeMax = 1f; - public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f; - public @Nullable BulletType fragBullet = null; - public float bulletInterval = 20f; - public int intervalBullets = 1; + /** Bullet that is created at a fixed interval. */ public @Nullable BulletType intervalBullet; + /** Interval, in ticks, between which bullet spawn. */ + public float bulletInterval = 20f; + /** Number of bullet spawned per interval. */ + public int intervalBullets = 1; + + /** Color used for hit/despawn effects. */ public Color hitColor = Color.white; + /** Color used for block heal effects. */ public Color healColor = Pal.heal; + /** Effect emitted upon blocks that are healed. */ public Effect healEffect = Fx.healBlockFull; /** Bullets spawned when this bullet is created. Rarely necessary, used for visuals. */ public Seq spawnBullets = new Seq<>(); /** Unit spawned _instead of_ this bullet. Useful for missiles. */ public @Nullable UnitType spawnUnit; + /** Color of trail behind bullet. */ public Color trailColor = Pal.missileYellowBack; + /** Chance of trail effect spawning on bullet per tick. */ public float trailChance = -0.0001f; + /** Uniform interval in which trail effect is spawned. */ public float trailInterval = 0f; + /** Trail effect that is spawned. */ public Effect trailEffect = Fx.missileTrail; + /** Rotation/size parameter that is passed to trail. Usually, this controls size. */ public float trailParam = 2f; + /** Whether the parameter passed to the trail is the bullet rotation, instead of a flat value. */ public boolean trailRotation = false; + /** Interpolation for trail width as function of bullet lifetime */ public Interp trailInterp = Interp.one; - /** Any value <= 0 disables the trail. */ + /** Length of trail quads. Any value <= 0 disables the trail. */ public int trailLength = -1; + /** Width of trail, if trailLength > 0 */ public float trailWidth = 2f; + /** If trailSinMag > 0, these values are applied as a sine curve to trail width. */ public float trailSinMag = 0f, trailSinScl = 3f; /** Use a negative value to disable splash damage. */ public float splashDamageRadius = -1f; + /** Amount of fires attempted around bullet. */ public int incendAmount = 0; + /** Spread of fires around bullet. */ public float incendSpread = 8f; + /** Chance of fire being created. */ public float incendChance = 1f; + + /** Power of bullet ability. Usually a number between 0 and 1; try 0.1 as a starting point. */ public float homingPower = 0f; + /** Range of homing effect around bullet. */ public float homingRange = 50f; /** Use a negative value to disable homing delay. */ public float homingDelay = -1f; - public float suppressionRange = -1f, suppressionDuration = 60f * 8f, suppressionEffectChance = 50f; + /** Range of healing bock suppression effect. */ + public float suppressionRange = -1f; + /** Duration of healing block suppression effect. */ + public float suppressionDuration = 60f * 8f; + /** Chance of suppression effect occurring on block, scaled down by number of blocks. */ + public float suppressionEffectChance = 50f; + /** Color of lightning created by bullet. */ public Color lightningColor = Pal.surge; + /** Number of separate lightning "roots". */ public int lightning; - public int lightningLength = 5, lightningLengthRand = 0; + /** Length of each lightning strand. */ + public int lightningLength = 5; + /** Extra random length added onto base length of lightning. */ + public int lightningLengthRand = 0; /** Use a negative value to use default bullet damage. */ public float lightningDamage = -1; + /** Spread of lightning, relative to bullet rotation. */ public float lightningCone = 360f; + /** Offset of lightning relative to bullet rotation. */ public float lightningAngle = 0f; /** The bullet created at lightning points. */ public @Nullable BulletType lightningType = null; + /** Scale of bullet weave pattern. Higher -> less vibration. */ public float weaveScale = 1f; + /** Intensity of bullet weaving. Note that this may make bullets inaccurate. */ public float weaveMag = 0f; + /** If true, the bullet weave will randomly switch directions on spawn. */ public boolean weaveRandom = true; - public float hitShake = 0f, despawnShake = 0f; + /** Number of individual puddles created. */ public int puddles; + /** Range of puddles around bullet position. */ public float puddleRange; + /** Liquid count of each puddle created. */ public float puddleAmount = 5f; + /** Liquid that puddles created are made of. */ public Liquid puddleLiquid = Liquids.water; + /** Whether to display the ammo multiplayer for this bullet type in its stats. */ public boolean displayAmmoMultiplier = true; + /** Radius of light emitted by this bullet; <0 to use defaults. */ public float lightRadius = -1f; + /** Opacity of light color. */ public float lightOpacity = 0.3f; + /** Color of light emitted by this bullet. */ public Color lightColor = Pal.powerLight; public BulletType(float speed, float damage){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 77436ec6bf..4d8547dad9 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -45,16 +45,22 @@ public class Block extends UnlockableContent implements Senseable{ public boolean hasLiquids; /** If true, buildings have a PowerModule. */ public boolean hasPower; - + /** Flag for determining whether this block outputs liquid somewhere; used for connections. */ public boolean outputsLiquid = false; + /** Used by certain power blocks (nodes) to flag as non-consuming of power. True by default, even if this block has no power. */ public boolean consumesPower = true; + /** If true, this block is a generator that can produce power. */ public boolean outputsPower = false; + /** If true, this block can conduct power like a cable. */ public boolean conductivePower = false; + /** If true, this block can output payloads; affects blending. */ public boolean outputsPayload = false; + /** If true, payloads will attempt to move into this block. */ public boolean acceptsPayload = false; + /** Visual flag use for blending of certain transportation blocks. */ public boolean acceptsItems = false; + /** If true, all item capacities of this block are separate instead of pooled as one number. */ public boolean separateItemCapacity = false; - /** maximum items this block can carry (usually, this is per-type of item) */ public int itemCapacity = 10; /** maximum total liquids this block can carry if hasLiquids = true */