mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Turret rotation ghost plan fix
This commit is contained in:
parent
840ac5f913
commit
e79fa75f8b
4 changed files with 8 additions and 4 deletions
|
|
@ -477,6 +477,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||
for(var build : previousBuildings){
|
||||
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)){
|
||||
build.addPlan(false, true);
|
||||
tile.setBlock(build.block, state.rules.defaultTeam, build.rotation, () -> build);
|
||||
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
|
||||
|
|
|
|||
|
|
@ -310,13 +310,13 @@ public class BlockRenderer{
|
|||
}
|
||||
|
||||
if(brokenFade > 0.001f){
|
||||
for(BlockPlan block : player.team().data().plans){
|
||||
Block b = block.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;
|
||||
for(BlockPlan plan : player.team().data().plans){
|
||||
Block b = plan.block;
|
||||
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.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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||
public boolean rotateDraw = true;
|
||||
/** if rotate is true and this is false, the region won't rotate when drawing in the editor */
|
||||
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 */
|
||||
public boolean lockRotation = true;
|
||||
/** if true, schematic flips with this block are inverted. */
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ public class Turret extends ReloadTurret{
|
|||
quickRotate = false;
|
||||
drawArrow = false;
|
||||
rotateDrawEditor = false;
|
||||
visualRotationOffset = -90f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue