1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 20:53:28 +08:00

try to fix belt signal generation source calculation

This commit is contained in:
2025-08-10 15:34:37 +08:00
parent 0178c8cc2e
commit a9dd130f76

View File

@@ -807,13 +807,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
var result = new Dictionary<int, float>();
var extra = new Dictionary<int, float>();
CalculateAllProductions(result, extra, itemId);
foreach (var p in extra)
{
if (result.TryGetValue(itemId, out var v) && v >= p.Value) continue;
result[itemId] = p.Value;
}
result.Remove(itemId);
foreach (var p in extra)
{
result[p.Key] = (result.TryGetValue(p.Key, out var v) ? v : 0) + p.Value;
}
var cnt = result.Count;
if (cnt == 0)
{
@@ -1253,16 +1253,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
times = count / itemSource.Count;
}
{
result.TryGetValue(itemId, out var oldCount);
result[itemId] = oldCount + count;
}
result[itemId] = (result.TryGetValue(itemId, out var oldCount) ? oldCount : 0) + count;
if (itemSource.Extra != null)
{
foreach (var p in itemSource.Extra)
{
extra.TryGetValue(p.Key, out var oldCount);
extra[p.Key] = oldCount + times * p.Value;
extra[p.Key] = (extra.TryGetValue(p.Key, out oldCount) ? oldCount : 0) + times * p.Value;
}
}