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 6, 2024
1 parent 3d49aec commit 4797a6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 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
2 changes: 1 addition & 1 deletion src/magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ TbBool can_cast_power_on_thing(PlayerNumber plyr_idx, const struct Thing *thing,
if (thing->owner == plyr_idx) {
struct TrapConfigStats *trapst;
trapst = &game.conf.trapdoor_conf.trap_cfgstats[thing->model];
if ((trapst->slappable == 1) && trap_is_active(thing)) {
if ((trapst->slappable > 0) && trap_is_active(thing)) {
return true;
}
}
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
2 changes: 1 addition & 1 deletion src/thing_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TbBool trap_is_slappable(const struct Thing *thing, PlayerNumber plyr_idx)
if (thing->owner == plyr_idx)
{
trapst = &game.conf.trapdoor_conf.trap_cfgstats[thing->model];
return (trapst->slappable == 1) && trap_is_active(thing);
return (trapst->slappable > 0) && trap_is_active(thing);
}
return false;
}
Expand Down

0 comments on commit 4797a6f

Please sign in to comment.