Core/AreaTriggers: Implemented new areatrigger type: bounded plane
Port From (https://github.com/TrinityCore/TrinityCore/commit/6856b248836205f3567d27848541859b93d93469)
This commit is contained in:
@@ -41,6 +41,7 @@ namespace Framework.Constants
|
|||||||
Polygon = 3,
|
Polygon = 3,
|
||||||
Cylinder = 4,
|
Cylinder = 4,
|
||||||
Disk = 5,
|
Disk = 5,
|
||||||
|
BoundedPlane = 6,
|
||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ namespace Framework.Database
|
|||||||
fileName = @"/sql/base/characters_database.sql";
|
fileName = @"/sql/base/characters_database.sql";
|
||||||
break;
|
break;
|
||||||
case "WorldDatabase":
|
case "WorldDatabase":
|
||||||
fileName = @"/sql/TDB_full_world_927.22082_2022_08_21.sql";
|
fileName = @"/sql/TDB_full_world_927.22111_2022_11_20.sql";
|
||||||
break;
|
break;
|
||||||
case "HotfixDatabase":
|
case "HotfixDatabase":
|
||||||
fileName = @"/sql/TDB_full_hotfixes_927.22082_2022_08_21.sql";
|
fileName = @"/sql/TDB_full_hotfixes_927.22111_2022_11_20.sql";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -376,6 +376,9 @@ namespace Game.Entities
|
|||||||
case AreaTriggerTypes.Disk:
|
case AreaTriggerTypes.Disk:
|
||||||
SearchUnitInDisk(targetList);
|
SearchUnitInDisk(targetList);
|
||||||
break;
|
break;
|
||||||
|
case AreaTriggerTypes.BoundedPlane:
|
||||||
|
SearchUnitInBoundedPlane(targetList);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -470,6 +473,25 @@ namespace Game.Entities
|
|||||||
targetList.RemoveAll(unit => unit.IsInDist2d(this, innerRadius) || unit.GetPositionZ() < minZ || unit.GetPositionZ() > maxZ);
|
targetList.RemoveAll(unit => unit.IsInDist2d(this, innerRadius) || unit.GetPositionZ() < minZ || unit.GetPositionZ() > maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchUnitInBoundedPlane(List<Unit> targetList)
|
||||||
|
{
|
||||||
|
SearchUnits(targetList, GetMaxSearchRadius(), false);
|
||||||
|
|
||||||
|
Position boxCenter = GetPosition();
|
||||||
|
float extentsX, extentsY;
|
||||||
|
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
extentsX = _shape.BoxDatas.Extents[0];
|
||||||
|
extentsY = _shape.BoxDatas.Extents[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
targetList.RemoveAll(unit =>
|
||||||
|
{
|
||||||
|
return !unit.IsWithinBox(boxCenter, extentsX, extentsY, MapConst.MapSize);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void HandleUnitEnterExit(List<Unit> newTargetList)
|
void HandleUnitEnterExit(List<Unit> newTargetList)
|
||||||
{
|
{
|
||||||
List<ObjectGuid> exitUnits = _insideUnits;
|
List<ObjectGuid> exitUnits = _insideUnits;
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ namespace Game.Entities
|
|||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public diskDatas DiskDatas;
|
public diskDatas DiskDatas;
|
||||||
|
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public boundedPlaneDatas BoundedPlaneDatas;
|
||||||
|
|
||||||
public struct defaultdatas
|
public struct defaultdatas
|
||||||
{
|
{
|
||||||
public fixed float Data[SharedConst.MaxAreatriggerEntityData];
|
public fixed float Data[SharedConst.MaxAreatriggerEntityData];
|
||||||
@@ -95,6 +98,12 @@ namespace Game.Entities
|
|||||||
public float LocationZOffset;
|
public float LocationZOffset;
|
||||||
public float LocationZOffsetTarget;
|
public float LocationZOffsetTarget;
|
||||||
}
|
}
|
||||||
|
// AREATRIGGER_TYPE_BOUNDED_PLANE
|
||||||
|
public struct boundedPlaneDatas
|
||||||
|
{
|
||||||
|
public fixed float Extents[2];
|
||||||
|
public fixed float ExtentsTarget[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -218,6 +227,8 @@ namespace Game.Entities
|
|||||||
return Math.Max(CylinderDatas.Radius, CylinderDatas.RadiusTarget);
|
return Math.Max(CylinderDatas.Radius, CylinderDatas.RadiusTarget);
|
||||||
case AreaTriggerTypes.Disk:
|
case AreaTriggerTypes.Disk:
|
||||||
return Math.Max(DiskDatas.OuterRadius, DiskDatas.OuterRadiusTarget);
|
return Math.Max(DiskDatas.OuterRadius, DiskDatas.OuterRadiusTarget);
|
||||||
|
case AreaTriggerTypes.BoundedPlane:
|
||||||
|
return MathF.Sqrt(BoundedPlaneDatas.Extents[0] * BoundedPlaneDatas.Extents[0] / 4 + BoundedPlaneDatas.Extents[1] * BoundedPlaneDatas.Extents[1] / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@@ -228,6 +239,7 @@ namespace Game.Entities
|
|||||||
public bool IsPolygon() { return TriggerType == AreaTriggerTypes.Polygon; }
|
public bool IsPolygon() { return TriggerType == AreaTriggerTypes.Polygon; }
|
||||||
public bool IsCylinder() { return TriggerType == AreaTriggerTypes.Cylinder; }
|
public bool IsCylinder() { return TriggerType == AreaTriggerTypes.Cylinder; }
|
||||||
public bool IsDisk() { return TriggerType == AreaTriggerTypes.Disk; }
|
public bool IsDisk() { return TriggerType == AreaTriggerTypes.Disk; }
|
||||||
|
public bool IsBoudedPlane() { return TriggerType == AreaTriggerTypes.BoundedPlane; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AreaTriggerOrbitInfo
|
public class AreaTriggerOrbitInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user