Biotronic / TweakScale

Forked from Gaius Goodspeed's Goodspeed Aerospace Part & TweakScale plugin
30 stars 58 forks source link

Ability to custom scale mass #2

Closed sirkut closed 10 years ago

sirkut commented 10 years ago

With all the confusion with the massFactors and parts not scaling correctly I think it would be nice if there was a way we could add a custom range of mass values that would be used instead of scaling them with the plugin. in this case I was thinking customMass.

SCALETYPE { name = IR_RoboticStock freeScale = false scaleFactors = 0.25, 0.5, 1.0 customMass = 0.05, 0.1, 0.2 scaleNames = Small, Medium, Large minScale = 0.25 maxScale = 1.0 defaultScale = 1.0 }

Biotronic commented 10 years ago

I have a fantastic way to solve this, but I'm unsure if it's a good idea.

By simply removing the massFactors list and all code related to it, I get this:

@PART[roverBody] // Probodobodyne RoveMate
{
    MODULE
    {
        name = TweakScale
        type = surface

        MODULE
        {
            mass = 1,2,3,4,5,6,7
        }
    }
}

It works great, but of course any mod already using massFactors will have problems.

Of course, you can also do things like this:

@PART[roverBody] // Probodobodyne RoveMate
{
    MODULE
    {
        name = TweakScale
        type = surface

        MODULE
        {
            mass = 1
        }
    }
}

for linear mass scaling, mass = 2 for quadratic scaling, and so on and so forth.

Biotronic commented 10 years ago

Actually, that's not quite the same. It would set the mass to those values, rather than scale it by those values.

sirkut commented 10 years ago

I actually want the mass to be set to those values, I don't want TweakScale to affect it at all.

Biotronic commented 10 years ago

Then i guess...

actually, now that I've used my brain for about half a minute, I realize the system already supports this as of 1.7+:

@PART[roverBody] // Probodobodyne RoveMate
{
    MODULE
    {
        name = TweakScale
        type = surface

        MODULE
        {
            mass = 1,2,3,4,5,6,7
        }
    }
}

Just like that, it seems you should have the capability you ask for. Give it a try and report back?

sirkut commented 10 years ago

Well it seems to be working! I wanted a part to scale in mass from small to large: mass = 0.05, 0.1, 0.2 and it worked. Thanks for clearing that up. I did notice that I accidentally left massFactor as 1.0,0.0,0.0 and it still worked correctly.

Biotronic commented 10 years ago

Yeah, it first uses massFactors, then checks if there's a TweakScaleExponent entry for mass (not explicitly, but if it's there, it's used). And just like any other TweakScaleExponent entry, if it's a comma-delimited list it chooses one based on the index.

I still consider removing massFactors because TweakScaleExponent is just as good a solution to the problem. Only thing is, people may be using massFactors.