[CV] Variables cross-reference between parts they shouldn't
DrprofLuigi opened this issue ยท 1 comments
In older MTS versions, if a variable was zero, the part would then check the parent for a value.
With the new CV update, it seems the parent parts can pull values from a child part. Then other child parts will see that value, causing infinitely growing variable values.
This happened with my driveshafts which cause them to stick out from the front of the vehicles, however that was able to be mitigated through careful variable naming. However I also discovered this issue with my crates, which cannot be avoided.
The core VM that determines if crates can continue to be stacked is here:
"parts": [
{
"pos": [0, 0.375, 0],
"types": ["interactable_crate", "interactable_barrel", "generic_furniture_single", "interactable_luggage"],
"minValue": 0,
"maxValue": 2,
"interactableVariables": [["remainingHeight"]]
}
]
If remainingHeight
< 0 then the part is not interactable.
{
"variable": "remainingHeight",
"animations": [
{
"animationType": "translation",
"variable": "crateHeightLimit",
"axis": [0, 0, 1]
},
{
"animationType": "translation",
"variable": "part_stackHeight",
"axis": [0, -1, 0]
},
{
"animationType": "translation",
"variable": "part_height",
"axis": [0, -1, 0]
},
{//This is to prevent the variable from being zero by nudging it a bit
"animationType": "translation",
"variable": "unuisbest",
"axis": [0, -0.001, 0]
}
]
}
This is on each crate, and toggles the intractability of the slot above the crate.
When the crate is stacked in a single stack, it behaves as expected:
When a single crate branches into two stacks (two single crates on a double crate), the variables add erroneously:
And when two crates are placed, they add variables to eachother resulting an infinitely growing variable:
Even when a fresh crate is placed alone, the variables continues to grow, which I can't really explain:
I can confirm that this did not happen in earlier versions. This is likely cause by the variable 'pathing' getting wires crossed when referencing variables with the same name.
Here is the complete variableModifiers
section:
"variableModifiers": [
{
"variable": "part_stackHeight",
"animations": [
{
"animationType": "translation",
"variable": "parent_part_stackHeight",
"axis": [0, 0, 1]
},
{
"animationType": "translation",
"variable": "part_height",
"axis": [0, 1, 0]
}
]
},
{
"variable": "remainingHeight",
"animations": [
{
"animationType": "translation",
"variable": "crateHeightLimit",
"axis": [0, 0, 1]
},
{
"animationType": "translation",
"variable": "part_stackHeight",
"axis": [0, -1, 0]
},
{
"animationType": "translation",
"variable": "part_height",
"axis": [0, -1, 0]
},
{
"animationType": "translation",
"variable": "unuisbest",
"axis": [0, -0.001, 0]
}
]
}
]
It is very likely that the issue is in parent_part_stackHeight
, where the system gets confused at what the variable is referencing due to the parent_
prefix (this seems to be a common problem with the CV system).
What should happen is parent_part_stackHeight
sets the value of part_stackHeight
, and both values should be constant (it is the value of the parent variable plus the height of the crate). However what is actually happening is that there is a feedback loop causing this value to infinitely increase.