Start using OneOf<>for unions/variant
This commit is contained in:
@@ -201,7 +201,7 @@ namespace Game.DataStorage
|
|||||||
createProperties.Shape.Data = new AreaTriggerShapeInfo.Box(shapeData);
|
createProperties.Shape.Data = new AreaTriggerShapeInfo.Box(shapeData);
|
||||||
break;
|
break;
|
||||||
case AreaTriggerShapeType.Polygon:
|
case AreaTriggerShapeType.Polygon:
|
||||||
AreaTriggerShapeInfo.Polygon polygon = new AreaTriggerShapeInfo.Polygon(shapeData);
|
AreaTriggerShapeInfo.Polygon polygon = new AreaTriggerShapeInfo.Polygon(shapeData);
|
||||||
if (polygon.Height <= 0.0f)
|
if (polygon.Height <= 0.0f)
|
||||||
{
|
{
|
||||||
polygon.Height = 1.0f;
|
polygon.Height = 1.0f;
|
||||||
@@ -239,7 +239,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
var spline = splinesByCreateProperties.LookupByKey(createProperties.Id);
|
var spline = splinesByCreateProperties.LookupByKey(createProperties.Id);
|
||||||
if (spline != null)
|
if (spline != null)
|
||||||
createProperties.SplinePoints = spline;
|
createProperties.Movement = spline;
|
||||||
|
|
||||||
_areaTriggerCreateProperties[createProperties.Id] = createProperties;
|
_areaTriggerCreateProperties[createProperties.Id] = createProperties;
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ namespace Game.DataStorage
|
|||||||
orbitInfo.CounterClockwise = circularMovementInfos.Read<bool>(7);
|
orbitInfo.CounterClockwise = circularMovementInfos.Read<bool>(7);
|
||||||
orbitInfo.CanLoop = circularMovementInfos.Read<bool>(8);
|
orbitInfo.CanLoop = circularMovementInfos.Read<bool>(8);
|
||||||
|
|
||||||
createProperties.OrbitInfo = orbitInfo;
|
createProperties.Movement = orbitInfo;
|
||||||
}
|
}
|
||||||
while (circularMovementInfos.NextRow());
|
while (circularMovementInfos.NextRow());
|
||||||
}
|
}
|
||||||
@@ -344,15 +344,15 @@ namespace Game.DataStorage
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createProperties.OrbitInfo != null)
|
if (!createProperties.Movement.IsT0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, $"Table `areatrigger` has listed AreaTriggerCreatePropertiesId (Id: {createPropertiesId.Id}, IsCustom: {createPropertiesId.IsCustom}) with orbit info");
|
string movementType = createProperties.Movement.Match(
|
||||||
continue;
|
_ => "",
|
||||||
}
|
splineInfo => "spline",
|
||||||
|
OrbitInfo => "orbit"
|
||||||
|
);
|
||||||
|
|
||||||
if (createProperties.SplinePoints != null)
|
Log.outError(LogFilter.Sql, $"Table `areatrigger` has listed AreaTriggerCreatePropertiesId (Id: {createPropertiesId.Id}, IsCustom: {createPropertiesId.IsCustom}) with {movementType}");
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Sql, $"Table `areatrigger` has listed AreaTriggerCreatePropertiesId (Id: {createPropertiesId.Id}, IsCustom: {createPropertiesId.IsCustom}) with splines");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,22 +219,20 @@ namespace Game.Entities
|
|||||||
|
|
||||||
UpdateShape();
|
UpdateShape();
|
||||||
|
|
||||||
if (GetCreateProperties().OrbitInfo != null)
|
|
||||||
{
|
|
||||||
AreaTriggerOrbitInfo orbit = GetCreateProperties().OrbitInfo;
|
|
||||||
if (target != null && HasAreaTriggerFlag(AreaTriggerFieldFlags.Attached))
|
|
||||||
orbit.PathTarget = target.GetGUID();
|
|
||||||
else
|
|
||||||
orbit.Center = new(pos.posX, pos.posY, pos.posZ);
|
|
||||||
|
|
||||||
InitOrbit(orbit, GetCreateProperties().Speed);
|
GetCreateProperties().Movement.Switch(
|
||||||
}
|
_ => SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.PathType), (byte)AreaTriggerPathType.None),
|
||||||
else if (GetCreateProperties().SplinePoints != null)
|
splineInfo => InitSplineOffsets(splineInfo),
|
||||||
{
|
orbitInfo =>
|
||||||
InitSplineOffsets(GetCreateProperties().SplinePoints);
|
{
|
||||||
}
|
AreaTriggerOrbitInfo orbit = orbitInfo;
|
||||||
else
|
if (target != null && HasAreaTriggerFlag(AreaTriggerFieldFlags.Attached))
|
||||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.PathType), (byte)AreaTriggerPathType.None);
|
orbit.PathTarget = target.GetGUID();
|
||||||
|
else
|
||||||
|
orbit.Center = pos;
|
||||||
|
|
||||||
|
InitOrbit(orbit);
|
||||||
|
});
|
||||||
|
|
||||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.Facing), _stationaryPosition.GetOrientation());
|
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.Facing), _stationaryPosition.GetOrientation());
|
||||||
|
|
||||||
|
|||||||
@@ -248,8 +248,7 @@ namespace Game.Entities
|
|||||||
public AreaTriggerShapeInfo Shape = new();
|
public AreaTriggerShapeInfo Shape = new();
|
||||||
|
|
||||||
public float Speed = 1.0f;
|
public float Speed = 1.0f;
|
||||||
public List<Vector3> SplinePoints = new();
|
public OneOf<EmptyStruct, List<Vector3>, AreaTriggerOrbitInfo> Movement;
|
||||||
public AreaTriggerOrbitInfo OrbitInfo;
|
|
||||||
|
|
||||||
public uint ScriptId;
|
public uint ScriptId;
|
||||||
|
|
||||||
@@ -259,6 +258,8 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct EmptyStruct { }
|
||||||
|
|
||||||
public class AreaTriggerSpawn : SpawnData
|
public class AreaTriggerSpawn : SpawnData
|
||||||
{
|
{
|
||||||
public new AreaTriggerId Id;
|
public new AreaTriggerId Id;
|
||||||
|
|||||||
Reference in New Issue
Block a user