暂存
This commit is contained in:
Binary file not shown.
@@ -322,7 +322,7 @@
|
||||
</categories>
|
||||
</fuelFilter>
|
||||
<fuelCapacity>50</fuelCapacity>
|
||||
<fuelConsumptionRate>25</fuelConsumptionRate>
|
||||
<fuelConsumptionRate>12.5</fuelConsumptionRate>
|
||||
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
|
||||
</li>
|
||||
|
||||
@@ -337,7 +337,7 @@
|
||||
</categories>
|
||||
</fuelFilter>
|
||||
<fuelCapacity>50</fuelCapacity>
|
||||
<fuelConsumptionRate>25</fuelConsumptionRate>
|
||||
<fuelConsumptionRate>12.5</fuelConsumptionRate>
|
||||
<consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed>
|
||||
</li>
|
||||
</comps>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ArachnaeSwarm
|
||||
public class CompMultiFuelSpawner : ThingComp
|
||||
{
|
||||
private int ticksUntilSpawn;
|
||||
private List<IFuelSource> fuelComps; // Changed to use the interface
|
||||
private List<IFuelSource> fuelComps;
|
||||
|
||||
public CompProperties_MultiFuelSpawner Props => (CompProperties_MultiFuelSpawner)props;
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace ArachnaeSwarm
|
||||
{
|
||||
ResetCountdown();
|
||||
}
|
||||
// Find all components that implement our interface
|
||||
fuelComps = parent.GetComps<ThingComp>().OfType<IFuelSource>().ToList();
|
||||
}
|
||||
|
||||
@@ -54,21 +53,20 @@ namespace ArachnaeSwarm
|
||||
base.CompTick();
|
||||
|
||||
if (fuelComps.NullOrEmpty()) return;
|
||||
|
||||
// Check if all fuel sources have fuel
|
||||
|
||||
bool allFuelsOk = fuelComps.All(c => c.HasFuel);
|
||||
|
||||
|
||||
if (allFuelsOk && (parent.GetComp<CompPowerTrader>()?.PowerOn ?? true))
|
||||
{
|
||||
// CORRECTED LOGIC: Consume fuel every tick
|
||||
foreach (var comp in fuelComps)
|
||||
{
|
||||
comp.Notify_UsedThisTick();
|
||||
}
|
||||
|
||||
ticksUntilSpawn--;
|
||||
if (ticksUntilSpawn <= 0)
|
||||
{
|
||||
// Consume fuel from all sources
|
||||
foreach (var comp in fuelComps)
|
||||
{
|
||||
comp.Notify_UsedThisTick();
|
||||
}
|
||||
|
||||
TryDoSpawn();
|
||||
ResetCountdown();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,12 @@ namespace ArachnaeSwarm
|
||||
// ... and so on
|
||||
}
|
||||
|
||||
// We already have Notify_UsedThisTick from the previous step.
|
||||
// If not, we would add it here.
|
||||
public new void Notify_UsedThisTick()
|
||||
{
|
||||
if (Props.consumeFuelOnlyWhenUsed)
|
||||
{
|
||||
ConsumeFuel(Props.fuelConsumptionRate / 60000f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user