Jump to content

Trying to put toggle-able limits on IR parts. Just need help with last bit of code


VR_Dev

Recommended Posts

So I'm trying to incorporate the code for the B9 VTOL engines with the Infernal Robotics parts to be able to toggle through the parts rotation limits. So far I have been successful at loading the "FSVTOLrotator" Module from the engines into a IR hinge. This loads all the options I desire into the hotkey menu for the part, as seen here.

ljzWHbT.png

What I can't accomplish is getting the hinge's "RotateMin" and "Rotatemax" to recognize the limits the user sets in the table, exactly like you can with the engines. I believe these inputs to be "maxDownAngle" and "availableAngles1" in the VTOL MODULE. Even though I set the max angle to 180 the hinge stops at 90.

BhPJULx.png

I believe there is a simple solution, but it's been a while since I took any coding classes. I need to make the "maxDownAngle" and "availableAngles1" variables available for the "MUMechServo" MODULE to apply to "RotationMin/Max." This involves Modules sharing variables, which is where I'm confused. Here is the code I have gotten the closest with.

PART
{
// --- general parameters ---
name = IRHingeTallND_VTOL2
module = MuMechServo
author = Sirkut & Devo

// --- asset parameters ---
mesh = model.mu
scale = 1.0
specPower = 0.1
rimFalloff = 3
alphaCutoff = 0

// --- node definitions ---
node_attach = 0.0, -0.254, 0.0 , 0.0, -1.0, 0.0
node_stack_top = 0.0, 0.0, -0.325, 0.0, 0.0, -1.0, 0
node_stack_bottom = 0.0, -0.254, 0.0 , 0.0, -1.0, 0.0, 0

// --- editor parameters ---
TechRequired = advConstruction
entryCost = 0
cost = 50
category = Utility
subcategory = 0
title = Adjustable limit hinge 2
manufacturer = Magic Smoke Industries
description = Taller motorized hinge.

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,1,1,1,0

// --- standard part parameters ---
mass = 0.1
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 15
maxTemp = 3000
breakingForce = 999
breakingTorque = 999

rotateJoint = True
rotateAxis = -1, 0, 0
keyRotateSpeed = 20.0
rotateLimits = True
rotateMin = -90
rotateMax = 90

rotateLimitsRevertKey = False
jointSpring = 0
jointDamping = 0
onActivate = False
rotateKey = up
revRotateKey = down
fixedMesh = Base
servoName = New Hinge
invertSymmetry = False
motorSndPath = MagicSmokeIndustries/Sounds/infernalRoboticMotor // Motor loop sound path

MODULE
{
name = FSVTOLrotator
deployedAngle = 90 //the starting max value
maxDownAngle = -90 // Allowed rotation below the default parked state
stepAngle = 1 // How much each action group button press will rotate the engine
targetPartObject = engine_holder
availableAngles1 = 90, 0, 0 //max three values, use 0 to skip the value and shorten the list. The first value is the default, so smaller than default values should be the final numbers.
//availableAngles2 = 0, 0, 0 // more angles, for a max of 6
startInverted = True
steerDirection = -1
}
}

I know RotateMin/Max shouldn't be 90, but it's the only way to get all the options to load like I want. Somehow those have to be variables that you can change in the VTOL Module. I have tried a bunch of different configurations of the code as well.

-Having the FSVTOLRotator module be the base with the MuMechServo MODULE being called within it.

-Having the base module be a part, and calling both FSVTOLRotator and MuMEchServo as MODULES{} within it.

-Having Min/max = Module{FSVTOLRotator maxDownAngle/availableAngles1}

Like I said I believe there is an easy solution to this, and if so being able to change a parts rotation limits with a toggle will open up a whole new world for IR development, especially our walking mechs.

http://forum.kerbalspaceprogram.com/threads/73364-Walking-Flying-Custom-Replica-Mech-Mod

Edited by clown_baby
Made clearer
Link to comment
Share on other sites

So I've moved onto loading my T-Rex into the game. This got put on hold. If there's anyone half way proficient at c# I could explain to you what has to be done in the plugins. You could take credit for the whole thing.

I just really need those limits

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...