Jump to content

Part Resizing


Recommended Posts

KSRe currently has basic part resizing, but similar to the fuel switch this is something deserving of its own mod. Here's the current implementation, if anyone wants to build on it. 

 

public override void OnInitialized() {
            Game.Messages.PersistentSubscribe<PartSeparatedMessage>(SeparatedPart);
            Game.Messages.PersistentSubscribe<PartBehaviourInitializedMessage>(PartBehaviourInitialized);
        }


private void PartBehaviourInitialized(MessageCenterMessage message) {
            PartBehaviourInitializedMessage msg = (PartBehaviourInitializedMessage)message;
            if (msg.Part.SimObjectComponent.PartData.partName != "booster_1v_solid_flea") return;
            msg.Part.gameObject.transform.localScale = new Vector3(0.5f, 1, 0.5f);
        }

private void SeparatedPart(MessageCenterMessage message) {
            PartSeparatedMessage msg = (PartSeparatedMessage)message;
            if (msg?.messagePart?.PartName != "booster_1v_solid_flea") return;
            msg.messagePart.PartTransform.localScale = new Vector3(0.5f, 1, 0.5f);
}

 

This is setup to rescale the flea booster to be 0.625m (XS) diameter.

There are currently a couple of known bugs when using symmetry modes greater than 2 - that other parts attached radially to the flea are also rescaled in this way, and when a flea is attached radially to parts other than a flea. These bugs only affect the editor, and are resolved upon launch.

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...