[Doors] Remove door dev tools spam on client controlled doors (#2824)

* [Doors] Remove door dev tools spam on client controlled doors

* Update client_packet.cpp

* Update client_packet.cpp

* Update ruletypes.h
This commit is contained in:
Chris Miles
2023-02-06 17:23:40 -06:00
committed by GitHub
parent 0348cb6b8e
commit 0da6391be3
3 changed files with 33 additions and 9 deletions
+27 -8
View File
@@ -4385,27 +4385,46 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app)
return;
}
// set door selected
if (IsDevToolsEnabled()) {
float distance = DistanceNoZ(GetPosition(), currentdoor->GetPosition());
LogDoors(
"Door [{}] client handle, client distance from door [{:.2f}]",
currentdoor->GetDoorID(),
distance
);
bool within_distance = distance < RuleI(Range, MaxDistanceToClickDoors);
// distance gate this because some doors are client controlled and the client
// will spam door click even across the zone to force a door back into desired state
if (IsDevToolsEnabled() && within_distance) {
SetDoorToolEntityId(currentdoor->GetEntityID());
DoorManipulation::CommandHeader(this);
Message(
Chat::White,
fmt::format(
"Door ({}) [{}]",
currentdoor->GetEntityID(),
currentdoor->GetDoorID(),
Saylink::Silent("#door edit")
).c_str()
);
}
std::string export_string = fmt::format("{}", cd->doorid);
std::vector<std::any> args;
args.push_back(currentdoor);
if (parse->EventPlayer(EVENT_CLICK_DOOR, this, export_string, 0, &args) == 0)
{
// don't spam scripts with client controlled doors if not within distance
if (within_distance) {
std::string export_string = fmt::format("{}", cd->doorid);
std::vector<std::any> args;
args.push_back(currentdoor);
if (parse->EventPlayer(EVENT_CLICK_DOOR, this, export_string, 0, &args) == 0) {
currentdoor->HandleClick(this, 0);
}
}
else {
// we let this pass because client controlled doors require this to force the linked doors
// back into state
currentdoor->HandleClick(this, 0);
}
}
void Client::Handle_OP_ClickObject(const EQApplicationPacket *app)