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)
|
private async void HandleStartStructureConstruction(TryStartStructureConstructionMessage ev, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype))
|
if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype))
|
||||||
{
|
{
|
||||||
Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!");
|
Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!");
|
||||||
@@ -417,6 +418,12 @@ namespace Content.Server.Construction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.IsInContainer())
|
||||||
|
{
|
||||||
|
user.PopupMessageCursor(Loc.GetString("construction-system-inside-container"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var startNode = constructionGraph.Nodes[constructionPrototype.StartNode];
|
var startNode = constructionGraph.Nodes[constructionPrototype.StartNode];
|
||||||
var targetNode = constructionGraph.Nodes[constructionPrototype.TargetNode];
|
var targetNode = constructionGraph.Nodes[constructionPrototype.TargetNode];
|
||||||
var pathFind = constructionGraph.Path(startNode.Name, targetNode.Name);
|
var pathFind = constructionGraph.Path(startNode.Name, targetNode.Name);
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
construction-system-construct-cannot-start-another-construction = You can't start another construction now!
|
construction-system-construct-cannot-start-another-construction = You can't start another construction now!
|
||||||
construction-system-construct-no-materials = You don't have the materials to build that!
|
construction-system-construct-no-materials = You don't have the materials to build that!
|
||||||
construction-system-already-building = You are already building that!
|
construction-system-already-building = You are already building that!
|
||||||
|
construction-system-inside-container = You can't build while you're there!
|
||||||
|
|||||||
Reference in New Issue
Block a user