public override void SetInitialState()
        {
            m_Current = new DesignState(this, GetEmptyFoundation());

            // explicitly unused in StaticHousing
            m_Design = null;
            m_Backup = null;

            //init the other two design states just so they don't crash the base's serilization
            MultiComponentList y = new MultiComponentList(m_Current.Components);
            MultiComponentList x = new MultiComponentList(StaticHouseHelper.GetComponents(m_HouseBlueprintID));

            //merge x into y.
            //first, remove all in y
            for (int i = y.List.Length - 1; i >= 0; i--)
            {
                y.Remove(y.List[i].m_ItemID, y.List[i].m_OffsetX, y.List[i].m_OffsetY, y.List[i].m_OffsetZ);
            }

            //then add all the ones we want to the list
            for (int i = 0; i < x.List.Length; ++i)
            {
                y.Add(x.List[i].m_ItemID, x.List[i].m_OffsetX, x.List[i].m_OffsetY, x.List[i].m_OffsetZ, true);
            }

            m_Current.Components = y;

            return;
        }
Example #2
0
        private static bool TryInsertIntoState(DesignState state, int itemID, int x, int y, int z)
        {
            MultiComponentList mcl = state.Components;

            if (x < mcl.Min.X || y < mcl.Min.Y || x > mcl.Max.X || y > mcl.Max.Y)
            {
                return(false);
            }

            mcl.Add(itemID, x, y, z);
            state.OnRevised();

            return(true);
        }