mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-30 14:39:10 +07:00
Fixed door toggle
This commit is contained in:
@ -1,17 +1,16 @@
|
||||
package io.anuke.mindustry.world.blocks.defense;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Graphics.Cursor;
|
||||
import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.math.geom.Rectangle;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.Effects.Effect;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import java.io.*;
|
||||
@ -33,6 +32,22 @@ public class Door extends Wall{
|
||||
consumesTap = true;
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onDoorToggle(Player player, Tile tile, boolean open){
|
||||
DoorEntity entity = tile.entity();
|
||||
if(entity != null){
|
||||
entity.open = open;
|
||||
Door door = (Door)tile.block();
|
||||
|
||||
world.pathfinder.updateSolid(tile);
|
||||
if(!entity.open){
|
||||
Effects.effect(door.openfx, tile.drawx(), tile.drawy());
|
||||
}else{
|
||||
Effects.effect(door.closefx, tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
@ -69,13 +84,7 @@ public class Door extends Wall{
|
||||
return;
|
||||
}
|
||||
|
||||
entity.open = !entity.open;
|
||||
world.pathfinder.updateSolid(tile);
|
||||
if(!entity.open){
|
||||
Effects.effect(closefx, tile.drawx(), tile.drawy());
|
||||
}else{
|
||||
Effects.effect(openfx, tile.drawx(), tile.drawy());
|
||||
}
|
||||
Call.onDoorToggle(null, tile, !entity.open);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user