Skip to content

Commit

Permalink
Don't play animations if loaded in a given state
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Dec 10, 2023
1 parent f48115e commit d957790
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public float getPercent(EntityRollingStock stock) {
if (value >= 0.95) {
// FORWARD
if (!tickStart.containsKey(key)) {
tickStart.put(key, stock.getTickCount());
if (stock.getTickCount() < 2) {
tickStart.put(key, (int) -total_ticks_per_loop - stock.getTickCount() - 1);
} else {
tickStart.put(key, stock.getTickCount());
}
tickStop.remove(key);
}
if (def.mode == AnimationMode.PLAY_REVERSE) {
Expand All @@ -81,7 +85,11 @@ public float getPercent(EntityRollingStock stock) {
} else {
// REVERSE
if (!tickStop.containsKey(key)) {
tickStop.put(key, stock.getTickCount());
if (stock.getTickCount() < 2) {
tickStop.put(key, (int) -total_ticks_per_loop - stock.getTickCount() - 1);
} else {
tickStop.put(key, stock.getTickCount());
}
tickStart.remove(key);
}
if (def.mode == AnimationMode.PLAY_FORWARD) {
Expand Down

0 comments on commit d957790

Please sign in to comment.