Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -89,7 +89,7 @@ public class UnitCommand extends MappableContent{
|
|||||||
drawTarget = true;
|
drawTarget = true;
|
||||||
resetTarget = false;
|
resetTarget = false;
|
||||||
}};
|
}};
|
||||||
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unitCommandEnterPayload, null){{
|
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unitCommandEnterPayload, u -> new BoostAI()){{
|
||||||
switchToMove = false;
|
switchToMove = false;
|
||||||
drawTarget = true;
|
drawTarget = true;
|
||||||
resetTarget = false;
|
resetTarget = false;
|
||||||
|
|||||||
@@ -727,6 +727,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowDeposit(){
|
||||||
|
return block.alwaysAllowDeposit || !state.rules.onlyDepositCore;
|
||||||
|
}
|
||||||
|
|
||||||
/** Called when this block is dropped as a payload. */
|
/** Called when this block is dropped as a payload. */
|
||||||
public void dropped(){
|
public void dropped(){
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ public class OverlayRenderer{
|
|||||||
if(input.canDropItem() && build != null && build.interactable(player.team()) && build.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0 && player.within(build, itemTransferRange) &&
|
if(input.canDropItem() && build != null && build.interactable(player.team()) && build.acceptStack(player.unit().item(), player.unit().stack.amount, player.unit()) > 0 && player.within(build, itemTransferRange) &&
|
||||||
input.itemDepositCooldown <= 0f){
|
input.itemDepositCooldown <= 0f){
|
||||||
|
|
||||||
boolean invalid = (state.rules.onlyDepositCore && !(build instanceof CoreBuild));
|
boolean invalid = !build.allowDeposit();
|
||||||
|
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.square(build.x, build.y, build.block.size * tilesize / 2f + 3 + Mathf.absin(Time.time, 5f, 1f));
|
Lines.square(build.x, build.y, build.block.size * tilesize / 2f + 3 + Mathf.absin(Time.time, 5f, 1f));
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ 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 build){
|
public static void transferInventory(Player player, Building build){
|
||||||
if(player == null || build == null || !player.within(build, itemTransferRange) || build.items == null || player.dead() || (state.rules.onlyDepositCore && !(build instanceof CoreBuild))) return;
|
if(player == null || build == null || !player.within(build, itemTransferRange) || build.items == null || player.dead() || !build.allowDeposit()) return;
|
||||||
|
|
||||||
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, build) ||
|
if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, build) ||
|
||||||
//to avoid rejecting deposit packets that happen to overlap due to packet speed differences, the actual cap is double the cooldown with 2 deposits.
|
//to avoid rejecting deposit packets that happen to overlap due to packet speed differences, the actual cap is double the cooldown with 2 deposits.
|
||||||
@@ -2089,7 +2089,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(build != null && build.acceptStack(stack.item, stack.amount, player.unit()) > 0 && build.interactable(player.team()) &&
|
if(build != null && build.acceptStack(stack.item, stack.amount, player.unit()) > 0 && build.interactable(player.team()) &&
|
||||||
build.block.hasItems && player.unit().stack().amount > 0 && build.interactable(player.team())){
|
build.block.hasItems && player.unit().stack().amount > 0 && build.interactable(player.team())){
|
||||||
|
|
||||||
if(!(state.rules.onlyDepositCore && !(build instanceof CoreBuild)) && itemDepositCooldown <= 0f){
|
if(build.allowDeposit() && itemDepositCooldown <= 0f){
|
||||||
Call.transferInventory(player, build);
|
Call.transferInventory(player, build);
|
||||||
itemDepositCooldown = state.rules.itemDepositCooldown;
|
itemDepositCooldown = state.rules.itemDepositCooldown;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ public class LExecutor{
|
|||||||
}else{
|
}else{
|
||||||
Building build = p1.building();
|
Building build = p1.building();
|
||||||
int dropped = Math.min(unit.stack.amount, p2.numi());
|
int dropped = Math.min(unit.stack.amount, p2.numi());
|
||||||
if(build != null && build.team == unit.team && build.isValid() && dropped > 0 && unit.within(build, logicItemTransferRange + build.block.size * tilesize/2f)){
|
if(build != null && build.team == unit.team && build.isValid() && build.allowDeposit() && dropped > 0 && unit.within(build, logicItemTransferRange + build.block.size * tilesize/2f)){
|
||||||
int accepted = build.acceptStack(unit.item(), dropped, unit);
|
int accepted = build.acceptStack(unit.item(), dropped, unit);
|
||||||
if(accepted > 0){
|
if(accepted > 0){
|
||||||
Call.transferItemTo(unit, unit.item(), accepted, unit.x, unit.y, build);
|
Call.transferItemTo(unit, unit.item(), accepted, unit.x, unit.y, build);
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public boolean acceptsPayload = false;
|
public boolean acceptsPayload = false;
|
||||||
/** Visual flag use for blending of certain transportation blocks. */
|
/** Visual flag use for blending of certain transportation blocks. */
|
||||||
public boolean acceptsItems = false;
|
public boolean acceptsItems = false;
|
||||||
|
/** If true, this block won't be affected by the onlyDepositCore rule. */
|
||||||
|
public boolean alwaysAllowDeposit = false;
|
||||||
/** If true, all item capacities of this block are separate instead of pooled as one number. */
|
/** If true, all item capacities of this block are separate instead of pooled as one number. */
|
||||||
public boolean separateItemCapacity = false;
|
public boolean separateItemCapacity = false;
|
||||||
/** maximum items this block can carry (usually, this is per-type of item) */
|
/** maximum items this block can carry (usually, this is per-type of item) */
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
|
alwaysAllowDeposit = true;
|
||||||
priority = TargetPriority.core;
|
priority = TargetPriority.core;
|
||||||
flags = EnumSet.of(BlockFlag.core);
|
flags = EnumSet.of(BlockFlag.core);
|
||||||
unitCapModifier = 10;
|
unitCapModifier = 10;
|
||||||
|
|||||||
@@ -126,5 +126,10 @@ public class StorageBlock extends Block{
|
|||||||
public boolean canPickup(){
|
public boolean canPickup(){
|
||||||
return linkedCore == null;
|
return linkedCore == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean allowDeposit(){
|
||||||
|
return linkedCore != null || super.allowDeposit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user