Skip to content

Commit

Permalink
Merge pull request #29 from MEEPofFaith/Erekir
Browse files Browse the repository at this point in the history
Fix TC on Erekir (Mobile)
  • Loading branch information
sk7725 authored Jun 3, 2022
2 parents f5b161a + ce736a4 commit cd7733a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
let cols = [Pal.lancerLaser, Pal.accent, Color.valueOf("cc6eaf")];

function addTable(table){
table.table(Styles.black5, cons(t => {
t.background(Tex.buttonEdge3);
table.table(Tex.pane, t => {
let s = new Slider(-8, 8, 1, false);
s.setValue(0);
let l = t.label(() => {
Expand All @@ -16,24 +15,19 @@ function addTable(table){
}).growX().width(8.5 * 8).color(Pal.accent);
let b = t.button(new TextureRegionDrawable(Icon.refresh), 24, () => s.setValue(0)).padLeft(6).get();
b.getStyle().imageUpColor = Pal.accent;
t.add(s).padLeft(6);
t.add(s).padLeft(6).minWidth(200);
s.moved(v => {
let t = Math.pow(2, v);
Time.setDeltaProvider(() => Math.min(Core.graphics.getDeltaTime() * 60 * t, 3 * t));
l.color(Tmp.c1.lerp(cols, (s.getValue() + 8) / 16));
});
}));
table.fillParent = true;
});
table.visibility = () => {
if(!Vars.ui.hudfrag.shown) return false;
if(Vars.ui.minimapfrag.shown()) return false;
if(!Vars.ui.hudfrag.shown || Vars.ui.minimapfrag.shown()) return false;
if(!Vars.mobile) return true;
if(Vars.player.unit().isBuilding()) return false;
if(Vars.control.input.block != null) return false;
if(Vars.control.input.mode == PlaceMode.breaking) return false;
//todo port to v7
//if(Vars.control.input.selectRequests != null && !Vars.control.input.selectRequests.isEmpty() && Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()) return false;
return true;

let input = Vars.control.input;
return input.lastSchematic == null || input.selectPlans.isEmpty();
};
}

Expand All @@ -44,5 +38,6 @@ if(!Vars.headless){
tc.bottom().left();
addTable(tc);
Vars.ui.hudGroup.addChild(tc);
if(Vars.mobile) tc.moveBy(0, Scl.scl(46));
});
}

0 comments on commit cd7733a

Please sign in to comment.