Fixed door toggle
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
package io.anuke.mindustry.world.blocks.defense;
|
package io.anuke.mindustry.world.blocks.defense;
|
||||||
|
|
||||||
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.Graphics.Cursor;
|
import io.anuke.arc.Graphics.Cursor;
|
||||||
import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
|
||||||
import io.anuke.arc.math.geom.Rectangle;
|
import io.anuke.arc.math.geom.Rectangle;
|
||||||
import io.anuke.mindustry.content.Fx;
|
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.Effects.Effect;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -33,6 +32,22 @@ public class Door extends Wall{
|
|||||||
consumesTap = true;
|
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
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
super.load();
|
super.load();
|
||||||
@@ -69,13 +84,7 @@ public class Door extends Wall{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.open = !entity.open;
|
Call.onDoorToggle(null, tile, !entity.open);
|
||||||
world.pathfinder.updateSolid(tile);
|
|
||||||
if(!entity.open){
|
|
||||||
Effects.effect(closefx, tile.drawx(), tile.drawy());
|
|
||||||
}else{
|
|
||||||
Effects.effect(openfx, tile.drawx(), tile.drawy());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user