Workbench UI improve (#1508)
* grid workbench * categorization * Update CP14WorkbenchWindow.xaml.cs * conditions * categories
This commit is contained in:
@@ -92,11 +92,16 @@ public sealed partial class CP14WorkbenchSystem : CP14SharedWorkbenchSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var resultEntities = new HashSet<EntityUid>();
|
||||
for (int i = 0; i < recipe.ResultCount; i++)
|
||||
//Check conditions
|
||||
var passConditions = true;
|
||||
foreach (var condition in recipe.Conditions)
|
||||
{
|
||||
var resultEntity = Spawn(recipe.Result);
|
||||
resultEntities.Add(resultEntity);
|
||||
if (!condition.CheckCondition(EntityManager, _proto, ent, args.User))
|
||||
{
|
||||
condition.FailedEffect(EntityManager, _proto, ent, args.User);
|
||||
passConditions = false;
|
||||
}
|
||||
condition.PostCraft(EntityManager, _proto, ent, args.User);
|
||||
}
|
||||
|
||||
foreach (var req in recipe.Requirements)
|
||||
@@ -104,10 +109,20 @@ public sealed partial class CP14WorkbenchSystem : CP14SharedWorkbenchSystem
|
||||
req.PostCraft(EntityManager, _proto, placedEntities);
|
||||
}
|
||||
|
||||
//We teleport result to workbench AFTER craft.
|
||||
foreach (var resultEntity in resultEntities)
|
||||
if (passConditions)
|
||||
{
|
||||
_transform.SetCoordinates(resultEntity, Transform(ent).Coordinates.Offset(new Vector2(_random.NextFloat(-0.25f, 0.25f), _random.NextFloat(-0.25f, 0.25f))));
|
||||
var resultEntities = new HashSet<EntityUid>();
|
||||
for (var i = 0; i < recipe.ResultCount; i++)
|
||||
{
|
||||
var resultEntity = Spawn(recipe.Result);
|
||||
resultEntities.Add(resultEntity);
|
||||
}
|
||||
|
||||
//We teleport result to workbench AFTER craft.
|
||||
foreach (var resultEntity in resultEntities)
|
||||
{
|
||||
_transform.SetCoordinates(resultEntity, Transform(ent).Coordinates.Offset(new Vector2(_random.NextFloat(-0.25f, 0.25f), _random.NextFloat(-0.25f, 0.25f))));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateUIRecipes(ent);
|
||||
|
||||
Reference in New Issue
Block a user