Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construction Improvements #1381

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;
Expand Down Expand Up @@ -38,7 +37,6 @@ internal class ConstructionSystem : Shared.GameObjects.EntitySystems.Constructio
#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>();
Expand Down Expand Up @@ -117,32 +115,17 @@ private void HandleToolInteraction(AfterInteractMessage msg)

// 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)
Expand All @@ -157,6 +140,7 @@ private void HandleToolInteraction(AfterInteractMessage msg)
return;

// --- GOOD TO GO ---
msg.Handled = true;

// pop off the material and switch to frame
var targetEntPos = targetEnt.Transform.MapPosition;
Expand Down