Minor cleanup / Trail experiment
This commit is contained in:
@@ -136,7 +136,6 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
if(!signatures.contains(cname + "()")){
|
if(!signatures.contains(cname + "()")){
|
||||||
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
|
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
|
||||||
.addAnnotations(Seq.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get))
|
.addAnnotations(Seq.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get))
|
||||||
//.addAnnotation(Deprecated.class) //TODO undeprecate
|
|
||||||
.addJavadoc(field.doc() == null ? "" : field.doc())
|
.addJavadoc(field.doc() == null ? "" : field.doc())
|
||||||
.returns(field.tname()).build());
|
.returns(field.tname()).build());
|
||||||
}
|
}
|
||||||
@@ -147,7 +146,6 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
|
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
|
||||||
.addJavadoc(field.doc() == null ? "" : field.doc())
|
.addJavadoc(field.doc() == null ? "" : field.doc())
|
||||||
.addParameter(ParameterSpec.builder(field.tname(), field.name())
|
.addParameter(ParameterSpec.builder(field.tname(), field.name())
|
||||||
//.addAnnotation(Deprecated.class) //TODO undeprecate
|
|
||||||
.addAnnotations(Seq.with(field.annotations())
|
.addAnnotations(Seq.with(field.annotations())
|
||||||
.select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)).build()).build());
|
.select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)).build()).build());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#define HIGHP
|
#define HIGHP
|
||||||
|
|
||||||
#define MAX_HITS 64
|
|
||||||
#define HIT_RADIUS 12.0
|
|
||||||
#define ALPHA 0.18
|
#define ALPHA 0.18
|
||||||
#define thickness 1.0
|
|
||||||
#define step 2.0
|
#define step 2.0
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
//air + building + mining
|
//air + building + mining
|
||||||
//TODO implement other starter drones
|
//TODO implement other starter drones
|
||||||
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class}) UnitType alpha, beta, gamma;
|
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class, Trailc.class}) UnitType alpha, beta, gamma;
|
||||||
|
|
||||||
//air + building + mining + payload
|
//air + building + mining + payload
|
||||||
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class, Payloadc.class}) UnitType trident;
|
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class, Payloadc.class}) UnitType trident;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ abstract class TrailComp implements Unitc{
|
|||||||
@Import UnitType type;
|
@Import UnitType type;
|
||||||
@Import float x, y, rotation;
|
@Import float x, y, rotation;
|
||||||
|
|
||||||
transient Trail trail = new Trail();
|
transient Trail trail = new Trail(4);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
|||||||
static int sequenceNum = 0;
|
static int sequenceNum = 0;
|
||||||
|
|
||||||
/** weapon mount array, never null */
|
/** weapon mount array, never null */
|
||||||
@ReadOnly @SyncLocal WeaponMount[] mounts = {};
|
@SyncLocal WeaponMount[] mounts = {};
|
||||||
@ReadOnly transient float range, aimX, aimY;
|
@ReadOnly transient float range, aimX, aimY;
|
||||||
@ReadOnly transient boolean isRotate;
|
@ReadOnly transient boolean isRotate;
|
||||||
boolean isShooting;
|
boolean isShooting;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class OverlayRenderer{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
Building tile = world.entWorld(v.x, v.y);
|
Building tile = world.entWorld(v.x, v.y);
|
||||||
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack().amount, player.unit()) > 0){
|
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0){
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.square(tile.x(), tile.y(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
Lines.square(tile.x(), tile.y(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
||||||
Lines.stroke(1f, Pal.place);
|
Lines.stroke(1f, Pal.place);
|
||||||
|
|||||||
@@ -8,10 +8,15 @@ import arc.struct.*;
|
|||||||
import arc.util.pooling.*;
|
import arc.util.pooling.*;
|
||||||
|
|
||||||
public class Trail{
|
public class Trail{
|
||||||
private static final int length = 20;
|
private final int length;
|
||||||
private Seq<Vec3> points = new Seq<>();
|
private final Seq<Vec3> points;
|
||||||
private float lastX = -1, lastY = -1;
|
private float lastX = -1, lastY = -1;
|
||||||
|
|
||||||
|
public Trail(int length){
|
||||||
|
this.length = length;
|
||||||
|
points = new Seq<>(length);
|
||||||
|
}
|
||||||
|
|
||||||
public void draw(Color color, float width){
|
public void draw(Color color, float width){
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
@Remote(targets = Loc.client, called = Loc.server)
|
@Remote(targets = Loc.client, called = Loc.server)
|
||||||
public static void dropItem(Player player, float angle){
|
public static void dropItem(Player player, float angle){
|
||||||
if(net.server() && player.unit().stack().amount <= 0){
|
if(net.server() && player.unit().stack.amount <= 0){
|
||||||
throw new ValidateException(player, "Player cannot drop an item.");
|
throw new ValidateException(player, "Player cannot drop an item.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,18 +129,18 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
||||||
public static void transferInventory(Player player, Building tile){
|
public static void transferInventory(Player player, Building tile){
|
||||||
if(player == null || tile == null) return;
|
if(player == null || tile == null) return;
|
||||||
if(net.server() && (player.unit().stack().amount <= 0 || !Units.canInteract(player, tile) ||
|
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, tile) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.depositItem, tile.tile(), action -> {
|
!netServer.admins.allowAction(player, ActionType.depositItem, tile.tile(), action -> {
|
||||||
action.itemAmount = player.unit().stack().amount;
|
action.itemAmount = player.unit().stack.amount;
|
||||||
action.item = player.unit().item();
|
action.item = player.unit().item();
|
||||||
}))){
|
}))){
|
||||||
throw new ValidateException(player, "Player cannot transfer an item.");
|
throw new ValidateException(player, "Player cannot transfer an item.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Item item = player.unit().item();
|
Item item = player.unit().item();
|
||||||
int amount = player.unit().stack().amount;
|
int amount = player.unit().stack.amount;
|
||||||
int accepted = tile.acceptStack(item, amount, player.unit());
|
int accepted = tile.acceptStack(item, amount, player.unit());
|
||||||
player.unit().stack().amount -= accepted;
|
player.unit().stack.amount -= accepted;
|
||||||
|
|
||||||
Core.app.post(() -> Events.fire(new DepositEvent(tile, player, item, accepted)));
|
Core.app.post(() -> Events.fire(new DepositEvent(tile, player, item, accepted)));
|
||||||
|
|
||||||
@@ -726,7 +726,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean canTapPlayer(float x, float y){
|
boolean canTapPlayer(float x, float y){
|
||||||
return player.within(x, y, playerSelectRange) && player.unit().stack().amount > 0;
|
return player.within(x, y, playerSelectRange) && player.unit().stack.amount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tries to begin mining a tile, returns true if successful. */
|
/** Tries to begin mining a tile, returns true if successful. */
|
||||||
@@ -866,14 +866,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tryDropItems(@Nullable Building tile, float x, float y){
|
public void tryDropItems(@Nullable Building tile, float x, float y){
|
||||||
if(!droppingItem || player.unit().stack().amount <= 0 || canTapPlayer(x, y) || state.isPaused() ){
|
if(!droppingItem || player.unit().stack.amount <= 0 || canTapPlayer(x, y) || state.isPaused() ){
|
||||||
droppingItem = false;
|
droppingItem = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
droppingItem = false;
|
droppingItem = false;
|
||||||
|
|
||||||
ItemStack stack = player.unit().stack();
|
ItemStack stack = player.unit().stack;
|
||||||
|
|
||||||
if(tile != null && tile.acceptStack(stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block().hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){
|
if(tile != null && tile.acceptStack(stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block().hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){
|
||||||
Call.transferInventory(player, tile);
|
Call.transferInventory(player, tile);
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
(3f + Mathf.absin(Time.time(), 5f, 1f)) * unit.itemTime);
|
(3f + Mathf.absin(Time.time(), 5f, 1f)) * unit.itemTime);
|
||||||
|
|
||||||
if(unit.isLocal()){
|
if(unit.isLocal()){
|
||||||
Fonts.outline.draw(unit.stack().amount + "",
|
Fonts.outline.draw(unit.stack.amount + "",
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY) - 3,
|
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY) - 3,
|
||||||
Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center
|
Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center
|
||||||
@@ -320,7 +320,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public void drawWeapons(Unit unit){
|
public void drawWeapons(Unit unit){
|
||||||
applyColor(unit);
|
applyColor(unit);
|
||||||
|
|
||||||
for(WeaponMount mount : unit.mounts()){
|
for(WeaponMount mount : unit.mounts){
|
||||||
Weapon weapon = mount.weapon;
|
Weapon weapon = mount.weapon;
|
||||||
|
|
||||||
for(int i : (weapon.mirror ? Mathf.signs : Mathf.one)){
|
for(int i : (weapon.mirror ? Mathf.signs : Mathf.one)){
|
||||||
|
|||||||
Reference in New Issue
Block a user