Skip to content

Commit

Permalink
feat: config.lua option for enable/disable mount in protection zone (#…
Browse files Browse the repository at this point in the history
…1599)

Option in config to enable mounts in protection zone.

toggleMountInProtectionZone = true/false
  • Loading branch information
Luan Luciano authored Sep 23, 2023
1 parent e63dc63 commit fd76f92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ resetSessionsOnStartup = false
-- Misc.
-- NOTE: experienceDisplayRates: set to false to ignore exp rate or true to include exp rate
allowChangeOutfit = true
toggleMountInProtectionZone = false
freePremium = false
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
Expand Down
1 change: 1 addition & 0 deletions src/config/config_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ enum booleanConfig_t {
VIP_STAY_ONLINE,

REWARD_CHEST_COLLECT_ENABLED,
TOGGLE_MOUNT_IN_PZ,

LAST_BOOLEAN_CONFIG
};
Expand Down
2 changes: 2 additions & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ bool ConfigManager::load() {
boolean[REWARD_CHEST_COLLECT_ENABLED] = getGlobalBoolean(L, "rewardChestCollectEnabled", true);
integer[REWARD_CHEST_MAX_COLLECT_ITEMS] = getGlobalNumber(L, "rewardChestMaxCollectItems", 200);

boolean[TOGGLE_MOUNT_IN_PZ] = getGlobalBoolean(L, "toggleMountInProtectionZone", false);

loaded = true;
lua_close(L);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ void Player::onChangeZone(ZoneType_t zone) {
onAttackedCreatureDisappear(false);
}

if (!group->access && isMounted()) {
if (!g_configManager().getBoolean(TOGGLE_MOUNT_IN_PZ) && !group->access && isMounted()) {
dismount();
g_game().internalCreatureChangeOutfit(getPlayer(), defaultOutfit);
wasMounted = true;
Expand Down Expand Up @@ -5599,7 +5599,7 @@ bool Player::toggleMount(bool mount) {
}

auto tile = getTile();
if (!group->access && tile && tile->hasFlag(TILESTATE_PROTECTIONZONE)) {
if (!g_configManager().getBoolean(TOGGLE_MOUNT_IN_PZ) && !group->access && tile && tile->hasFlag(TILESTATE_PROTECTIONZONE)) {
sendCancelMessage(RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE);
return false;
}
Expand Down

0 comments on commit fd76f92

Please sign in to comment.