Exemple #1
0
        // For linting purposes only!
        public MapPreview(Map map, ModData modData)
        {
            this.modData = modData;
            cache        = modData.MapCache;

            Uid     = map.Uid;
            Package = map.Package;

            var mapPlayers = new MapPlayers(map.PlayerDefinitions);
            var spawns     = new List <CPos>();

            foreach (var kv in map.ActorDefinitions.Where(d => d.Value.Value == "mpspawn"))
            {
                var s = new ActorReference(kv.Value.Value, kv.Value.ToDictionary());
                spawns.Add(s.Get <LocationInit>().Value);
            }

            innerData = new InnerData
            {
                MapFormat   = map.MapFormat,
                Title       = map.Title,
                Categories  = map.Categories,
                Author      = map.Author,
                TileSet     = map.Tileset,
                Players     = mapPlayers,
                PlayerCount = mapPlayers.Players.Count(x => x.Value.Playable),
                SpawnPoints = spawns.ToArray(),
                GridType    = map.Grid.Type,
                Bounds      = map.Bounds,
                Preview     = null,
                Status      = MapStatus.Available,
                Class       = MapClassification.Unknown,
                Visibility  = map.Visibility,
            };

            innerData.SetCustomRules(modData, this, new Dictionary <string, MiniYaml>()
            {
                { "Rules", map.RuleDefinitions },
                { "Weapons", map.WeaponDefinitions },
                { "Voices", map.VoiceDefinitions },
                { "Music", map.MusicDefinitions },
                { "Notifications", map.NotificationDefinitions },
                { "Sequences", map.SequenceDefinitions },
                { "ModelSequences", map.ModelSequenceDefinitions }
            });
        }
Exemple #2
0
        public void UpdateFromMap(Map m, MapClassification classification)
        {
            Map           = m;
            Title         = m.Title;
            Type          = m.Type;
            Type          = m.Type;
            Author        = m.Author;
            Bounds        = m.Bounds;
            SpawnPoints   = m.SpawnPoints.Value;
            CustomPreview = m.CustomPreview;
            Status        = MapStatus.Available;
            Class         = classification;

            var players = new MapPlayers(m.PlayerDefinitions).Players;

            PlayerCount = players.Count(x => x.Value.Playable);

            SuitableForInitialMap = EvaluateUserFriendliness(players);
        }
Exemple #3
0
		public void UpdateFromMap(Map m, MapClassification classification)
		{
			Map = m;
			Title = m.Title;
			Type = m.Type;
			Type = m.Type;
			Author = m.Author;
			Bounds = m.Bounds;
			SpawnPoints = m.SpawnPoints.Value;
			GridType = m.Grid.Type;
			CustomPreview = m.CustomPreview;
			Status = MapStatus.Available;
			Class = classification;

			var players = new MapPlayers(m.PlayerDefinitions).Players;
			PlayerCount = players.Count(x => x.Value.Playable);

			SuitableForInitialMap = EvaluateUserFriendliness(players);
		}