Update target before launch
So it has the chance to make room before it receives the crater from the caller.
This commit is contained in:
@@ -73,6 +73,9 @@ public class CraterConveyor extends BaseConveyor{
|
|||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
CraterConveyorEntity entity = tile.ent();
|
CraterConveyorEntity entity = tile.ent();
|
||||||
|
|
||||||
|
if(entity.lastFrameUpdated == Core.graphics.getFrameId()) return;
|
||||||
|
entity.lastFrameUpdated = Core.graphics.getFrameId();
|
||||||
|
|
||||||
if(entity.crater == null){
|
if(entity.crater == null){
|
||||||
if(entity.items.total() > 0){
|
if(entity.items.total() > 0){
|
||||||
entity.crater = new Crater(tile);
|
entity.crater = new Crater(tile);
|
||||||
@@ -86,6 +89,7 @@ public class CraterConveyor extends BaseConveyor{
|
|||||||
|
|
||||||
if(shouldLaunch(tile)){
|
if(shouldLaunch(tile)){
|
||||||
Tile destination = tile.front();
|
Tile destination = tile.front();
|
||||||
|
destination.block().update(destination);
|
||||||
|
|
||||||
if(entity.crater.dst(tile) < 1.25f){
|
if(entity.crater.dst(tile) < 1.25f){
|
||||||
entity.crater.f = tile.rotation() * 90 - 90;
|
entity.crater.f = tile.rotation() * 90 - 90;
|
||||||
@@ -121,6 +125,7 @@ public class CraterConveyor extends BaseConveyor{
|
|||||||
|
|
||||||
public class CraterConveyorEntity extends BaseConveyorEntity{
|
public class CraterConveyorEntity extends BaseConveyorEntity{
|
||||||
Crater crater;
|
Crater crater;
|
||||||
|
float lastFrameUpdated = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class Crater implements Position{
|
protected class Crater implements Position{
|
||||||
|
|||||||
Reference in New Issue
Block a user