Bugfixes / Direct payload support
This commit is contained in:
@@ -1596,6 +1596,7 @@ public class Blocks implements ContentList{
|
||||
recoilAmount = 6f;
|
||||
shootShake = 2f;
|
||||
range = 290f;
|
||||
minRange = 50f;
|
||||
|
||||
health = 130 * size * size;
|
||||
shootSound = Sounds.artillery;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Bullets implements ContentList{
|
||||
artilleryUnit = new ArtilleryBulletType(2f, 8, "shell"){{
|
||||
hitEffect = Fx.blastExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
lifetime = 110f;
|
||||
bulletWidth = bulletHeight = 14f;
|
||||
collides = true;
|
||||
collidesTiles = true;
|
||||
|
||||
@@ -18,10 +18,17 @@ abstract class BlockUnitComp implements Unitc{
|
||||
//sets up block stats
|
||||
maxHealth(tile.block().health);
|
||||
health(tile.health());
|
||||
hitSize(tile.block().size * tilesize);
|
||||
hitSize(tile.block().size * tilesize * 0.7f);
|
||||
set(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(tile != null){
|
||||
team = tile.team();
|
||||
}
|
||||
}
|
||||
|
||||
@Replace
|
||||
public void kill(){
|
||||
tile.kill();
|
||||
|
||||
@@ -50,6 +50,15 @@ abstract class PayloadComp implements Posc, Rotc{
|
||||
}
|
||||
|
||||
boolean tryDropPayload(Payload payload){
|
||||
Tile on = tileOn();
|
||||
|
||||
//drop off payload on an acceptor if possible
|
||||
if(on != null && on.entity != null && on.entity.acceptPayload(on.entity, payload)){
|
||||
Fx.unitDrop.at(on.entity);
|
||||
on.entity.handlePayload(on.entity, payload);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(payload instanceof BlockPayload){
|
||||
return dropBlock((BlockPayload)payload);
|
||||
}else if(payload instanceof UnitPayload){
|
||||
|
||||
@@ -32,6 +32,7 @@ import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.BuildBlock.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -172,7 +173,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void onUnitControl(Playerc player, @Nullable Unitc unit){
|
||||
if(unit == null){
|
||||
//clear player unit when they possess a core
|
||||
if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreEntity)){
|
||||
Fx.spawn.at(player);
|
||||
player.clearUnit();
|
||||
player.deathTimer(60f); //for instant respawn
|
||||
}else if(unit == null){ //just clear the unit (is this used?)
|
||||
player.clearUnit();
|
||||
//make sure it's AI controlled, so players can't overwrite each other
|
||||
}else if(unit.isAI() && unit.team() == player.team()){
|
||||
|
||||
@@ -52,6 +52,8 @@ public abstract class Turret extends Block{
|
||||
public float shootCone = 8f;
|
||||
public float shootShake = 0f;
|
||||
public float xRand = 0f;
|
||||
/** Currently used for artillery only. */
|
||||
public float minRange = 0f;
|
||||
public float burstSpacing = 0;
|
||||
public boolean alternate = false;
|
||||
public boolean targetAir = true;
|
||||
@@ -289,16 +291,12 @@ public abstract class Turret extends Block{
|
||||
return entry.type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ammo type that will be returned if useAmmo is called.
|
||||
*/
|
||||
/** @return the ammo type that will be returned if useAmmo is called. */
|
||||
public BulletType peekAmmo(){
|
||||
return ammo.peek().type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the turret has ammo.
|
||||
*/
|
||||
/** @return whether the turret has ammo. */
|
||||
public boolean hasAmmo(){
|
||||
return ammo.size > 0 && ammo.peek().amount >= ammoPerShot;
|
||||
}
|
||||
@@ -358,7 +356,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void bullet(BulletType type, float angle){
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, targetPos.x, targetPos.y) / type.range()) : 1f;
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, targetPos.x, targetPos.y) / type.range(), minRange / type.range(), range / type.range()) : 1f;
|
||||
|
||||
type.create(this, team, x + tr.x, y + tr.y, angle, 1f + Mathf.range(velocityInaccuracy), lifeScl);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,8 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptPayload(Tilec source, Payload payload){
|
||||
return this.item == null && progress <= 5f;
|
||||
//accepting payloads from units isn't supported
|
||||
return this.item == null && progress <= 5f && source != this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -15,6 +16,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.meta.*;
|
||||
import mindustry.world.modules.*;
|
||||
|
||||
@@ -79,8 +81,21 @@ public class CoreBlock extends StorageBlock{
|
||||
return false;
|
||||
}
|
||||
|
||||
public class CoreEntity extends TileEntity{
|
||||
protected int storageCapacity;
|
||||
public class CoreEntity extends TileEntity implements ControlBlock{
|
||||
public int storageCapacity;
|
||||
//note that this unit is never actually used for control; the possession handler makes the player respawn when this unit is controlled
|
||||
public @NonNull BlockUnitc unit = Nulls.blockUnit;
|
||||
|
||||
@Override
|
||||
public void created(){
|
||||
unit = (BlockUnitc)UnitTypes.block.create(team);
|
||||
unit.tile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Unitc unit(){
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void requestSpawn(Playerc player){
|
||||
Call.onPlayerSpawn(tile, player);
|
||||
|
||||
Reference in New Issue
Block a user