public static void AddStairsTo( ref MultiComponentList mcl ) { // copy the original.. mcl = new MultiComponentList( mcl ); mcl.Resize( mcl.Width, mcl.Height + 1 ); int xCenter = mcl.Center.X; int yCenter = mcl.Center.Y; int y = mcl.Height - 1; for ( int x = 0; x < mcl.Width; ++x ) mcl.Add( 0x63, x - xCenter, y - yCenter, 0 ); }
public MultiComponentList GetEmptyFoundation() { // Copy original foundation layout MultiComponentList mcl = new MultiComponentList( MultiData.GetComponents( ItemID ) ); mcl.Resize( mcl.Width, mcl.Height + 1 ); int xCenter = mcl.Center.X; int yCenter = mcl.Center.Y; int y = mcl.Height - 1; ApplyFoundation( m_Type, mcl ); for ( int x = 1; x < mcl.Width; ++x ) mcl.Add( 0x751, x - xCenter, y - yCenter, 0 ); return mcl; }
public static MultiComponentList GetComponents(this IAddon addon) { if (addon == null) { return(null); } var hash = ComputeHash(addon); var mcl = ComponentsCache.GetValue(hash); if (mcl != null) { return(mcl); } mcl = new MultiComponentList(MultiComponentList.Empty); int x1 = 0, y1 = 0, x2 = 0, y2 = 0; IList comp; if (addon.GetPropertyValue("Components", out comp)) { Point3D off; foreach (var c in comp) { if (c.GetPropertyValue("Offset", out off)) { x1 = Math.Min(off.X, x1); y1 = Math.Min(off.Y, y1); x2 = Math.Max(off.X, x2); y2 = Math.Max(off.Y, y2); } } } mcl.Resize(1 + (x2 - x1), 1 + (y2 - y1)); if (comp != null) { Point3D off; foreach (var c in comp.OfType <Item>()) { if (c.GetPropertyValue("Offset", out off)) { off = off.Clone3D(Math.Abs(x1), Math.Abs(y1)); mcl.Add(c.ItemID, off.X, off.Y, off.Z); } } } if (addon is Item) { ((Item)addon).Delete(); } return(ComponentsCache[hash] = mcl); }