Deconstruction Features (#1242)

* ConstructionSystem now detects when a tool is used on an arbitrary entity.

* Refactored building logic from ConstructionComponent to ConstructionSystem.

* Add OnDeconstruct events so that deconstruction can be blocked if prerequisites are not met.

* Multi-step deconstruction works.
Windows can be deconstructed using a screwdriver.

* In-hand construction and deconstruction works.

* Intermediate entities now have a better name assigned to them when created.

* Removed a question mark to appease Jenkins.

* Instead of running ExposeData on the existing ItemComponent of an intermediateFrame, the system will now replace the existing ItemComponent with a new one, and run ExposeData on the new one.
This commit is contained in:
Acruid
2020-07-02 14:50:57 -07:00
committed by GitHub
parent 6c205c4a79
commit 3ee480a3b1
8 changed files with 480 additions and 162 deletions

View File

@@ -2,6 +2,7 @@
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
@@ -48,6 +49,23 @@ namespace Content.Server.GameObjects.Components.Power
}
}
public override void HandleMessage(ComponentMessage message, IComponent component)
{
base.HandleMessage(message, component);
switch (message)
{
case BeginDeconstructCompMsg msg:
if (!msg.BlockDeconstruct && !(_lightBulbContainer.ContainedEntity is null))
{
var notifyManager = IoCManager.Resolve<IServerNotifyManager>();
notifyManager.PopupMessage(Owner, msg.User, "Remove the bulb.");
msg.BlockDeconstruct = true;
}
break;
}
}
public bool InteractUsing(InteractUsingEventArgs eventArgs)
{
return InsertBulb(eventArgs.Using);