Fix network configurator verbs and misc fixes (#16210)

This commit is contained in:
Julian Giebel
2023-05-07 12:58:12 +02:00
committed by GitHub
parent d072cb6144
commit 5c86778fff
3 changed files with 10 additions and 10 deletions

View File

@@ -293,23 +293,23 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
Impact = LogImpact.Low Impact = LogImpact.Low
}; };
if (configurator.LinkModeActive) if (configurator.LinkModeActive && (HasComp<DeviceLinkSinkComponent>(args.Target) || HasComp<DeviceLinkSourceComponent>(args.Target)))
{ {
var linkStarted = configurator.ActiveDeviceLink.HasValue; var linkStarted = configurator.ActiveDeviceLink.HasValue;
verb.Text = Loc.GetString(linkStarted ? "network-configurator-link" : "network-configurator-start-link"); verb.Text = Loc.GetString(linkStarted ? "network-configurator-link" : "network-configurator-start-link");
verb.Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/in.svg.192dpi.png")); verb.Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/in.svg.192dpi.png"));
args.Verbs.Add(verb);
} }
else if (!HasComp<DeviceNetworkComponent>(args.Target)) else if (HasComp<DeviceNetworkComponent>(args.Target))
{ {
var isDeviceList = HasComp<DeviceListComponent>(args.Target); var isDeviceList = HasComp<DeviceListComponent>(args.Target);
verb.Text = Loc.GetString(isDeviceList ? "network-configurator-configure" : "network-configurator-save-device"); verb.Text = Loc.GetString(isDeviceList ? "network-configurator-configure" : "network-configurator-save-device");
verb.Icon = isDeviceList verb.Icon = isDeviceList
? new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")) ? new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/settings.svg.192dpi.png"))
: new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/in.svg.192dpi.png")); : new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/in.svg.192dpi.png"));
}
args.Verbs.Add(verb); args.Verbs.Add(verb);
} }
}
/// <summary> /// <summary>
/// Powerful. Funny alt interact using. /// Powerful. Funny alt interact using.
@@ -356,9 +356,9 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
AlternativeVerb verb = new() AlternativeVerb verb = new()
{ {
Text = Loc.GetString("network-configurator-save-device"), Text = Loc.GetString("network-configurator-switch-mode"),
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/in.svg.192dpi.png")), Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")),
Act = () => TryAddNetworkDevice(args.Target, args.Using.Value, args.User), Act = () => SwitchMode(args.User, args.Target, configurator),
Impact = LogImpact.Low Impact = LogImpact.Low
}; };
args.Verbs.Add(verb); args.Verbs.Add(verb);

View File

@@ -17,7 +17,7 @@ public sealed class NetworkConfiguratorComponent : Component
/// </summary> /// </summary>
[DataField("linkModeActive")] [DataField("linkModeActive")]
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public bool LinkModeActive = false; public bool LinkModeActive = true;
/// <summary> /// <summary>
/// The entity containing a <see cref="DeviceListComponent"/> this configurator is currently interacting with /// The entity containing a <see cref="DeviceListComponent"/> this configurator is currently interacting with

View File

@@ -1,7 +1,7 @@
- type: sinkPort - type: sinkPort
id: AutoClose id: AutoClose
name: signal-port-name-autoclose name: signal-port-name-hold-open
description: signal-port-description-autoclose description: signal-port-description-hold-open
- type: sinkPort - type: sinkPort
id: Toggle id: Toggle