Finish refactoring tools. Add multitools. (as in multiple tools in one)

This commit is contained in:
zumorica
2020-04-29 13:43:07 +02:00
parent ca5638badf
commit ff5549a0d1
37 changed files with 840 additions and 467 deletions

View File

@@ -1,11 +1,12 @@
using System;
using System.Threading;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.VendingMachines;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Server.GameObjects;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
@@ -200,27 +201,28 @@ namespace Content.Server.GameObjects.Components.Doors
public bool AttackBy(AttackByEventArgs eventArgs)
{
if (eventArgs.AttackWith.HasComponent<CrowbarComponent>())
{
if (IsPowered())
{
var notify = IoCManager.Resolve<IServerNotifyManager>();
notify.PopupMessage(Owner, eventArgs.User, "The powered motors block your efforts!");
return true;
}
if (!eventArgs.AttackWith.TryGetComponent<ToolComponent>(out var tool))
return false;
if (State == DoorState.Closed)
{
Open();
}
else if(State == DoorState.Open)
{
Close();
}
if (tool.Behavior != Tool.Crowbar) return false;
if (IsPowered())
{
var notify = IoCManager.Resolve<IServerNotifyManager>();
notify.PopupMessage(Owner, eventArgs.User, "The powered motors block your efforts!");
return true;
}
return false;
if (State == DoorState.Closed)
{
Open();
}
else if(State == DoorState.Open)
{
Close();
}
return true;
}
}
}