Skip to content

Commit 8d1f41b

Browse files
Display for more things
1 parent 839765f commit 8d1f41b

4 files changed

Lines changed: 84 additions & 13 deletions

File tree

src/exogenesis/ExogenesisMod.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@
55
import arc.util.Log;
66
import exogenesis.entities.EntityRegister;
77
import exogenesis.graphics.ExoShaders;
8+
import exogenesis.type.DamageType;
89
import exogenesis.type.bullet.TypedBulletType;
10+
import exogenesis.type.bullet.vanilla.ExoContinuousFlameBulletType;
11+
import exogenesis.type.bullet.vanilla.ExoContinuousLaserBulletType;
12+
import exogenesis.type.bullet.vanilla.ExoFlakBulletType;
13+
import exogenesis.type.bullet.vanilla.ExoLaserBulletType;
914
import exogenesis.util.func.DrawFunc;
1015
import exogenesis.world.ExoTeams;
16+
import mindustry.content.Blocks;
17+
import mindustry.content.Liquids;
18+
import mindustry.content.UnitTypes;
1119
import mindustry.entities.Effect;
20+
import mindustry.entities.bullet.BasicBulletType;
1221
import mindustry.entities.bullet.BulletType;
1322
import mindustry.game.EventType;
1423
import exogenesis.util.util.Utils;
@@ -20,6 +29,11 @@
2029
import mindustry.gen.Unit;
2130
import mindustry.mod.Mod;
2231
import mindustry.mod.Mods;
32+
import mindustry.world.Block;
33+
import mindustry.world.blocks.defense.turrets.ContinuousLiquidTurret;
34+
import mindustry.world.blocks.defense.turrets.ContinuousTurret;
35+
import mindustry.world.blocks.defense.turrets.LaserTurret;
36+
import mindustry.world.blocks.defense.turrets.PowerTurret;
2337
//import exogenesis.gen.*;
2438

2539
import static arc.Core.app;
@@ -38,6 +52,7 @@ public ExogenesisMod(){
3852
});
3953

4054
if (DEBUG){
55+
//also one thing: splash damage not apply to typed damage properly, this is a todo
4156
Events.on(EventType.UnitDamageEvent.class, event -> {
4257
BulletType type = event.bullet.type();
4358
Unit unit = event.unit;
@@ -72,5 +87,33 @@ public void loadContent(){
7287
ExoPlanets.load();
7388
ExoSectorPresets.load();
7489
ExoVanstarTechTree.load();
90+
91+
//for debug use, test for display. can remove safely
92+
if (DEBUG){
93+
//test for PowerTurret display (lancer)
94+
BulletType laser = new ExoLaserBulletType();
95+
laser.damage = 500f;
96+
((TypedBulletType) laser).addDamageMultiplier(ExoDamageTypes.kinetic, 1.2f, ExoDamageTypes.energy, 0.8f, ExoDamageTypes.graviton, 0.5f);
97+
((PowerTurret)Blocks.lancer).shootType = laser;
98+
99+
//test for ContinuousLiquidTurret display (sublimate)\
100+
//actually there can be some display problem for display, todo later
101+
//BulletType flame = new ExoContinuousFlameBulletType();
102+
//flame.damage = 1000f / 12f;
103+
//((TypedBulletType) flame).addDamageMultiplier(ExoDamageTypes.kinetic, 2f, ExoDamageTypes.energy, 0.3f, ExoDamageTypes.thermal, 5f);
104+
//((ContinuousLiquidTurret)Blocks.sublimate).ammoTypes.put(Liquids.cyanogen, flame);
105+
106+
//test for ContinuousTurret display (meltdown)
107+
BulletType beam = new ExoContinuousLaserBulletType();
108+
beam.damage = 5000f / 12f;
109+
((TypedBulletType) beam).addDamageMultiplier(ExoDamageTypes.energy, 2f, ExoDamageTypes.cryogenic, 4f);
110+
((LaserTurret)Blocks.meltdown).shootType = beam;
111+
112+
//test for Unit Display (gamma)
113+
BulletType bullet = new ExoFlakBulletType();
114+
bullet.damage = 200;
115+
((TypedBulletType) bullet).addDamageMultiplier(ExoDamageTypes.explosive, 5f, ExoDamageTypes.pierce, 2.5f);
116+
UnitTypes.gamma.weapons.each(weapon -> weapon.bullet = bullet);
117+
}
75118
}
76119
}

src/exogenesis/content/ExoPostProcess.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import mindustry.entities.bullet.BulletType;
1010
import mindustry.gen.Icon;
1111
import mindustry.graphics.Pal;
12+
import mindustry.type.Liquid;
13+
import mindustry.type.UnitType;
1214
import mindustry.ui.Styles;
1315
import mindustry.world.Block;
14-
import mindustry.world.blocks.defense.turrets.ContinuousTurret;
15-
import mindustry.world.blocks.defense.turrets.ItemTurret;
16+
import mindustry.world.blocks.defense.turrets.*;
1617
import mindustry.world.meta.Stat;
1718
import mindustry.world.meta.StatCat;
1819
import mindustry.world.meta.StatValues;
@@ -51,14 +52,29 @@ public static void displayUnitResistanceStat(){
5152

5253
public static void displayBulletDamageTypeStat(){
5354
for (Block block: content.blocks()){
54-
if (block instanceof ItemTurret itemTurret){
55-
block.checkStats();
56-
var map = block.stats.toMap();
57-
if (map.get(StatCat.function) != null && map.get(StatCat.function).get(Stat.ammo) != null){
58-
block.stats.remove(Stat.ammo);
59-
block.stats.add(Stat.ammo, ExoStatValues.ammo(itemTurret.ammoTypes, 0, false));
60-
}
55+
if (block instanceof ItemTurret itemTurret) processAmmoStat(block, itemTurret.ammoTypes);
56+
if (block instanceof LiquidTurret liquidTurret) processAmmoStat(block, liquidTurret.ammoTypes);
57+
if (block instanceof PowerTurret powerTurret) processAmmoStat(block, ObjectMap.of(powerTurret, powerTurret.shootType));
58+
if (block instanceof ContinuousTurret continuousTurret) processAmmoStat(block, ObjectMap.of(continuousTurret, continuousTurret.shootType));
59+
if (block instanceof ContinuousLiquidTurret continuousLiquidTurret) processAmmoStat(block, continuousLiquidTurret.ammoTypes);
60+
}
61+
62+
for (UnitType unitType: content.units()){
63+
unitType.checkStats();
64+
var map = unitType.stats.toMap();
65+
if (map.get(StatCat.function) != null && map.get(StatCat.function).get(Stat.weapons) != null){
66+
unitType.stats.remove(Stat.weapons);
67+
unitType.stats.add(Stat.weapons, ExoStatValues.weapons(unitType, unitType.weapons));
6168
}
6269
}
6370
}
71+
72+
private static void processAmmoStat(Block block, ObjectMap<? extends UnlockableContent, BulletType> ammo){
73+
block.checkStats();
74+
var map = block.stats.toMap();
75+
if (map.get(StatCat.function) != null && map.get(StatCat.function).get(Stat.ammo) != null){
76+
block.stats.remove(Stat.ammo);
77+
block.stats.add(Stat.ammo, ExoStatValues.ammo(ammo, 0, false));
78+
}
79+
}
6480
}

src/exogenesis/type/bullet/TypedBulletType.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package exogenesis.type.bullet;
22

33
import arc.Core;
4+
import arc.math.Mathf;
45
import arc.scene.ui.layout.Table;
56
import arc.struct.ObjectFloatMap;
67
import arc.struct.OrderedMap;
@@ -35,10 +36,15 @@ default void buildStat(BulletType type, UnlockableContent t, Table bt, boolean c
3536
typedDamageMultipliers().each((damageType, multiplier) -> {
3637
bt.table(dt -> {
3738
//todo replace the image with emoji
38-
dt.left();
39-
dt.add("[accent]" + Strings.fixed(type.damage * multiplier, 0) + " []");
40-
dt.image(damageType.fullIcon).size(20, 20).padRight(4);
41-
dt.add(damageType.localizedName);
39+
if (type.continuousDamage() > 0){
40+
dt.add("[accent]" + Strings.fixed(Mathf.round(type.continuousDamage() * multiplier), 0) + " []");
41+
dt.image(damageType.fullIcon).size(20, 20).padRight(4);
42+
dt.add(damageType.localizedName + StatUnit.perSecond.localized());
43+
}else {
44+
dt.add("[accent]" + Strings.fixed(Mathf.round(type.damage * multiplier), 0) + " []");
45+
dt.image(damageType.fullIcon).size(20, 20).padRight(4);
46+
dt.add(damageType.localizedName);
47+
}
4248
});
4349
bt.row();
4450
});

src/exogenesis/type/bullet/vanilla/ExoContinuousFlameBulletType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
package exogenesis.type.bullet.vanilla;
22

3+
import arc.scene.ui.layout.Table;
34
import arc.struct.ObjectFloatMap;
45
import arc.struct.OrderedMap;
6+
import arc.util.Strings;
57
import exogenesis.type.DamageType;
68
import exogenesis.type.bullet.TypedBulletType;
9+
import mindustry.ctype.UnlockableContent;
10+
import mindustry.entities.bullet.BulletType;
711
import mindustry.entities.bullet.ContinuousFlameBulletType;
812
import mindustry.gen.Bullet;
913
import mindustry.gen.Hitboxc;
1014

15+
import static exogenesis.content.ExoStatValues.buildSharedBulletTypeStat;
16+
1117
public class ExoContinuousFlameBulletType extends ContinuousFlameBulletType implements TypedBulletType{
1218
public OrderedMap<DamageType, Float> damageMultiplier = new OrderedMap<>();
1319

0 commit comments

Comments
 (0)