Block regionRotated
This commit is contained in:
@@ -31,7 +31,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
0.25f, 0.7f, 0.1f, 0.03f
|
||||
};
|
||||
|
||||
public Color[] colors = {Color.valueOf("eb7abe").a(0.55f), Color.valueOf("e189f5").a(0.7f), Color.valueOf("907ef7").a(0.8f), Color.valueOf("91a4ff"), Color.white};
|
||||
public Color[] colors = {Color.valueOf("eb7abe").a(0.55f), Color.valueOf("e189f5").a(0.7f), Color.valueOf("907ef7").a(0.8f), Color.valueOf("91a4ff"), Color.white.cpy()};
|
||||
|
||||
public ContinuousFlameBulletType(float damage){
|
||||
this.damage = damage;
|
||||
|
||||
@@ -216,15 +216,11 @@ public class ClassMap{
|
||||
classes.put("MessageBuild", mindustry.world.blocks.logic.MessageBlock.MessageBuild.class);
|
||||
classes.put("SwitchBlock", mindustry.world.blocks.logic.SwitchBlock.class);
|
||||
classes.put("SwitchBuild", mindustry.world.blocks.logic.SwitchBlock.SwitchBuild.class);
|
||||
classes.put("BallisticSilo", mindustry.world.blocks.payloads.BallisticSilo.class);
|
||||
classes.put("BallisticSiloBuild", mindustry.world.blocks.payloads.BallisticSilo.BallisticSiloBuild.class);
|
||||
classes.put("BlockProducer", mindustry.world.blocks.payloads.BlockProducer.class);
|
||||
classes.put("BlockProducerBuild", mindustry.world.blocks.payloads.BlockProducer.BlockProducerBuild.class);
|
||||
classes.put("BuildPayload", mindustry.world.blocks.payloads.BuildPayload.class);
|
||||
classes.put("Constructor", mindustry.world.blocks.payloads.Constructor.class);
|
||||
classes.put("ConstructorBuild", mindustry.world.blocks.payloads.Constructor.ConstructorBuild.class);
|
||||
classes.put("NuclearWarhead", mindustry.world.blocks.payloads.NuclearWarhead.class);
|
||||
classes.put("NuclearWarheadBuild", mindustry.world.blocks.payloads.NuclearWarhead.NuclearWarheadBuild.class);
|
||||
classes.put("Payload", mindustry.world.blocks.payloads.Payload.class);
|
||||
classes.put("PayloadBlock", mindustry.world.blocks.payloads.PayloadBlock.class);
|
||||
classes.put("PayloadBlockBuild", mindustry.world.blocks.payloads.PayloadBlock.PayloadBlockBuild.class);
|
||||
|
||||
@@ -369,7 +369,7 @@ public class Mods implements Loadable{
|
||||
mods.add(mod);
|
||||
}catch(Throwable e){
|
||||
if(e instanceof ClassNotFoundException && e.getMessage().contains("mindustry.plugin.Plugin")){
|
||||
Log.info("Plugin @ is outdated and needs to be ported to 6.0! Update its main class to inherit from 'mindustry.mod.Plugin'. See https://mindustrygame.github.io/wiki/modding/6-migrationv6/");
|
||||
Log.info("Plugin '@' is outdated and needs to be ported to 6.0! Update its main class to inherit from 'mindustry.mod.Plugin'. See https://mindustrygame.github.io/wiki/modding/6-migrationv6/", file.name());
|
||||
}else{
|
||||
Log.err("Failed to load mod file @. Skipping.", file);
|
||||
Log.err(e);
|
||||
|
||||
@@ -289,6 +289,8 @@ public class Block extends UnlockableContent{
|
||||
protected TextureRegion[] generatedIcons;
|
||||
protected TextureRegion[] editorVariantRegions;
|
||||
|
||||
/** Regions indexes from icons() that are rotated. If either of these is not -1, other regions won't be rotated in ConstructBlocks. */
|
||||
public int regionRotated1 = -1, regionRotated2 = -1;
|
||||
public TextureRegion region, editorIcon;
|
||||
public @Load("@-shadow") TextureRegion customShadowRegion;
|
||||
public @Load("@-team") TextureRegion teamRegion;
|
||||
|
||||
@@ -224,14 +224,17 @@ public class ConstructBlock extends Block{
|
||||
|
||||
Draw.draw(Layer.blockBuilding, () -> {
|
||||
Draw.color(Pal.accent, Pal.remove, constructColor);
|
||||
boolean noOverrides = current.regionRotated1 == -1 && current.regionRotated2 == -1;
|
||||
int i = 0;
|
||||
|
||||
for(TextureRegion region : current.getGeneratedIcons()){
|
||||
Shaders.blockbuild.region = region;
|
||||
Shaders.blockbuild.time = Time.time;
|
||||
Shaders.blockbuild.progress = progress;
|
||||
|
||||
Draw.rect(region, x, y, current.rotate ? rotdeg() : 0);
|
||||
Draw.rect(region, x, y, current.rotate && (noOverrides || current.regionRotated2 == i || current.regionRotated1 == i) ? rotdeg() : 0);
|
||||
Draw.flush();
|
||||
i ++;
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package mindustry.world.blocks.payloads;
|
||||
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.blocks.payloads.NuclearWarhead.*;
|
||||
|
||||
public class BallisticSilo extends PayloadBlock{
|
||||
|
||||
public BallisticSilo(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
public class BallisticSiloBuild extends PayloadBlockBuild<BuildPayload>{
|
||||
@Override
|
||||
public boolean acceptPayload(Building source, Payload payload){
|
||||
return this.payload == null && payload instanceof BuildPayload b && b.build instanceof NuclearWarheadBuild;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
moveInPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
drawPayload();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public abstract class BlockProducer extends PayloadBlock{
|
||||
hasItems = true;
|
||||
hasPower = true;
|
||||
rotate = true;
|
||||
regionRotated1 = 1;
|
||||
|
||||
consumes.add(new ConsumeItemDynamic((BlockProducerBuild e) -> e.recipe() != null ? e.recipe().requirements : ItemStack.empty));
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package mindustry.world.blocks.payloads;
|
||||
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class NuclearWarhead extends Block{
|
||||
public float radius = 100f;
|
||||
|
||||
public NuclearWarhead(String name){
|
||||
super(name);
|
||||
solid = true;
|
||||
update = true;
|
||||
}
|
||||
|
||||
public class NuclearWarheadBuild extends Building{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
rotate = true;
|
||||
outputsPayload = true;
|
||||
group = BlockGroup.units;
|
||||
regionRotated1 = 1;
|
||||
|
||||
//point2 is relative
|
||||
config(Point2.class, (PayloadDriverBuild tile, Point2 point) -> tile.link = Point2.pack(point.x + tile.tileX(), point.y + tile.tileY()));
|
||||
|
||||
@@ -32,6 +32,7 @@ public class PayloadSource extends PayloadBlock{
|
||||
clipSize = 120;
|
||||
noUpdateDisabled = true;
|
||||
clearOnDoubleTap = true;
|
||||
regionRotated1 = 1;
|
||||
|
||||
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
||||
if(canProduce(block) && build.block != block){
|
||||
|
||||
@@ -29,6 +29,8 @@ public class Reconstructor extends UnitBlock{
|
||||
|
||||
public Reconstructor(String name){
|
||||
super(name);
|
||||
regionRotated1 = 1;
|
||||
regionRotated2 = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,6 +38,7 @@ public class UnitFactory extends UnitBlock{
|
||||
clearOnDoubleTap = true;
|
||||
outputsPayload = true;
|
||||
rotate = true;
|
||||
regionRotated1 = 1;
|
||||
|
||||
config(Integer.class, (UnitFactoryBuild tile, Integer i) -> {
|
||||
if(tile.currentPlan == i) return;
|
||||
|
||||
Reference in New Issue
Block a user