Turret rotation ghost plan fix
This commit is contained in:
@@ -477,6 +477,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
for(var build : previousBuildings){
|
for(var build : previousBuildings){
|
||||||
Tile tile = world.tile(build.tileX(), build.tileY());
|
Tile tile = world.tile(build.tileX(), build.tileY());
|
||||||
if(tile != null && tile.build == null && Build.validPlace(build.block, state.rules.defaultTeam, build.tileX(), build.tileY(), build.rotation, false, false)){
|
if(tile != null && tile.build == null && Build.validPlace(build.block, state.rules.defaultTeam, build.tileX(), build.tileY(), build.rotation, false, false)){
|
||||||
|
build.addPlan(false, true);
|
||||||
tile.setBlock(build.block, state.rules.defaultTeam, build.rotation, () -> build);
|
tile.setBlock(build.block, state.rules.defaultTeam, build.rotation, () -> build);
|
||||||
build.changeTeam(Team.derelict);
|
build.changeTeam(Team.derelict);
|
||||||
build.dropped(); //TODO: call pickedUp too? this may screw up power networks in a major way as they refer to potentially deleted entities
|
build.dropped(); //TODO: call pickedUp too? this may screw up power networks in a major way as they refer to potentially deleted entities
|
||||||
|
|||||||
@@ -310,13 +310,13 @@ public class BlockRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(brokenFade > 0.001f){
|
if(brokenFade > 0.001f){
|
||||||
for(BlockPlan block : player.team().data().plans){
|
for(BlockPlan plan : player.team().data().plans){
|
||||||
Block b = block.block;
|
Block b = plan.block;
|
||||||
if(!camera.bounds(Tmp.r1).grow(tilesize * 2f).overlaps(Tmp.r2.setSize(b.size * tilesize).setCenter(block.x * tilesize + b.offset, block.y * tilesize + b.offset))) continue;
|
if(!camera.bounds(Tmp.r1).grow(tilesize * 2f).overlaps(Tmp.r2.setSize(b.size * tilesize).setCenter(plan.x * tilesize + b.offset, plan.y * tilesize + b.offset))) continue;
|
||||||
|
|
||||||
Draw.alpha(0.33f * brokenFade);
|
Draw.alpha(0.33f * brokenFade);
|
||||||
Draw.mixcol(Color.white, 0.2f + Mathf.absin(Time.globalTime, 6f, 0.2f));
|
Draw.mixcol(Color.white, 0.2f + Mathf.absin(Time.globalTime, 6f, 0.2f));
|
||||||
Draw.rect(b.fullIcon, block.x * tilesize + b.offset, block.y * tilesize + b.offset, b.rotate ? block.rotation * 90 : 0f);
|
Draw.rect(b.fullIcon, plan.x * tilesize + b.offset, plan.y * tilesize + b.offset, b.rotate ? plan.rotation * 90 + plan.block.visualRotationOffset : 0f);
|
||||||
}
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public boolean rotateDraw = true;
|
public boolean rotateDraw = true;
|
||||||
/** if rotate is true and this is false, the region won't rotate when drawing in the editor */
|
/** if rotate is true and this is false, the region won't rotate when drawing in the editor */
|
||||||
public boolean rotateDrawEditor = true;
|
public boolean rotateDrawEditor = true;
|
||||||
|
/** visual rotation offset used in broken plan rendering */
|
||||||
|
public float visualRotationOffset = 0f;
|
||||||
/** if rotate = false and this is true, rotation will be locked at 0 when placing (default); advanced use only */
|
/** if rotate = false and this is true, rotation will be locked at 0 when placing (default); advanced use only */
|
||||||
public boolean lockRotation = true;
|
public boolean lockRotation = true;
|
||||||
/** if true, schematic flips with this block are inverted. */
|
/** if true, schematic flips with this block are inverted. */
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ public class Turret extends ReloadTurret{
|
|||||||
quickRotate = false;
|
quickRotate = false;
|
||||||
drawArrow = false;
|
drawArrow = false;
|
||||||
rotateDrawEditor = false;
|
rotateDrawEditor = false;
|
||||||
|
visualRotationOffset = -90f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user