mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Fixed #8795
This commit is contained in:
parent
e097346a73
commit
053afcace9
2 changed files with 22 additions and 4 deletions
|
|
@ -364,13 +364,19 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
|
||||
@Remote(targets = Loc.both, called = Loc.server)
|
||||
public static void requestBuildPayload(Player player, Building build){
|
||||
if(player == null || !(player.unit() instanceof Payloadc pay)) return;
|
||||
if(player == null || !(player.unit() instanceof Payloadc pay) || build == null) return;
|
||||
|
||||
Unit unit = player.unit();
|
||||
|
||||
if(build != null && state.teams.canInteract(unit.team, build.team)
|
||||
&& unit.within(build, tilesize * build.block.size * 1.2f + tilesize * 5f)){
|
||||
if(!unit.within(build, tilesize * build.block.size * 1.2f + tilesize * 5f)) return;
|
||||
|
||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.pickupBlock, build.tile, action -> {
|
||||
action.unit = unit;
|
||||
})){
|
||||
throw new ValidateException(player, "Player cannot pick up a block.");
|
||||
}
|
||||
|
||||
if(state.teams.canInteract(unit.team, build.team)){
|
||||
//pick up block's payload
|
||||
Payload current = build.getPayload();
|
||||
if(current != null && pay.canPickupPayload(current)){
|
||||
|
|
@ -424,6 +430,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
|
||||
Payloadc pay = (Payloadc)player.unit();
|
||||
|
||||
if(pay.payloads().isEmpty()) return;
|
||||
|
||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.dropPayload, player.unit().tileOn(), action -> {
|
||||
action.payload = pay.payloads().peek();
|
||||
})){
|
||||
throw new ValidateException(player, "Player cannot drop a payload.");
|
||||
}
|
||||
|
||||
//apply margin of error
|
||||
Tmp.v1.set(x, y).sub(pay).limit(tilesize * 4f).add(pay);
|
||||
float cx = Tmp.v1.x, cy = Tmp.v1.y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue