Construction Improvements (#1381)
* Actually set the tool interaction message to handled. Remove the floating text explaining why deconstruction failed. * Removed unused IServerNotifyManager dependency.
This commit is contained in:
@@ -6,7 +6,6 @@ using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
@@ -38,7 +37,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
private readonly Dictionary<string, ConstructionPrototype> _craftRecipes = new Dictionary<string, ConstructionPrototype>();
|
||||
@@ -117,32 +115,17 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
// no known recipe for entity
|
||||
if (!_craftRecipes.TryGetValue(targetPrototype.ID, out var prototype))
|
||||
{
|
||||
_notifyManager.PopupMessage(msg.Attacked, msg.User,
|
||||
"Cannot be deconstructed.");
|
||||
msg.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// there is a recipe, but it can't be deconstructed.
|
||||
var lastStep = prototype.Stages[^1].Backward;
|
||||
if (!(lastStep is ConstructionStepTool))
|
||||
{
|
||||
_notifyManager.PopupMessage(msg.Attacked, msg.User,
|
||||
"Cannot be deconstructed.");
|
||||
msg.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// wrong tool
|
||||
var caps = ((ConstructionStepTool) lastStep).ToolQuality;
|
||||
if ((toolComp.Qualities & caps) == 0)
|
||||
{
|
||||
_notifyManager.PopupMessage(msg.Attacked, msg.User,
|
||||
"Wrong tool to start deconstruct.");
|
||||
msg.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// ask around and see if the deconstruction prerequisites are satisfied
|
||||
// (remove bulbs, approved access, open panels, etc)
|
||||
@@ -157,6 +140,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
return;
|
||||
|
||||
// --- GOOD TO GO ---
|
||||
msg.Handled = true;
|
||||
|
||||
// pop off the material and switch to frame
|
||||
var targetEntPos = targetEnt.Transform.MapPosition;
|
||||
|
||||
Reference in New Issue
Block a user