Skip to content

Commit

Permalink
No longer hardcode it to exclude ShMF_Boulder
Browse files Browse the repository at this point in the history
  • Loading branch information
Loobinex committed May 5, 2024
1 parent 3d49aec commit 0a58c78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/fxdata/trapdoor.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ActivationType = 0
EffectType = 0
; If the trap is visible before getting triggered.
Hidden = 0
; Can the trap be triggered by activating it. Shots only.
; Can the trap be triggered by activating it. Set to 1 to activate by slap, set to 2 to make it target nearest enemy in range on slap.
Slappable = 0
; Can the trap be destroyed by shooting it. If 1 it can by any attack, 0 only by units with 'Disarm ability', -1 by nobody.
Destructible = 0
Expand Down
14 changes: 11 additions & 3 deletions src/player_instances.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,20 @@ long pinstfe_hand_whip(struct PlayerInfo *player, long *n)
break;
case TCls_Trap:
trapst = &game.conf.trapdoor_conf.trap_cfgstats[thing->model];
if ((trapst->slappable == 1) && trap_is_active(thing))
if (trap_is_active(thing))
{
struct TrapStats* trapstat = &game.conf.trap_stats[thing->model];
struct Thing* trgtng = INVALID_THING;
shotst = get_shot_model_stats(trapstat->created_itm_model);
struct Thing* trgtng = ((shotst->model_flags & ShMF_Boulder) != 0) ? INVALID_THING : get_nearest_enemy_creature_in_sight_and_range_of_trap(thing);
external_activate_trap_shot_at_angle(thing, player->acamera->orient_a, trgtng);
if (trapst->slappable == 1)
{
external_activate_trap_shot_at_angle(thing, player->acamera->orient_a, trgtng);
} else
if (trapst->slappable == 2)
{
trgtng = get_nearest_enemy_creature_in_sight_and_range_of_trap(thing);
external_activate_trap_shot_at_angle(thing, player->acamera->orient_a, trgtng);
}
}
break;
case TCls_Object:
Expand Down

0 comments on commit 0a58c78

Please sign in to comment.