Skip to content

Commit

Permalink
Reset trap animation when switching to a new animation (#3241)
Browse files Browse the repository at this point in the history
Fixes a bug where traps with custom attack animations end their attack with the beginning of the animation.
  • Loading branch information
Loobinex committed May 18, 2024
1 parent b87d1f5 commit c8e59da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/thing_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,8 @@ void process_trap_charge(struct Thing* traptng)
{
GameTurnDelta trigger_duration = get_lifespan_of_animation(trapstat->attack_sprite_anim_idx, trapstat->anim_speed);
traptng->trap.shooting_finished_turn = (game.play_gameturn + trigger_duration);
traptng->current_frame = 0;
traptng->anim_time = 0;
}
if ((trapstat->recharge_sprite_anim_idx != 0) || (trapstat->attack_sprite_anim_idx != 0))
{
Expand Down Expand Up @@ -794,7 +796,7 @@ TngUpdateRet update_trap(struct Thing *traptng)
return TUFRet_Deleted;
}
struct TrapStats* trapstat = &game.conf.trap_stats[traptng->model];
if (traptng->trap.wait_for_rearm == true) // Trap rearming, so either 'shooting' anim or 'recharch' anim.
if (traptng->trap.wait_for_rearm == true) // Trap rearming, so either 'shooting' anim or 'recharge' anim.
{
if ((traptng->trap.rearm_turn <= game.play_gameturn)) // Recharge complete, rearm.
{
Expand Down

0 comments on commit c8e59da

Please sign in to comment.