Пример #1
0
        public override void Initialise(MapInfo info, Player player)
        {
            base.Initialise(info, player);

            if (info.ResidenceId != 0u)
            {
                residence = ResidenceManager.GetCachedResidence(info.ResidenceId);
                if (residence == null)
                {
                    throw new InvalidOperationException();
                }
            }
            else
            {
                residence = ResidenceManager.CreateResidence(player);
            }

            // initialise plug entities
            foreach (Plot plot in residence.GetPlots().Where(p => p.PlugEntry != null))
            {
                var plug = new Plug(plot.PlotEntry, plot.PlugEntry);
                EnqueueAdd(plug, Vector3.Zero);
            }
        }