From f5cbdeeb42faa13f1ca0f9d72497807af7cf860b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 23 May 2023 13:46:48 +0800 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 3 +++ server/gameserver/room.h | 1 + server/gameserver/sandtable.cc | 3 +++ 3 files changed, 7 insertions(+) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index b8567d87..21489d52 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1278,6 +1278,9 @@ void Creature::Shot(glm::vec3& target_dir, bool& shot_ok, float fly_distance, in if (!GetCurrWeapon()->meta) { return; } + if (room->HasRoomSwitch(kRoomSwitchDisableShot)) { + return; + } if (HasBuffEffect(kBET_Jump) || HasBuffEffect(kBET_Fly)) { diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 6dfc2a08..d6432ac3 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -56,6 +56,7 @@ enum RoomSwitch_e kRoomSwitchDisableMove = 0, kRoomSwitchDisableUseSkill, kRoomSwitchDisableUseItem, + kRoomSwitchDisableShot, }; typedef void (*FrameCallCb)(void*); diff --git a/server/gameserver/sandtable.cc b/server/gameserver/sandtable.cc index aceb7b43..c3619cf0 100644 --- a/server/gameserver/sandtable.cc +++ b/server/gameserver/sandtable.cc @@ -9,6 +9,7 @@ SandTable::SandTable(Room* room): room_(room) { room->OpenRoomSwitch(kRoomSwitchDisableUseSkill); room->OpenRoomSwitch(kRoomSwitchDisableUseItem); + room->OpenRoomSwitch(kRoomSwitchDisableShot); int lock_time = std::max(0, (int)room->GetGasInactiveTime() - 10); room->xtimer.SetTimeoutEx (SERVER_FRAME_RATE * lock_time, @@ -28,6 +29,7 @@ void SandTable::OnGameStart() room_->OpenRoomSwitch(kRoomSwitchDisableMove); room_->OpenRoomSwitch(kRoomSwitchDisableUseSkill); room_->OpenRoomSwitch(kRoomSwitchDisableUseItem); + room_->OpenRoomSwitch(kRoomSwitchDisableShot); room_->xtimer.SetTimeoutEx (SERVER_FRAME_RATE * mt::Param::s().wait_cloud_time, [room = room_] (int event, const a8::Args* args) @@ -36,6 +38,7 @@ void SandTable::OnGameStart() room->CloseRoomSwitch(kRoomSwitchDisableMove); room->CloseRoomSwitch(kRoomSwitchDisableUseSkill); room->CloseRoomSwitch(kRoomSwitchDisableUseItem); + room->CloseRoomSwitch(kRoomSwitchDisableShot); } }, &room_->xtimer_attacher_);