UmbraSpaceIndustries / MKS

MKS/OKS Colonization Systems
Other
219 stars 150 forks source link

Fix attachment nodes becoming unusable in editor after undo #1572

Open mhoram-kerbin opened 1 year ago

mhoram-kerbin commented 1 year ago

fix #1571

The attach nodes of Wolf Cargo Containers are defined like this:

    node_stack_side   =    0,  0, -0.5,  0,  0, -1, 1
    node_stack_side_1 =    0,  0,  0.5,  0,  0,  1, 1
    node_stack_side_2 = -0.5,  0,    0, -1,  0,  0, 1
    node_stack_side_4 =  0.5,  0,    0,  1,  0,  0, 1

However after attaching parts to each of the side nodes, they get saved in the .craft file as:

    attN = side,advSasModule_4294251462_0|0|-0.5_0|0|-1_0|0|-0.5_0|0|-1
    attN = side,advSasModule_4294251836_0|0|0.5_0|0|1_0|0|0.5_0|0|1
    attN = side,advSasModule_4294251088_-0.5|0|0_-1|0|0_-0.5|0|0_-1|0|0
    attN = side,advSasModule_4294250716_0.5|0|0_1|0|0_0.5|0|0_1|0|0

This indicates that all 4 attached parts are attached to the same attach node "node_stack_side"

Also in the save game, the Wolf Cargo Container looks like this:

    srfN = srfAttach, -1
    attN = side, -1
    attN = side, -1
    attN = side, -1
    attN = side, -1
    attN = top, 0
    attN = bottom, -1

This indicates four times, that the attach node "node_stack_side" has no part "-1" attached to it but says nothing about the other three attach nodes.

My conclusion is, that the nodestack definitions are parsed in a strange way when more than two underscores "" appear in the definition.

This PR changes the definitions by removing the third underscore.

I can't tell for sure, if this change makes problems for existing savegames, so I would appreciate it, if someone with more experience could verify, if this is a breaking change.