From 991d98b7189b2135e800850335b68ee5ae718c97 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sun, 18 Sep 2022 19:50:27 +0800 Subject: [PATCH] add a `display` field to weapons just like abilities (#7591) * weapo * that --- core/src/mindustry/type/Weapon.java | 4 +++- core/src/mindustry/type/weapons/BuildWeapon.java | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 0edd2387d0..6870046bd9 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -31,6 +31,8 @@ public class Weapon implements Cloneable{ public BulletType bullet = Bullets.placeholder; /** shell ejection effect */ public Effect ejectEffect = Fx.none; + /** whether weapon should appear in the stats of a unit with this weapon */ + public boolean display = true; /** whether to consume ammo when ammo is enabled in rules */ public boolean useAmmo = true; /** whether to create a flipped copy of this weapon upon initialization. default: true */ @@ -147,7 +149,7 @@ public class Weapon implements Cloneable{ } public boolean hasStats(UnitType u){ - return true; + return display; } public void addStats(UnitType u, Table t){ diff --git a/core/src/mindustry/type/weapons/BuildWeapon.java b/core/src/mindustry/type/weapons/BuildWeapon.java index 4ca1e55483..40bfa667e1 100644 --- a/core/src/mindustry/type/weapons/BuildWeapon.java +++ b/core/src/mindustry/type/weapons/BuildWeapon.java @@ -22,14 +22,10 @@ public class BuildWeapon extends Weapon{ rotate = true; noAttack = true; predictTarget = false; + display = false; bullet = new BulletType(); } - @Override - public boolean hasStats(UnitType u){ - return false; - } - @Override public void update(Unit unit, WeaponMount mount){ mount.shoot = false;