Fixed setProp x/y not teleporting on strict servers
This commit is contained in:
@@ -31,6 +31,14 @@ public class UnitCommand{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}},
|
||||
loadPayloadCommand = new UnitCommand("loadPayload", "download", u -> null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
}},
|
||||
unloadPayloadCommand = new UnitCommand("unloadPayload", "upload", u -> null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
}};
|
||||
|
||||
/** Unique ID number. */
|
||||
|
||||
@@ -11,9 +11,9 @@ public class UnitStance{
|
||||
|
||||
public static final UnitStance
|
||||
|
||||
stopStance = new UnitStance("stop", "cancel"), //not a real stance, cannot be selected, just cancels ordewrs
|
||||
shootStance = new UnitStance("shoot", "commandAttack"),
|
||||
holdFireStance = new UnitStance("holdfire", "none"),
|
||||
stop = new UnitStance("stop", "cancel"), //not a real stance, cannot be selected, just cancels ordewrs
|
||||
shoot = new UnitStance("shoot", "commandAttack"),
|
||||
holdFire = new UnitStance("holdfire", "none"),
|
||||
pursueTarget = new UnitStance("pursuetarget", "right"),
|
||||
patrol = new UnitStance("patrol", "refresh"),
|
||||
ram = new UnitStance("ram", "rightOpen");
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CommandAI extends AIController{
|
||||
protected boolean flocked;
|
||||
|
||||
/** Stance, usually related to firing mode. */
|
||||
public UnitStance stance = UnitStance.shootStance;
|
||||
public UnitStance stance = UnitStance.shoot;
|
||||
/** Current command this unit is following. */
|
||||
public @Nullable UnitCommand command;
|
||||
/** Current controller instance based on command. */
|
||||
@@ -65,7 +65,7 @@ public class CommandAI extends AIController{
|
||||
@Override
|
||||
public void updateUnit(){
|
||||
//this should not be possible
|
||||
if(stance == UnitStance.stopStance) stance = UnitStance.shootStance;
|
||||
if(stance == UnitStance.stop) stance = UnitStance.shoot;
|
||||
|
||||
if(stance == UnitStance.pursueTarget && target != null && attackTarget == null && targetPos == null){
|
||||
commandTarget(target, false);
|
||||
@@ -279,7 +279,7 @@ public class CommandAI extends AIController{
|
||||
|
||||
@Override
|
||||
public boolean shouldFire(){
|
||||
return stance != UnitStance.holdFireStance;
|
||||
return stance != UnitStance.holdFire;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1285,8 +1285,6 @@ public class UnitTypes{
|
||||
lowAltitude = true;
|
||||
|
||||
ammoType = new PowerAmmoType(900);
|
||||
stances = new UnitStance[]{UnitStance.stopStance, UnitStance.shootStance, UnitStance.holdFireStance, UnitStance.patrol};
|
||||
|
||||
mineTier = 2;
|
||||
mineSpeed = 3.5f;
|
||||
|
||||
@@ -1345,7 +1343,6 @@ public class UnitTypes{
|
||||
isEnemy = false;
|
||||
|
||||
ammoType = new PowerAmmoType(1100);
|
||||
stances = new UnitStance[]{UnitStance.stopStance, UnitStance.shootStance, UnitStance.holdFireStance, UnitStance.patrol};
|
||||
|
||||
weapons.add(
|
||||
new Weapon("heal-weapon-mount"){{
|
||||
|
||||
@@ -696,7 +696,6 @@ public class NetServer implements ApplicationListener{
|
||||
vector.limit(maxMove);
|
||||
|
||||
float prevx = unit.x, prevy = unit.y;
|
||||
//unit.set(con.lastPosition);
|
||||
if(!unit.isFlying()){
|
||||
unit.move(vector.x, vector.y);
|
||||
}else{
|
||||
|
||||
@@ -269,8 +269,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
}
|
||||
}
|
||||
case shield -> shield = Math.max((float)value, 0f);
|
||||
case x -> x = World.unconv((float)value);
|
||||
case y -> y = World.unconv((float)value);
|
||||
case x -> {
|
||||
x = World.unconv((float)value);
|
||||
if(!isLocal()) snapInterpolation();
|
||||
}
|
||||
case y -> {
|
||||
y = World.unconv((float)value);
|
||||
if(!isLocal()) snapInterpolation();
|
||||
}
|
||||
case rotation -> rotation = (float)value;
|
||||
case team -> {
|
||||
if(!net.client()){
|
||||
|
||||
@@ -325,7 +325,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
for(int id : unitIds){
|
||||
Unit unit = Groups.unit.getByID(id);
|
||||
if(unit != null && unit.team == player.team() && unit.controller() instanceof CommandAI ai){
|
||||
if(stance == UnitStance.stopStance){ //not a real stance, just cancels orders
|
||||
if(stance == UnitStance.stop){ //not a real stance, just cancels orders
|
||||
ai.clearCommands();
|
||||
}else{
|
||||
ai.stance = stance;
|
||||
|
||||
@@ -288,23 +288,20 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
t.visible(() -> !showCancel() && block == null && !hasSchem());
|
||||
t.bottom().left();
|
||||
|
||||
t.button("@command.queue", Icon.rightOpen, Styles.clearTogglet, () -> {
|
||||
queueCommandMode = !queueCommandMode;
|
||||
}).width(155f).height(48f).margin(12f).checked(b -> queueCommandMode).visible(() -> commandMode).row();
|
||||
|
||||
t.button("@command", Icon.units, Styles.clearTogglet, () -> {
|
||||
commandMode = !commandMode;
|
||||
}).width(155f).height(56f).margin(12f).checked(b -> {
|
||||
b.setText(queueCommandMode ? bundle.get("command") + "\n" + bundle.get("command.queue") : bundle.get("command"));
|
||||
return commandMode;
|
||||
});
|
||||
|
||||
t.button(Icon.rightOpen, Styles.clearTogglei, () -> {
|
||||
queueCommandMode = !queueCommandMode;
|
||||
}).size(56f).margin(12f).checked(b -> queueCommandMode).visible(() -> commandMode).row();
|
||||
}).width(155f).height(48f).margin(12f).checked(b -> commandMode);
|
||||
|
||||
//for better looking insets
|
||||
t.rect((x, y, w, h) -> {
|
||||
if(Core.scene.marginBottom > 0){
|
||||
Tex.paneRight.draw(x, 0, w, y);
|
||||
}
|
||||
}).fillX().colspan(2).row();
|
||||
}).fillX().row();
|
||||
});
|
||||
|
||||
group.fill(t -> {
|
||||
|
||||
@@ -321,7 +321,7 @@ public class TypeIO{
|
||||
public static UnitStance readStance(Reads read){
|
||||
int val = read.ub();
|
||||
//never returns null
|
||||
return val == 255 ? UnitStance.shootStance : UnitStance.all.get(val);
|
||||
return val == 255 ? UnitStance.shoot : UnitStance.all.get(val);
|
||||
}
|
||||
|
||||
public static void writeEntity(Writes write, Entityc entity){
|
||||
|
||||
@@ -836,13 +836,13 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
|
||||
if(stances.length == 0){
|
||||
if(canAttack){
|
||||
Seq<UnitStance> seq = Seq.with(UnitStance.stopStance, UnitStance.shootStance, UnitStance.holdFireStance, UnitStance.pursueTarget, UnitStance.patrol);
|
||||
Seq<UnitStance> seq = Seq.with(UnitStance.stop, UnitStance.shoot, UnitStance.holdFire, UnitStance.pursueTarget, UnitStance.patrol);
|
||||
if(crushDamage > 0){
|
||||
seq.add(UnitStance.ram);
|
||||
}
|
||||
stances = seq.toArray(UnitStance.class);
|
||||
}else{
|
||||
stances = new UnitStance[]{UnitStance.stopStance};
|
||||
stances = new UnitStance[]{UnitStance.stop};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ public class PlacementFragment{
|
||||
for(var command : commands){
|
||||
coms.button(Icon.icons.get(command.icon, Icon.cancel), Styles.clearNoneTogglei, () -> {
|
||||
Call.setUnitCommand(player, units.mapInt(un -> un.id).toArray(), command);
|
||||
}).checked(i -> currentCommand[0] == command).size(50f).tooltip(command.localized());
|
||||
}).checked(i -> currentCommand[0] == command).size(50f).tooltip(command.localized(), true);
|
||||
|
||||
if(++scol % 6 == 0) coms.row();
|
||||
}
|
||||
@@ -541,7 +541,7 @@ public class PlacementFragment{
|
||||
|
||||
coms.button(Icon.icons.get(stance.icon, Icon.cancel), Styles.clearNoneTogglei, () -> {
|
||||
Call.setUnitStance(player, units.mapInt(un -> un.id).toArray(), stance);
|
||||
}).checked(i -> currentStance[0] == stance).size(50f).tooltip(stance.localized());
|
||||
}).checked(i -> currentStance[0] == stance).size(50f).tooltip(stance.localized(), true);
|
||||
|
||||
if(++scol % 6 == 0) coms.row();
|
||||
}
|
||||
@@ -597,7 +597,7 @@ public class PlacementFragment{
|
||||
//not a huge fan of running input logic here, but it's convenient as the stance arrays are all here...
|
||||
for(int i = 0; i < Math.min(stanceBindings.length, stances.size); i++){
|
||||
//first stance must always be the stop stance
|
||||
if(Core.input.keyTap(stanceBindings[i]) && (i != 0 || stances.get(0) == UnitStance.stopStance)){
|
||||
if(Core.input.keyTap(stanceBindings[i]) && (i != 0 || stances.get(0) == UnitStance.stop)){
|
||||
Call.setUnitStance(player, control.input.selectedUnits.mapInt(un -> un.id).toArray(), stances.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user