Misc turret progress

This commit is contained in:
Anuken
2022-02-11 15:24:34 -05:00
parent ba3e2f6f67
commit 7c507ce2f4
7 changed files with 34 additions and 24 deletions

View File

@@ -3319,23 +3319,31 @@ public class Blocks{
requirements(Category.turret, with(Items.carbide, 250, Items.surgeAlloy, 160, Items.silicon, 300, Items.beryllium, 400)); requirements(Category.turret, with(Items.carbide, 250, Items.surgeAlloy, 160, Items.silicon, 300, Items.beryllium, 400));
ammo(Items.scrap, new BasicBulletType(){{ ammo(Items.scrap, new BasicBulletType(){{
damage = 40; damage = 50;
speed = 8.5f; speed = 8.5f;
width = 11f; //width = 11f;
height = 16f; //height = 19f;
width = height = 17;
backSprite = "large-bomb-back";
sprite = "mine-bullet";
trailColor = Pal.bulletYellowBack; trailColor = Pal.bulletYellowBack;
velocityInaccuracy = 0.11f; velocityInaccuracy = 0.11f;
collidesGround = false; collidesGround = false;
collidesTiles = false; collidesTiles = false;
shootEffect = Fx.shootBig2; shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootBigSmoke2; smokeEffect = Fx.shootBigSmoke2;
frontColor = Color.white; frontColor = trailColor = Color.white;
backColor = Color.valueOf("869cbe"); backColor = Color.valueOf("869cbe");
trailInterval = 3;
lifetime = 34f; lifetime = 34f;
rotationOffset = 90f;
//spin = 360f;
//controversial //controversial
homingDelay = 10f; //homingDelay = 10f;
homingPower = 0.01f; //homingPower = 0.01f;
hitEffect = despawnEffect = Fx.hitBulletColor;
}}); }});
//TODO bullet. //TODO bullet.
@@ -3357,7 +3365,7 @@ public class Blocks{
widthSpread = true; widthSpread = true;
targetGround = false; targetGround = false;
spread = 4.6f; spread = 4.6f;
inaccuracy = 9f; inaccuracy = 8f;
restitution = 0.1f; restitution = 0.1f;
shootWarmupSpeed = 0.08f; shootWarmupSpeed = 0.08f;
@@ -3368,6 +3376,8 @@ public class Blocks{
scaledHealth = 340; scaledHealth = 340;
range = 270f; range = 270f;
size = 4; size = 4;
limitRange(4f);
}}; }};
//endregion //endregion

View File

@@ -589,7 +589,7 @@ public class Control implements ApplicationListener, Loadable{
} }
} }
if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !scene.hasKeyboard()){ if(!mobile && Core.input.keyTap(Binding.screenshot) && !scene.hasField() && !scene.hasKeyboard()){
renderer.takeMapScreenshot(); renderer.takeMapScreenshot();
} }

View File

@@ -142,7 +142,7 @@ public class UI implements ApplicationListener, Loadable{
Core.scene.act(); Core.scene.act();
Core.scene.draw(); Core.scene.draw();
if(Core.input.keyTap(KeyCode.mouseLeft) && Core.scene.getKeyboardFocus() instanceof TextField){ if(Core.input.keyTap(KeyCode.mouseLeft) && Core.scene.hasField()){
Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true); Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
if(!(e instanceof TextField)){ if(!(e instanceof TextField)){
Core.scene.setKeyboardFocus(null); Core.scene.setKeyboardFocus(null);

View File

@@ -9,7 +9,6 @@ import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.scene.*; import arc.scene.*;
import arc.scene.event.*; import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.util.*; import arc.util.*;
import mindustry.graphics.*; import mindustry.graphics.*;
@@ -178,7 +177,7 @@ public class MapView extends Element implements GestureListener{
public void act(float delta){ public void act(float delta){
super.act(delta); super.act(delta);
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && !Core.input.keyDown(KeyCode.controlLeft)){ if(Core.scene.getKeyboardFocus() == null || !Core.scene.hasField() && !Core.input.keyDown(KeyCode.controlLeft)){
float ax = Core.input.axis(Binding.move_x); float ax = Core.input.axis(Binding.move_x);
float ay = Core.input.axis(Binding.move_y); float ay = Core.input.axis(Binding.move_y);
offsetx -= ax * 15 * Time.delta / zoom; offsetx -= ax * 15 * Time.delta / zoom;

View File

@@ -14,8 +14,9 @@ public class BasicBulletType extends BulletType{
public Color mixColorFrom = new Color(1f, 1f, 1f, 0f), mixColorTo = new Color(1f, 1f, 1f, 0f); public Color mixColorFrom = new Color(1f, 1f, 1f, 0f), mixColorTo = new Color(1f, 1f, 1f, 0f);
public float width = 5f, height = 7f; public float width = 5f, height = 7f;
public float shrinkX = 0f, shrinkY = 0.5f; public float shrinkX = 0f, shrinkY = 0.5f;
public float spin = 0; public float spin = 0, rotationOffset = 0f;
public String sprite; public String sprite;
public @Nullable String backSprite;
public TextureRegion backRegion; public TextureRegion backRegion;
public TextureRegion frontRegion; public TextureRegion frontRegion;
@@ -36,7 +37,7 @@ public class BasicBulletType extends BulletType{
@Override @Override
public void load(){ public void load(){
backRegion = Core.atlas.find(sprite + "-back"); backRegion = Core.atlas.find(backSprite == null ? (sprite + "-back") : backSprite);
frontRegion = Core.atlas.find(sprite); frontRegion = Core.atlas.find(sprite);
} }
@@ -45,14 +46,17 @@ public class BasicBulletType extends BulletType{
super.draw(b); super.draw(b);
float height = this.height * ((1f - shrinkY) + shrinkY * b.fout()); float height = this.height * ((1f - shrinkY) + shrinkY * b.fout());
float width = this.width * ((1f - shrinkX) + shrinkX * b.fout()); float width = this.width * ((1f - shrinkX) + shrinkX * b.fout());
float offset = -90 + (spin != 0 ? Mathf.randomSeed(b.id, 360f) + b.time * spin : 0f); float offset = -90 + (spin != 0 ? Mathf.randomSeed(b.id, 360f) + b.time * spin : 0f) + rotationOffset;
Color mix = Tmp.c1.set(mixColorFrom).lerp(mixColorTo, b.fin()); Color mix = Tmp.c1.set(mixColorFrom).lerp(mixColorTo, b.fin());
Draw.mixcol(mix, mix.a); Draw.mixcol(mix, mix.a);
if(backRegion.found()){
Draw.color(backColor); Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset); Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
}
Draw.color(frontColor); Draw.color(frontColor);
Draw.rect(frontRegion, b.x, b.y, width, height, b.rotation() + offset); Draw.rect(frontRegion, b.x, b.y, width, height, b.rotation() + offset);

View File

@@ -9,7 +9,6 @@ import arc.input.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.scene.*; import arc.scene.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.util.*; import arc.util.*;
import mindustry.*; import mindustry.*;
@@ -277,10 +276,8 @@ public class DesktopInput extends InputHandler{
shouldShoot = !scene.hasMouse() && !locked; shouldShoot = !scene.hasMouse() && !locked;
if(!locked && state.rules.unitCommand && block == null){ if(!locked && state.rules.unitCommand && block == null && !scene.hasField()){
//if(input.keyTap(Binding.commandMode)){
commandMode = input.keyDown(Binding.commandMode); commandMode = input.keyDown(Binding.commandMode);
//}
}else{ }else{
commandMode = false; commandMode = false;
} }
@@ -317,7 +314,7 @@ public class DesktopInput extends InputHandler{
player.shooting = false; player.shooting = false;
} }
if(state.isGame() && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){ if(state.isGame() && !scene.hasDialog() && !scene.hasField()){
if(Core.input.keyTap(Binding.minimap)) ui.minimapfrag.toggle(); if(Core.input.keyTap(Binding.minimap)) ui.minimapfrag.toggle();
if(Core.input.keyTap(Binding.planet_map) && state.isCampaign()) ui.planet.toggle(); if(Core.input.keyTap(Binding.planet_map) && state.isCampaign()) ui.planet.toggle();
if(Core.input.keyTap(Binding.research) && state.isCampaign()) ui.research.toggle(); if(Core.input.keyTap(Binding.research) && state.isCampaign()) ui.research.toggle();
@@ -450,7 +447,7 @@ public class DesktopInput extends InputHandler{
} }
void pollInput(){ void pollInput(){
if(scene.getKeyboardFocus() instanceof TextField) return; if(scene.hasField()) return;
Tile selected = tileAt(Core.input.mouseX(), Core.input.mouseY()); Tile selected = tileAt(Core.input.mouseX(), Core.input.mouseY());
int cursorX = tileX(Core.input.mouseX()); int cursorX = tileX(Core.input.mouseX());

View File

@@ -179,7 +179,7 @@ public class HudFragment extends Fragment{
} }
cont.update(() -> { cont.update(() -> {
if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !Core.scene.hasField()){
Core.settings.getBoolOnce("ui-hidden", () -> { Core.settings.getBoolOnce("ui-hidden", () -> {
ui.announce(Core.bundle.format("showui", Core.keybinds.get(Binding.toggle_menus).key.toString(), 11)); ui.announce(Core.bundle.format("showui", Core.keybinds.get(Binding.toggle_menus).key.toString(), 11));
}); });