Regression on handling the `TweakScaleRogueDuplicate` patching problem.
Lisias opened this issue · 7 comments
A bug on a workaround code for an old problem was found on TS 2.4.6.22 .
In the past, bad patches were plaguing the TweakScale ecosystem, and one of that bad patching is injecting TweakScale twice in a part. I don't need to explain what would happen with two TS modules trying to scale the same part at the same time.
We can easily reproduce this using the following patch somewhere in your GameData:
ship = Untitled Space Craft
version = 1.4.3
description =
type = VAB
size = 0.905763268,1.24505234,0.905763268
persistentId = 3392072693
rot = 0,0,0,0
missionFlag = Squad/Flags/default
vesselType = Debris
PART
{
part = probeCoreSphere_4294689086
partName = Part
persistentId = 2354039458
pos = 0,15,0
attPos = 0,0,0
attPos0 = 0,15,0
rot = 0,0,0,1
attRot = 0,0,0,1
attRot0 = 0,0,0,1
mir = 1,1,1
symMethod = Radial
autostrutMode = Off
rigidAttachment = False
istg = -1
resPri = 0
dstg = 0
sidx = -1
sqor = -1
sepI = -1
attm = 0
modCost = 0
modMass = 0
modSize = 0,0,0
link = strutCube_4294678208
attN = bottom,strutCube_4294678208_0|-0.3383468|0
EVENTS
{
}
ACTIONS
{
}
PARTDATA
{
}
MODULE
{
name = ModuleCommand
isEnabled = True
hibernation = False
hibernateOnWarp = False
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
MakeReferenceToggle
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
HibernateToggle
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleKerbNetAccess
isEnabled = True
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
OpenKerbNetAction
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleDataTransmitter
isEnabled = True
xmitIncomplete = False
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
StartTransmissionAction
{
actionGroup = None
active = False
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = TweakScale
isEnabled = True
type = stack
active = True
available = True
currentScale = 0.625
defaultScale = 0.625
defaultTransformScale = (0, 0, 0)
DryCost = 300
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = AttachedOnEditor
isEnabled = True
active = True
originalPos = (0, 15, 0)
originalRotation = (0, 0, 0, 1)
moduleVersion = 6
stagingEnabled = True
originalAttachNodePos = (0.0, -0.3, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, -1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleTripLogger
isEnabled = True
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
Log
{
flight = 0
}
UPGRADESAPPLIED
{
}
}
RESOURCE
{
name = ElectricCharge
amount = 10
maxAmount = 10
flowState = True
isTweakable = True
hideFlow = False
isVisible = True
flowMode = Both
}
}
PART
{
part = strutCube_4294678208
partName = Part
persistentId = 1812148777
pos = 0,14.5329189,0
attPos = 0,0,0
attPos0 = 0,-0.46708107,0
rot = 0,0,0,1
attRot = 0,0,0,1
attRot0 = 0,0,0,1
mir = 1,1,1
symMethod = Radial
autostrutMode = Off
rigidAttachment = False
istg = -1
resPri = 0
dstg = 0
sidx = -1
sqor = -1
sepI = -1
attm = 0
modCost = 0
modMass = 0
modSize = 0,0,0
attN = top,probeCoreSphere_4294689086_0|0.1287344|0
EVENTS
{
}
ACTIONS
{
}
PARTDATA
{
}
MODULE
{
name = TweakScale
isEnabled = True
type = stack
active = True
available = True
currentScale = 0.3125
defaultScale = 0.3125
defaultTransformScale = (0, 0, 0)
DryCost = 16
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = AttachedOnEditor
isEnabled = True
active = True
originalPos = (0, 14.5329189, 0)
originalRotation = (0, 0, 0, 1)
moduleVersion = 6
stagingEnabled = True
originalAttachNodePos = (0.0, 0.1, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, 1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
originalAttachNodePos = (0.0, -0.1, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, -1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = TweakScaleRogueDuplicate // Programatically tainted due duplicity. Only one single instance above should exist, usually the first one.
isEnabled = True
type = stack
active = False
available = False
currentScale = 3125
defaultScale = 3125
defaultTransformScale = (0, 0, 0)
DryCost = 0
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
}
From this point, all strutCube parts will have two TweakScale sections in your craft and sfs files:
ship = Untitled Space Craft
version = 1.4.3
description =
type = VAB
size = 0.905763268,1.24505234,0.905763268
persistentId = 3392072693
rot = 0,0,0,0
missionFlag = Squad/Flags/default
vesselType = Debris
PART
{
part = probeCoreSphere_4294689086
partName = Part
persistentId = 2354039458
pos = 0,15,0
attPos = 0,0,0
attPos0 = 0,15,0
rot = 0,0,0,1
attRot = 0,0,0,1
attRot0 = 0,0,0,1
mir = 1,1,1
symMethod = Radial
autostrutMode = Off
rigidAttachment = False
istg = -1
resPri = 0
dstg = 0
sidx = -1
sqor = -1
sepI = -1
attm = 0
modCost = 0
modMass = 0
modSize = 0,0,0
link = strutCube_4294678208
attN = bottom,strutCube_4294678208_0|-0.3383468|0
EVENTS
{
}
ACTIONS
{
}
PARTDATA
{
}
MODULE
{
name = ModuleCommand
isEnabled = True
hibernation = False
hibernateOnWarp = False
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
MakeReferenceToggle
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
HibernateToggle
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleKerbNetAccess
isEnabled = True
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
OpenKerbNetAction
{
actionGroup = None
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleDataTransmitter
isEnabled = True
xmitIncomplete = False
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
StartTransmissionAction
{
actionGroup = None
active = False
wasActiveBeforePartWasAdjusted = False
}
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = TweakScale
isEnabled = True
type = stack
active = True
available = True
currentScale = 0.625
defaultScale = 0.625
defaultTransformScale = (0, 0, 0)
DryCost = 300
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = AttachedOnEditor
isEnabled = True
active = True
originalPos = (0, 15, 0)
originalRotation = (0, 0, 0, 1)
moduleVersion = 6
stagingEnabled = True
originalAttachNodePos = (0.0, -0.3, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, -1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = ModuleTripLogger
isEnabled = True
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
Log
{
flight = 0
}
UPGRADESAPPLIED
{
}
}
RESOURCE
{
name = ElectricCharge
amount = 10
maxAmount = 10
flowState = True
isTweakable = True
hideFlow = False
isVisible = True
flowMode = Both
}
}
PART
{
part = strutCube_4294678208
partName = Part
persistentId = 1812148777
pos = 0,14.5329189,0
attPos = 0,0,0
attPos0 = 0,-0.46708107,0
rot = 0,0,0,1
attRot = 0,0,0,1
attRot0 = 0,0,0,1
mir = 1,1,1
symMethod = Radial
autostrutMode = Off
rigidAttachment = False
istg = -1
resPri = 0
dstg = 0
sidx = -1
sqor = -1
sepI = -1
attm = 0
modCost = 0
modMass = 0
modSize = 0,0,0
attN = top,probeCoreSphere_4294689086_0|0.1287344|0
EVENTS
{
}
ACTIONS
{
}
PARTDATA
{
}
MODULE
{
name = TweakScale
isEnabled = True
type = stack
active = True
available = True
currentScale = 0.3125
defaultScale = 0.3125
defaultTransformScale = (0, 0, 0)
DryCost = 16
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = AttachedOnEditor
isEnabled = True
active = True
originalPos = (0, 14.5329189, 0)
originalRotation = (0, 0, 0, 1)
moduleVersion = 6
stagingEnabled = True
originalAttachNodePos = (0.0, 0.1, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, 1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
originalAttachNodePos = (0.0, -0.1, 0.0)
originalAttachNodeSize = 0
originalAttachNodeOrientation = (0.0, -1.0, 0.0)
originalAttachNodeOffset = (0.0, 0.0, 0.0)
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
MODULE
{
name = TweakScaleRogueDuplicate // Programatically tainted due duplicity. Only one single instance above should exist, usually the first one.
isEnabled = True
type = stack
active = False
available = False
currentScale = 3125
defaultScale = 3125
defaultTransformScale = (0, 0, 0)
DryCost = 0
OriginalCrewCapacity = 0
stagingEnabled = True
EVENTS
{
}
ACTIONS
{
}
UPGRADESAPPLIED
{
}
}
}
Everything was fine for some years, until I had changed something on 2.4.6.22 to solve another issue, and created this one by accident: when saving a game (after loading it with mangled crafts made by previous TS versions), or when launching the craft from VAB/SPH on 2.4.6.22, you will get screwed: the craft will not launch (at best), and you will not be able to save your game (at worst!).
The following exception will be found in your KSP.log
:
[WRN 18:13:04.257] [Part]: PartModule indexing mismatch at strutCube, index 4.
Node 'TweakScaleRogueDuplicate' found in loaded data, but 'TweakScale' is defined in prefab.
Looking for TweakScaleRogueDuplicate in other indices...
[WRN 18:13:04.257] ...no TweakScaleRogueDuplicate module found on part definition. Skipping...
[LOG 18:13:04.257] Untitled Space Craft loaded!
[EXC 18:13:05.849] NullReferenceException: Object reference not set to an instance of an object
TweakScale.TweakScale.OnSave (ConfigNode node) (at <cf1abb1b50de40fe83042990f01ebf6f>:0)
PartModule.Save (ConfigNode node) (at <106570632fc343a784fad39e75e877bf>:0)
ShipConstruct.SaveShip () (at <106570632fc343a784fad39e75e877bf>:0)
ShipConstruction.CreateBackup (ShipConstruct ship) (at <106570632fc343a784fad39e75e877bf>:0)
FlightDriver.setStartupNewVessel () (at <106570632fc343a784fad39e75e877bf>:0)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
KSPe.Util.Log.UnityLogDecorator:UnityEngine.ILogHandler.LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
FlightDriver:setStartupNewVessel()
FlightDriver:Start()
This was reproduced on KSP 1.12.5 and KSP 1.4.3 - no chance of being anything else but a TS bug.
Search & Destroy this damned problem.
Also on Forum.
The most damaging bugs usually happens due the most silly of the mistakes. #facepalm.
Embarrassingly fixed by commit bb8d952
As requested, the log files from Professor_K for rouge patch checking.
More log files from Professor_K.
KSP.log.zip
ModuleManager.ConfigCache.zip
Logs.ModuleManager.zip
Rescue Mk2.craft.zip