mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
[Door Opening] Rule to let configure Animal Door Opening (#1231)
* Add rule configuration for letting animals open doors or not * Handle one more spot * Make adjustments and add mob property that serves as a check as to whether a mob entity can open doors or not * Push attribute to mob window
This commit is contained in:
+12
-9
@@ -3604,18 +3604,21 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 hate)
|
||||
|
||||
void EntityList::OpenDoorsNear(Mob *who)
|
||||
{
|
||||
if (!who->CanOpenDoors()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = door_list.begin();it != door_list.end(); ++it) {
|
||||
Doors *cdoor = it->second;
|
||||
if (!cdoor || cdoor->IsDoorOpen())
|
||||
for (auto &it : door_list) {
|
||||
Doors *door = it.second;
|
||||
if (!door || door->IsDoorOpen()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto diff = who->GetPosition() - cdoor->GetPosition();
|
||||
|
||||
float curdist = diff.x * diff.x + diff.y * diff.y;
|
||||
|
||||
if (diff.z * diff.z < 10 && curdist <= 100)
|
||||
cdoor->Open(who);
|
||||
auto diff = who->GetPosition() - door->GetPosition();
|
||||
float distance = diff.x * diff.x + diff.y * diff.y;
|
||||
if (diff.z * diff.z < 10 && distance <= 100) {
|
||||
door->Open(who);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user