Turn logic / Cross-sector production / Pad tweaks

This commit is contained in:
Anuken
2020-05-15 11:03:21 -04:00
parent 603cb4295a
commit b68e0a8562
16 changed files with 188 additions and 39 deletions

View File

@@ -72,7 +72,7 @@ public class LaunchPad extends Block{
Draw.reset();
}
float cooldown = Mathf.clamp(timer.getTime(timerLaunch) / 60f);
float cooldown = Mathf.clamp(timer.getTime(timerLaunch) / 90f);
Draw.mixcol(lightColor, 1f - cooldown);
@@ -109,48 +109,71 @@ public class LaunchPad extends Block{
@Import float x,y;
Array<ItemStack> stacks = new Array<>();
transient Interval in = new Interval();
@Override
public void draw(){
float alpha = fout(Interp.pow5Out);
float cx = x + fin(Interp.pow2In) * 15f, cy = y + fin(Interp.pow5In) * 130f;
float rotation = fin() * 120f;
float scale = (1f - alpha) * 1.3f + 1f;
float cx = cx(), cy = cy();
float rotation = fin() * (130f + Mathf.randomSeedRange(id(), 50f));
Draw.z(Layer.effect);
Draw.z(Layer.effect + 0.001f);
Draw.color(Pal.engine);
float rad = 0.2f + fslope();
Fill.light(cx, cy, 10, 25f * rad, Tmp.c2.set(Pal.engine), Tmp.c1.set(Pal.engine).a(0f));
Fill.light(cx, cy, 10, 25f * (rad + scale-1f), Tmp.c2.set(Pal.engine).a(alpha), Tmp.c1.set(Pal.engine).a(0f));
Draw.alpha(alpha);
for(int i = 0; i < 4; i++){
Drawf.tri(cx, cy, 6f, 40f * rad, i * 90f + rotation);
Drawf.tri(cx, cy, 6f, 40f * (rad + scale-1f), i * 90f + rotation);
}
Draw.color();
Draw.z(Layer.weather - 1);
Draw.alpha(alpha);
Draw.rect("launchpod", cx, cy, rotation);
TextureRegion region = Core.atlas.find("launchpod");
float rw = region.getWidth() * Draw.scl * scale, rh = region.getHeight() * Draw.scl * scale;
Tmp.v1.trns(225f, fin(Interp.linear) * 250f);
Draw.alpha(alpha);
Draw.rect(region, cx, cy, rw, rh, rotation);
Tmp.v1.trns(225f, fin(Interp.pow3In) * 250f);
Draw.z(Layer.flyingUnit + 1);
Draw.color(0, 0, 0, 0.22f * alpha);
Draw.rect("launchpod", cx + Tmp.v1.x, cy + Tmp.v1.y, rotation);
Draw.rect(region, cx + Tmp.v1.x, cy + Tmp.v1.y, rw, rh, rotation);
Draw.reset();
}
float cx(){
return x + fin(Interp.pow2In) * (12f + Mathf.randomSeedRange(id() + 3, 4f));
}
float cy(){
return y + fin(Interp.pow5In) * (100f + Mathf.randomSeedRange(id() + 2, 30f));
}
@Override
public void update(){
float r = 3f;
if(in.get(4f - fin()*2f)){
Fx.rocketSmoke.at(cx() + Mathf.range(r), cy() + Mathf.range(r), fin());
}
}
@Override
public void remove(){
//actually launch the items upon removal
if(team() == Vars.state.rules.defaultTeam){
for(ItemStack stack : stacks){
Vars.data.addItem(stack.item, stack.amount);
Events.fire(new LaunchItemEvent(stack));
Vars.state.stats.handleItemExport(stack);
}
}
}