Implemented mass drivers

This commit is contained in:
Anuken
2018-06-16 14:34:11 -04:00
parent ff542a9946
commit 6c620182ea
13 changed files with 447 additions and 40 deletions

View File

@@ -628,6 +628,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
if(local){
int index = stream.readByte();
players[index].readSaveSuper(stream);
dead = false;
}
}

View File

@@ -30,6 +30,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
private static Vector2 vector = new Vector2();
private Team team;
private Object data;
private boolean supressCollision;
public Timer timer = new Timer(3);
@@ -43,9 +44,14 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
}
public static void create (BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl){
create(type, owner, team, x, y, angle, velocityScl, null);
}
public static void create (BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, Object data){
Bullet bullet = Pools.obtain(Bullet.class);
bullet.type = type;
bullet.owner = owner;
bullet.data = data;
bullet.velocity.set(0, type.speed).setAngle(angle).scl(velocityScl);
bullet.velocity.add(owner instanceof VelocityTrait ? ((VelocityTrait)owner).getVelocity() : Vector2.Zero);
@@ -90,6 +96,10 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
time += add;
}
public Object getData() {
return data;
}
@Override
public int getTypeID() {
return typeID;
@@ -185,6 +195,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
super.reset();
timer.clear();
team = null;
data = null;
}
@Override

View File

@@ -55,6 +55,11 @@ public class ItemDrop extends SolidEntity implements SyncTrait, DrawTrait, Veloc
return drop;
}
@Remote(called = Loc.server, in = In.entities)
public static void createItemDrop(Item item, int amount, float x, float y, float velocityX, float velocityY){
create(item, amount, x, y, 0).getVelocity().set(velocityX, velocityY);
}
@Remote(called = Loc.server, in = In.entities)
public static void onPickup(int itemid){
itemGroup.removeByID(itemid);