mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
commit
9033ebcfd7
2 changed files with 14 additions and 3 deletions
|
|
@ -139,9 +139,19 @@ public class EventType{
|
|||
|
||||
}
|
||||
|
||||
/** Called when a player withdraws items from a block. Tutorial only.*/
|
||||
/** Called when the player withdraws items from a block. */
|
||||
public static class WithdrawEvent{
|
||||
public final Tile tile;
|
||||
public final Player player;
|
||||
public final Item item;
|
||||
public final int amount;
|
||||
|
||||
public WithdrawEvent(Tile tile, Player player, Item item, int amount){
|
||||
this.tile = tile;
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when a player deposits items to a block.*/
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||
int removed = tile.block().removeStack(tile, item, amount);
|
||||
|
||||
player.addItem(item, removed);
|
||||
Events.fire(new WithdrawEvent(tile, player, item, amount));
|
||||
for(int j = 0; j < Mathf.clamp(removed / 3, 1, 8); j++){
|
||||
Time.run(j * 3f, () -> Call.transferItemEffect(item, tile.drawx(), tile.drawy(), player));
|
||||
}
|
||||
|
|
@ -100,7 +101,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||
holding = false;
|
||||
holdTime = 0f;
|
||||
|
||||
Events.fire(new WithdrawEvent());
|
||||
if(net.client()) Events.fire(new WithdrawEvent(tile, player, lastItem, amount));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||
lastItem = item;
|
||||
holding = true;
|
||||
holdTime = 0f;
|
||||
Events.fire(new WithdrawEvent());
|
||||
if(net.client()) Events.fire(new WithdrawEvent(tile, player, item, amount));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue