Fixed chat stopping velocity / Fixed drone repair not being synced
This commit is contained in:
@@ -110,6 +110,7 @@ public class Renderer extends RendererModule{
|
|||||||
Cursors.arrow = Cursors.loadCursor("cursor");
|
Cursors.arrow = Cursors.loadCursor("cursor");
|
||||||
Cursors.hand = Cursors.loadCursor("hand");
|
Cursors.hand = Cursors.loadCursor("hand");
|
||||||
Cursors.ibeam = Cursors.loadCursor("ibar");
|
Cursors.ibeam = Cursors.loadCursor("ibar");
|
||||||
|
Cursors.restoreCursor();
|
||||||
Cursors.loadCustom("drill");
|
Cursors.loadCustom("drill");
|
||||||
Cursors.loadCustom("unload");
|
Cursors.loadCustom("unload");
|
||||||
|
|
||||||
|
|||||||
@@ -495,8 +495,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
damage(health + 1); //die instantly
|
damage(health + 1); //die instantly
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ui.chatfrag.chatOpen()) return;
|
|
||||||
|
|
||||||
float speed = isBoosting && !mech.flying ? debug ? 5f : mech.boostSpeed : mech.speed;
|
float speed = isBoosting && !mech.flying ? debug ? 5f : mech.boostSpeed : mech.speed;
|
||||||
//fraction of speed when at max load
|
//fraction of speed when at max load
|
||||||
float carrySlowdown = 0.7f;
|
float carrySlowdown = 0.7f;
|
||||||
@@ -511,7 +509,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
}
|
}
|
||||||
|
|
||||||
//drop from carrier on key press
|
//drop from carrier on key press
|
||||||
if(Inputs.keyTap("drop_unit")){
|
if(!ui.chatfrag.chatOpen() && Inputs.keyTap("drop_unit")){
|
||||||
if(!mech.flying){
|
if(!mech.flying){
|
||||||
if(getCarrier() != null){
|
if(getCarrier() != null){
|
||||||
CallEntity.dropSelf(this);
|
CallEntity.dropSelf(this);
|
||||||
@@ -547,7 +545,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
movement.limit(speed * Timers.delta());
|
movement.limit(speed * Timers.delta());
|
||||||
|
|
||||||
if(getCarrier() == null){
|
if(getCarrier() == null){
|
||||||
|
if(!ui.chatfrag.chatOpen()){
|
||||||
velocity.add(movement);
|
velocity.add(movement);
|
||||||
|
}
|
||||||
float prex = x, prey = y;
|
float prex = x, prey = y;
|
||||||
updateVelocityStatus(mech.drag, 10f);
|
updateVelocityStatus(mech.drag, 10f);
|
||||||
moved = distanceTo(prex, prey) > 0.01f;
|
moved = distanceTo(prex, prey) > 0.01f;
|
||||||
@@ -557,6 +557,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
y = Mathf.lerpDelta(y, getCarrier().getY(), 0.1f);
|
y = Mathf.lerpDelta(y, getCarrier().getY(), 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ui.chatfrag.chatOpen()){
|
||||||
if(!isShooting()){
|
if(!isShooting()){
|
||||||
if(!movement.isZero()){
|
if(!movement.isZero()){
|
||||||
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f);
|
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f);
|
||||||
@@ -566,6 +567,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
|||||||
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f);
|
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateShooting(){
|
protected void updateShooting(){
|
||||||
if(isShooting()){
|
if(isShooting()){
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import io.anuke.mindustry.entities.units.UnitState;
|
|||||||
import io.anuke.mindustry.game.EventType.BlockBuildEvent;
|
import io.anuke.mindustry.game.EventType.BlockBuildEvent;
|
||||||
import io.anuke.mindustry.gen.CallEntity;
|
import io.anuke.mindustry.gen.CallEntity;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
@@ -47,9 +48,11 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
protected Item targetItem;
|
protected Item targetItem;
|
||||||
protected Tile mineTile;
|
protected Tile mineTile;
|
||||||
protected Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
protected Queue<BuildRequest> placeQueue = new ThreadQueue<>();
|
||||||
|
|
||||||
public final UnitState
|
public final UnitState
|
||||||
|
|
||||||
build = new UnitState(){
|
build = new UnitState(){
|
||||||
|
|
||||||
public void entered(){
|
public void entered(){
|
||||||
if(!(target instanceof BuildEntity)){
|
if(!(target instanceof BuildEntity)){
|
||||||
target = null;
|
target = null;
|
||||||
@@ -90,6 +93,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
},
|
},
|
||||||
|
|
||||||
repair = new UnitState(){
|
repair = new UnitState(){
|
||||||
|
|
||||||
public void entered(){
|
public void entered(){
|
||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
@@ -118,6 +122,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mine = new UnitState(){
|
mine = new UnitState(){
|
||||||
public void entered(){
|
public void entered(){
|
||||||
target = null;
|
target = null;
|
||||||
@@ -323,6 +328,12 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
public void update(){
|
public void update(){
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
|
if(Net.client() && state.is(repair) && target instanceof TileEntity){
|
||||||
|
TileEntity entity = (TileEntity) target;
|
||||||
|
entity.health += type.healSpeed * Timers.delta();
|
||||||
|
entity.health = Mathf.clamp(entity.health, 0, entity.tile.block().health);
|
||||||
|
}
|
||||||
|
|
||||||
x += Mathf.sin(Timers.time() + id * 999, 25f, 0.07f);
|
x += Mathf.sin(Timers.time() + id * 999, 25f, 0.07f);
|
||||||
y += Mathf.cos(Timers.time() + id * 999, 25f, 0.07f);
|
y += Mathf.cos(Timers.time() + id * 999, 25f, 0.07f);
|
||||||
|
|
||||||
@@ -418,6 +429,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
public void write(DataOutput data) throws IOException{
|
public void write(DataOutput data) throws IOException{
|
||||||
super.write(data);
|
super.write(data);
|
||||||
data.writeInt(mineTile == null ? -1 : mineTile.packedPosition());
|
data.writeInt(mineTile == null ? -1 : mineTile.packedPosition());
|
||||||
|
data.writeInt(state.is(repair) && target instanceof TileEntity ? ((TileEntity)target).tile.packedPosition() : -1);
|
||||||
writeBuilding(data);
|
writeBuilding(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,12 +437,21 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
|||||||
public void read(DataInput data, long time) throws IOException{
|
public void read(DataInput data, long time) throws IOException{
|
||||||
super.read(data, time);
|
super.read(data, time);
|
||||||
int mined = data.readInt();
|
int mined = data.readInt();
|
||||||
|
int repairing = data.readInt();
|
||||||
|
|
||||||
readBuilding(data);
|
readBuilding(data);
|
||||||
|
|
||||||
if(mined != -1){
|
if(mined != -1){
|
||||||
mineTile = world.tile(mined);
|
mineTile = world.tile(mined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(repairing != -1){
|
||||||
|
Tile tile = world.tile(repairing);
|
||||||
|
target = tile.entity;
|
||||||
|
state.set(repair);
|
||||||
|
}else{
|
||||||
|
state.set(retreat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user