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

View File

@ -142,7 +142,7 @@ public class UI implements ApplicationListener, Loadable{
Core.scene.act();
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);
if(!(e instanceof TextField)){
Core.scene.setKeyboardFocus(null);

View File

@ -9,7 +9,6 @@ import arc.math.*;
import arc.math.geom.*;
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.util.*;
import mindustry.graphics.*;
@ -178,7 +177,7 @@ public class MapView extends Element implements GestureListener{
public void act(float 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 ay = Core.input.axis(Binding.move_y);
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 float width = 5f, height = 7f;
public float shrinkX = 0f, shrinkY = 0.5f;
public float spin = 0;
public float spin = 0, rotationOffset = 0f;
public String sprite;
public @Nullable String backSprite;
public TextureRegion backRegion;
public TextureRegion frontRegion;
@ -36,7 +37,7 @@ public class BasicBulletType extends BulletType{
@Override
public void load(){
backRegion = Core.atlas.find(sprite + "-back");
backRegion = Core.atlas.find(backSprite == null ? (sprite + "-back") : backSprite);
frontRegion = Core.atlas.find(sprite);
}
@ -45,14 +46,17 @@ public class BasicBulletType extends BulletType{
super.draw(b);
float height = this.height * ((1f - shrinkY) + shrinkY * 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());
Draw.mixcol(mix, mix.a);
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
if(backRegion.found()){
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, width, height, b.rotation() + offset);
}
Draw.color(frontColor);
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.geom.*;
import arc.scene.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.util.*;
import mindustry.*;
@ -277,10 +276,8 @@ public class DesktopInput extends InputHandler{
shouldShoot = !scene.hasMouse() && !locked;
if(!locked && state.rules.unitCommand && block == null){
//if(input.keyTap(Binding.commandMode)){
commandMode = input.keyDown(Binding.commandMode);
//}
if(!locked && state.rules.unitCommand && block == null && !scene.hasField()){
commandMode = input.keyDown(Binding.commandMode);
}else{
commandMode = false;
}
@ -317,7 +314,7 @@ public class DesktopInput extends InputHandler{
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.planet_map) && state.isCampaign()) ui.planet.toggle();
if(Core.input.keyTap(Binding.research) && state.isCampaign()) ui.research.toggle();
@ -450,7 +447,7 @@ public class DesktopInput extends InputHandler{
}
void pollInput(){
if(scene.getKeyboardFocus() instanceof TextField) return;
if(scene.hasField()) return;
Tile selected = tileAt(Core.input.mouseX(), Core.input.mouseY());
int cursorX = tileX(Core.input.mouseX());

View File

@ -179,7 +179,7 @@ public class HudFragment extends Fragment{
}
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", () -> {
ui.announce(Core.bundle.format("showui", Core.keybinds.get(Binding.toggle_menus).key.toString(), 11));
});