Added logic payEnter command
This commit is contained in:
@@ -74,13 +74,13 @@ public class PayloadConveyor extends Block{
|
||||
public int step = -1, stepAccepted = -1;
|
||||
|
||||
@Override
|
||||
public boolean canControlSelect(Player player){
|
||||
return this.item == null && !player.unit().spawnedByCore && player.unit().hitSize / tilesize <= payloadLimit && player.tileOn() != null && player.tileOn().build == this;
|
||||
public boolean canControlSelect(Unit player){
|
||||
return this.item == null && !player.spawnedByCore && player.hitSize / tilesize <= payloadLimit && player.tileOn() != null && player.tileOn().build == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onControlSelect(Player player){
|
||||
acceptPlayerPayload(player, p -> item = p);
|
||||
public void onControlSelect(Unit player){
|
||||
handleUnitPayload(player, p -> item = p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,16 +78,16 @@ public class PayloadBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canControlSelect(Player player){
|
||||
return !player.unit().spawnedByCore && this.payload == null && acceptUnitPayload(player.unit()) && player.tileOn() != null && player.tileOn().build == this;
|
||||
public boolean canControlSelect(Unit player){
|
||||
return !player.spawnedByCore && this.payload == null && acceptUnitPayload(player) && player.tileOn() != null && player.tileOn().build == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onControlSelect(Player player){
|
||||
public void onControlSelect(Unit player){
|
||||
float x = player.x, y = player.y;
|
||||
acceptPlayerPayload(player, p -> payload = (T)p);
|
||||
handleUnitPayload(player, p -> payload = (T)p);
|
||||
this.payVector.set(x, y).sub(this).clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
|
||||
this.payRotation = player.unit().rotation;
|
||||
this.payRotation = player.rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -242,12 +242,15 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canControlSelect(Player player){
|
||||
return true;
|
||||
public boolean canControlSelect(Unit player){
|
||||
return player.isPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onControlSelect(Player player){
|
||||
public void onControlSelect(Unit unit){
|
||||
if(!unit.isPlayer()) return;
|
||||
Player player = unit.getPlayer();
|
||||
|
||||
Fx.spawn.at(player);
|
||||
if(net.client() && player == Vars.player){
|
||||
control.input.controlledType = null;
|
||||
|
||||
Reference in New Issue
Block a user