Better item construction

This commit is contained in:
Clyybber
2020-06-06 10:40:53 +02:00
parent 5d2282231f
commit 2995981b5e
4 changed files with 84 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Construction;
using Content.Client.Interfaces.GameObjects;
using Content.Shared.Construction;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Client.Graphics;
@@ -236,11 +237,10 @@ namespace Content.Client.Construction
return;
}
if (prototype.Type != ConstructionType.Structure)
if (prototype.Type == ConstructionType.Item)
{
// In-hand attackby doesn't exist so this is the best alternative.
var loc = Owner.Owner.GetComponent<ITransformComponent>().GridPosition;
Owner.SpawnGhost(prototype, loc, Direction.North);
Owner.TryStartItemConstruction(prototype.ID);
BuildButton.Pressed = false;
return;
}

View File

@@ -114,6 +114,12 @@ namespace Content.Client.GameObjects.Components.Construction
SendNetworkMessage(msg);
}
public void TryStartItemConstruction(string prototypeName)
{
var msg = new TryStartItemConstructionMessage(prototypeName);
SendNetworkMessage(msg);
}
public void ClearGhost(int ghostId)
{
if (Ghosts.TryGetValue(ghostId, out var ghost))