New artillery turret bullet patterns
This commit is contained in:
@@ -8,7 +8,7 @@ import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
|
||||
public class UnitTypes implements ContentList{
|
||||
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fabricator;
|
||||
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fortress, fabricator;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -58,6 +58,15 @@ public class UnitTypes implements ContentList{
|
||||
health = 500;
|
||||
}};
|
||||
|
||||
fortress = new UnitType("fortress", Fortress.class, Fortress::new){{
|
||||
maxVelocity = 0.8f;
|
||||
speed = 0.18f;
|
||||
drag = 0.4f;
|
||||
range = 10f;
|
||||
weapon = Weapons.flamethrower;
|
||||
health = 500;
|
||||
}};
|
||||
|
||||
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
|
||||
@@ -107,6 +107,8 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
shootType = AmmoTypes.arc;
|
||||
reload = 30f;
|
||||
shootShake = 1f;
|
||||
powerUsed = 5f;
|
||||
powerCapacity = 30f;
|
||||
range = 60f;
|
||||
shootEffect = ShootFx.lightningShoot;
|
||||
heatColor = Color.RED;
|
||||
|
||||
@@ -247,7 +247,7 @@ public class TurretBullets extends BulletList implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
arc = new BulletType(0.001f, 11){
|
||||
arc = new BulletType(0.001f, 7){
|
||||
{
|
||||
lifetime = 1;
|
||||
despawneffect = Fx.none;
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
import io.anuke.ucore.io.ByteBufferOutput;
|
||||
import io.anuke.ucore.io.CountableByteArrayOutputStream;
|
||||
import io.anuke.ucore.io.delta.ByteDeltaEncoder;
|
||||
import io.anuke.ucore.io.delta.ByteMatcherHash;
|
||||
@@ -39,6 +40,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
@@ -64,6 +66,9 @@ public class NetServer extends Module{
|
||||
private IntMap<Player> connections = new IntMap<>();
|
||||
private boolean closing = false;
|
||||
|
||||
private ByteBuffer writeBuffer = ByteBuffer.allocate(127);
|
||||
private ByteBufferOutput outputBuffer = new ByteBufferOutput(writeBuffer);
|
||||
|
||||
/**Stream for writing player sync data to.*/
|
||||
private CountableByteArrayOutputStream syncStream = new CountableByteArrayOutputStream();
|
||||
/**Data stream for writing player sync data to.*/
|
||||
@@ -174,6 +179,15 @@ public class NetServer extends Module{
|
||||
player.color.set(packet.color);
|
||||
player.color.a = 1f;
|
||||
|
||||
try{
|
||||
writeBuffer.position(0);
|
||||
player.write(outputBuffer);
|
||||
}catch(Throwable t){
|
||||
t.printStackTrace();
|
||||
kick(id, KickReason.nameEmpty);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.mode.isPvp){
|
||||
//find team with minimum amount of players and auto-assign player to that.
|
||||
Team min = Mathf.findMin(Team.all, team -> {
|
||||
|
||||
@@ -46,10 +46,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);
|
||||
create(type, owner, team, x, y, angle, velocityScl, 1f, null);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, Object data){
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl){
|
||||
create(type, owner, team, x, y, angle, velocityScl, lifetimeScl, null);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Object data){
|
||||
Bullet bullet = Pooling.obtain(Bullet.class);
|
||||
bullet.type = type;
|
||||
bullet.owner = owner;
|
||||
@@ -63,6 +67,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
|
||||
bullet.team = team;
|
||||
bullet.type = type;
|
||||
bullet.time(type.lifetime() * (1f - lifetimeScl));
|
||||
|
||||
//translate bullets backwards, purely for visual reasons
|
||||
float backDelta = Timers.delta();
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.GroundUnit;
|
||||
|
||||
public class Fortress extends GroundUnit{
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class ArtilleryTurret extends ItemTurret{
|
||||
|
||||
for(int i = 0; i < shots; i++){
|
||||
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
|
||||
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), dst / maxTraveled + Mathf.range(velocityInaccuracy));
|
||||
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), Mathf.clamp(dst / maxTraveled));
|
||||
}
|
||||
|
||||
effects(tile);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class MassDriver extends Block{
|
||||
other.isRecieving = true;
|
||||
Bullet.create(TurretBullets.driverBolt, entity, entity.getTeam(),
|
||||
tile.drawx() + Angles.trnsx(angle, driver.translation), tile.drawy() + Angles.trnsy(angle, driver.translation),
|
||||
angle, 1f, data);
|
||||
angle, 1f, 1f, data);
|
||||
|
||||
Effects.effect(driver.shootEffect, tile.drawx() + Angles.trnsx(angle, driver.translation),
|
||||
tile.drawy() + Angles.trnsy(angle, driver.translation), angle);
|
||||
|
||||
Reference in New Issue
Block a user