Beefcake
Member
According to this code, certain objects could be made exception such as ItemID, StaticID, or LandTileID, and doesn't interrupt boat movement.
how do I add those objects appearing on the map, flowers and such, which cannot be removed via UltimaLive, to the exception list?
ext: static,0xC49 or see jpeg.
thanks
how do I add those objects appearing on the map, flowers and such, which cannot be removed via UltimaLive, to the exception list?
ext: static,0xC49 or see jpeg.
thanks
public bool CanFit(Point3D p, Map map, int itemID):
public bool CanFit(Point3D p, Map map, int itemID)
{
if (map == null || map == Map.Internal || Deleted || CheckDecay())
return false;
MultiComponentList newComponents = MultiData.GetComponents(itemID);
for (int x = 0; x < newComponents.Width; ++x)
{
for (int y = 0; y < newComponents.Height; ++y)
{
int tx = p.X + newComponents.Min.X + x;
int ty = p.Y + newComponents.Min.Y + y;
if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty) || IsExcludedTile(newComponents.Tiles[x][y]))
continue;
LandTile landTile = map.Tiles.GetLandTile(tx, ty);
StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);
bool hasWater = false;
int dif = Math.Abs(landTile.Z - p.Z);
if ((dif >= 0 && dif <= 1) && ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)))
hasWater = true;
int z = p.Z;
for (int i = 0; i < tiles.Length; ++i)
{
StaticTile tile = tiles[i];
if (IsExcludedTile(tile))
continue;
bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);
if (tile.Z == p.Z && isWater)
hasWater = true;
else if (tile.Z >= p.Z && !isWater)
{
if (Owner is BaseShipCaptain && !Owner.Deleted && m_Order == BoatOrder.Course)
{
((BaseShipCaptain)Owner).CheckBlock(tile, new Point3D(tx, ty, tile.Z));
}
return false;
}
}
if (!hasWater)
{
return false;
}
}
}
IPooledEnumerable eable = map.GetObjectsInBounds(new Rectangle2D(p.X + newComponents.Min.X, p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height));
foreach (IEntity e in eable)
{
int x = e.X - p.X + newComponents.Min.X;
int y = e.Y - p.Y + newComponents.Min.Y;
// No multi tiles on that point -or- mast/sail tiles
if (x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height)
{
if (newComponents.Tiles[x][y].Length == 0 || IsExcludedTile(newComponents.Tiles[x][y]))
continue;
}
if (e is Item)
{
Item item = e as Item;
if ((item is BaseAddon || item is AddonComponent) && CheckAddon(item))
continue;
// Special item, we're good
if (CheckItem(itemID, item, p) || CanMoveOver(item) || item.Z < p.Z || ExemptOverheadComponent(p, itemID, item.X, item.Y, item.Z + item.ItemData.Height))
continue;
}
else if (e is Mobile)
{
Mobile mobile = e as Mobile;
if (Contains(mobile) || ExemptOverheadComponent(p, itemID, mobile.X, mobile.Y, mobile.Z + 10))
continue;
}
if (Owner is BaseShipCaptain && !Owner.Deleted && m_Order == BoatOrder.Course)
{
((BaseShipCaptain)Owner).CheckBlock(e, e.Location);
}
eable.Free();
return false;
}
eable.Free();
return true;
}
Attachments
Last edited: