mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
[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:
parent
0348cb6b8e
commit
0da6391be3
@ -583,6 +583,7 @@ RULE_INT(Range, SongMessages, 75, "The packet range in which song messages are s
|
|||||||
RULE_INT(Range, ClientPositionUpdates, 300, "Distance in which the own changed position is communicated to other clients")
|
RULE_INT(Range, ClientPositionUpdates, 300, "Distance in which the own changed position is communicated to other clients")
|
||||||
RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit messages are sent")
|
RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit messages are sent")
|
||||||
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
|
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
|
||||||
|
RULE_INT(Range, MaxDistanceToClickDoors, 100, "Max distance that a client can click a door from (Client says 'You can't reach that' at roughly 25-50 for most doors)")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Bots)
|
RULE_CATEGORY(Bots)
|
||||||
|
|||||||
@ -4385,27 +4385,46 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set door selected
|
float distance = DistanceNoZ(GetPosition(), currentdoor->GetPosition());
|
||||||
if (IsDevToolsEnabled()) {
|
|
||||||
|
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());
|
SetDoorToolEntityId(currentdoor->GetEntityID());
|
||||||
DoorManipulation::CommandHeader(this);
|
DoorManipulation::CommandHeader(this);
|
||||||
Message(
|
Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Door ({}) [{}]",
|
"Door ({}) [{}]",
|
||||||
currentdoor->GetEntityID(),
|
currentdoor->GetDoorID(),
|
||||||
Saylink::Silent("#door edit")
|
Saylink::Silent("#door edit")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string export_string = fmt::format("{}", cd->doorid);
|
// don't spam scripts with client controlled doors if not within distance
|
||||||
std::vector<std::any> args;
|
if (within_distance) {
|
||||||
args.push_back(currentdoor);
|
std::string export_string = fmt::format("{}", cd->doorid);
|
||||||
if (parse->EventPlayer(EVENT_CLICK_DOOR, this, export_string, 0, &args) == 0)
|
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);
|
currentdoor->HandleClick(this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_ClickObject(const EQApplicationPacket *app)
|
void Client::Handle_OP_ClickObject(const EQApplicationPacket *app)
|
||||||
|
|||||||
@ -121,6 +121,7 @@ Doors::~Doors()
|
|||||||
bool Doors::Process()
|
bool Doors::Process()
|
||||||
{
|
{
|
||||||
if (m_close_timer.Enabled() && m_close_timer.Check() && IsDoorOpen()) {
|
if (m_close_timer.Enabled() && m_close_timer.Check() && IsDoorOpen()) {
|
||||||
|
LogDoorsDetail("door open and timer triggered door_id [{}] open_type [{}]", GetDoorID(), m_open_type);
|
||||||
if (m_open_type == 40 || GetTriggerType() == 1) {
|
if (m_open_type == 40 || GetTriggerType() == 1) {
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
@ -627,11 +628,13 @@ void Doors::ForceOpen(Mob *sender, bool alt_mode)
|
|||||||
if (!alt_mode) { // original function
|
if (!alt_mode) { // original function
|
||||||
if (!m_is_open) {
|
if (!m_is_open) {
|
||||||
if (!m_disable_timer) {
|
if (!m_disable_timer) {
|
||||||
|
LogDoorsDetail("door_id [{}] starting timer", md->doorid);
|
||||||
m_close_timer.Start();
|
m_close_timer.Start();
|
||||||
}
|
}
|
||||||
m_is_open = true;
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
LogDoorsDetail("door_id [{}] disable timer", md->doorid);
|
||||||
m_close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
if (!m_disable_timer) {
|
if (!m_disable_timer) {
|
||||||
m_is_open = false;
|
m_is_open = false;
|
||||||
@ -640,6 +643,7 @@ void Doors::ForceOpen(Mob *sender, bool alt_mode)
|
|||||||
}
|
}
|
||||||
else { // alternative function
|
else { // alternative function
|
||||||
if (!m_disable_timer) {
|
if (!m_disable_timer) {
|
||||||
|
LogDoorsDetail("door_id [{}] alt starting timer", md->doorid);
|
||||||
m_close_timer.Start();
|
m_close_timer.Start();
|
||||||
}
|
}
|
||||||
m_is_open = true;
|
m_is_open = true;
|
||||||
@ -840,7 +844,7 @@ void Doors::CreateDatabaseEntry()
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto e = DoorsRepository::NewEntity();
|
auto e = DoorsRepository::NewEntity();
|
||||||
|
|
||||||
e.id = GetDoorDBID();
|
e.id = GetDoorDBID();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user