Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: option for enable mount in protection zone #1599

Merged
merged 9 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
enableMountInPZ = false
dudantas marked this conversation as resolved.
Show resolved Hide resolved
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,
ENABLE_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[ENABLE_MOUNT_IN_PZ] = getGlobalBoolean(L, "enableMountInPZ", 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 @@ -1690,7 +1690,7 @@ void Player::onChangeZone(ZoneType_t zone) {
onAttackedCreatureDisappear(false);
}

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

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