Fixed #2679
This commit is contained in:
@@ -85,6 +85,16 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(){
|
||||||
|
for(WeaponMount mount : mounts){
|
||||||
|
if(mount.bullet != null){
|
||||||
|
mount.bullet.time = mount.bullet.lifetime - 10f;
|
||||||
|
mount.bullet = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Update shooting and rotation for this unit. */
|
/** Update shooting and rotation for this unit. */
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
@@ -167,7 +177,10 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
sequenceNum = 0;
|
sequenceNum = 0;
|
||||||
if(weapon.shotDelay + weapon.firstShotDelay > 0.01f){
|
if(weapon.shotDelay + weapon.firstShotDelay > 0.01f){
|
||||||
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> {
|
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> {
|
||||||
Time.run(sequenceNum * weapon.shotDelay + weapon.firstShotDelay, () -> mount.bullet = bullet(weapon, x + this.x - baseX, y + this.y - baseY, f + Mathf.range(weapon.inaccuracy), lifeScl));
|
Time.run(sequenceNum * weapon.shotDelay + weapon.firstShotDelay, () -> {
|
||||||
|
if(!isAdded()) return;
|
||||||
|
mount.bullet = bullet(weapon, x + this.x - baseX, y + this.y - baseY, f + Mathf.range(weapon.inaccuracy), lifeScl);
|
||||||
|
});
|
||||||
sequenceNum++;
|
sequenceNum++;
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
@@ -178,6 +191,8 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
|
|
||||||
if(weapon.firstShotDelay > 0){
|
if(weapon.firstShotDelay > 0){
|
||||||
Time.run(weapon.firstShotDelay, () -> {
|
Time.run(weapon.firstShotDelay, () -> {
|
||||||
|
if(!isAdded()) return;
|
||||||
|
|
||||||
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
||||||
Effect.shake(weapon.shake, weapon.shake, x, y);
|
Effect.shake(weapon.shake, weapon.shake, x, y);
|
||||||
mount.heat = 1f;
|
mount.heat = 1f;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class ItemDisplay extends Table{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemDisplay(Item item, int amount, boolean showName){
|
public ItemDisplay(Item item, int amount, boolean showName){
|
||||||
add(new ItemImage(new ItemStack(item, amount))).size(8 * 4).padRight(amount > 99 ? 12 : 0);
|
add(new ItemImage(new ItemStack(item, amount)));
|
||||||
if(showName) add(item.localizedName).padLeft(4 + amount > 99 ? 4 : 0);
|
if(showName) add(item.localizedName).padLeft(4 + amount > 99 ? 4 : 0);
|
||||||
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|||||||
@@ -8,15 +8,17 @@ import mindustry.type.*;
|
|||||||
public class ItemImage extends Stack{
|
public class ItemImage extends Stack{
|
||||||
|
|
||||||
public ItemImage(TextureRegion region, int amount){
|
public ItemImage(TextureRegion region, int amount){
|
||||||
Table t = new Table().left().bottom();
|
|
||||||
t.add(amount + "").name("item-label");
|
|
||||||
t.pack();
|
|
||||||
|
|
||||||
add(new Table(o -> {
|
add(new Table(o -> {
|
||||||
o.left();
|
o.left();
|
||||||
o.add(new Image(region)).size(32f);
|
o.add(new Image(region)).size(32f);
|
||||||
}));
|
}));
|
||||||
add(t);
|
|
||||||
|
add(new Table(t -> {
|
||||||
|
t.left().bottom();
|
||||||
|
t.add(amount + "");
|
||||||
|
t.pack();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemImage(TextureRegion region){
|
public ItemImage(TextureRegion region){
|
||||||
@@ -27,12 +29,18 @@ public class ItemImage extends Stack{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemImage(ItemStack stack){
|
public ItemImage(ItemStack stack){
|
||||||
add(new Image(stack.item.icon(Cicon.medium)));
|
|
||||||
|
add(new Table(o -> {
|
||||||
|
o.left();
|
||||||
|
o.add(new Image(stack.item.icon(Cicon.medium))).size(32f);
|
||||||
|
}));
|
||||||
|
|
||||||
if(stack.amount != 0){
|
if(stack.amount != 0){
|
||||||
Table t = new Table().left().bottom();
|
add(new Table(t -> {
|
||||||
t.add(stack.amount + "").name("item-label").style(Styles.outlineLabel);
|
t.left().bottom();
|
||||||
add(t);
|
t.add(stack.amount + "").style(Styles.outlineLabel);
|
||||||
|
t.pack();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user