mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
EntityInsertConstructionGraphStep accepts an amount (#46268)
* commit * self review * x * format --------- Co-authored-by: iaada <iaada@users.noreply.github.com> Co-authored-by: Pok245 <113675512+Pok27@users.noreply.github.com>
This commit is contained in:
parent
3bce58629d
commit
fb9401cf6a
5 changed files with 22 additions and 6 deletions
|
|
@ -206,6 +206,7 @@ namespace Content.Server.Construction
|
|||
break;
|
||||
|
||||
case ArbitraryInsertConstructionGraphStep arbitraryStep:
|
||||
var toFind = arbitraryStep.Amount;
|
||||
foreach (var entity in new HashSet<EntityUid>(EnumerateNearby(user)))
|
||||
{
|
||||
if (!arbitraryStep.EntityValid(entity, EntityManager, Factory))
|
||||
|
|
@ -228,8 +229,12 @@ namespace Content.Server.Construction
|
|||
else if (!_container.Insert(entity, GetContainer(arbitraryStep.Store)))
|
||||
continue;
|
||||
|
||||
handled = true;
|
||||
used.Add(entity);
|
||||
toFind--;
|
||||
if (toFind > 0)
|
||||
continue;
|
||||
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Content.Shared.Construction.Steps
|
|||
return new ConstructionGuideEntry
|
||||
{
|
||||
Localization = "construction-presenter-arbitrary-step",
|
||||
Arguments = new (string, object)[]{("name", stepName)},
|
||||
Arguments = [("name", stepName), ("amount", Amount)],
|
||||
Icon = Icon,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,17 @@ namespace Content.Shared.Construction.Steps
|
|||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract partial class EntityInsertConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
[DataField("store")] public string Store { get; private set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// A container ID to store the entity in.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public string Store { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// How many of the entity is needed.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public int Amount { get; private set; } = 1;
|
||||
|
||||
public abstract bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ namespace Content.Shared.Construction.Steps
|
|||
[DataField("material", required:true)]
|
||||
public ProtoId<StackPrototype> MaterialPrototypeId { get; private set; }
|
||||
|
||||
[DataField] public int Amount { get; private set; } = 1;
|
||||
|
||||
public override void DoExamine(ExaminedEvent examinedEvent)
|
||||
{
|
||||
var material = IoCManager.Resolve<IPrototypeManager>().Index(MaterialPrototypeId);
|
||||
|
|
|
|||
|
|
@ -5,5 +5,8 @@ construction-presenter-step-wrapper = {$step-number}. {$text}
|
|||
|
||||
construction-presenter-tool-step = Use a {LOC($tool)}.
|
||||
construction-presenter-material-step = Add {$amount}x {LOC($material)}.
|
||||
construction-presenter-arbitrary-step = Add {LOC($name)}.
|
||||
construction-presenter-arbitrary-step = Add {$amount ->
|
||||
[one] {LOC($name)}.
|
||||
*[many] {$amount}x {MAKEPLURAL(LOC($name))}.
|
||||
}
|
||||
construction-presenter-temperature-step = Heat to {$temperature}.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue