Skip to content

Commit

Permalink
Traps are visibly disabled when they cannot shoot (#3257)
Browse files Browse the repository at this point in the history
- AttackAnimationID displays based on the duration of the shot/effect on activation_type 2 and 3. (Shot/effect on trap)
- Bundled traps now visible inactive while they cannot be triggered (but are not shooting)
- Comes with new trapdoors.zip in the alpha package
  • Loading branch information
Loobinex authored May 25, 2024
1 parent f874b35 commit 43a02b9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config/fxdata/trapdoor.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ Shots = 12
TimeBetweenShots = 2000
SellingValue = 250
AnimationID = 844
AttackAnimationID = 844
RechargeAnimationID = TRAP_RED_DIS
ModelSize = 256
AnimationSpeed = 256
TriggerType = 2
Expand Down Expand Up @@ -306,6 +308,8 @@ Shots = 5
TimeBetweenShots = 200
SellingValue = 350
AnimationID = 845
AttackAnimationID = 845
RechargeAnimationID = TRAP_BLUE_DIS
ModelSize = 256
AnimationSpeed = 256
TriggerType = 2
Expand Down Expand Up @@ -341,6 +345,8 @@ Shots = 6
TimeBetweenShots = 140
SellingValue = 500
AnimationID = 846
AttackAnimationID = 846
RechargeAnimationID = TRAP_PURPLE_DIS
ModelSize = 256
AnimationSpeed = 256
TriggerType = 2
Expand Down Expand Up @@ -376,6 +382,8 @@ Shots = 3
TimeBetweenShots = 84
SellingValue = 750
AnimationID = 844
AttackAnimationID = 844
RechargeAnimationID = TRAP_RED_DIS
ModelSize = 256
AnimationSpeed = 256
TriggerType = 2
Expand Down Expand Up @@ -411,6 +419,7 @@ Shots = 1
TimeBetweenShots = 0
SellingValue = 750
AnimationID = 845
RechargeAnimationID = TRAP_BLUE_DIS
ModelSize = 256
AnimationSpeed = 256
TriggerType = 2
Expand Down
14 changes: 13 additions & 1 deletion src/thing_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,19 @@ void process_trap_charge(struct Thing* traptng)
traptng->trap.rearm_turn = game.play_gameturn + mconf->shots_delay;
if (game.conf.trap_stats[traptng->model].attack_sprite_anim_idx != 0)
{
GameTurnDelta trigger_duration = get_lifespan_of_animation(trapstat->attack_sprite_anim_idx, trapstat->anim_speed);
GameTurnDelta trigger_duration;
if (trapstat->activation_type == 2) //Effect stays on trap, so the attack animation remains visible for as long as the effect is alive
{
trigger_duration = get_effect_model_stats(trapstat->created_itm_model)->start_health;
} else
if (trapstat->activation_type == 3) //Shot stays on trap, so the attack animation remains visible for as long as the trap is alive
{
trigger_duration = get_shot_model_stats(trapstat->created_itm_model)->health;
}
else
{
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;
Expand Down

0 comments on commit 43a02b9

Please sign in to comment.