Outline changes
This commit is contained in:
@@ -2,7 +2,6 @@ package mindustry.content;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.ctype.*;
|
||||
@@ -62,6 +61,7 @@ public class UnitTypes implements ContentList{
|
||||
reload = 14f;
|
||||
x = 4f;
|
||||
y = 2f;
|
||||
top = false;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
}});
|
||||
@@ -76,6 +76,7 @@ public class UnitTypes implements ContentList{
|
||||
immunities.add(StatusEffects.burning);
|
||||
|
||||
weapons.add(new Weapon("flamethrower"){{
|
||||
top = false;
|
||||
shootSound = Sounds.flame;
|
||||
shootY = 2f;
|
||||
reload = 14f;
|
||||
@@ -107,6 +108,7 @@ public class UnitTypes implements ContentList{
|
||||
mechFrontSway = 0.55f;
|
||||
|
||||
weapons.add(new Weapon("artillery"){{
|
||||
top = false;
|
||||
y = 1f;
|
||||
x = 9f;
|
||||
reload = 60f;
|
||||
@@ -143,6 +145,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
weapons.add(
|
||||
new Weapon("scepter-weapon"){{
|
||||
top = false;
|
||||
y = 1f;
|
||||
x = 16f;
|
||||
shootY = 8f;
|
||||
@@ -202,6 +205,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
weapons.add(
|
||||
new Weapon("reign-weapon"){{
|
||||
top = false;
|
||||
y = 1f;
|
||||
x = 21.5f;
|
||||
shootY = 11f;
|
||||
@@ -260,6 +264,7 @@ public class UnitTypes implements ContentList{
|
||||
abilities.add(new HealFieldAbility(10f, 60f * 4, 60f));
|
||||
|
||||
weapons.add(new Weapon("heal-weapon"){{
|
||||
top = false;
|
||||
shootY = 2f;
|
||||
reload = 24f;
|
||||
x = 4.5f;
|
||||
@@ -288,6 +293,7 @@ public class UnitTypes implements ContentList{
|
||||
abilities.add(new ShieldFieldAbility(20f, 40f, 60f * 5, 60f));
|
||||
|
||||
weapons.add(new Weapon("heal-shotgun-weapon"){{
|
||||
top = false;
|
||||
x = 5f;
|
||||
shake = 2.2f;
|
||||
y = 0.5f;
|
||||
@@ -337,6 +343,7 @@ public class UnitTypes implements ContentList{
|
||||
abilities.add(new ForceFieldAbility(60f, 0.3f, 400f, 60f * 6));
|
||||
|
||||
weapons.add(new Weapon("beam-weapon"){{
|
||||
top = false;
|
||||
shake = 2f;
|
||||
shootY = 4f;
|
||||
x = 6.5f;
|
||||
@@ -407,6 +414,7 @@ public class UnitTypes implements ContentList{
|
||||
groundLayer = Layer.legUnit - 1f;
|
||||
|
||||
weapons.add(new Weapon("eruption"){{
|
||||
top = false;
|
||||
shootY = 3f;
|
||||
reload = 10f;
|
||||
ejectEffect = Fx.none;
|
||||
@@ -1188,7 +1196,7 @@ public class UnitTypes implements ContentList{
|
||||
shootY = 7f;
|
||||
shake = 5f;
|
||||
recoil = 4f;
|
||||
occlusion = 17f;
|
||||
occlusion = 12f;
|
||||
|
||||
shots = 1;
|
||||
inaccuracy = 3f;
|
||||
@@ -1279,7 +1287,7 @@ public class UnitTypes implements ContentList{
|
||||
rotateSpeed = 4f;
|
||||
mirror = false;
|
||||
|
||||
occlusion = 30f;
|
||||
occlusion = 20f;
|
||||
|
||||
shootY = 2f;
|
||||
recoil = 4f;
|
||||
@@ -1351,7 +1359,7 @@ public class UnitTypes implements ContentList{
|
||||
immunities = ObjectSet.with(StatusEffects.wet);
|
||||
rotateShooting = false;
|
||||
|
||||
float spawnTime = 0.5f * Time.toMinutes;
|
||||
float spawnTime = 60f * 25f;
|
||||
|
||||
abilities.add(new UnitSpawnAbility(flare, spawnTime, 19.25f, -31.75f), new UnitSpawnAbility(flare, spawnTime, -19.25f, -31.75f));
|
||||
|
||||
@@ -1446,6 +1454,7 @@ public class UnitTypes implements ContentList{
|
||||
lowAltitude = true;
|
||||
|
||||
weapons.add(new Weapon("small-mount-weapon"){{
|
||||
top = false;
|
||||
reload = 20f;
|
||||
x = 3f;
|
||||
y = 0.5f;
|
||||
@@ -1483,6 +1492,7 @@ public class UnitTypes implements ContentList{
|
||||
hitsize = 10f;
|
||||
|
||||
weapons.add(new Weapon("small-mount-weapon"){{
|
||||
top = false;
|
||||
reload = 15f;
|
||||
x = 1f;
|
||||
y = 2f;
|
||||
|
||||
@@ -32,7 +32,7 @@ import mindustry.world.blocks.units.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class UnitType extends UnlockableContent{
|
||||
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
||||
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f), outlineSpace = 0.01f;
|
||||
private static final Vec2 legOffset = new Vec2();
|
||||
|
||||
/** If true, the unit is always at elevation 1. */
|
||||
@@ -81,7 +81,6 @@ public class UnitType extends UnlockableContent{
|
||||
public float lightRadius = 60f, lightOpacity = 0.6f;
|
||||
public Color lightColor = Pal.powerLight;
|
||||
public boolean drawCell = true, drawItems = true, drawShields = true;
|
||||
public int parts = 0;
|
||||
public int trailLength = 3;
|
||||
public float trailX = 4f, trailY = -3f, trailScl = 1f;
|
||||
/** Whether the unit can heal blocks. Initialized in init() */
|
||||
@@ -93,8 +92,8 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
public Seq<Weapon> weapons = new Seq<>();
|
||||
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion,
|
||||
occlusionRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion;
|
||||
public TextureRegion[] partRegions, partCellRegions, wreckRegions;
|
||||
occlusionRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion;
|
||||
public TextureRegion[] wreckRegions;
|
||||
|
||||
public UnitType(String name){
|
||||
super(name);
|
||||
@@ -291,16 +290,9 @@ public class UnitType extends UnlockableContent{
|
||||
baseRegion = Core.atlas.find(name + "-base");
|
||||
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
||||
occlusionRegion = Core.atlas.find("circle-shadow");
|
||||
outlineRegion = Core.atlas.find(name + "-outline");
|
||||
shadowRegion = icon(Cicon.full);
|
||||
|
||||
partRegions = new TextureRegion[parts];
|
||||
partCellRegions = new TextureRegion[parts];
|
||||
|
||||
for(int i = 0; i < parts; i++){
|
||||
partRegions[i] = Core.atlas.find(name + "-part" + i);
|
||||
partCellRegions[i] = Core.atlas.find(name + "-cell" + i);
|
||||
}
|
||||
|
||||
wreckRegions = new TextureRegion[3];
|
||||
for(int i = 0; i < wreckRegions.length; i++){
|
||||
wreckRegions[i] = Core.atlas.find(name + "-wreck" + i);
|
||||
@@ -351,8 +343,13 @@ public class UnitType extends UnlockableContent{
|
||||
drawPayload((Unit & Payloadc)unit);
|
||||
}
|
||||
|
||||
//TODO
|
||||
drawOcclusion(unit);
|
||||
|
||||
Draw.z(z - outlineSpace);
|
||||
|
||||
drawOutline(unit);
|
||||
|
||||
Draw.z(z);
|
||||
if(engineSize > 0) drawEngine(unit);
|
||||
drawBody(unit);
|
||||
@@ -507,6 +504,20 @@ public class UnitType extends UnlockableContent{
|
||||
Drawf.shadow(wx, wy, weapon.occlusion);
|
||||
}
|
||||
|
||||
if(weapon.outlineRegion.found()){
|
||||
float z = Draw.z();
|
||||
if(!weapon.top) Draw.z(z - outlineSpace);
|
||||
|
||||
Draw.rect(weapon.outlineRegion,
|
||||
wx, wy,
|
||||
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||
weapon.region.height * Draw.scl,
|
||||
weaponRotation);
|
||||
|
||||
|
||||
Draw.z(z);
|
||||
}
|
||||
|
||||
Draw.rect(weapon.region,
|
||||
wx, wy,
|
||||
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||
@@ -529,10 +540,16 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawOutline(Unit unit){
|
||||
if(Core.atlas.isFound(outlineRegion)){
|
||||
Draw.rect(outlineRegion, unit.x, unit.y, unit.rotation - 90);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawBody(Unit unit){
|
||||
applyColor(unit);
|
||||
|
||||
Draw.rect(region, unit, unit.rotation - 90);
|
||||
Draw.rect(region, unit.x, unit.y, unit.rotation - 90);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
@@ -541,7 +558,7 @@ public class UnitType extends UnlockableContent{
|
||||
applyColor(unit);
|
||||
|
||||
Draw.color(cellColor(unit));
|
||||
Draw.rect(cellRegion, unit, unit.rotation - 90);
|
||||
Draw.rect(cellRegion, unit.x, unit.y, unit.rotation - 90);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -551,7 +568,7 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
public void drawLight(Unit unit){
|
||||
if(lightRadius > 0){
|
||||
Drawf.light(unit.team, unit, lightRadius, lightColor, lightOpacity);
|
||||
Drawf.light(unit.team, unit.x, unit.y, lightRadius, lightColor, lightOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ public class Weapon{
|
||||
public boolean alternate = true;
|
||||
/** whether to rotate toward the target independently of unit */
|
||||
public boolean rotate = false;
|
||||
/** whether to draw the outline on top. */
|
||||
public boolean top = true;
|
||||
/** rotation speed of weapon when rotation is enabled, in degrees/t*/
|
||||
public float rotateSpeed = 20f;
|
||||
/** weapon reload in frames */
|
||||
@@ -71,6 +73,8 @@ public class Weapon{
|
||||
public TextureRegion region;
|
||||
/** heat region, must be same size as region (optional) */
|
||||
public TextureRegion heatRegion;
|
||||
/** outline region to display if top is false */
|
||||
public TextureRegion outlineRegion;
|
||||
/** heat region tint */
|
||||
public Color heatColor = Pal.turretHeat;
|
||||
|
||||
@@ -91,6 +95,7 @@ public class Weapon{
|
||||
public void load(){
|
||||
region = Core.atlas.find(name, Core.atlas.find("clear"));
|
||||
heatRegion = Core.atlas.find(name + "-heat");
|
||||
outlineRegion = Core.atlas.find(name + "-outline");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user