From 434580845b12f779253c6008442c892ff0268e5b Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 2 Feb 2022 00:05:55 +1100 Subject: [PATCH] Fix map yaml linter (#6433) --- .../Commands/LoadGameMapCommand.cs | 2 +- .../GameTicking/GameTicker.RoundFlow.cs | 2 +- Content.Server/Maps/GameMapPrototype.cs | 3 ++- Content.Server/Salvage/SalvageMapPrototype.cs | 4 +++- Content.Server/Salvage/SalvageSystem.cs | 2 +- .../Ammunition/Components/AmmoComponent.cs | 2 +- Resources/Prototypes/Maps/game.yml | 12 +++++----- Resources/Prototypes/Maps/holiday.yml | 2 +- Resources/Prototypes/Maps/salvage.yml | 24 +++++++++---------- Resources/Prototypes/Maps/test.yml | 4 ++-- 10 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Content.Server/Administration/Commands/LoadGameMapCommand.cs b/Content.Server/Administration/Commands/LoadGameMapCommand.cs index b3713d4723..873705d83a 100644 --- a/Content.Server/Administration/Commands/LoadGameMapCommand.cs +++ b/Content.Server/Administration/Commands/LoadGameMapCommand.cs @@ -39,7 +39,7 @@ namespace Content.Server.Administration.Commands { if (int.TryParse(args[1], out var mapId)) { - var gameMapEnt = mapLoader.LoadBlueprint(new MapId(mapId), gameMap.MapPath); + var gameMapEnt = mapLoader.LoadBlueprint(new MapId(mapId), gameMap.MapPath.ToString()); if (gameMapEnt is null) { shell.WriteError($"Failed to create the given game map, is the path {gameMap.MapPath} correct?"); diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index a293ea588c..55978fa56d 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -89,7 +89,7 @@ namespace Content.Server.GameTicking _pauseManager.AddUninitializedMap(toLoad); } - _mapLoader.LoadMap(toLoad, map.MapPath); + _mapLoader.LoadMap(toLoad, map.MapPath.ToString()); var grids = _mapManager.GetAllMapGrids(toLoad).ToList(); var dict = new Dictionary(); diff --git a/Content.Server/Maps/GameMapPrototype.cs b/Content.Server/Maps/GameMapPrototype.cs index 09c0c98ab4..c1907a9e13 100644 --- a/Content.Server/Maps/GameMapPrototype.cs +++ b/Content.Server/Maps/GameMapPrototype.cs @@ -5,6 +5,7 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; +using Robust.Shared.Utility; namespace Content.Server.Maps; @@ -52,7 +53,7 @@ public class GameMapPrototype : IPrototype /// Relative directory path to the given map, i.e. `Maps/saltern.yml` /// [DataField("mapPath", required: true)] - public string MapPath { get; } = default!; + public ResourcePath MapPath { get; } = default!; /// /// Controls if the map can be used as a fallback if no maps are eligible. diff --git a/Content.Server/Salvage/SalvageMapPrototype.cs b/Content.Server/Salvage/SalvageMapPrototype.cs index 7ff63be143..07a583ee59 100644 --- a/Content.Server/Salvage/SalvageMapPrototype.cs +++ b/Content.Server/Salvage/SalvageMapPrototype.cs @@ -3,6 +3,8 @@ using System.Linq; using Content.Server.Objectives.Interfaces; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; +using Robust.Shared.Serialization.TypeSerializers.Implementations; +using Robust.Shared.Utility; using Robust.Shared.ViewVariables; namespace Content.Server.Salvage @@ -19,7 +21,7 @@ namespace Content.Server.Salvage /// [ViewVariables] [DataField("mapPath", required: true)] - public string MapPath { get; } = default!; + public ResourcePath MapPath { get; } = default!; /// /// Size *from 0,0* in units of the map (used to determine if it fits) diff --git a/Content.Server/Salvage/SalvageSystem.cs b/Content.Server/Salvage/SalvageSystem.cs index 5c94582c6b..292ae4774c 100644 --- a/Content.Server/Salvage/SalvageSystem.cs +++ b/Content.Server/Salvage/SalvageSystem.cs @@ -278,7 +278,7 @@ namespace Content.Server.Salvage Report("salvage-system-announcement-spawn-no-debris-available"); return false; } - var bp = _mapLoader.LoadBlueprint(spl.MapId, map.MapPath); + var bp = _mapLoader.LoadBlueprint(spl.MapId, map.MapPath.ToString()); if (bp == null) { Report("salvage-system-announcement-spawn-debris-disintegrated"); diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs index 4481e6a1a5..0b80668bc5 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components [DataField("ammoVelocity")] public float Velocity { get; } = 20f; - [DataField("muzzleFlash", customTypeSerializer:typeof(ResourcePathSerializer))] + [DataField("muzzleFlash")] public ResourcePath? MuzzleFlashSprite = new("Objects/Weapons/Guns/Projectiles/bullet_muzzle.png"); [DataField("soundCollectionEject")] diff --git a/Resources/Prototypes/Maps/game.yml b/Resources/Prototypes/Maps/game.yml index eed6cfd983..62aaa80dc2 100644 --- a/Resources/Prototypes/Maps/game.yml +++ b/Resources/Prototypes/Maps/game.yml @@ -5,7 +5,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: '14' - mapPath: Maps/saltern.yml + mapPath: /Maps/saltern.yml minPlayers: 0 maxPlayers: 20 fallback: true @@ -41,7 +41,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: 'VG' - mapPath: Maps/packedstation.yml + mapPath: /Maps/packedstation.yml minPlayers: 15 conditions: - !type:HolidayMapCondition @@ -81,7 +81,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: '14' - mapPath: Maps/knightship.yml + mapPath: /Maps/knightship.yml minPlayers: 0 maxPlayers: 8 overflowJobs: [] @@ -102,7 +102,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: '14' - mapPath: Maps/ssreach.yml + mapPath: /Maps/ssreach.yml minPlayers: 8 maxPlayers: 25 overflowJobs: @@ -130,7 +130,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: '14' - mapPath: Maps/dart.yml + mapPath: /Maps/dart.yml minPlayers: 0 votable: false overflowJobs: [] @@ -144,7 +144,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: 'VG' - mapPath: Maps/moonrise.yml + mapPath: /Maps/moonrise.yml minPlayers: 0 votable: false overflowJobs: [] diff --git a/Resources/Prototypes/Maps/holiday.yml b/Resources/Prototypes/Maps/holiday.yml index b4ff65d883..5ec74809d3 100644 --- a/Resources/Prototypes/Maps/holiday.yml +++ b/Resources/Prototypes/Maps/holiday.yml @@ -5,7 +5,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: 'VG' - mapPath: Maps/packedstationxmas.yml + mapPath: /Maps/packedstationxmas.yml minPlayers: 15 conditions: - !type:HolidayMapCondition diff --git a/Resources/Prototypes/Maps/salvage.yml b/Resources/Prototypes/Maps/salvage.yml index 5f27c29a66..bec7da09b1 100644 --- a/Resources/Prototypes/Maps/salvage.yml +++ b/Resources/Prototypes/Maps/salvage.yml @@ -6,37 +6,37 @@ - type: salvageMap id: small1 name: "Small / Engineering Storage 1" - mapPath: Maps/Salvage/small-1.yml + mapPath: /Maps/Salvage/small-1.yml size: 3.5 - type: salvageMap id: small2 name: "Small / Gaming Nook 1" - mapPath: Maps/Salvage/small-2.yml + mapPath: /Maps/Salvage/small-2.yml size: 3.5 - type: salvageMap id: small-ship-1 name: "Small / Ship 1 (Pill)" - mapPath: Maps/Salvage/small-ship-1.yml + mapPath: /Maps/Salvage/small-ship-1.yml size: 3.5 - type: salvageMap id: small3 name: "Small / Laundromat 1" - mapPath: Maps/Salvage/small-3.yml + mapPath: /Maps/Salvage/small-3.yml size: 3.5 - type: salvageMap id: smallAISurveyDrone name: "Small / AI Survey Drone" - mapPath: Maps/Salvage/small-ai-survey-drone.yml + mapPath: /Maps/Salvage/small-ai-survey-drone.yml size: 3.5 - type: salvageMap id: small4 name: "Small / Bar Salvage" - mapPath: Maps/Salvage/small-4.yml + mapPath: /Maps/Salvage/small-4.yml size: 3.5 # Small - Asteroids @@ -44,7 +44,7 @@ - type: salvageMap id: smallA1 name: "Small / Asteroid 1 Plasmafire" - mapPath: Maps/Salvage/small-a-1.yml + mapPath: /Maps/Salvage/small-a-1.yml size: 3.5 # "Medium"-class maps - Max size square: 15x15, indicated size: 7.5 @@ -52,25 +52,25 @@ - type: salvageMap id: medium1 name: "Medium / Plasma-Trapped Cache 1" - mapPath: Maps/Salvage/medium-1.yml + mapPath: /Maps/Salvage/medium-1.yml size: 7.5 - type: salvageMap id: mediumvault1 name: "Medium / Vault 1" - mapPath: Maps/Salvage/medium-vault-1.yml + mapPath: /Maps/Salvage/medium-vault-1.yml size: 7.5 - type: salvageMap id: mediumOrchestra name: "Medium / Silent Orchestra" - mapPath: Maps/Salvage/medium-silent-orchestra.yml + mapPath: /Maps/Salvage/medium-silent-orchestra.yml size: 7.5 - type: salvageMap id: mediumShuttleWreck name: "Medium / Ruined Emergency Shuttle" - mapPath: Maps/Salvage/medium-ruined-emergency-shuttle.yml + mapPath: /Maps/Salvage/medium-ruined-emergency-shuttle.yml size: 8.5 # Over standard medium wreck size, may need future adjustment. - + diff --git a/Resources/Prototypes/Maps/test.yml b/Resources/Prototypes/Maps/test.yml index 54e73b089e..eee2cd36c9 100644 --- a/Resources/Prototypes/Maps/test.yml +++ b/Resources/Prototypes/Maps/test.yml @@ -1,7 +1,7 @@ - type: gameMap id: empty mapName: Empty - mapPath: Maps/Test/empty.yml + mapPath: /Maps/Test/empty.yml minPlayers: 0 votable: false overflowJobs: @@ -16,7 +16,7 @@ nameGenerator: !type:NanotrasenNameGenerator prefixCreator: '14' - mapPath: Maps/knightship.yml + mapPath: /Maps/knightship.yml minPlayers: 0 votable: false overflowJobs: