Fix construction from inside containers (#4595)
* Disallow construction of construction ghosts from inside a container * Move IsInContainer check to before doing container ensuring * Move IsInContainer check to HandleStartStructureConstruction to allow building items but not construct structures when inside a cozy locker * Update Resources/Locale/en-US/construction/construction-system.ftl Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -395,6 +395,7 @@ namespace Content.Server.Construction
|
||||
|
||||
private async void HandleStartStructureConstruction(TryStartStructureConstructionMessage ev, EntitySessionEventArgs args)
|
||||
{
|
||||
|
||||
if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype))
|
||||
{
|
||||
Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!");
|
||||
@@ -417,6 +418,12 @@ namespace Content.Server.Construction
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.IsInContainer())
|
||||
{
|
||||
user.PopupMessageCursor(Loc.GetString("construction-system-inside-container"));
|
||||
return;
|
||||
}
|
||||
|
||||
var startNode = constructionGraph.Nodes[constructionPrototype.StartNode];
|
||||
var targetNode = constructionGraph.Nodes[constructionPrototype.TargetNode];
|
||||
var pathFind = constructionGraph.Path(startNode.Name, targetNode.Name);
|
||||
|
||||
Reference in New Issue
Block a user