Scrapped reaper segments

This commit is contained in:
Anuken
2020-06-12 13:32:00 -04:00
parent ce9f515543
commit a76cb3cb1a
35 changed files with 5157 additions and 4487 deletions

View File

@@ -48,16 +48,16 @@ public class Bullets implements ContentList{
hitEffect = Fx.flakExplosion;
knockback = 0.8f;
lifetime = 50f;
bulletWidth = bulletHeight = 11f;
width = height = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
}};
artilleryPlasticFrag = new BasicBulletType(2.5f, 10, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 1f;
width = 10f;
height = 12f;
shrinkY = 1f;
lifetime = 15f;
backColor = Pal.plastaniumBack;
frontColor = Pal.plastaniumFront;
@@ -68,7 +68,7 @@ public class Bullets implements ContentList{
hitEffect = Fx.plasticExplosion;
knockback = 1f;
lifetime = 55f;
bulletWidth = bulletHeight = 13f;
width = height = 13f;
collidesTiles = false;
splashDamageRadius = 35f;
splashDamage = 45f;
@@ -82,7 +82,7 @@ public class Bullets implements ContentList{
hitEffect = Fx.flakExplosion;
knockback = 0.8f;
lifetime = 45f;
bulletWidth = bulletHeight = 11f;
width = height = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
@@ -96,7 +96,7 @@ public class Bullets implements ContentList{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 60f;
bulletWidth = bulletHeight = 13f;
width = height = 13f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 35f;
@@ -110,7 +110,7 @@ public class Bullets implements ContentList{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 70f;
bulletWidth = bulletHeight = 14f;
width = height = 14f;
collidesTiles = false;
ammoMultiplier = 4f;
splashDamageRadius = 45f;
@@ -123,9 +123,9 @@ public class Bullets implements ContentList{
}};
glassFrag = new BasicBulletType(3f, 5, "bullet"){{
bulletWidth = 5f;
bulletHeight = 12f;
bulletShrink = 1f;
width = 5f;
height = 12f;
shrinkY = 1f;
lifetime = 20f;
backColor = Pal.gray;
frontColor = Color.white;
@@ -136,8 +136,8 @@ public class Bullets implements ContentList{
lifetime = 60f;
ammoMultiplier = 4f;
shootEffect = Fx.shootSmall;
bulletWidth = 6f;
bulletHeight = 8f;
width = 6f;
height = 8f;
hitEffect = Fx.flakExplosion;
splashDamage = 27f;
splashDamageRadius = 15f;
@@ -148,8 +148,8 @@ public class Bullets implements ContentList{
ammoMultiplier = 5f;
shootEffect = Fx.shootSmall;
reloadMultiplier = 0.5f;
bulletWidth = 6f;
bulletHeight = 8f;
width = 6f;
height = 8f;
hitEffect = Fx.flakExplosion;
splashDamage = 22f;
splashDamageRadius = 24f;
@@ -160,8 +160,8 @@ public class Bullets implements ContentList{
ammoMultiplier = 5f;
shootEffect = Fx.shootSmall;
reloadMultiplier = 0.8f;
bulletWidth = 6f;
bulletHeight = 8f;
width = 6f;
height = 8f;
hitEffect = Fx.flakExplosion;
splashDamage = 20f;
splashDamageRadius = 20f;
@@ -199,9 +199,9 @@ public class Bullets implements ContentList{
}};
missileExplosive = new MissileBulletType(2.7f, 10, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 30f;
@@ -217,9 +217,9 @@ public class Bullets implements ContentList{
missileIncendiary = new MissileBulletType(2.9f, 12, "missile"){{
frontColor = Pal.lightishOrange;
backColor = Pal.lightOrange;
bulletWidth = 7f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 7f;
height = 8f;
shrinkY = 0f;
drag = -0.01f;
homingPower = 0.08f;
splashDamageRadius = 20f;
@@ -230,9 +230,9 @@ public class Bullets implements ContentList{
}};
missileSurge = new MissileBulletType(4.4f, 20, "bullet"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.01f;
splashDamageRadius = 28f;
splashDamage = 40f;
@@ -244,9 +244,9 @@ public class Bullets implements ContentList{
}};
missileJavelin = new MissileBulletType(5f, 10.5f, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.003f;
keepVelocity = false;
splashDamageRadius = 20f;
@@ -262,9 +262,9 @@ public class Bullets implements ContentList{
}};
missileSwarm = new MissileBulletType(2.7f, 12, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.003f;
homingRange = 60f;
keepVelocity = false;
@@ -281,8 +281,8 @@ public class Bullets implements ContentList{
}};
standardCopper = new BasicBulletType(2.5f, 9, "bullet"){{
bulletWidth = 7f;
bulletHeight = 9f;
width = 7f;
height = 9f;
lifetime = 60f;
shootEffect = Fx.shootSmall;
smokeEffect = Fx.shootSmallSmoke;
@@ -290,16 +290,16 @@ public class Bullets implements ContentList{
}};
standardDense = new BasicBulletType(3.5f, 18, "bullet"){{
bulletWidth = 9f;
bulletHeight = 12f;
width = 9f;
height = 12f;
reloadMultiplier = 0.6f;
ammoMultiplier = 4;
lifetime = 60f;
}};
standardThorium = new BasicBulletType(4f, 29, "bullet"){{
bulletWidth = 10f;
bulletHeight = 13f;
width = 10f;
height = 13f;
shootEffect = Fx.shootBig;
smokeEffect = Fx.shootBigSmoke;
ammoMultiplier = 4;
@@ -307,8 +307,8 @@ public class Bullets implements ContentList{
}};
standardHoming = new BasicBulletType(3f, 12, "bullet"){{
bulletWidth = 7f;
bulletHeight = 9f;
width = 7f;
height = 9f;
homingPower = 0.08f;
reloadMultiplier = 1.5f;
ammoMultiplier = 5;
@@ -316,8 +316,8 @@ public class Bullets implements ContentList{
}};
standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
width = 10f;
height = 12f;
frontColor = Pal.lightishOrange;
backColor = Pal.lightOrange;
status = StatusEffects.burning;
@@ -326,8 +326,8 @@ public class Bullets implements ContentList{
}};
standardGlaive = new BasicBulletType(4f, 7.5f, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
width = 10f;
height = 12f;
frontColor = Color.valueOf("feb380");
backColor = Color.valueOf("ea8878");
status = StatusEffects.burning;
@@ -335,28 +335,28 @@ public class Bullets implements ContentList{
}};
standardMechSmall = new BasicBulletType(4f, 9, "bullet"){{
bulletWidth = 11f;
bulletHeight = 14f;
width = 11f;
height = 14f;
lifetime = 40f;
inaccuracy = 5f;
despawnEffect = Fx.hitBulletSmall;
}};
standardDenseBig = new BasicBulletType(7f, 55, "bullet"){{
bulletWidth = 15f;
bulletHeight = 21f;
width = 15f;
height = 21f;
shootEffect = Fx.shootBig;
}};
standardThoriumBig = new BasicBulletType(8f, 80, "bullet"){{
bulletWidth = 16f;
bulletHeight = 23f;
width = 16f;
height = 23f;
shootEffect = Fx.shootBig;
}};
standardIncendiaryBig = new BasicBulletType(7f, 60, "bullet"){{
bulletWidth = 16f;
bulletHeight = 21f;
width = 16f;
height = 21f;
frontColor = Pal.lightishOrange;
backColor = Pal.lightOrange;
status = StatusEffects.burning;
@@ -510,16 +510,16 @@ public class Bullets implements ContentList{
driverBolt = new MassDriverBolt();
frag = new BasicBulletType(5f, 8, "bullet"){{
bulletWidth = 8f;
bulletHeight = 9f;
bulletShrink = 0.5f;
width = 8f;
height = 9f;
shrinkY = 0.5f;
lifetime = 50f;
drag = 0.04f;
}};
bombExplosive = new BombBulletType(18f, 25f, "shell"){{
bulletWidth = 10f;
bulletHeight = 14f;
width = 10f;
height = 14f;
hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
@@ -529,8 +529,8 @@ public class Bullets implements ContentList{
}};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){{
bulletWidth = 8f;
bulletHeight = 12f;
width = 8f;
height = 12f;
hitEffect = Fx.flakExplosion;
backColor = Pal.lightOrange;
frontColor = Pal.lightishOrange;
@@ -541,8 +541,8 @@ public class Bullets implements ContentList{
bombOil = new BombBulletType(2f, 3f, "shell"){
{
bulletWidth = 8f;
bulletHeight = 12f;
width = 8f;
height = 12f;
hitEffect = Fx.pulverize;
backColor = new Color(0x4f4f4fff);
frontColor = Color.gray;

View File

@@ -1,8 +1,11 @@
package mindustry.content;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
@@ -197,7 +200,7 @@ public class UnitTypes implements ContentList{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 110f;
bulletWidth = bulletHeight = 14f;
width = height = 14f;
collides = true;
collidesTiles = true;
splashDamageRadius = 20f;
@@ -371,9 +374,9 @@ public class UnitTypes implements ContentList{
shake = 1f;
bullet = new MissileBulletType(2.7f, 12, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.003f;
homingRange = 60f;
keepVelocity = false;
@@ -403,6 +406,7 @@ public class UnitTypes implements ContentList{
engineOffset = 38;
engineSize = 7.3f;
hitsize = 58f;
parts = 4;
weapons.add(new Weapon(){{
y = 1.5f;
@@ -412,7 +416,63 @@ public class UnitTypes implements ContentList{
bullet = Bullets.standardCopper;
shootSound = Sounds.shoot;
}});
}};
}
@Override
public void drawBody(Unitc unit){
applyColor(unit);
for(int i = 0; i < parts; i++){
Vec2 v = drift(i);
Draw.rect(partRegions[i], unit.x() + v.x, unit.y() + v.y, unit.rotation() - 90 + rot(unit, i));
}
Draw.reset();
}
@Override
public void drawCell(Unitc unit){
applyColor(unit);
Draw.color(cellColor(unit));
for(int i = 0; i < parts; i++){
Vec2 v = drift(i);
Draw.rect(partCellRegions[i], unit.x() + v.x, unit.y() + v.y, unit.rotation() - 90 + rot(unit, i));
}
Draw.reset();
}
@Override
public void drawEngine(Unitc unit){
float bend = rot(unit, parts - 1);
Vec2 v = drift(parts - 1);
float cx = Angles.trnsx(bend + unit.rotation() + 180, engineOffset) - Angles.trnsx(unit.rotation() + 180, engineOffset) + v.x,
cy = Angles.trnsy(bend + unit.rotation() + 180, engineOffset) - Angles.trnsy(unit.rotation() + 180, engineOffset) + v.y;
unit.trns(cx, cy);
super.drawEngine(unit);
unit.trns(-cx, -cy);
}
@Override
public void update(Unitc unit){
unit.animation(Mathf.slerpDelta(unit.animation(), unit.rotation(), 0.01f));
}
Vec2 drift(int i){
float l = 0.5f;
float s = 12f;
float off = i*19;
return Tmp.v1.set(Mathf.absin(Time.time()+off, s, l), Mathf.absin(Time.time() + 94+off, s, l)).limit(l);
}
float rot(Unitc unit, int i){
float offset = ((i + 0.5f) - parts/2f) / (parts/2f);
float mag = i == parts - 1 ? 8f : 13f;
return Mathf.clamp((unit.animation() - unit.rotation()) / 3f, -mag, mag) * offset;
}
};
vanguard = new UnitType("vanguard"){{
@@ -487,8 +547,8 @@ public class UnitTypes implements ContentList{
alternate = true;
bullet = new BasicBulletType(2.5f, 9){{
bulletWidth = 7f;
bulletHeight = 9f;
width = 7f;
height = 9f;
lifetime = 60f;
shootEffect = Fx.shootSmall;
smokeEffect = Fx.shootSmallSmoke;

View File

@@ -37,12 +37,12 @@ public class ArtilleryBulletType extends BasicBulletType{
float baseScale = 0.7f;
float scale = (baseScale + b.fslope() * (1f - baseScale));
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
float height = this.height * ((1f - shrinkY) + shrinkY * b.fout());
Draw.color(backColor);
Draw.rect(backRegion, b.x(), b.y(), bulletWidth * scale, height * scale, b.rotation() - 90);
Draw.rect(backRegion, b.x(), b.y(), width * scale, height * scale, b.rotation() - 90);
Draw.color(frontColor);
Draw.rect(frontRegion, b.x(), b.y(), bulletWidth * scale, height * scale, b.rotation() - 90);
Draw.rect(frontRegion, b.x(), b.y(), width * scale, height * scale, b.rotation() - 90);
Draw.color();
}
}

View File

@@ -10,16 +10,16 @@ import mindustry.graphics.Pal;
/** An extended BulletType for most ammo-based bullets shot from turrets and units. */
public class BasicBulletType extends BulletType{
public Color backColor = Pal.bulletYellowBack, frontColor = Pal.bulletYellow;
public float bulletWidth = 5f, bulletHeight = 7f;
public float bulletShrink = 0.5f;
public String bulletSprite;
public float width = 5f, height = 7f;
public float shrinkX = 0f, shrinkY = 0.5f;
public String sprite;
public TextureRegion backRegion;
public TextureRegion frontRegion;
public BasicBulletType(float speed, float damage, String bulletSprite){
super(speed, damage);
this.bulletSprite = bulletSprite;
this.sprite = bulletSprite;
}
@@ -34,18 +34,19 @@ public class BasicBulletType extends BulletType{
@Override
public void load(){
backRegion = Core.atlas.find(bulletSprite + "-back");
frontRegion = Core.atlas.find(bulletSprite);
backRegion = Core.atlas.find(sprite + "-back");
frontRegion = Core.atlas.find(sprite);
}
@Override
public void draw(Bulletc b){
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
float height = this.height * ((1f - shrinkY) + shrinkY * b.fout());
float width = this.width * ((1f - shrinkX) + shrinkX * b.fout());
Draw.color(backColor);
Draw.rect(backRegion, b.x(), b.y(), bulletWidth, height, b.rotation() - 90);
Draw.rect(backRegion, b.x(), b.y(), width, height, b.rotation() - 90);
Draw.color(frontColor);
Draw.rect(frontRegion, b.x(), b.y(), bulletWidth, height, b.rotation() - 90);
Draw.rect(frontRegion, b.x(), b.y(), width, height, b.rotation() - 90);
Draw.color();
}
}

View File

@@ -10,7 +10,7 @@ public class BombBulletType extends BasicBulletType{
splashDamage = damage;
collidesTiles = false;
collides = false;
bulletShrink = 0.7f;
shrinkY = 0.7f;
lifetime = 30f;
drag = 0.05f;
keepVelocity = false;

View File

@@ -13,8 +13,8 @@ public class FlakBulletType extends BasicBulletType{
splashDamage = 15f;
splashDamageRadius = 34f;
hitEffect = Fx.flakExplosionBig;
bulletWidth = 8f;
bulletHeight = 10f;
width = 8f;
height = 10f;
collidesGround = false;
}

View File

@@ -26,6 +26,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
private UnitController controller;
private UnitType type;
boolean spawnedByCore;
float animation;
public void moveAt(Vec2 vector){
moveAt(vector, type.accel);

View File

@@ -28,7 +28,6 @@ import static mindustry.Vars.*;
public class UnitType extends UnlockableContent{
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
public static final boolean debug = false;
private static final Vec2 legOffset = new Vec2();
public boolean flying;
@@ -62,6 +61,7 @@ public class UnitType extends UnlockableContent{
public float lightRadius = 60f, lightOpacity = 0.6f;
public Color lightColor = Pal.powerLight;
public boolean drawCell = true, drawItems = true;
public int parts = 0;
public ObjectSet<StatusEffect> immunities = new ObjectSet<>();
public Sound deathSound = Sounds.bang;
@@ -69,16 +69,13 @@ public class UnitType extends UnlockableContent{
public Seq<Weapon> weapons = new Seq<>();
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion,
occlusionRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion;
public TextureRegion[] partRegions;
public TextureRegion[] partCellRegions;
public UnitType(String name){
super(name);
if(EntityMapping.map(name) != null){
constructor = EntityMapping.map(name);
}else{
//TODO fix for mods
throw new RuntimeException("Unit has no type: " + name);
}
constructor = EntityMapping.map(name);
}
public UnitController createController(){
@@ -130,6 +127,14 @@ public class UnitType extends UnlockableContent{
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
occlusionRegion = Core.atlas.find("circle-shadow");
shadowRegion = icon(Cicon.full);
partRegions = new TextureRegion[parts];
partCellRegions = new TextureRegion[parts];
for(int i = 0; i < parts; i++){
partRegions[i] = Core.atlas.find(name + "-part" + i);
partCellRegions[i] = Core.atlas.find(name + "-cell" + i);
}
}
@Override
@@ -175,12 +180,10 @@ public class UnitType extends UnlockableContent{
drawOcclusion(unit);
Draw.z(z);
drawEngine(unit);
if(!debug){
drawBody(unit);
if(drawCell) drawCell(unit);
drawWeapons(unit);
}
if(engineSize > 0) drawEngine(unit);
drawBody(unit);
if(drawCell) drawCell(unit);
drawWeapons(unit);
if(drawItems) drawItems(unit);
drawLight(unit);
@@ -328,11 +331,15 @@ public class UnitType extends UnlockableContent{
public void drawCell(Unitc unit){
applyColor(unit);
Draw.color(Color.black, unit.team().color, unit.healthf() + Mathf.absin(Time.time(), Math.max(unit.healthf() * 5f, 1f), 1f - unit.healthf()));
Draw.color(cellColor(unit));
Draw.rect(cellRegion, unit, unit.rotation() - 90);
Draw.reset();
}
public Color cellColor(Unitc unit){
return Tmp.c1.set(Color.black).lerp(unit.team().color, unit.healthf() + Mathf.absin(Time.time(), Math.max(unit.healthf() * 5f, 1f), 1f - unit.healthf()));
}
public void drawLight(Unitc unit){
if(lightRadius > 0){
Drawf.light(unit, lightRadius, lightColor, lightOpacity);
@@ -367,38 +374,28 @@ public class UnitType extends UnlockableContent{
Tmp.v1.set(leg.base).sub(leg.joint).inv().setLength(legExtension);
if(debug){
Draw.color(Color.red);
Lines.line(position.x, position.y, leg.joint.x, leg.joint.y);
if(leg.moving && baseElevation > 0){
float scl = baseElevation;
float elev = Mathf.slope(1f - leg.stage) * scl;
Draw.color(shadowColor);
Draw.rect(footRegion, leg.base.x + shadowTX * elev, leg.base.y + shadowTY * elev, position.angleTo(leg.base));
Draw.color();
}
Draw.color(Color.green);
Lines.line(leg.joint.x, leg.joint.y, leg.base.x, leg.base.y);
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
Draw.reset();
}else{
if(leg.moving && baseElevation > 0){
float scl = baseElevation;
float elev = Mathf.slope(1f - leg.stage) * scl;
Draw.color(shadowColor);
Draw.rect(footRegion, leg.base.x + shadowTX * elev, leg.base.y + shadowTY * elev, position.angleTo(leg.base));
Draw.color();
}
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, CapStyle.none, 0);
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, CapStyle.none, 0);
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, CapStyle.none, 0);
if(jointRegion.found()){
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
}
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, CapStyle.none, 0);
if(jointRegion.found()){
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
}
if(baseJointRegion.found()){
Draw.rect(baseJointRegion, position.x, position.y, rotation);
}
if(baseJointRegion.found()){
Draw.rect(baseJointRegion, position.x, position.y, rotation);
}
}

View File

@@ -35,7 +35,7 @@ import java.util.*;
import static mindustry.Vars.*;
public class Block extends UnlockableContent{
public static final int crackRegions = 8, maxCrackSize = 5;
public static final int crackRegions = 8, maxCrackSize = 9;
public boolean hasItems;
public boolean hasLiquids;

View File

@@ -75,8 +75,8 @@ public class PayloadConveyor extends Block{
//differing sizes
(accept.block().size > size &&
(rotation() % 2 == 0 ? //check orientation
Math.abs(accept.y() - y) <= accept.block().size * tilesize - size * tilesize : //check Y alignment
Math.abs(accept.x() - x) <= accept.block().size * tilesize - size * tilesize //check X alignment
Math.abs(accept.y() - y) <= (accept.block().size * tilesize - size * tilesize)/2f : //check Y alignment
Math.abs(accept.x() - x) <= (accept.block().size * tilesize - size * tilesize)/2f //check X alignment
)))){
next = accept;
}else{

View File

@@ -71,7 +71,7 @@ public class BlockLoader extends PayloadAcceptor{
//draw input
for(int i = 0; i < 4; i++){
if(blends(this, i) && i != rotation()){
if(blends(i) && i != rotation()){
Draw.rect(inRegion, x, y, i * 90);
}
}

View File

@@ -30,11 +30,20 @@ public class PayloadAcceptor extends Block{
int size = tile.block().size;
Tilec accept = tile.nearby(Geometry.d4(direction).x * size, Geometry.d4(direction).y * size);
return accept != null &&
accept.block().size == size &&
accept.block().outputsPayload &&
//block must either be facing this one, or not be rotating
//if size is the same, block must either be facing this one, or not be rotating
((accept.block().size == size &&
((accept.tileX() + Geometry.d4(accept.rotation()).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation()).y * size == tile.tileY())
|| !accept.block().rotate || (accept.block().rotate && !accept.block().outputFacing));
|| !accept.block().rotate || (accept.block().rotate && !accept.block().outputFacing))) ||
//if the other block is smaller, check alignment
(accept.block().size < size &&
(accept.rotation() % 2 == 0 ? //check orientation; make sure it's aligned properly with this block.
Math.abs(accept.y() - tile.y()) <= (size * tilesize - accept.block().size * tilesize)/2f : //check Y alignment
Math.abs(accept.x() - tile.x()) <= (size * tilesize - accept.block().size * tilesize)/2f //check X alignment
)) && (!accept.block().rotate || accept.front() == tile || !accept.block().outputFacing) //make sure it's facing this block
);
}
public class PayloadAcceptorEntity<T extends Payload> extends TileEntity{
@@ -63,6 +72,10 @@ public class PayloadAcceptor extends Block{
return t;
}
public boolean blends(int direction){
return PayloadAcceptor.blends(this, direction);
}
public void updatePayload(){
if(payload != null){
payload.set(x + payVector.x, y + payVector.y, payRotation);

View File

@@ -13,7 +13,7 @@ import mindustry.ui.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.meta.*;
import static mindustry.Vars.state;
import static mindustry.Vars.*;
public class Reconstructor extends UnitBlock{
public float constructTime = 60 * 2;
@@ -63,7 +63,7 @@ public class Reconstructor extends UnitBlock{
//draw input
for(int i = 0; i < 4; i++){
if(blends(this, i) && i != rotation()){
if(blends(i) && i != rotation()){
Draw.rect(inRegion, x, y, i * 90);
}
}