mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-11 09:20:51 -07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
16a01cbef3
8 changed files with 17 additions and 5 deletions
|
|
@ -89,7 +89,7 @@ public class UnitCommand extends MappableContent{
|
|||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}};
|
||||
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unitCommandEnterPayload, null){{
|
||||
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unitCommandEnterPayload, u -> new BoostAI()){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
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. */
|
||||
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) &&
|
||||
input.itemDepositCooldown <= 0f){
|
||||
|
||||
boolean invalid = (state.rules.onlyDepositCore && !(build instanceof CoreBuild));
|
||||
boolean invalid = !build.allowDeposit();
|
||||
|
||||
Lines.stroke(3f, Pal.gray);
|
||||
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)
|
||||
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) ||
|
||||
//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()) &&
|
||||
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);
|
||||
itemDepositCooldown = state.rules.itemDepositCooldown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ public class LExecutor{
|
|||
}else{
|
||||
Building build = p1.building();
|
||||
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);
|
||||
if(accepted > 0){
|
||||
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;
|
||||
/** Visual flag use for blending of certain transportation blocks. */
|
||||
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. */
|
||||
public boolean separateItemCapacity = false;
|
||||
/** maximum items this block can carry (usually, this is per-type of item) */
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class CoreBlock extends StorageBlock{
|
|||
solid = true;
|
||||
update = true;
|
||||
hasItems = true;
|
||||
alwaysAllowDeposit = true;
|
||||
priority = TargetPriority.core;
|
||||
flags = EnumSet.of(BlockFlag.core);
|
||||
unitCapModifier = 10;
|
||||
|
|
|
|||
|
|
@ -126,5 +126,10 @@ public class StorageBlock extends Block{
|
|||
public boolean canPickup(){
|
||||
return linkedCore == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowDeposit(){
|
||||
return linkedCore != null || super.allowDeposit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue