Fix some popup issues with pipe layer changes (#38244)
* fix: only show pipe layer popups to the user changing them * fix: don't show pipe layer subfloor popup when not using a screwdriver * fix: properly pass down user and used for serverside pipe layer changes Technically this doesn't matter as the Shared codepath for this method doesn't actually use these on the server: only the user is used for a clientside popup. Still, will be good to have these for future changes that might need them.
This commit is contained in:
@@ -119,14 +119,16 @@ public abstract partial class SharedAtmosPipeLayersSystem : EntitySystem
|
||||
if (ent.Comp.NumberOfPipeLayers <= 1 || ent.Comp.PipeLayersLocked)
|
||||
return;
|
||||
|
||||
if (!TryComp<ToolComponent>(args.Used, out var tool) || !_tool.HasQuality(args.Used, ent.Comp.Tool, tool))
|
||||
return;
|
||||
|
||||
if (TryComp<SubFloorHideComponent>(ent, out var subFloorHide) && subFloorHide.IsUnderCover)
|
||||
{
|
||||
_popup.PopupPredicted(Loc.GetString("atmos-pipe-layers-component-cannot-adjust-pipes"), ent, args.User);
|
||||
_popup.PopupClient(Loc.GetString("atmos-pipe-layers-component-cannot-adjust-pipes"), ent, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<ToolComponent>(args.Used, out var tool) && _tool.HasQuality(args.Used, ent.Comp.Tool, tool))
|
||||
_tool.UseTool(args.Used, args.User, ent, ent.Comp.Delay, tool.Qualities, new TrySetNextPipeLayerCompletedEvent());
|
||||
_tool.UseTool(args.Used, args.User, ent, ent.Comp.Delay, tool.Qualities, new TrySetNextPipeLayerCompletedEvent());
|
||||
}
|
||||
|
||||
private void OnUseInHandEvent(Entity<AtmosPipeLayersComponent> ent, ref UseInHandEvent args)
|
||||
@@ -141,7 +143,7 @@ public abstract partial class SharedAtmosPipeLayersSystem : EntitySystem
|
||||
var toolName = Loc.GetString(toolProto.ToolName).ToLower();
|
||||
var message = Loc.GetString("atmos-pipe-layers-component-tool-missing", ("toolName", toolName));
|
||||
|
||||
_popup.PopupPredicted(message, ent, args.User);
|
||||
_popup.PopupClient(message, ent, args.User);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -217,7 +219,7 @@ public abstract partial class SharedAtmosPipeLayersSystem : EntitySystem
|
||||
var layerName = GetPipeLayerName(ent.Comp.CurrentPipeLayer);
|
||||
var message = Loc.GetString("atmos-pipe-layers-component-change-layer", ("layerName", layerName));
|
||||
|
||||
_popup.PopupPredicted(message, ent, user);
|
||||
_popup.PopupClient(message, ent, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user