Auto-target configuration

This commit is contained in:
Anuken
2018-09-29 20:49:19 -04:00
parent e7533232c0
commit b43c542213
6 changed files with 30 additions and 24 deletions
+1
View File
@@ -347,6 +347,7 @@ text.category.liquids=Liquids
text.category.items=Items text.category.items=Items
text.category.crafting=Crafting text.category.crafting=Crafting
text.category.shooting=Shooting text.category.shooting=Shooting
setting.autotarget.name=Auto-Target
setting.fpscap.name=Max FPS setting.fpscap.name=Max FPS
setting.fpscap.none=None setting.fpscap.none=None
setting.fpscap.text={0} FPS setting.fpscap.text={0} FPS
@@ -38,6 +38,7 @@ public class Liquids implements ContentList{
viscosity = 0.7f; viscosity = 0.7f;
flammability = 0.6f; flammability = 0.6f;
explosiveness = 0.6f; explosiveness = 0.6f;
heatCapacity = 0.7f;
tier = 1; tier = 1;
effect = StatusEffects.tarred; effect = StatusEffects.tarred;
} }
@@ -664,7 +664,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
if(target == null){ if(target == null){
isShooting = false; isShooting = false;
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange()); if(Settings.getBool("autotarget")){
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
}
}else if(target.isValid()){ }else if(target.isValid()){
//rotate toward and shoot the target //rotate toward and shoot the target
if(mech.turnCursor){ if(mech.turnCursor){
@@ -210,33 +210,32 @@ public class DesktopInput extends InputHandler{
player.setMineTile(null); player.setMineTile(null);
} }
if(!ui.hasMouse()){ if(Inputs.keyTap(section, "select") && !ui.hasMouse()){
if(Inputs.keyTap(section, "select")){ if(isPlacing()){
if(isPlacing()){
selectX = cursor.x;
selectY = cursor.y;
mode = placing;
}else{
//only begin shooting if there's no cursor event
if (!tileTapped(cursor) && !tryTapPlayer(Graphics.mouseWorld().x, Graphics.mouseWorld().y) && player.getPlaceQueue().size == 0 && !droppingItem &&
!tryBeginMine(cursor) && player.getMineTile() == null) {
player.isShooting = true;
}
}
}else if(Inputs.keyTap(section, "deselect") && (recipe != null || mode != none || player.isBuilding())){
if(recipe == null){
player.clearBuilding();
}
recipe = null;
mode = none;
}else if(Inputs.keyTap(section, "break")){
selectX = cursor.x; selectX = cursor.x;
selectY = cursor.y; selectY = cursor.y;
mode = breaking; mode = placing;
}else{
//only begin shooting if there's no cursor event
if (!tileTapped(cursor) && !tryTapPlayer(Graphics.mouseWorld().x, Graphics.mouseWorld().y) && player.getPlaceQueue().size == 0 && !droppingItem &&
!tryBeginMine(cursor) && player.getMineTile() == null) {
player.isShooting = true;
}
} }
}else if(Inputs.keyTap(section, "deselect") && (recipe != null || mode != none || player.isBuilding())){
if(recipe == null){
player.clearBuilding();
}
recipe = null;
mode = none;
}else if(Inputs.keyTap(section, "break") && !ui.hasMouse()){
selectX = cursor.x;
selectY = cursor.y;
mode = breaking;
} }
if(Inputs.keyRelease(section, "break") || Inputs.keyRelease(section, "select")){ if(Inputs.keyRelease(section, "break") || Inputs.keyRelease(section, "select")){
if(mode == placing){ //touch up while placing, place everything in selection if(mode == placing){ //touch up while placing, place everything in selection
@@ -136,6 +136,9 @@ public class SettingsMenuDialog extends SettingsDialog{
game.screenshakePref(); game.screenshakePref();
//game.checkPref("smoothcam", true); //game.checkPref("smoothcam", true);
game.checkPref("effects", true); game.checkPref("effects", true);
if(mobile){
game.checkPref("autotarget", true);
}
//game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%"); //game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Bundles.format("setting.seconds", i)); game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Bundles.format("setting.seconds", i));
game.pref(new Setting(){ game.pref(new Setting(){
+1 -1
View File
@@ -43,7 +43,7 @@ public class Tile implements PosTrait, TargetTrait{
private byte team; private byte team;
/** Tile elevation. -1 means slope.*/ /** Tile elevation. -1 means slope.*/
private byte elevation; private byte elevation;
/** Visibility status: 3 states, but saved as a single bit. 0 = unexplored, 1 = visited, 2 = currently visible (saved as 1)*/ /** Fog visibility status: 3 states, but saved as a single bit. 0 = unexplored, 1 = visited, 2 = currently visible (saved as 1)*/
private byte visibility; private byte visibility;
public Tile(int x, int y){ public Tile(int x, int y){