fix: Fixes boat component locations when moving (#1868)
This commit is contained in:
parent
21836cf62f
commit
8ac9ec27e4
1 changed files with 21 additions and 11 deletions
|
|
@ -7,6 +7,7 @@ using Server.Engines.Spawners;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Multis.Boats;
|
using Server.Multis.Boats;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
using CalcMoves = Server.Movement.Movement;
|
||||||
|
|
||||||
namespace Server.Multis
|
namespace Server.Multis
|
||||||
{
|
{
|
||||||
|
|
@ -282,15 +283,15 @@ namespace Server.Multis
|
||||||
SPlank.SetFacing(_facing);
|
SPlank.SetFacing(_facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
var xOffset = X;
|
var xOffset = 0;
|
||||||
var yOffset = Y;
|
var yOffset = 0;
|
||||||
Movement.Movement.Offset(_facing, ref xOffset, ref yOffset);
|
CalcMoves.Offset(_facing, ref xOffset, ref yOffset);
|
||||||
|
|
||||||
if (TillerMan != null)
|
if (TillerMan != null)
|
||||||
{
|
{
|
||||||
TillerMan.Location = new Point3D(
|
TillerMan.Location = new Point3D(
|
||||||
xOffset * TillerManDistance + (_facing == Direction.North ? 1 : 0),
|
X + xOffset * TillerManDistance + (_facing == Direction.North ? 1 : 0),
|
||||||
yOffset * TillerManDistance,
|
Y + yOffset * TillerManDistance,
|
||||||
TillerMan.Z
|
TillerMan.Z
|
||||||
);
|
);
|
||||||
TillerMan.SetFacing(_facing);
|
TillerMan.SetFacing(_facing);
|
||||||
|
|
@ -299,7 +300,7 @@ namespace Server.Multis
|
||||||
|
|
||||||
if (Hold != null)
|
if (Hold != null)
|
||||||
{
|
{
|
||||||
Hold.Location = new Point3D(xOffset * HoldDistance, yOffset * HoldDistance, Hold.Z);
|
Hold.Location = new Point3D(X + xOffset * HoldDistance, Y + yOffset * HoldDistance, Hold.Z);
|
||||||
Hold.SetFacing(_facing);
|
Hold.SetFacing(_facing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2085,8 +2086,8 @@ namespace Server.Multis
|
||||||
PPlank?.SetFacing(facing);
|
PPlank?.SetFacing(facing);
|
||||||
SPlank?.SetFacing(facing);
|
SPlank?.SetFacing(facing);
|
||||||
|
|
||||||
var xOffset = X;
|
var xOffset = 0;
|
||||||
var yOffset = Y;
|
var yOffset = 0;
|
||||||
Movement.Movement.Offset(facing, ref xOffset, ref yOffset);
|
Movement.Movement.Offset(facing, ref xOffset, ref yOffset);
|
||||||
|
|
||||||
var count = ((_facing - old) & 0x7) / 2;
|
var count = ((_facing - old) & 0x7) / 2;
|
||||||
|
|
@ -2112,15 +2113,15 @@ namespace Server.Multis
|
||||||
if (TillerMan != null)
|
if (TillerMan != null)
|
||||||
{
|
{
|
||||||
TillerMan.Location = new Point3D(
|
TillerMan.Location = new Point3D(
|
||||||
xOffset * TillerManDistance + (facing == Direction.North ? 1 : 0),
|
X + xOffset * TillerManDistance + (facing == Direction.North ? 1 : 0),
|
||||||
yOffset * TillerManDistance,
|
Y + yOffset * TillerManDistance,
|
||||||
TillerMan.Z
|
TillerMan.Z
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hold != null)
|
if (Hold != null)
|
||||||
{
|
{
|
||||||
Hold.Location = new Point3D(xOffset * HoldDistance, yOffset * HoldDistance, Hold.Z);
|
Hold.Location = new Point3D(X + xOffset * HoldDistance, Y + yOffset * HoldDistance, Hold.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PPlank != null)
|
if (PPlank != null)
|
||||||
|
|
@ -2157,6 +2158,15 @@ namespace Server.Multis
|
||||||
{
|
{
|
||||||
EventSink.WorldLoad += UpdateAllComponents;
|
EventSink.WorldLoad += UpdateAllComponents;
|
||||||
EventSink.WorldSave += UpdateAllComponents;
|
EventSink.WorldSave += UpdateAllComponents;
|
||||||
|
|
||||||
|
// Fix tiler/hold/plank locations
|
||||||
|
foreach (var item in World.Items.Values)
|
||||||
|
{
|
||||||
|
if (item is BaseBoat boat)
|
||||||
|
{
|
||||||
|
boat.UpdateComponents();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TurnTimer : Timer
|
private class TurnTimer : Timer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue