Skip to content

Commit

Permalink
Stacked breakables could overflow the stack, whoops!
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Oct 8, 2020
1 parent cea3098 commit 10d9f77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Dungeoneer/src/com/interrupt/dungeoneer/entities/Breakable.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ public void tick(Level level, float delta) {
// move any entities standing on us
entityStandingOnUsCache.addAll(level.getEntitiesColliding(x, y, z + 0.06f, this));

for(Entity e : entityStandingOnUsCache) {
for(int i = 0; i < entityStandingOnUsCache.size; i++) {
Entity e = entityStandingOnUsCache.get(i);

if(e.isDynamic) {
e.physicsSleeping = false;

Expand All @@ -242,8 +244,10 @@ public void tick(Level level, float delta) {
e.ya += (y - yBefore) * 0.3f;

// Tick this entity now, so it can tick any entities on top of itself
e.tick(level, delta);
e.skipTick = true;
if(!e.skipTick) {
e.skipTick = true;
e.tick(level, delta);
}
}
}

Expand Down

0 comments on commit 10d9f77

Please sign in to comment.