Skip to content

Commit

Permalink
Revert "Revert "Replace ResourcePath with ResPath (#15308)" (Simp…
Browse files Browse the repository at this point in the history
…le-Station#155… (#15566)
  • Loading branch information
metalgearsloth authored and Vordenburg committed May 7, 2023
1 parent 943ed02 commit ceda130
Show file tree
Hide file tree
Showing 133 changed files with 285 additions and 281 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void LoadActionAssignments(string path, bool userData)
if (PlayerActions == null)
return;

var file = new ResourcePath(path).ToRootedPath();
var file = new ResPath(path).ToRootedPath();
TextReader reader = userData
? _resources.UserData.OpenText(file)
: _resources.ContentFileReadText(file);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/Commands/UploadFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var path = new ResourcePath(args[0]).ToRelativePath();
var path = new ResPath(args[0]).ToRelativePath();

var dialog = IoCManager.Resolve<IFileDialogManager>();

Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Administration/Commands/UploadFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class UploadFolder : IConsoleCommand
public string Description => Loc.GetString("uploadfolder-command-description");
public string Help => Loc.GetString("uploadfolder-command-help");

private static readonly ResourcePath BaseUploadFolderPath = new("/UploadFolder");
private static readonly ResPath BaseUploadFolderPath = new("/UploadFolder");

[Dependency] private IResourceManager _resourceManager = default!;
[Dependency] private IConfigurationManager _configManager = default!;
Expand All @@ -37,7 +37,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)
shell.WriteLine( Loc.GetString("uploadfolder-command-help"));
return;
}
var folderPath = new ResourcePath(BaseUploadFolderPath + $"/{args[0]}");
var folderPath = new ResPath(BaseUploadFolderPath + $"/{args[0]}");

if (!_resourceManager.UserData.Exists(folderPath.ToRootedPath()))
{
Expand All @@ -63,7 +63,7 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)
var netManager = IoCManager.Resolve<INetManager>();
var msg = netManager.CreateNetMessage<NetworkResourceUploadMessage>();

msg.RelativePath = new ResourcePath($"{filepath.ToString().Remove(0,14)}"); //removes /UploadFolder/ from path
msg.RelativePath = new ResPath($"{filepath.ToString().Remove(0,14)}"); //removes /UploadFolder/ from path
msg.Data = data;

netManager.ClientSendMessage(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void Initialize()
_netMgr.RegisterNetMessage<MsgUpdateAdminStatus>(UpdateMessageRx);

// Load flags for engine commands, since those don't have the attributes.
if (_res.TryContentFileRead(new ResourcePath("/clientCommandPerms.yml"), out var efs))
if (_res.TryContentFileRead(new ResPath("/clientCommandPerms.yml"), out var efs))
{
_localCommandPermissions.LoadPermissionsFromStream(efs);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private void AddAdminVerbs(GetVerbsEvent<Verb> args)
Verb verb = new();
verb.Category = VerbCategory.Debug;
verb.Text = "View Variables";
verb.Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"));
verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"));
verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
args.Verbs.Add(verb);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/Systems/KillSignSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void KillSignAdded(EntityUid uid, KillSignComponent component, Component

var adj = sprite.Bounds.Height / 2 + ((1.0f/32) * 6.0f);

var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/killsign.rsi"), "sign"));
var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResPath("Objects/Misc/killsign.rsi"), "sign"));
sprite.LayerMapSet(KillSignKey.Key, layer);

sprite.LayerSetOffset(layer, new Vector2(0.0f, adj));
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/AirlockPainter/AirlockPainterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override void Initialize()
continue;
}

RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(TextureRoot / new ResourcePath(iconPath));
RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(TextureRoot / new ResPath(iconPath));
if (!doorRsi.RSI.TryGetState("closed", out var icon))
{
Entries.Add(new AirlockPainterEntry(style, null));
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/Miasma/FliesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void FliesAdded(EntityUid uid, FliesComponent component, ComponentStartu
if (sprite.LayerMapTryGet(FliesKey.Key, out var _))
return;

var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/flies.rsi"), "flies"));
var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ("Objects/Misc/flies.rsi"), "flies"));
sprite.LayerMapSet(FliesKey.Key, layer);
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/Overlays/GasTileOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IR
SpriteSpecifier overlay;

if (!string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayState))
overlay = new SpriteSpecifier.Rsi(new ResourcePath(gasPrototype.GasOverlaySprite), gasPrototype.GasOverlayState);
overlay = new SpriteSpecifier.Rsi(new (gasPrototype.GasOverlaySprite), gasPrototype.GasOverlayState);
else if (!string.IsNullOrEmpty(gasPrototype.GasOverlayTexture))
overlay = new SpriteSpecifier.Texture(new ResourcePath(gasPrototype.GasOverlayTexture));
overlay = new SpriteSpecifier.Texture(new (gasPrototype.GasOverlayTexture));
else
continue;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Audio/AmbientSoundSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private static bool Callback(
string key;

if (ambientComp.Sound is SoundPathSpecifier path)
key = path.Path?.ToString() ?? string.Empty;
key = path.Path.ToString();
else
key = ((SoundCollectionSpecifier) ambientComp.Sound).Collection ?? string.Empty;

Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Changelog/ChangelogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void SaveNewReadId()
NewChangelogEntries = false;
NewChangelogEntriesChanged?.Invoke();

using var sw = _resource.UserData.OpenWriteText(new ResourcePath($"/changelog_last_seen_{_configManager.GetCVar(CCVars.ServerId)}"));
using var sw = _resource.UserData.OpenWriteText(new ($"/changelog_last_seen_{_configManager.GetCVar(CCVars.ServerId)}"));

sw.Write(MaxId.ToString());
}
Expand All @@ -60,7 +60,7 @@ public async void Initialize()

MaxId = changelog.Max(c => c.Id);

var path = new ResourcePath($"/changelog_last_seen_{_configManager.GetCVar(CCVars.ServerId)}");
var path = new ResPath($"/changelog_last_seen_{_configManager.GetCVar(CCVars.ServerId)}");
if(_resource.UserData.TryReadAllText(path, out var lastReadIdText))
{
LastReadId = int.Parse(lastReadIdText);
Expand All @@ -86,7 +86,7 @@ public async Task<List<ChangelogEntry>> LoadChangelog()
return result.OrderBy(x => x.Time).ToList();
}

private Task<List<ChangelogEntry>> LoadChangelogFile(ResourcePath path)
private Task<List<ChangelogEntry>> LoadChangelogFile(ResPath path)
{
return Task.Run(() =>
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Changelog/ChangelogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private TextureRect GetIcon(ChangelogLineType type)

return new TextureRect
{
Texture = _resourceCache.GetTexture(new ResourcePath($"/Textures/Interface/Changelog/{file}")),
Texture = _resourceCache.GetTexture(new ResPath($"/Textures/Interface/Changelog/{file}")),
VerticalAlignment = VAlignment.Top,
TextureScale = (0.5f, 0.5f),
Margin = new Thickness(2, 4, 6, 2),
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ChemMasterWindow()

// Pill type selection buttons, in total there are 20 pills.
// Pill rsi file should have states named as pill1, pill2, and so on.
var resourcePath = new ResourcePath(PillsRsiPath);
var resourcePath = new ResPath(PillsRsiPath);
var pillTypeGroup = new ButtonGroup();
PillTypeButtons = new Button[20];
for (uint i = 0; i < PillTypeButtons.Length; i++)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Credits/CreditsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void PopulatePatrons(BoxContainer patronsContainer)

private IEnumerable<PatronEntry> LoadPatrons()
{
var yamlStream = _resourceManager.ContentFileReadYaml(new ResourcePath("/Credits/Patrons.yml"));
var yamlStream = _resourceManager.ContentFileReadYaml(new ("/Credits/Patrons.yml"));
var sequence = (YamlSequenceNode) yamlStream.Documents[0].RootNode;

return sequence
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/CrewManifest/CrewManifestUi.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public CrewManifestSection(string sectionTitle, List<CrewManifestEntry> entries,

AddChild(gridContainer);

var path = new ResourcePath("/Textures/Interface/Misc/job_icons.rsi");
var path = new ResPath("/Textures/Interface/Misc/job_icons.rsi");
cache.TryGetResource(path, out RSIResource? rsi);

foreach (var entry in entries)
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Damage/DamageVisualsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private void AddDamageLayerToSprite(SpriteComponent spriteComponent, DamageVisua
{
var newLayer = spriteComponent.AddLayer(
new SpriteSpecifier.Rsi(
new ResourcePath(sprite.Sprite), state
new (sprite.Sprite), state
), index);
spriteComponent.LayerMapSet(mapKey, newLayer);
if (sprite.Color != null)
Expand Down Expand Up @@ -461,7 +461,7 @@ private void ReorderOverlaySprite(SpriteComponent spriteComponent, DamageVisuals
threshold = damageVisComp.Thresholds[1];
spriteLayer = spriteComponent.AddLayer(
new SpriteSpecifier.Rsi(
new ResourcePath(sprite.Sprite),
new (sprite.Sprite),
$"{statePrefix}_{threshold}"
),
spriteLayer);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/DoAfter/DoAfterOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DoAfterOverlay(IEntityManager entManager, IPrototypeManager protoManager,
_timing = timing;
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
_meta = _entManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
var sprite = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
var sprite = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);

_shader = protoManager.Index<ShaderPrototype>("unshaded").Instance();
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/EntityHealthBar/EntityHealthBarOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public EntityHealthBarOverlay(IEntityManager entManager, IPrototypeManager proto
_mobStateSystem = _entManager.EntitySysManager.GetEntitySystem<MobStateSystem>();
_mobThresholdSystem = _entManager.EntitySysManager.GetEntitySystem<MobThresholdSystem>();

var sprite = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/health_bar.rsi"), "icon");
var sprite = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/health_bar.rsi"), "icon");
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);

_shader = protoManager.Index<ShaderPrototype>("unshaded").Instance();
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Examine/ExamineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void AddExamineVerb(GetVerbsEvent<ExamineVerb> args)
// Center it on the entity if they use the verb instead.
verb.Act = () => DoExamine(args.Target, false);
verb.Text = Loc.GetString("examine-verb-name");
verb.Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/examine.svg.192dpi.png"));
verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/examine.svg.192dpi.png"));
verb.ShowOnExamineTooltip = false;
verb.ClientExclusive = true;
args.Verbs.Add(verb);
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Ghost/GhostComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class GhostComponent : SharedGhostComponent

public InstantAction ToggleLightingAction = new()
{
Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/VerbIcons/light.svg.192dpi.png")),
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/light.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-lighting-manager-name",
Description = "ghost-gui-toggle-lighting-manager-desc",
UserPopup = "ghost-gui-toggle-lighting-manager-popup",
Expand All @@ -24,7 +24,7 @@ public sealed class GhostComponent : SharedGhostComponent

public InstantAction ToggleFoVAction = new()
{
Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/VerbIcons/vv.svg.192dpi.png")),
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/vv.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-fov-name",
Description = "ghost-gui-toggle-fov-desc",
UserPopup = "ghost-gui-toggle-fov-popup",
Expand All @@ -35,7 +35,7 @@ public sealed class GhostComponent : SharedGhostComponent

public InstantAction ToggleGhostsAction = new()
{
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Mobs/Ghosts/ghost_human.rsi"), "icon"),
Icon = new SpriteSpecifier.Rsi(new ("Mobs/Ghosts/ghost_human.rsi"), "icon"),
DisplayName = "ghost-gui-toggle-ghost-visibility-name",
Description = "ghost-gui-toggle-ghost-visibility-desc",
UserPopup = "ghost-gui-toggle-ghost-visibility-popup",
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Guidebook/GuideEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class GuideEntry
/// <summary>
/// The file containing the contents of this guide.
/// </summary>
[DataField("text", required: true)] public ResourcePath Text = default!;
[DataField("text", required: true)] public ResPath Text = default!;

/// <summary>
/// The unique id for this guide.
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Guidebook/GuidebookSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void OnGetVerbs(EntityUid uid, GuideHelpComponent component, GetVerbsEve
args.Verbs.Add(new()
{
Text = Loc.GetString("guide-help-verb"),
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/information.svg.192dpi.png")),
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/information.svg.192dpi.png")),
Act = () => OnGuidebookOpen?.Invoke(component.Guides, null, null, component.IncludeChildren, component.Guides[0]),
ClientExclusive = true,
CloseMenu = true
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/LateJoin/LateJoinGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private void RebuildUI()
Stretch = TextureRect.StretchMode.KeepCentered
};

var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), prototype.Icon);
var specifier = new SpriteSpecifier.Rsi(new ("/Textures/Interface/Misc/job_icons.rsi"), prototype.Icon);
icon.Texture = _sprites.Frame0(specifier);
jobSelector.AddChild(icon);

Expand Down Expand Up @@ -262,7 +262,7 @@ private void RebuildUI()
{
TextureScale = (0.4f, 0.4f),
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = _sprites.Frame0(new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Nano/lock.svg.192dpi.png"))),
Texture = _sprites.Frame0(new SpriteSpecifier.Texture(new ("/Textures/Interface/Nano/lock.svg.192dpi.png"))),
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Right,
});
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Mapping/MappingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public sealed partial class MappingSystem : EntitySystem
/// <summary>
/// The icon to use for space tiles.
/// </summary>
private readonly SpriteSpecifier _spaceIcon = new SpriteSpecifier.Texture(new ResourcePath("Tiles/cropped_parallax.png"));
private readonly SpriteSpecifier _spaceIcon = new SpriteSpecifier.Texture(new ("Tiles/cropped_parallax.png"));

/// <summary>
/// The icon to use for entity-eraser.
/// </summary>
private readonly SpriteSpecifier _deleteIcon = new SpriteSpecifier.Texture(new ResourcePath("Interface/VerbIcons/delete.svg.192dpi.png"));
private readonly SpriteSpecifier _deleteIcon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/delete.svg.192dpi.png"));

public string DefaultMappingActions = "/mapping_actions.yml";

Expand Down Expand Up @@ -80,7 +80,7 @@ private void OnFillActionSlot(FillActionSlotEvent ev)

var tileIcon = contentTileDef.IsSpace
? _spaceIcon
: new SpriteSpecifier.Texture(contentTileDef.Sprite!);
: new SpriteSpecifier.Texture(contentTileDef.Sprite!.Value);

ev.Action = new InstantAction()
{
Expand Down
10 changes: 5 additions & 5 deletions Content.Client/PDA/PDAMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public PDAMenu()

ViewContainer.OnChildAdded += control => control.Visible = false;

HomeButton.IconTexture = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/home.png"));
FlashLightToggleButton.IconTexture = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/light.png"));
EjectPenButton.IconTexture = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/pencil.png"));
EjectIdButton.IconTexture = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/eject.png"));
ProgramCloseButton.IconTexture = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/Nano/cross.svg.png"));
HomeButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/home.png"));
FlashLightToggleButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/light.png"));
EjectPenButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/pencil.png"));
EjectIdButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/eject.png"));
ProgramCloseButton.IconTexture = new SpriteSpecifier.Texture(new ("/Textures/Interface/Nano/cross.svg.png"));


HomeButton.OnPressed += _ => ToHomeScreen();
Expand Down
Loading

0 comments on commit ceda130

Please sign in to comment.