Removed CoreLauncher
This commit is contained in:
@@ -82,7 +82,7 @@ public class Blocks implements ContentList{
|
||||
repairPoint, resupplyPoint,
|
||||
|
||||
//campaign
|
||||
launchPad, launchPadLarge, coreSilo, dataProcessor,
|
||||
launchPad, launchPadLarge, dataProcessor,
|
||||
|
||||
//misc experimental
|
||||
blockForge, blockLoader, blockUnloader;
|
||||
@@ -1836,16 +1836,6 @@ public class Blocks implements ContentList{
|
||||
consumes.power(6f);
|
||||
}};
|
||||
|
||||
//TODO remove later
|
||||
/*
|
||||
coreSilo = new CoreLauncher("core-silo"){{
|
||||
requirements(Category.effect, BuildVisibility.campaignOnly, ItemStack.with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
|
||||
size = 5;
|
||||
itemCapacity = 500;
|
||||
|
||||
consumes.items(ItemStack.with(Items.copper, 500));
|
||||
}};*/
|
||||
|
||||
dataProcessor = new ResearchBlock("data-processor"){{
|
||||
requirements(Category.effect, BuildVisibility.campaignOnly, ItemStack.with(Items.copper, 200, Items.lead, 100));
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import arc.math.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.audio.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
@@ -239,6 +240,15 @@ public class Control implements ApplicationListener, Loadable{
|
||||
});
|
||||
}
|
||||
|
||||
//TODO move
|
||||
public void handleLaunch(Tilec tile){
|
||||
LaunchCorec ent = LaunchCoreEntity.create();
|
||||
ent.set(tile);
|
||||
ent.block(Blocks.coreShard);
|
||||
ent.lifetime(Vars.launchDuration);
|
||||
ent.add();
|
||||
}
|
||||
|
||||
public void playSector(Sector sector){
|
||||
ui.loadAnd(() -> {
|
||||
ui.planet.hide();
|
||||
|
||||
76
core/src/mindustry/entities/comp/LaunchCoreComp.java
Normal file
76
core/src/mindustry/entities/comp/LaunchCoreComp.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
@EntityDef(value = LaunchCorec.class, serialize = false)
|
||||
@Component
|
||||
abstract class LaunchCoreComp implements Drawc, Timedc{
|
||||
@Import float x, y;
|
||||
|
||||
transient Interval in = new Interval();
|
||||
Block block;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float alpha = fout(Interp.pow5Out);
|
||||
float scale = (1f - alpha) * 1.4f + 1f;
|
||||
float cx = cx(), cy = cy();
|
||||
float rotation = fin() * (140f + Mathf.randomSeedRange(id(), 50f));
|
||||
|
||||
Draw.z(Layer.effect + 0.001f);
|
||||
|
||||
Draw.color(Pal.engine);
|
||||
|
||||
float rad = 0.2f + fslope();
|
||||
float rscl = (block.size - 1) * 0.85f;
|
||||
|
||||
Fill.light(cx, cy, 10, 25f * (rad + scale-1f) * rscl, 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 * rscl, 40f * (rad + scale-1f) * rscl, i * 90f + rotation);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
Draw.z(Layer.weather - 1);
|
||||
|
||||
TextureRegion region = block.icon(Cicon.full);
|
||||
float rw = region.getWidth() * Draw.scl * scale, rh = region.getHeight() * Draw.scl * scale;
|
||||
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, cx, cy, rw, rh, rotation - 45);
|
||||
|
||||
Tmp.v1.trns(225f, fin(Interp.pow3In) * 250f);
|
||||
|
||||
Draw.z(Layer.flyingUnit + 1);
|
||||
Draw.color(0, 0, 0, 0.22f * alpha);
|
||||
Draw.rect(region, cx + Tmp.v1.x, cy + Tmp.v1.y, rw, rh, rotation - 45);
|
||||
|
||||
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 = 4f;
|
||||
if(in.get(3f - fin()*2f)){
|
||||
Fx.rocketSmokeLarge.at(cx() + Mathf.range(r), cy() + Mathf.range(r), fin());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import mindustry.graphics.g3d.PlanetRenderer.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.Sector.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.campaign.CoreLauncher.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.graphics.g3d.PlanetRenderer.*;
|
||||
@@ -36,7 +35,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
private int launchRange;
|
||||
private float zoom = 1f, selectAlpha = 1f;
|
||||
private @Nullable Sector selected, hovered, launchSector;
|
||||
private CoreLauncherEntity launcher;
|
||||
private Tilec launcher;
|
||||
private Mode mode = look;
|
||||
|
||||
public PlanetDialog(){
|
||||
@@ -98,7 +97,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
return super.show();
|
||||
}
|
||||
|
||||
public void show(Sector sector, int range, CoreLauncherEntity launcher){
|
||||
public void show(Sector sector, int range, Tilec launcher){
|
||||
this.launcher = launcher;
|
||||
selected = null;
|
||||
hovered = null;
|
||||
@@ -343,7 +342,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(mode == launch){
|
||||
launcher.launch();
|
||||
control.handleLaunch(launcher);
|
||||
zoom = 0.5f;
|
||||
|
||||
ui.hudfrag.showLaunchDirect();
|
||||
|
||||
@@ -24,6 +24,7 @@ import mindustry.net.Packets.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.dialogs.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -56,6 +57,7 @@ public class HudFragment extends Fragment{
|
||||
showToast("Sector[accent] captured[]!");
|
||||
});
|
||||
|
||||
//TODO full implementation
|
||||
Events.on(ResetEvent.class, e -> {
|
||||
coreItems.resetUsed();
|
||||
});
|
||||
@@ -145,7 +147,7 @@ public class HudFragment extends Fragment{
|
||||
cont.row();
|
||||
}
|
||||
|
||||
//TODO BUTTONS FOR VIEWING EXPORTS/IMPORTS/RESEARCH
|
||||
//TODO BUTTONS FOR VIEWING EXPORTS/IMPORTS/RESEARCH/MAP/ETC
|
||||
/*
|
||||
cont.table(t -> {
|
||||
|
||||
@@ -324,7 +326,7 @@ public class HudFragment extends Fragment{
|
||||
p.touchable(Touchable.disabled);
|
||||
});
|
||||
|
||||
//DEBUG: rate table
|
||||
//TODO DEBUG: rate table
|
||||
parent.fill(t -> {
|
||||
t.bottom().left();
|
||||
t.table(Styles.black6, c -> {
|
||||
@@ -355,8 +357,16 @@ public class HudFragment extends Fragment{
|
||||
rebuild.run();
|
||||
}
|
||||
});
|
||||
});
|
||||
}).visible(() -> state.isCampaign() && content.items().contains(i -> state.secinfo.getExport(i) > 0));
|
||||
});
|
||||
|
||||
//TODO move, select loadout, consume resources
|
||||
parent.fill(t -> {
|
||||
t.bottom().visible(() -> state.isCampaign() && player.team().core() != null);
|
||||
|
||||
t.button("test launch", Icon.warning, () -> {
|
||||
ui.planet.show(state.getSector(), ((CoreBlock)player.team().core().block).launchRange, player.team().core());
|
||||
}).width(150f);
|
||||
});
|
||||
|
||||
blockfrag.build(parent);
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
package mindustry.world.blocks.campaign;
|
||||
|
||||
import arc.Graphics.*;
|
||||
import arc.Graphics.Cursor.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class CoreLauncher extends Block{
|
||||
public int range = 1;
|
||||
|
||||
public CoreLauncher(String name){
|
||||
super(name);
|
||||
|
||||
hasItems = true;
|
||||
configurable = true;
|
||||
update = true;
|
||||
//will be enabled when needed (if at all)
|
||||
//buildPlaceability = BuildPlaceability.sectorCaptured;
|
||||
}
|
||||
|
||||
public class CoreLauncherEntity extends TileEntity{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configTapped(){
|
||||
|
||||
if(state.isCampaign() && consValid()){
|
||||
Vars.ui.planet.show(state.rules.sector, range, this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor getCursor(){
|
||||
return consValid() ? SystemCursor.hand : SystemCursor.arrow;
|
||||
}
|
||||
|
||||
public void launch(){
|
||||
LaunchCorec ent = LaunchCoreEntity.create();
|
||||
ent.set(this);
|
||||
ent.block(Blocks.coreShard);
|
||||
ent.lifetime(Vars.launchDuration);
|
||||
ent.add();
|
||||
|
||||
cons.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@EntityDef(value = LaunchCorec.class, serialize = false)
|
||||
@Component
|
||||
static abstract class LaunchCoreComp implements Drawc, Timedc{
|
||||
@Import float x, y;
|
||||
|
||||
transient Interval in = new Interval();
|
||||
Block block;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float alpha = fout(Interp.pow5Out);
|
||||
float scale = (1f - alpha) * 1.4f + 1f;
|
||||
float cx = cx(), cy = cy();
|
||||
float rotation = fin() * (140f + Mathf.randomSeedRange(id(), 50f));
|
||||
|
||||
Draw.z(Layer.effect + 0.001f);
|
||||
|
||||
Draw.color(Pal.engine);
|
||||
|
||||
float rad = 0.2f + fslope();
|
||||
float rscl = (block.size - 1) * 0.85f;
|
||||
|
||||
Fill.light(cx, cy, 10, 25f * (rad + scale-1f) * rscl, 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 * rscl, 40f * (rad + scale-1f) * rscl, i * 90f + rotation);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
Draw.z(Layer.weather - 1);
|
||||
|
||||
TextureRegion region = block.icon(Cicon.full);
|
||||
float rw = region.getWidth() * Draw.scl * scale, rh = region.getHeight() * Draw.scl * scale;
|
||||
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, cx, cy, rw, rh, rotation - 45);
|
||||
|
||||
Tmp.v1.trns(225f, fin(Interp.pow3In) * 250f);
|
||||
|
||||
Draw.z(Layer.flyingUnit + 1);
|
||||
Draw.color(0, 0, 0, 0.22f * alpha);
|
||||
Draw.rect(region, cx + Tmp.v1.x, cy + Tmp.v1.y, rw, rh, rotation - 45);
|
||||
|
||||
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 = 4f;
|
||||
if(in.get(3f - fin()*2f)){
|
||||
Fx.rocketSmokeLarge.at(cx() + Mathf.range(r), cy() + Mathf.range(r), fin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
public final int timerResupply = timers++;
|
||||
|
||||
public int launchRange = 1;
|
||||
|
||||
public int ammoAmount = 5;
|
||||
public float resupplyRate = 10f;
|
||||
public float resupplyRange = 60f;
|
||||
|
||||
Reference in New Issue
Block a user