Merge branch 'master' into crater
This commit is contained in:
@@ -307,7 +307,19 @@ public class UI implements ApplicationListener, Loadable{
|
||||
hide();
|
||||
}).disabled(b -> field.getText().isEmpty());
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
}}.show();
|
||||
keyDown(KeyCode.ENTER, () -> {
|
||||
String text = field.getText();
|
||||
if(!text.isEmpty()){
|
||||
confirmed.get(text);
|
||||
hide();
|
||||
}
|
||||
});
|
||||
keyDown(KeyCode.ESCAPE, this::hide);
|
||||
keyDown(KeyCode.BACK, this::hide);
|
||||
show();
|
||||
Core.scene.setKeyboardFocus(field);
|
||||
field.setCursorPosition(def.length());
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -637,7 +637,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
if(!state.isEditor() && isShooting() && mech.canShoot(this)){
|
||||
if(!mech.turnCursor){
|
||||
//shoot forward ignoring cursor
|
||||
mech.weapon.update(this, x + Angles.trnsx(rotation, 1f), y + Angles.trnsy(rotation, 1f));
|
||||
mech.weapon.update(this, x + Angles.trnsx(rotation, mech.weapon.targetDistance), y + Angles.trnsy(rotation, mech.weapon.targetDistance));
|
||||
}else{
|
||||
mech.weapon.update(this, pointerX, pointerY);
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ public class Schematics implements Loadable{
|
||||
ui.showException(e);
|
||||
}
|
||||
}
|
||||
all.sort();
|
||||
}
|
||||
|
||||
public void savePreview(Schematic schematic, Fi file){
|
||||
@@ -280,6 +281,7 @@ public class Schematics implements Loadable{
|
||||
ui.showException(e);
|
||||
Log.err(e);
|
||||
}
|
||||
all.sort();
|
||||
}
|
||||
|
||||
public void remove(Schematic s){
|
||||
@@ -292,6 +294,7 @@ public class Schematics implements Loadable{
|
||||
previews.get(s).dispose();
|
||||
previews.remove(s);
|
||||
}
|
||||
all.sort();
|
||||
}
|
||||
|
||||
/** Creates a schematic from a world selection. */
|
||||
|
||||
@@ -512,10 +512,8 @@ public class Mods implements Loadable{
|
||||
for(ContentType type : ContentType.all){
|
||||
Fi folder = contentRoot.child(type.name().toLowerCase() + "s");
|
||||
if(folder.exists()){
|
||||
for(Fi file : folder.list()){
|
||||
if(file.extension().equals("json") || file.extension().equals("hjson")){
|
||||
runs.add(new LoadRun(type, file, mod));
|
||||
}
|
||||
for(Fi file : folder.findAll(f -> f.extension().equals("json") || f.extension().equals("hjson"))){
|
||||
runs.add(new LoadRun(type, file, mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ public class Weapon{
|
||||
public float shotDelay = 0;
|
||||
/** whether shooter rotation is ignored when shooting. */
|
||||
public boolean ignoreRotation = false;
|
||||
/** if turnCursor is false for a mech, how far away will the weapon target. */
|
||||
public float targetDistance = 1f;
|
||||
|
||||
public Sound shootSound = Sounds.pew;
|
||||
|
||||
|
||||
@@ -262,6 +262,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
protected boolean shooterValid(Tile tile, Tile other){
|
||||
|
||||
if(other == null) return true;
|
||||
if(!(other.block() instanceof MassDriver)) return false;
|
||||
MassDriverEntity entity = other.ent();
|
||||
@@ -274,7 +275,7 @@ public class MassDriver extends Block{
|
||||
if(entity == null || entity.link == -1) return false;
|
||||
Tile link = world.tile(entity.link);
|
||||
|
||||
return link != null && link.block() instanceof MassDriver && tile.dst(link) <= range;
|
||||
return link != null && link.block() instanceof MassDriver && link.getTeam() == tile.getTeam() && tile.dst(link) <= range;
|
||||
}
|
||||
|
||||
public static class DriverBulletData implements Poolable{
|
||||
|
||||
Reference in New Issue
Block a user