mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
hotfix
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
"displayName": "Unit Information",
|
"displayName": "Unit Information",
|
||||||
"author": "Sharlotte",
|
"author": "Sharlotte",
|
||||||
"description": "The mod displays more information in-game, such as unit/building, wave, core, tile, item/unit total info etc",
|
"description": "The mod displays more information in-game, such as unit/building, wave, core, tile, item/unit total info etc",
|
||||||
"version": "1.5.2",
|
"version": "1.5.3",
|
||||||
"main": "UnitInfo.core.Main",
|
"main": "UnitInfo.core.Main",
|
||||||
"minGameVersion": "134",
|
"minGameVersion": "135",
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
"java": true
|
"java": true
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ pArtifactFilename = UnitInfo.jar
|
|||||||
# Group of project (should line up with dirs in src/)
|
# Group of project (should line up with dirs in src/)
|
||||||
pGroup = sharlotte
|
pGroup = sharlotte
|
||||||
# Version of Mindustry to use (if not working, consult jitpack.io)
|
# Version of Mindustry to use (if not working, consult jitpack.io)
|
||||||
pMindustryVersion = v134.1
|
pMindustryVersion = v135
|
||||||
# Minimum API level for d8 (if you don't know what this is, leave it unless d8 yells at you)
|
# Minimum API level for d8 (if you don't know what this is, leave it unless d8 yells at you)
|
||||||
pMinApi = 26
|
pMinApi = 26
|
||||||
@@ -164,7 +164,7 @@ public class UnitDisplay extends Table {
|
|||||||
t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)));
|
t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
table(t -> t.stack(table1, new UnitInfoDisplay()).padRight(Scl.scl(modUiScale) * 8 * 8f));
|
table(t -> t.stack(new UnitInfoDisplay().marginBottom(80f), table1).padRight(Scl.scl(modUiScale) * 8 * 8f));
|
||||||
|
|
||||||
update(() -> {
|
update(() -> {
|
||||||
try {
|
try {
|
||||||
@@ -340,126 +340,53 @@ public class UnitDisplay extends Table {
|
|||||||
}
|
}
|
||||||
static class UnitInfoDisplay extends Table {
|
static class UnitInfoDisplay extends Table {
|
||||||
public UnitInfoDisplay() {
|
public UnitInfoDisplay() {
|
||||||
table(table1 -> {
|
top();
|
||||||
table1.left().top();
|
float[] count = new float[]{-1};
|
||||||
|
table().update(t -> {
|
||||||
table1.table().update(t -> {
|
if(getTarget() instanceof Payloadc payload){
|
||||||
t.clear();
|
if(count[0] != payload.payloadUsed()){
|
||||||
if(getTarget() instanceof Unit u && u.item() != null) {
|
|
||||||
if(state.rules.damageExplosions) {
|
|
||||||
float power = u.item().charge * Mathf.pow(u.stack().amount, 1.11f) * 160f;
|
|
||||||
int powerAmount = (int)Mathf.clamp(power / 700, 0, 8);
|
|
||||||
int powerLength = 5 + Mathf.clamp((int)(Mathf.pow(power, 0.98f) / 500), 1, 18);
|
|
||||||
float powerDamage = 3 + Mathf.pow(power, 0.35f);
|
|
||||||
|
|
||||||
if(powerAmount > 0) {
|
|
||||||
t.stack(
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.image(Icon.power.getRegion()).size(8 * 3f * Scl.scl(modUiScale));
|
|
||||||
}),
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.right().top();
|
|
||||||
Label label = new Label(()->powerAmount + "");
|
|
||||||
label.setFontScale(0.75f * Scl.scl(modUiScale));
|
|
||||||
tt.add(label).padBottom(4f).padLeft(4f);
|
|
||||||
tt.pack();
|
|
||||||
})
|
|
||||||
).pad(4).visible(() -> state.rules.damageExplosions&&powerAmount > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(u.item().flammability > 1) {
|
|
||||||
float flammability = u.item().flammability * u.stack().amount / 1.9f;
|
|
||||||
int fireAmount = (int)Mathf.clamp(flammability / 4, 0, 30);
|
|
||||||
t.stack(
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.image(StatusEffects.burning.uiIcon).size(8 * 3f * Scl.scl(modUiScale));
|
|
||||||
}),
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.right().top();
|
|
||||||
Label label = new Label(()->fireAmount+"");
|
|
||||||
label.setFontScale(0.75f * Scl.scl(modUiScale));
|
|
||||||
tt.add(label).padBottom(4f).padLeft(4f);
|
|
||||||
tt.pack();
|
|
||||||
})
|
|
||||||
).pad(4).visible(() -> state.rules.damageExplosions&&u.item().flammability > 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float explosiveness = 2f + u.item().explosiveness * u.stack().amount * 1.53f;
|
|
||||||
float explosivenessMax = 2f + u.item().explosiveness * u.stack().amount * 1.53f;
|
|
||||||
int exploAmount = explosiveness <= 2 ? 0 : Mathf.clamp((int)(explosiveness / 11), 1, 25);
|
|
||||||
int exploAmountMax = explosivenessMax <= 2 ? 0 : Mathf.clamp((int)(explosivenessMax / 11), 1, 25);
|
|
||||||
float exploRadiusMin = Mathf.clamp(u.bounds() / 2f + explosiveness, 0, 50f) * (1f / exploAmount);
|
|
||||||
float exploRadiusMax = Mathf.clamp(u.bounds() / 2f + explosiveness, 0, 50f);
|
|
||||||
float exploDamage = explosiveness / 2f;
|
|
||||||
|
|
||||||
if(exploAmount > 0){
|
|
||||||
t.stack(
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.image(Icon.modeAttack.getRegion()).size(8 * 3f * Scl.scl(modUiScale));
|
|
||||||
}),
|
|
||||||
new Table(tt -> {
|
|
||||||
tt.right().top();
|
|
||||||
Label label = new Label(()->""+ Strings.fixed(exploDamage * exploAmount, 1));
|
|
||||||
label.setFontScale(0.75f * Scl.scl(modUiScale));
|
|
||||||
label.setColor(Tmp.c1.set(Color.white).lerp(Pal.health, (exploAmount*1f)/exploAmountMax));
|
|
||||||
tt.add(label).padBottom(4f).padLeft(8f);
|
|
||||||
tt.pack();
|
|
||||||
})
|
|
||||||
).pad(4).visible(() -> exploAmount>0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).growX().visible(() -> getTarget() instanceof Unit);
|
|
||||||
table1.row();
|
|
||||||
|
|
||||||
float[] count = new float[]{-1};
|
|
||||||
table1.table().update(t -> {
|
|
||||||
if(getTarget() instanceof Payloadc payload){
|
|
||||||
if(count[0] != payload.payloadUsed()){
|
|
||||||
t.clear();
|
|
||||||
t.top().left();
|
|
||||||
|
|
||||||
float pad = 0;
|
|
||||||
float items = payload.payloads().size;
|
|
||||||
if(8 * 2 * items + pad * items > 275f){
|
|
||||||
pad = (275f - (8 * 2) * items) / items;
|
|
||||||
}
|
|
||||||
int i = 0;
|
|
||||||
for(Payload p : payload.payloads()){
|
|
||||||
t.image(p.icon()).size(8 * 2).padRight(pad);
|
|
||||||
if(++i % 12 == 0) t.row();
|
|
||||||
}
|
|
||||||
|
|
||||||
count[0] = payload.payloadUsed();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
count[0] = -1;
|
|
||||||
t.clear();
|
t.clear();
|
||||||
|
t.top().left();
|
||||||
|
|
||||||
|
float pad = 0;
|
||||||
|
float items = payload.payloads().size;
|
||||||
|
if(8 * 2 * items + pad * items > 275f){
|
||||||
|
pad = (275f - (8 * 2) * items) / items;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
for(Payload p : payload.payloads()){
|
||||||
|
t.image(p.icon()).size(8 * 2).padRight(pad);
|
||||||
|
if(++i % 12 == 0) t.row();
|
||||||
|
}
|
||||||
|
|
||||||
|
count[0] = payload.payloadUsed();
|
||||||
}
|
}
|
||||||
}).growX().visible(() -> getTarget() instanceof Payloadc p && p.payloadUsed() > 0).colspan(2);
|
}else{
|
||||||
table1.row();
|
count[0] = -1;
|
||||||
|
t.clear();
|
||||||
|
}
|
||||||
|
}).growX().visible(() -> getTarget() instanceof Payloadc p && p.payloadUsed() > 0).colspan(2).row();
|
||||||
|
|
||||||
Bits statuses = new Bits();
|
Bits statuses = new Bits();
|
||||||
table1.table().update(t -> {
|
table().update(t -> {
|
||||||
t.left();
|
t.left();
|
||||||
if(getTarget() instanceof Statusc st){
|
if(getTarget() instanceof Statusc st){
|
||||||
Bits applied = st.statusBits();
|
Bits applied = st.statusBits();
|
||||||
if(!statuses.equals(applied)){
|
if(!statuses.equals(applied)){
|
||||||
t.clear();
|
t.clear();
|
||||||
|
|
||||||
if(applied != null){
|
if(applied != null){
|
||||||
for(StatusEffect effect : content.statusEffects()){
|
for(StatusEffect effect : content.statusEffects()){
|
||||||
if(applied.get(effect.id) && !effect.isHidden()){
|
if(applied.get(effect.id) && !effect.isHidden()){
|
||||||
t.image(effect.uiIcon).size(iconSmall).get().addListener(new Tooltip(l -> l.label(() ->
|
t.image(effect.uiIcon).size(iconSmall).get()
|
||||||
effect.localizedName + " [lightgray]" + UI.formatTime(st.getDuration(effect))).style(Styles.outlineLabel)));
|
.addListener(new Tooltip(l -> l.label(() -> effect.localizedName + " [lightgray]" + UI.formatTime(st.getDuration(effect))).style(Styles.outlineLabel)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
statuses.set(applied);
|
|
||||||
}
|
}
|
||||||
|
statuses.set(applied);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).left();
|
}
|
||||||
}).get();
|
}).left();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,13 @@ package UnitInfo.ui;
|
|||||||
|
|
||||||
import UnitInfo.SVars;
|
import UnitInfo.SVars;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.NinePatch;
|
|
||||||
import arc.input.KeyCode;
|
import arc.input.KeyCode;
|
||||||
import arc.math.Mathf;
|
import arc.math.Mathf;
|
||||||
import arc.scene.Element;
|
import arc.scene.Element;
|
||||||
import arc.scene.event.HandCursorListener;
|
import arc.scene.event.HandCursorListener;
|
||||||
import arc.scene.style.NinePatchDrawable;
|
import arc.scene.style.NinePatchDrawable;
|
||||||
import arc.scene.style.ScaledNinePatchDrawable;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.style.TextureRegionDrawable;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.scene.ui.Image;
|
|
||||||
import arc.scene.ui.Label;
|
|
||||||
import arc.scene.ui.ScrollPane;
|
|
||||||
import arc.scene.ui.Tooltip;
|
|
||||||
import arc.scene.ui.layout.Scl;
|
|
||||||
import arc.scene.ui.layout.Table;
|
|
||||||
import arc.struct.ObjectIntMap;
|
import arc.struct.ObjectIntMap;
|
||||||
import arc.struct.Seq;
|
import arc.struct.Seq;
|
||||||
import arc.util.Scaling;
|
import arc.util.Scaling;
|
||||||
@@ -23,11 +16,9 @@ import arc.util.Time;
|
|||||||
import arc.util.Tmp;
|
import arc.util.Tmp;
|
||||||
import mindustry.content.StatusEffects;
|
import mindustry.content.StatusEffects;
|
||||||
import mindustry.game.SpawnGroup;
|
import mindustry.game.SpawnGroup;
|
||||||
import mindustry.gen.Icon;
|
import mindustry.gen.*;
|
||||||
import mindustry.gen.Tex;
|
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
import mindustry.ui.Fonts;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.Styles;
|
|
||||||
|
|
||||||
import static UnitInfo.SVars.modUiScale;
|
import static UnitInfo.SVars.modUiScale;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
|
|||||||
Reference in New Issue
Block a user