Implemented ground mech boosting
@@ -1,16 +0,0 @@
|
|||||||
#Maps entity names to IDs. Autogenerated.
|
|
||||||
|
|
||||||
draug=0
|
|
||||||
mindustry.entities.def.BulletComp=1
|
|
||||||
mindustry.entities.def.DecalComp=2
|
|
||||||
mindustry.entities.def.EffectComp=3
|
|
||||||
mindustry.entities.def.FireComp=4
|
|
||||||
mindustry.entities.def.PlayerComp=5
|
|
||||||
mindustry.entities.def.PuddleComp=6
|
|
||||||
mindustry.entities.def.TileComp=7
|
|
||||||
mindustry.type.Weather.WeatherComp=8
|
|
||||||
mindustry.world.blocks.storage.LaunchPad.LaunchPayloadComp=9
|
|
||||||
phantom=10
|
|
||||||
titan=11
|
|
||||||
vanguard=12
|
|
||||||
wraith=13
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:vel,type:arc.math.geom.Vec2,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:vel,type:arc.math.geom.Vec2,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:baseFlammability,type:float,size:4},{name:block,type:mindustry.world.Block,size:-1},{name:lifetime,type:float,size:4},{name:puddleFlammability,type:float,size:4},{name:tile,type:mindustry.world.Tile,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:height,type:float,size:4},{name:stacks,type:arc.struct.Array<mindustry.type.ItemStack>,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{version:1,fields:[{name:height,type:float,size:4},{name:lifetime,type:float,size:4},{name:stacks,type:arc.struct.Array<mindustry.type.ItemStack>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{version:2,fields:[{name:lifetime,type:float,size:4},{name:stacks,type:arc.struct.Array<mindustry.type.ItemStack>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:baseRotation,type:float,size:4},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:vel,type:arc.math.geom.Vec2,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:vel,type:arc.math.geom.Vec2,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:accepting,type:float,size:4},{name:amount,type:float,size:4},{name:generation,type:int,size:4},{name:lastRipple,type:float,size:4},{name:liquid,type:mindustry.type.Liquid,size:-1},{name:tile,type:mindustry.world.Tile,size:-1},{name:updateTime,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:vel,type:arc.math.geom.Vec2,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{fields:[{name:intensity,type:float,size:4},{name:life,type:float,size:4},{name:opacity,type:float,size:4},{name:weather,type:mindustry.type.Weather,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
|
|
||||||
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 729 B |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 994 B |
|
Before Width: | Height: | Size: 730 KiB After Width: | Height: | Size: 734 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 837 KiB |
|
Before Width: | Height: | Size: 837 KiB |
@@ -128,7 +128,7 @@ public class Vars implements Loadable{
|
|||||||
/** whether typing into the console is enabled - developers only */
|
/** whether typing into the console is enabled - developers only */
|
||||||
public static boolean enableConsole = false;
|
public static boolean enableConsole = false;
|
||||||
/** whether to clear sector saves when landing */
|
/** whether to clear sector saves when landing */
|
||||||
public static boolean clearSectors = true;
|
public static boolean clearSectors = false;
|
||||||
/** whether any light rendering is enabled */
|
/** whether any light rendering is enabled */
|
||||||
public static boolean enableLight = true;
|
public static boolean enableLight = true;
|
||||||
/** application data directory, equivalent to {@link Settings#getDataDirectory()} */
|
/** application data directory, equivalent to {@link Settings#getDataDirectory()} */
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
public class UnitTypes implements ContentList{
|
public class UnitTypes implements ContentList{
|
||||||
|
|
||||||
//ground
|
//ground
|
||||||
public static @EntityDef({Unitc.class, Legsc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator;
|
public static @EntityDef({Unitc.class, Legsc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator, alpha;
|
||||||
|
|
||||||
//air
|
//air
|
||||||
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
|
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
|
||||||
@@ -263,6 +265,39 @@ public class UnitTypes implements ContentList{
|
|||||||
hitsize = 8f;
|
hitsize = 8f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
alpha = new UnitType("alpha"){{
|
||||||
|
drillTier = -1;
|
||||||
|
speed = 0.6f;
|
||||||
|
hitsize = 9f;
|
||||||
|
mass = 1.75f;
|
||||||
|
boostMultiplier = 2f;
|
||||||
|
itemCapacity = 15;
|
||||||
|
mass = 0.9f;
|
||||||
|
health = 160f;
|
||||||
|
buildSpeed = 0.9f;
|
||||||
|
canBoost = true;
|
||||||
|
|
||||||
|
weapons.add(new Weapon("shockgun"){{
|
||||||
|
shake = 2f;
|
||||||
|
shootY = 1f;
|
||||||
|
x = 1f;
|
||||||
|
shootX = 3f;
|
||||||
|
reload = 70f;
|
||||||
|
alternate = true;
|
||||||
|
recoil = 4f;
|
||||||
|
shootSound = Sounds.laser;
|
||||||
|
|
||||||
|
bullet = new LaserBulletType(){{
|
||||||
|
damage = 20f;
|
||||||
|
recoil = 1f;
|
||||||
|
sideAngle = 45f;
|
||||||
|
sideWidth = 1f;
|
||||||
|
sideLength = 70f;
|
||||||
|
colors = new Color[]{Pal.heal.cpy().a(0.4f), Pal.heal, Color.white};
|
||||||
|
}};
|
||||||
|
}});
|
||||||
|
}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
chaosArray = new UnitType("chaos-array", GroundUnit::new){{
|
chaosArray = new UnitType("chaos-array", GroundUnit::new){{
|
||||||
@@ -480,7 +515,7 @@ public class UnitTypes implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
alpha = new UnitType("alpha-mech", false){
|
"alpha "= new UnitType("alpha-mech", false){
|
||||||
{
|
{
|
||||||
drillTier = -1;
|
drillTier = -1;
|
||||||
speed = 0.5f;
|
speed = 0.5f;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
@@ -14,10 +14,11 @@ import static mindustry.Vars.net;
|
|||||||
abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
||||||
private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2();
|
private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2();
|
||||||
|
|
||||||
@Import float x, y, drag;
|
@Import float x, y;
|
||||||
@Import Vec2 vel;
|
@Import Vec2 vel;
|
||||||
|
|
||||||
float elevation;
|
float elevation;
|
||||||
|
private transient boolean wasFlying;
|
||||||
transient float drownTime;
|
transient float drownTime;
|
||||||
transient float splashTimer;
|
transient float splashTimer;
|
||||||
|
|
||||||
@@ -26,13 +27,17 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isFlying(){
|
boolean isFlying(){
|
||||||
return elevation >= 0.001f;
|
return elevation >= 0.09f;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canDrown(){
|
boolean canDrown(){
|
||||||
return isGrounded();
|
return isGrounded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void landed(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void wobble(){
|
void wobble(){
|
||||||
x += Mathf.sin(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
x += Mathf.sin(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
||||||
y += Mathf.cos(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
y += Mathf.cos(Time.time() + id() * 99, 25f, 0.05f) * Time.delta() * elevation;
|
||||||
@@ -53,6 +58,16 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
|||||||
public void update(){
|
public void update(){
|
||||||
Floor floor = floorOn();
|
Floor floor = floorOn();
|
||||||
|
|
||||||
|
if(isFlying() != wasFlying){
|
||||||
|
if(wasFlying){
|
||||||
|
if(tileOn() != null){
|
||||||
|
Fx.unitLand.at(x, y, floorOn().isLiquid ? 1f : 0.5f, floorOn().mapColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wasFlying = isFlying();
|
||||||
|
}
|
||||||
|
|
||||||
if(isGrounded() && floor.isLiquid){
|
if(isGrounded() && floor.isLiquid){
|
||||||
if((splashTimer += Mathf.dst(deltaX(), deltaY())) >= 7f){
|
if((splashTimer += Mathf.dst(deltaX(), deltaY())) >= 7f){
|
||||||
floor.walkEffect.at(x, y, 0, floor.mapColor);
|
floor.walkEffect.at(x, y, 0, floor.mapColor);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.math.geom.QuadTree.*;
|
import arc.math.geom.QuadTree.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.async.PhysicsProcess.*;
|
import mindustry.async.PhysicsProcess.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.Graphics.*;
|
import arc.Graphics.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
@@ -125,8 +125,19 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
teamIndex.updateCount(team(), -1);
|
teamIndex.updateCount(team(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void landed(){
|
||||||
|
if(type.landShake > 0f){
|
||||||
|
Effects.shake(type.landShake, type.landShake, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
type.landed(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
type.update(this);
|
||||||
|
|
||||||
drag(type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f));
|
drag(type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f));
|
||||||
|
|
||||||
//apply knockback based on spawns
|
//apply knockback based on spawns
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package mindustry.entities.def;
|
package mindustry.entities.comp;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
@@ -45,7 +45,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
/** Selected build request for movement. */
|
/** Selected build request for movement. */
|
||||||
private @Nullable BuildRequest sreq;
|
private @Nullable BuildRequest sreq;
|
||||||
/** Whether player is currently deleting removal requests. */
|
/** Whether player is currently deleting removal requests. */
|
||||||
private boolean deleting = false;
|
private boolean deleting = false, shouldShoot = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildUI(Group group){
|
public void buildUI(Group group){
|
||||||
@@ -186,11 +186,14 @@ public class DesktopInput extends InputHandler{
|
|||||||
Core.camera.position.lerpDelta(player, 0.08f);
|
Core.camera.position.lerpDelta(player, 0.08f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldShoot = true;
|
||||||
|
|
||||||
if(!scene.hasMouse()){
|
if(!scene.hasMouse()){
|
||||||
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
||||||
Unitc on = selectedUnit();
|
Unitc on = selectedUnit();
|
||||||
if(on != null){
|
if(on != null){
|
||||||
Call.onUnitControl(player, on);
|
Call.onUnitControl(player, on);
|
||||||
|
shouldShoot = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,10 +457,10 @@ public class DesktopInput extends InputHandler{
|
|||||||
//only begin shooting if there's no cursor event
|
//only begin shooting if there's no cursor event
|
||||||
if(!tileTapped(selected.entity) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && (player.builder().requests().size == 0 || !player.builder().isBuilding()) && !droppingItem &&
|
if(!tileTapped(selected.entity) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && (player.builder().requests().size == 0 || !player.builder().isBuilding()) && !droppingItem &&
|
||||||
!tryBeginMine(selected) && player.miner().mineTile() == null && !Core.scene.hasKeyboard()){
|
!tryBeginMine(selected) && player.miner().mineTile() == null && !Core.scene.hasKeyboard()){
|
||||||
isShooting = true;
|
isShooting = shouldShoot;
|
||||||
}
|
}
|
||||||
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
||||||
isShooting = true;
|
isShooting = shouldShoot;
|
||||||
}
|
}
|
||||||
}else if(Core.input.keyTap(Binding.deselect) && isPlacing()){
|
}else if(Core.input.keyTap(Binding.deselect) && isPlacing()){
|
||||||
block = null;
|
block = null;
|
||||||
@@ -558,7 +561,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
protected void updateMovement(Unitc unit){
|
protected void updateMovement(Unitc unit){
|
||||||
boolean omni = !(unit instanceof WaterMovec);
|
boolean omni = !(unit instanceof WaterMovec);
|
||||||
boolean legs = unit.isGrounded();
|
boolean legs = unit.isGrounded();
|
||||||
float speed = unit.type().speed;
|
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation());
|
||||||
float xa = Core.input.axis(Binding.move_x);
|
float xa = Core.input.axis(Binding.move_x);
|
||||||
float ya = Core.input.axis(Binding.move_y);
|
float ya = Core.input.axis(Binding.move_y);
|
||||||
|
|
||||||
@@ -590,5 +593,13 @@ public class DesktopInput extends InputHandler{
|
|||||||
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation(), Core.input.mouseWorld().dst(unit)).add(unit.x(), unit.y()));
|
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation(), Core.input.mouseWorld().dst(unit)).add(unit.x(), unit.y()));
|
||||||
|
|
||||||
unit.controlWeapons(true, isShooting);
|
unit.controlWeapons(true, isShooting);
|
||||||
|
|
||||||
|
isBoosting = Core.input.keyDown(Binding.boost);
|
||||||
|
|
||||||
|
if(unit.type().canBoost){
|
||||||
|
Tile tile = unit.tileOn();
|
||||||
|
|
||||||
|
unit.elevation(Mathf.approachDelta(unit.elevation(), (tile != null && tile.solid()) || (isBoosting && !movement.isZero()) ? 1f : 0f, 0.08f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
public int rotation;
|
public int rotation;
|
||||||
public boolean droppingItem;
|
public boolean droppingItem;
|
||||||
public Group uiGroup;
|
public Group uiGroup;
|
||||||
public boolean isShooting, isBuilding = true, buildWasAutoPaused = false;
|
public boolean isShooting, isBuilding = true, buildWasAutoPaused = false, isBoosting = false;
|
||||||
public @Nullable UnitType controlledType;
|
public @Nullable UnitType controlledType;
|
||||||
|
|
||||||
protected @Nullable Schematic lastSchematic;
|
protected @Nullable Schematic lastSchematic;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import arc.math.*;
|
|||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
@@ -30,11 +30,12 @@ public class UnitType extends UnlockableContent{
|
|||||||
public boolean flying;
|
public boolean flying;
|
||||||
public @NonNull Prov<? extends Unitc> constructor;
|
public @NonNull Prov<? extends Unitc> constructor;
|
||||||
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
|
||||||
public float speed = 1.1f, boostSpeed = 0.75f, rotateSpeed = 5f, baseRotateSpeed = 5f;
|
public float speed = 1.1f, boostMultiplier = 1f, rotateSpeed = 5f, baseRotateSpeed = 5f;
|
||||||
public float drag = 0.3f, mass = 1f, accel = 0.5f;
|
public float drag = 0.3f, mass = 1f, accel = 0.5f, landShake = 0f;
|
||||||
public float health = 200f, range = -1;
|
public float health = 200f, range = -1;
|
||||||
public boolean targetAir = true, targetGround = true;
|
public boolean targetAir = true, targetGround = true;
|
||||||
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
|
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
|
||||||
|
public boolean canBoost = false;
|
||||||
public float sway = 1f;
|
public float sway = 1f;
|
||||||
|
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
@@ -54,7 +55,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public Sound deathSound = Sounds.bang;
|
public Sound deathSound = Sounds.bang;
|
||||||
|
|
||||||
public Array<Weapon> weapons = new Array<>();
|
public Array<Weapon> weapons = new Array<>();
|
||||||
public TextureRegion baseRegion, legRegion, region, cellRegion, occlusionRegion;
|
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion, occlusionRegion;
|
||||||
|
|
||||||
public UnitType(String name){
|
public UnitType(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -83,6 +84,10 @@ public class UnitType extends UnlockableContent{
|
|||||||
return weapons.size > 0;
|
return weapons.size > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update(Unitc unit){}
|
||||||
|
|
||||||
|
public void landed(Unitc unit){}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayInfo(Table table){
|
public void displayInfo(Table table){
|
||||||
ContentDisplay.displayUnit(table, this);
|
ContentDisplay.displayUnit(table, this);
|
||||||
@@ -108,6 +113,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
baseRegion = Core.atlas.find(name + "-base");
|
baseRegion = Core.atlas.find(name + "-base");
|
||||||
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
||||||
occlusionRegion = Core.atlas.find("circle-shadow");
|
occlusionRegion = Core.atlas.find("circle-shadow");
|
||||||
|
shadowRegion = icon(Cicon.full);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -119,25 +125,24 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
public void draw(Unitc unit){
|
public void draw(Unitc unit){
|
||||||
Legsc legs = unit instanceof Legsc ? (Legsc)unit : null;
|
Legsc legs = unit instanceof Legsc ? (Legsc)unit : null;
|
||||||
|
float z = unit.elevation() > 0.5f ? (lowAltitude ? Layer.flyingUnitLow : Layer.flyingUnit) : Layer.groundUnit;
|
||||||
|
|
||||||
if(unit.controller().isBeingControlled(player.unit())){
|
if(unit.controller().isBeingControlled(player.unit())){
|
||||||
drawControl(unit);
|
drawControl(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unit.isFlying()){
|
if(unit.isFlying()){
|
||||||
Draw.z(Layer.darkness);
|
Draw.z(Math.min(Layer.darkness, z - 1f));
|
||||||
drawShadow(unit);
|
drawShadow(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
float z = unit.elevation() > 0.5f ? (lowAltitude ? Layer.flyingUnitLow : Layer.flyingUnit) : Layer.groundUnit;
|
|
||||||
|
|
||||||
Draw.z(z - 0.02f);
|
Draw.z(z - 0.02f);
|
||||||
|
|
||||||
if(legs != null){
|
if(legs != null){
|
||||||
drawLegs(legs);
|
drawLegs(legs);
|
||||||
|
|
||||||
float ft = Mathf.sin(legs.walkTime(), 3f, 3f);
|
float ft = Mathf.sin(legs.walkTime(), 3f, 3f);
|
||||||
legOffset.trns(legs.baseRotation(), 0f, ft * 0.18f * sway);
|
legOffset.trns(legs.baseRotation(), 0f, Mathf.lerp(ft * 0.18f * sway, 0f, unit.elevation()));
|
||||||
unit.trns(legOffset.x, legOffset.y);
|
unit.trns(legOffset.x, legOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +183,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
public void drawShadow(Unitc unit){
|
public void drawShadow(Unitc unit){
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.rect(region, unit.x() + shadowTX * unit.elevation(), unit.y() + shadowTY * unit.elevation(), unit.rotation() - 90);
|
Draw.rect(shadowRegion, unit.x() + shadowTX * unit.elevation(), unit.y() + shadowTY * unit.elevation(), unit.rotation() - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,26 +231,29 @@ public class UnitType extends UnlockableContent{
|
|||||||
public void drawEngine(Unitc unit){
|
public void drawEngine(Unitc unit){
|
||||||
if(!unit.isFlying()) return;
|
if(!unit.isFlying()) return;
|
||||||
|
|
||||||
|
float scale = unit.elevation();
|
||||||
|
float offset = engineOffset/2f + engineOffset/2f*scale;
|
||||||
|
|
||||||
if(unit instanceof Trailc){
|
if(unit instanceof Trailc){
|
||||||
Trail trail = ((Trailc)unit).trail();
|
Trail trail = ((Trailc)unit).trail();
|
||||||
|
|
||||||
float cx = unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset),
|
float cx = unit.x() + Angles.trnsx(unit.rotation() + 180, offset),
|
||||||
cy = unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset);
|
cy = unit.y() + Angles.trnsy(unit.rotation() + 180, offset);
|
||||||
trail.update(cx, cy);
|
trail.update(cx, cy);
|
||||||
trail.draw(unit.team().color, (engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f) * unit.elevation()));
|
trail.draw(unit.team().color, (engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f) * scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color(unit.team().color);
|
Draw.color(unit.team().color);
|
||||||
Fill.circle(
|
Fill.circle(
|
||||||
unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset),
|
unit.x() + Angles.trnsx(unit.rotation() + 180, offset),
|
||||||
unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset),
|
unit.y() + Angles.trnsy(unit.rotation() + 180, offset),
|
||||||
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f) * unit.elevation())
|
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f)) * scale
|
||||||
);
|
);
|
||||||
Draw.color(Color.white);
|
Draw.color(Color.white);
|
||||||
Fill.circle(
|
Fill.circle(
|
||||||
unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset - 1f),
|
unit.x() + Angles.trnsx(unit.rotation() + 180, offset - 1f),
|
||||||
unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset - 1f),
|
unit.y() + Angles.trnsy(unit.rotation() + 180, offset - 1f),
|
||||||
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f)) / 2f * unit.elevation()
|
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f)) / 2f * scale
|
||||||
);
|
);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
@@ -305,8 +313,10 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
Draw.mixcol(Color.white, unit.hitTime());
|
Draw.mixcol(Color.white, unit.hitTime());
|
||||||
|
|
||||||
float sin = Mathf.sin(unit.walkTime(), 3f, 1f);
|
float e = unit.elevation();
|
||||||
|
float sin = Mathf.lerp(Mathf.sin(unit.walkTime(), 3f, 1f), 0f, e);
|
||||||
float ft = sin*(2.5f + (unit.hitSize()-8f)/2f);
|
float ft = sin*(2.5f + (unit.hitSize()-8f)/2f);
|
||||||
|
float boostTrns = e * 2f;
|
||||||
|
|
||||||
Floor floor = unit.floorOn();
|
Floor floor = unit.floorOn();
|
||||||
|
|
||||||
@@ -317,11 +327,11 @@ public class UnitType extends UnlockableContent{
|
|||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
//Draw.mixcol(Color.valueOf("989aa4"), Math.max(sin * i, 0));
|
//Draw.mixcol(Color.valueOf("989aa4"), Math.max(sin * i, 0));
|
||||||
Draw.rect(legRegion,
|
Draw.rect(legRegion,
|
||||||
unit.x() + Angles.trnsx(unit.baseRotation(), ft * i),
|
unit.x() + Angles.trnsx(unit.baseRotation(), ft * i - boostTrns, -boostTrns*i),
|
||||||
unit.y() + Angles.trnsy(unit.baseRotation(), ft * i),
|
unit.y() + Angles.trnsy(unit.baseRotation(), ft * i - boostTrns, -boostTrns*i),
|
||||||
legRegion.getWidth() * i * Draw.scl,
|
legRegion.getWidth() * i * Draw.scl,
|
||||||
legRegion.getHeight() * Draw.scl - Math.max(-sin * i, 0) * legRegion.getHeight() * 0.5f * Draw.scl,
|
legRegion.getHeight() * Draw.scl - Math.max(-sin * i, 0) * legRegion.getHeight() * 0.5f * Draw.scl,
|
||||||
unit.baseRotation() - 90);
|
unit.baseRotation() - 90 + 35f*i*e);
|
||||||
}
|
}
|
||||||
//Draw.mixcol();
|
//Draw.mixcol();
|
||||||
|
|
||||||
|
|||||||