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