Block regionRotated
This commit is contained in:
@@ -31,7 +31,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
|||||||
0.25f, 0.7f, 0.1f, 0.03f
|
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){
|
public ContinuousFlameBulletType(float damage){
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
|||||||
@@ -216,15 +216,11 @@ public class ClassMap{
|
|||||||
classes.put("MessageBuild", mindustry.world.blocks.logic.MessageBlock.MessageBuild.class);
|
classes.put("MessageBuild", mindustry.world.blocks.logic.MessageBlock.MessageBuild.class);
|
||||||
classes.put("SwitchBlock", mindustry.world.blocks.logic.SwitchBlock.class);
|
classes.put("SwitchBlock", mindustry.world.blocks.logic.SwitchBlock.class);
|
||||||
classes.put("SwitchBuild", mindustry.world.blocks.logic.SwitchBlock.SwitchBuild.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("BlockProducer", mindustry.world.blocks.payloads.BlockProducer.class);
|
||||||
classes.put("BlockProducerBuild", mindustry.world.blocks.payloads.BlockProducer.BlockProducerBuild.class);
|
classes.put("BlockProducerBuild", mindustry.world.blocks.payloads.BlockProducer.BlockProducerBuild.class);
|
||||||
classes.put("BuildPayload", mindustry.world.blocks.payloads.BuildPayload.class);
|
classes.put("BuildPayload", mindustry.world.blocks.payloads.BuildPayload.class);
|
||||||
classes.put("Constructor", mindustry.world.blocks.payloads.Constructor.class);
|
classes.put("Constructor", mindustry.world.blocks.payloads.Constructor.class);
|
||||||
classes.put("ConstructorBuild", mindustry.world.blocks.payloads.Constructor.ConstructorBuild.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("Payload", mindustry.world.blocks.payloads.Payload.class);
|
||||||
classes.put("PayloadBlock", mindustry.world.blocks.payloads.PayloadBlock.class);
|
classes.put("PayloadBlock", mindustry.world.blocks.payloads.PayloadBlock.class);
|
||||||
classes.put("PayloadBlockBuild", mindustry.world.blocks.payloads.PayloadBlock.PayloadBlockBuild.class);
|
classes.put("PayloadBlockBuild", mindustry.world.blocks.payloads.PayloadBlock.PayloadBlockBuild.class);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ public class Mods implements Loadable{
|
|||||||
mods.add(mod);
|
mods.add(mod);
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
if(e instanceof ClassNotFoundException && e.getMessage().contains("mindustry.plugin.Plugin")){
|
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{
|
}else{
|
||||||
Log.err("Failed to load mod file @. Skipping.", file);
|
Log.err("Failed to load mod file @. Skipping.", file);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
|
|||||||
@@ -289,6 +289,8 @@ public class Block extends UnlockableContent{
|
|||||||
protected TextureRegion[] generatedIcons;
|
protected TextureRegion[] generatedIcons;
|
||||||
protected TextureRegion[] editorVariantRegions;
|
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 TextureRegion region, editorIcon;
|
||||||
public @Load("@-shadow") TextureRegion customShadowRegion;
|
public @Load("@-shadow") TextureRegion customShadowRegion;
|
||||||
public @Load("@-team") TextureRegion teamRegion;
|
public @Load("@-team") TextureRegion teamRegion;
|
||||||
|
|||||||
@@ -224,14 +224,17 @@ public class ConstructBlock extends Block{
|
|||||||
|
|
||||||
Draw.draw(Layer.blockBuilding, () -> {
|
Draw.draw(Layer.blockBuilding, () -> {
|
||||||
Draw.color(Pal.accent, Pal.remove, constructColor);
|
Draw.color(Pal.accent, Pal.remove, constructColor);
|
||||||
|
boolean noOverrides = current.regionRotated1 == -1 && current.regionRotated2 == -1;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
for(TextureRegion region : current.getGeneratedIcons()){
|
for(TextureRegion region : current.getGeneratedIcons()){
|
||||||
Shaders.blockbuild.region = region;
|
Shaders.blockbuild.region = region;
|
||||||
Shaders.blockbuild.time = Time.time;
|
Shaders.blockbuild.time = Time.time;
|
||||||
Shaders.blockbuild.progress = progress;
|
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();
|
Draw.flush();
|
||||||
|
i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
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;
|
hasItems = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
rotate = true;
|
rotate = true;
|
||||||
|
regionRotated1 = 1;
|
||||||
|
|
||||||
consumes.add(new ConsumeItemDynamic((BlockProducerBuild e) -> e.recipe() != null ? e.recipe().requirements : ItemStack.empty));
|
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;
|
rotate = true;
|
||||||
outputsPayload = true;
|
outputsPayload = true;
|
||||||
group = BlockGroup.units;
|
group = BlockGroup.units;
|
||||||
|
regionRotated1 = 1;
|
||||||
|
|
||||||
//point2 is relative
|
//point2 is relative
|
||||||
config(Point2.class, (PayloadDriverBuild tile, Point2 point) -> tile.link = Point2.pack(point.x + tile.tileX(), point.y + tile.tileY()));
|
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;
|
clipSize = 120;
|
||||||
noUpdateDisabled = true;
|
noUpdateDisabled = true;
|
||||||
clearOnDoubleTap = true;
|
clearOnDoubleTap = true;
|
||||||
|
regionRotated1 = 1;
|
||||||
|
|
||||||
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
||||||
if(canProduce(block) && build.block != block){
|
if(canProduce(block) && build.block != block){
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class Reconstructor extends UnitBlock{
|
|||||||
|
|
||||||
public Reconstructor(String name){
|
public Reconstructor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
regionRotated1 = 1;
|
||||||
|
regionRotated2 = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class UnitFactory extends UnitBlock{
|
|||||||
clearOnDoubleTap = true;
|
clearOnDoubleTap = true;
|
||||||
outputsPayload = true;
|
outputsPayload = true;
|
||||||
rotate = true;
|
rotate = true;
|
||||||
|
regionRotated1 = 1;
|
||||||
|
|
||||||
config(Integer.class, (UnitFactoryBuild tile, Integer i) -> {
|
config(Integer.class, (UnitFactoryBuild tile, Integer i) -> {
|
||||||
if(tile.currentPlan == i) return;
|
if(tile.currentPlan == i) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user