ScrapYard (SYD) by magico13

ScrapYard (SYD) by magico13

4.2k Downloads

[Bug ๐Ÿž]: Fail to re-use command pods

zer0Kerbal opened this issue ยท 7 comments

commented

Alexsys

Posted July 27 (edited)
Gents,

For some reason Scrapyard fails to reuse Command pods, they just stack up every time, 1 use each.

When I apply it, it appears "1 previous use" for a split second, then switches to Part Is New immediately.

Command pods aren't in favor or something?

Ofc I run it with KCT and kerbalism

Writes this in the log, for some reason

[LOG 22:03:11.816] [ScrapYard] Copied tracker. Recovered 1 times with id 2740612802
[LOG 22:03:11.816] [ScrapYard] Found inventory part on vessel that is not in inventory. Resetting. mk1pod.v2:2740612802

https://www.dropbox.com/s/ud0qj4mdn6e6087/KSP.log?dl=0 zi log
KSP.log

commented

Alexsys
confirmed.

from new compiled 2.2.99.0-prerelease (no CC.dll)

KSP.log:9619:[LOG 22:44:52.608] [ScrapYard] VerifyEditor.ApplyInventoryToVessel: 0ms
KSP.log:9620:[LOG 22:44:52.608] [ScrapYard] Copy: 0ms
KSP.log:9621:[LOG 22:44:52.608] [ScrapYard] Convert To IParts: 0ms
KSP.log:9622:[LOG 22:44:52.608] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. mk1pod.v2:416852418
KSP.log:9625:[LOG 22:44:52.608] [ScrapYard] Check Parts: 0ms
KSP.log:9627:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <ef3e45a011a34dcb890693cee6e67d1f>:0)
KSP.log:9628:	ScrapYard.ScrapYard.VerifyEditor () (at <ef3e45a011a34dcb890693cee6e67d1f>:0)
KSP.log:9634:[LOG 22:45:00.627] [ScrapYard] Found a part in inventory for mk1pod.v2
KSP.log:9635:[LOG 22:45:00.627] [ScrapYard] VerifyEditor.ApplyInventoryToVessel: 0ms
KSP.log:9636:[LOG 22:45:00.627] [ScrapYard] Copy: 0ms
KSP.log:9637:[LOG 22:45:00.627] [ScrapYard] Convert To IParts: 0ms
KSP.log:9638:[LOG 22:45:00.627] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. mk1pod.v2:416852418
KSP.log:9641:[LOG 22:45:00.627] [ScrapYard] Check Parts: 0ms
KSP.log:9643:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <ef3e45a011a34dcb890693cee6e67d1f>:0)
KSP.log:9644:	ScrapYard.ScrapYard.VerifyEditor () (at <ef3e45a011a34dcb890693cee6e67d1f>:0)
KSP.log:9651:[LOG 22:45:01.690] [ScrapYard] Copy: 0ms

KSP.log:9866:[LOG 22:45:13.655] [ScrapYard] Vessel Rollout!
KSP.log:9869:[LOG 22:45:13.655] [ScrapYard] Adding build (parts)
KSP.log:9870:[LOG 22:45:13.655] [ScrapYard] mk1pod.v2 has been used 5/5/0 (T/N/I) times.
KSP.log:9871:[LOG 22:45:13.655] [ScrapYard] mk1pod.v2 has been used in 4/4/0 (T/N/I) builds.
KSP.log:9876:[LOG 22:45:13.661] [ScrapYard] OnSave
commented

@Lisias

issues seem to be here:

public static void VerifyEditorShip()
{
//make a copy of the inventory
PartInventory copy;
using (Logging.Timer.StartNew("Copy"))
{
copy = ScrapYard.Instance.TheInventory.Copy();
}
using (Logging.Timer.StartNew("Check Parts"))
{
long constTime = 0;
long removeTime = 0;
long findTime = 0;
//long freshTime = 0;
//foreach (Part part in EditorLogic.fetch?.ship?.Parts ?? new List<Part>())
List<InventoryPart> editorParts = null;
using (Logging.Timer.StartNew("Convert To IParts"))
{
editorParts = EditorLogic.fetch?.ship?.Parts?.Select(p => new InventoryPart(p))?.ToList();
}
if (editorParts != null)
{
for (int i = 0; i < editorParts.Count; i++)
{
Stopwatch constWatch = Stopwatch.StartNew();
InventoryPart iPart = editorParts[i];//new InventoryPart(part);
constTime += constWatch.ElapsedMilliseconds;
//Stopwatch freshWatch = Stopwatch.StartNew();
//if (iPart.ID == null)
//{
// (EditorLogic.fetch.ship.Parts[i].Modules["ModuleSYPartTracker"] as ModuleSYPartTracker).MakeFresh();
//}
//freshTime += freshWatch.ElapsedMilliseconds;
if (iPart.TrackerModule.Inventoried)
{
Stopwatch remWatch = Stopwatch.StartNew();
InventoryPart inInventory = copy.RemovePart(iPart, ComparisonStrength.STRICT); //strict, we only remove parts that are exact
if (inInventory == null)
{
//reset their tracker status
Logging.Log($"Found inventory part on vessel that is not in inventory. Resetting. {iPart.Name}:{iPart.ID}");
(EditorLogic.fetch.ship.Parts[i].Modules["ModuleSYPartTracker"] as ModuleSYPartTracker).MakeFresh();
}
removeTime += remWatch.ElapsedMilliseconds;
}
else
{
//check that we're not sharing an ID with something in the inventory
Stopwatch findWatch = Stopwatch.StartNew();
InventoryPart inInventory = copy.FindPart(iPart.ID);
if (inInventory != null)
{
//found a part that is sharing an ID but shouldn't be
Logging.Log($"Found part on vessel with same ID as inventory part, but not matching. Resetting. {iPart.Name}:{iPart.ID}");
(EditorLogic.fetch.ship.Parts[i].Modules["ModuleSYPartTracker"] as ModuleSYPartTracker).MakeFresh();
}
findTime += findWatch.ElapsedMilliseconds;
}
}
}
Logging.DebugLog($"Constructor: {constTime}");
Logging.DebugLog($"Removal: {removeTime}");
Logging.DebugLog($"Finding: {findTime}");
//Logging.Log($"Freshening: {freshTime}");
}
using (Logging.Timer.StartNew("Update Part List"))
{
//update the part list if visible
if (ScrapYard.Instance.InstanceSelectorUI.IsVisible)
{
ScrapYard.Instance.InstanceSelectorUI.InstanceVM?.UpdatePartList();
}
}
}

commented

much smaller/focused log (screened with LogExport v1.2

__SYD-LOG-2023-01-0822-51-10.txt

commented

I have a hunch @Lisias that this has to do with mk1pod vs mk1pod.v2
will experiment with other pods and the landercan - which also has a .v2

commented

it seems ^^^ is part of the issue

KSP.log:11187:[LOG 23:20:04.487] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. xmas-tree:2125076484
KSP.log:11190:[LOG 23:20:04.487] [ScrapYard] Check Parts: 0ms
KSP.log:11192:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11193:	ScrapYard.ScrapYard.VerifyEditor () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)

xmas-tree (a pod) seems to work properly.

but the mk2LanderCabin.v2 can


KSP.log:11857:[LOG 23:20:56.893] [ScrapYard] Found a part in inventory for mk2LanderCabin.v2
KSP.log:11858:[LOG 23:20:56.894] [ScrapYard] VerifyEditor.ApplyInventoryToVessel: 0ms
KSP.log:11859:[LOG 23:20:56.894] [ScrapYard] Copy: 0ms
KSP.log:11860:[LOG 23:20:56.894] [ScrapYard] Convert To IParts: 0ms
KSP.log:11861:[LOG 23:20:56.894] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. mk2LanderCabin.v2:328767103
KSP.log:11864:[LOG 23:20:56.894] [ScrapYard] Check Parts: 0ms
KSP.log:11866:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11867:	ScrapYard.ScrapYard.VerifyEditor () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11872:[LOG 23:21:02.234] [ScrapYard] Disabled on_partDropped
KSP.log:11873:[LOG 23:21:02.234] [ScrapYard] Disabled st_place
KSP.log:11874:[LOG 23:21:02.275] [ScrapYard] Found a part in inventory for mk2LanderCabin.v2
KSP.log:11875:[LOG 23:21:02.920] [ScrapYard] Found a part in inventory for mk2LanderCabin.v2
KSP.log:11876:[LOG 23:21:02.920] [ScrapYard] VerifyEditor.ApplyInventoryToVessel: 0ms
KSP.log:11877:[LOG 23:21:02.920] [ScrapYard] Copy: 0ms
KSP.log:11878:[LOG 23:21:02.920] [ScrapYard] Convert To IParts: 0ms
KSP.log:11879:[LOG 23:21:02.920] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. mk2LanderCabin.v2:328767103
KSP.log:11882:[LOG 23:21:02.920] [ScrapYard] Check Parts: 0ms
KSP.log:11884:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11885:	ScrapYard.ScrapYard.VerifyEditor () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11890:[LOG 23:21:03.165] [ScrapYard] Restored st_place
KSP.log:11891:[LOG 23:21:03.165] [ScrapYard] Restored on_partDropped
KSP.log:11892:[LOG 23:21:05.009] [ScrapYard] Disabled on_partDropped
KSP.log:11893:[LOG 23:21:05.009] [ScrapYard] Disabled st_place
KSP.log:11897:[LOG 23:21:05.523] [ScrapYard] Restored st_place
KSP.log:11898:[LOG 23:21:05.523] [ScrapYard] Restored on_partDropped
KSP.log:11899:[LOG 23:21:05.960] [ScrapYard] Found a part in inventory for mk2LanderCabin.v2
KSP.log:11900:[LOG 23:21:05.960] [ScrapYard] VerifyEditor.ApplyInventoryToVessel: 0ms
KSP.log:11901:[LOG 23:21:05.960] [ScrapYard] Copy: 0ms
KSP.log:11902:[LOG 23:21:05.960] [ScrapYard] Convert To IParts: 0ms
KSP.log:11903:[LOG 23:21:05.960] [ScrapYard] Found part on vessel with same ID as inventory part, but not matching. Resetting. mk2LanderCabin.v2:328767103
KSP.log:11906:[LOG 23:21:05.960] [ScrapYard] Check Parts: 0ms
KSP.log:11908:	ScrapYard.Utilities.EditorHandling.VerifyEditorShip () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11909:	ScrapYard.ScrapYard.VerifyEditor () (at <e7f0cede827e4778bb2b7539f4dc0f47>:0)
KSP.log:11927:[LOG 23:21:07.077] [ScrapYard] OnSave
KSP.log:11928:[LOG 23:21:07.077] [ScrapYard] Saved Part Inventory of size 14 in 0ms

__SYD-LOG-2023-01-0823-26-37.txt

commented

closing because cannot duplicate
__SYD-LOG-2023-01-0823-49-34.txt
KSP.log

commented

doh
somehow misplaced the <ModuleSYPartTracker.cfg> config - with it in place - no issues.
__SYD-LOG-2023-01-0823-41-27.txt
KSP.zip