* clean up

* Update empire_orders.yml
This commit is contained in:
Ed
2024-11-30 14:16:48 +03:00
committed by GitHub
parent 373d3a892b
commit bb43b37fd8
10 changed files with 379 additions and 238 deletions

View File

@@ -52,7 +52,7 @@ public sealed class CP14ModularCraftSystem : CP14SharedModularCraftSystem
{
foreach (var detail in autoAssemble.Details)
{
TryAddPartToFirstSlot(ent, detail);
TryAddPartToFirstSlot(ent, detail, false); // we want auto assemble when spawned in crates
}
}
}
@@ -77,10 +77,13 @@ public sealed class CP14ModularCraftSystem : CP14SharedModularCraftSystem
return true;
}
}
return false;
}
private bool TryAddPartToFirstSlot(Entity<CP14ModularCraftStartPointComponent> start,
ProtoId<CP14ModularCraftPartPrototype> partProto)
ProtoId<CP14ModularCraftPartPrototype> partProto,
bool blockStorage = true)
{
if (!_proto.TryIndex(partProto, out var partIndexed))
return false;
@@ -91,20 +94,24 @@ public sealed class CP14ModularCraftSystem : CP14SharedModularCraftSystem
if (!start.Comp.FreeSlots.Contains(partIndexed.TargetSlot.Value))
return false;
return TryAddPartToSlot(start, null, partProto, partIndexed.TargetSlot.Value);
return TryAddPartToSlot(start, null, partProto, partIndexed.TargetSlot.Value, blockStorage);
}
private bool TryAddPartToSlot(Entity<CP14ModularCraftStartPointComponent> start,
Entity<CP14ModularCraftPartComponent>? part,
ProtoId<CP14ModularCraftPartPrototype> partProto,
ProtoId<CP14ModularCraftSlotPrototype> slot)
ProtoId<CP14ModularCraftSlotPrototype> slot,
bool blockStorage = true)
{
if (!start.Comp.FreeSlots.Contains(slot))
return false;
var xform = Transform(start);
if (xform.GridUid != xform.ParentUid)
return false;
if (blockStorage)
{
var xform = Transform(start);
if (xform.GridUid != xform.ParentUid)
return false;
}
AddPartToSlot(start, part, partProto, slot);
return true;