mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Auto-target configuration
This commit is contained in:
parent
e7533232c0
commit
b43c542213
@ -347,6 +347,7 @@ text.category.liquids=Liquids
|
||||
text.category.items=Items
|
||||
text.category.crafting=Crafting
|
||||
text.category.shooting=Shooting
|
||||
setting.autotarget.name=Auto-Target
|
||||
setting.fpscap.name=Max FPS
|
||||
setting.fpscap.none=None
|
||||
setting.fpscap.text={0} FPS
|
||||
|
@ -38,6 +38,7 @@ public class Liquids implements ContentList{
|
||||
viscosity = 0.7f;
|
||||
flammability = 0.6f;
|
||||
explosiveness = 0.6f;
|
||||
heatCapacity = 0.7f;
|
||||
tier = 1;
|
||||
effect = StatusEffects.tarred;
|
||||
}
|
||||
|
@ -664,7 +664,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
if(target == null){
|
||||
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()){
|
||||
//rotate toward and shoot the target
|
||||
if(mech.turnCursor){
|
||||
|
@ -210,33 +210,32 @@ public class DesktopInput extends InputHandler{
|
||||
player.setMineTile(null);
|
||||
}
|
||||
|
||||
if(!ui.hasMouse()){
|
||||
if(Inputs.keyTap(section, "select")){
|
||||
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")){
|
||||
if(Inputs.keyTap(section, "select") && !ui.hasMouse()){
|
||||
if(isPlacing()){
|
||||
selectX = cursor.x;
|
||||
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(mode == placing){ //touch up while placing, place everything in selection
|
||||
|
@ -136,6 +136,9 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.screenshakePref();
|
||||
//game.checkPref("smoothcam", true);
|
||||
game.checkPref("effects", true);
|
||||
if(mobile){
|
||||
game.checkPref("autotarget", true);
|
||||
}
|
||||
//game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
|
||||
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Bundles.format("setting.seconds", i));
|
||||
game.pref(new Setting(){
|
||||
|
@ -43,7 +43,7 @@ public class Tile implements PosTrait, TargetTrait{
|
||||
private byte team;
|
||||
/** Tile elevation. -1 means slope.*/
|
||||
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;
|
||||
|
||||
public Tile(int x, int y){
|
||||
|
Loading…
Reference in New Issue
Block a user