Jump to content

[1.0.x] [V1.9f] Kerbal Foundries wheels, anti-grav repulsors and tracks


lo-fi

What to work on next?  

1,282 members have voted

  1. 1. What to work on next?

    • More wheels
      123
    • More tracks
      453
    • Rover bodies
      241
    • Landing gear
      137
    • Landing legs
      108
    • Something completely different
      193


Recommended Posts

What about wheels without suspension - rigid axle?

If you don't mind a little cfg bashing... I have this working in 1.0.4 if you need help - Lofi if you want a crack at solid axles please by all means go for it! Love your work. just trying to take the focus off making us new stuff so you can finish what you are currently working on

http://forum.kerbalspaceprogram.com/threads/90438-WIP-New-Wheels-multipurpose-parts-landinglegs-Beam-Axles

Video of me using them in 1.0.2

Link to comment
Share on other sites

When you put it that way, you've basically got a stock wheel like that ruggedized wheel... what's it called? has little to no suspension room, massive tire, only plus side on it is the nice steering range.

On another topic entirely, lo-fi... I was reading another forum that had a picture posted which features your last public release of the long track. Someone there was complaining (well, not really, just warning other users) that sudden stops could ruin a craft with only a single set of those tracks on it. My suspicion is that the effect of suddenly stopping and then flipping over when using single sets of tracks will only get worse with the changes made recently, which I experienced first-hand, where an extremely light craft on a pair of medium tracks could over-power the emergency-break and cause the entire craft to do a complete flip end-over-end just by tapping the W key once. I understand what's doing that I believe... it's that part where the heavier the craft, and the less overall support the craft has, the lower the performance of the parts... however, it seems that the parts can become too responsive when the craft is lighter than expected. I'm thinking the calculation that heads up all the other changes to the responsiveness of the part needs a limiter so it doesn't become too-responsive on lighter crafts.

- - - Updated - - -

If you don't mind a little cfg bashing... I have this working in 1.0.4 if you need help - Lofi if you want a crack at solid axles please by all means go for it! Love your work. just trying to take the focus off making us new stuff so you can finish what you are currently working on

http://forum.kerbalspaceprogram.com/threads/90438-WIP-New-Wheels-multipurpose-parts-landinglegs-Beam-Axles

Video of me using them in 1.0.2

When I saw you going down those inclines at an angle and saw how it was basically suspending the same way, but the movement was at the connection to the body, not at the end of the axle... I got really excited. I haven't been that excited since I saw lo-fi's first video. Just needs a KF-style steering overhaul and it would make an awesome addition.

Link to comment
Share on other sites

I lose track of what I've changed! And the torque, steering and braking has been tweaked. Though I could just implement ABS...

Spanner did some smashing work.. I believe he used IR for those, but I'd just write a plugin to get proper control over the joints (see my trailer hitch video). That's the sort of design you can only make with joints. I'll have a bash one day :)

Link to comment
Share on other sites

I lose track of what I've changed! And the torque, steering and braking has been tweaked. Though I could just implement ABS...

Spanner did some smashing work.. I believe he used IR for those, but I'd just write a plugin to get proper control over the joints (see my trailer hitch video). That's the sort of design you can only make with joints. I'll have a bash one day :)

See now I'm excited :) Spanners axle still works well, but there are some short comings with the old module it relies on that KF could definitely improve upon. But don't misunderstand me, take your time Lofi, you've had a lot to update I'm sure. And you're guys work is always worth waiting for.

Edit:

Also here is an updated cfg for that axle

Light Duty

PART{
name = BeamAxleAlphaIR2
module = Part
author = Spanner


mesh = model.mu
scale = 1
rescaleFactor = 1


node_stack_top = 0.0, 0.0, 0.219179, 0.0, 0.0, 1.0
node_attach = 0.0, 0.0, 0.219179, -0.0, 0.0, 1.0


TechRequired = advancedMotors
entryCost = 6000


cost = 580
category = none
subcategory = 0
title = Beam Axle
manufacturer = SMSE Power Products Ltd. A division of SM Industries
description = The xxx2,When mounting ensure red faced drive flange faces forwards. Comes with combined power unit, retardation device and vector control, in short it goes, stops and steers and it beats walking


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


mass = 0.025
dragModelType = default
maximum_drag = 0.3
minimum_drag = 0.2
angularDrag = 1
crashTolerance = 7
maxTemp = 1200 // = 3600
crashTolerance = 200
bulkheadProfiles = srf


MODULE
{
name = ModuleWheel
hasMotor = true
resourceName = ElectricCharge
resourceConsumptionRate = 0.7
canSteer = true
controlAxisType = Forward
steeringModeType = AutomaticSteer
brakeTorque = 8
brakeSpeed = 1.5
impactTolerance = 3000
overSpeedDamage = 250


WHEEL
{
wheelName = wheel
wheelColliderName = wheelCollider
suspensionTransformName = suspensionTraverse
suspensionNeutralPointName = suspensionNeutralPoint
damagedObjectName = bustedwheel
rotateX = -1
rotateY = 0
rotateZ = 0
}

WHEEL
{
wheelName = wheel001
wheelColliderName = wheelCollider001
suspensionTransformName = suspensionTraverse001
suspensionNeutralPointName = suspensionNeutralPoint001
damagedObjectName = bustedwheel001
rotateX = -1
rotateY = 0
rotateZ = 0
}
steeringCurve
{
key = 0 20
key = 10 6
key = 30 2

}


torqueCurve
{
key = 2 8 0 0
key = 8 12 0 0
key = 20 0 0 0

}


}


MODULE
{
name = FXModuleConstrainPosition
matchRotation = true
matchPosition = false
CONSTRAINFX
{
targetName = steering
moversName = trackSteering
}

}
MODULE
{
name = TweakScale
type = IR_RoboticRotatron

TWEAKSCALEEXPONENTS
{
mass = 0.125, 0.250, 0.500, 1
}

TWEAKSCALEEXPONENTS
{
name = MuMechToggle
}
}
MODULE
{
name = MuMechToggle
rotateJoint = True
rotateAxis = 0, 0, 1


keyRotateSpeed = 20.0
rotateLimits = True
//limitTweakable = True
rotateMin = -15
rotateMax = 15
//freeMoving = False
jointSpring = 8.0
jointDamping = 1.0
onActivate = False
rotateKey =
revRotateKey =
fixedMesh = Base
partMassOriginal = 0.3
servoName = BeamAxleAlphaIR
}
}


Heavy Duty

PART{
name = BeamAxleAlphaIR2_Hvy
module = Part
author = Spanner


mesh = model.mu
scale = 1
rescaleFactor = 1


node_stack_top = 0.0, 0.0, 0.219179, 0.0, 0.0, 1.0
node_attach = 0.0, 0.0, 0.219179, -0.0, 0.0, 1.0


TechRequired = advancedMotors
entryCost = 6000


cost = 580
category = none
subcategory = 0
title = Beam Axle Heavy
manufacturer = SMSE Power Products Ltd. A division of SM Industries
description = The xxx2,When mounting ensure red faced drive flange faces forwards. Comes with combined power unit, retardation device and vector control, in short it goes, stops and steers and it beats walking


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


mass = 0.025
dragModelType = default
maximum_drag = 0.3
minimum_drag = 0.2
angularDrag = 1
crashTolerance = 7
maxTemp = 1200 // = 3600
crashTolerance = 200
bulkheadProfiles = srf


MODULE
{
name = ModuleWheel
hasMotor = true
resourceName = ElectricCharge
resourceConsumptionRate = 0.7
canSteer = true
controlAxisType = Forward
steeringModeType = AutomaticSteer
brakeTorque = 8
brakeSpeed = 1.5
impactTolerance = 3000
overSpeedDamage = 250


WHEEL
{
wheelName = wheel
wheelColliderName = wheelCollider
suspensionTransformName = suspensionTraverse
suspensionNeutralPointName = suspensionNeutralPoint
damagedObjectName = bustedwheel
rotateX = -1
rotateY = 0
rotateZ = 0
}

WHEEL
{
wheelName = wheel001
wheelColliderName = wheelCollider001
suspensionTransformName = suspensionTraverse001
suspensionNeutralPointName = suspensionNeutralPoint001
damagedObjectName = bustedwheel001
rotateX = -1
rotateY = 0
rotateZ = 0
}
steeringCurve
{
key = 0 20
key = 10 6
key = 30 2

}


torqueCurve
{
key = 2 8 0 0
key = 8 12 0 0
key = 20 0 0 0

}


}


MODULE
{
name = FXModuleConstrainPosition
matchRotation = true
matchPosition = false
CONSTRAINFX
{
targetName = steering
moversName = trackSteering
}

}
MODULE
{
name = TweakScale
type = IR_RoboticRotatron

TWEAKSCALEEXPONENTS
{
mass = 0.125, 0.250, 0.500, 1
}

TWEAKSCALEEXPONENTS
{
name = MuMechToggle
}
}
MODULE
{
name = MuMechToggle
rotateJoint = True
rotateAxis = 0, 0, 1


keyRotateSpeed = 20.0
rotateLimits = True
//limitTweakable = True
rotateMin = -10
rotateMax = 10
//freeMoving = False
jointSpring = 12.0
jointDamping = 1.7
onActivate = False
rotateKey =
revRotateKey =
fixedMesh = Base
partMassOriginal = 0.3
servoName = BeamAxleAlphaIR
}
}


Edited by V8jester
Link to comment
Share on other sites

I see you've been hard at work lo-fi from looking at the github updates. Awesome stuff. we better implement some more global toggles for those lights and such, since lighting can definitely create an issue with performance, especially if the user can run shadows (I can't, really bogs me down). I always figured the repulsors would have emissives instead of lights. Also, did you mean to disable the orientation markers by default in the global config? I'd think the default action would be to have them enabled.

I'm going to start looking into porting over a basic configuration menu from one of the other mods I use (probably use smokescreen as a template) so we can get these modifiable from the space center scene (I don't want to have to deal with toggling this stuff in-flight just yet, as that adds a new dimension of complexity.)

Link to comment
Share on other sites

Ah, nice one V8jester. And thanks - you're too kind :)

The repulsors do have emissives now :) I was just playing around really. I might force the lights into vertex mode, which is far less intensive than pixel. For that sort of thing, the light looking a little messed up can be no bad thing. And agreed, the config field is a great idea. For the UI, you could also look at HyperEdit. It's nice and simple. Really liking how this is shaping up!

Link to comment
Share on other sites

I'll look at GUI stuff later today. I was just thinking there was a less intensive lighting option. I remember planet shine had two modes for lights, and considering pixel lighting has limits per user config of KSP overall, you'd run into that limit pretty quick.

Link to comment
Share on other sites

Indeed! The lights may not even make it, but the particles are going to look fantastic once tweaked. New wheels still need a lot of love in the texturing department too.

Link to comment
Share on other sites

Back to something else: it has been mentioned sometimes, do you already have a plan about damage models? Tracks espe ially are perfect for having more than one damage state. :)

Link to comment
Share on other sites

The bottom of the repulsor looks amazing, such a shame it's only on the underside. I have read most of the recent posts but can't say I fully understood that much of it :) Will the be a (relatively easy) method to get the dust effects onto stock/other mods wheels? It seems to be a "once you've seen it everything must have it " deal. Great stuff as usual.

Link to comment
Share on other sites

The dust effects, in their original implementation (aka. "hacked out of CollisionFX by me many months ago") it would work on all objects that scrape over the terrain with an emphasis on wheels. What the implementation in KF is meant to be is an addon not only to the KF-specific wheels, but to all the KF conversions of other wheels. Eventually I could see us being able to easily expand the new module to work with other wheels built on top of the stock module with a set of default values combined with some auto-detected values. When/if that is possible, then the KFDustFX module will work on those wheels without any modification or legacy modules applied.

I would like to, before any major release of the KF mod, include a module that would be applicable to any non-KF wheels. Once lo-fi is done messing around with the various stuff having to do with the dust, I'll work on creating a legacy version of the module which makes use of all the new color control stuff, but takes input from the stock module.

My goal in the end is to makes the wheel modules able to be put on any other wheel (stock or modded) with a modular approach to any of the special KF features so that, if an end user wanted to, a non-KF wheel could be told to use the KF module to handle its collisions (both for dust and for basic wheel control) and not make use of anything other than the very basic wheel control features of the KF module which would include the ability to then activate the other features, including dust, if they so wished. You'd still have to do a lot of modification to make the wheel fully capable of using the KF modules to the greatest extent, but it could work in a pinch. Already we have configs for the stock wheels (either by copying them into new parts, or a MM patch to modify them in-place) and it's becoming easier and easier to convert new wheels to use the KF modules with every rewrite/refactor of the code.

So, in short... yes, there will be a way to add these effects to non-KF wheels eventually but also, eventually, there won't BE any non-KF wheels when KF is installed. By the way, these ideas and plans are all independent of lo-fi's plans and dreams, but I think he would agree with many of my ideas as good long-term goals. Feel free to correct me on anything, oh fearless leader. I simply have this vision of all these things being as modular as possible and easy to apply to any old parts that don't already make use of these advanced features in much the same way that an old engine without the advanced gimbal actions, included in mods like KM_Gimbal.dll, can be converted simply by replacing the gimbal module definition. We're not even close to that yet, but there's light at the end of the tunnel. It's not in the visible spectrum yet, but it is there.

Okay, so that was anything but short...

- - - Updated - - -

I just threw down a challenge for Kerbal Foundries users--see if you can build a craft using antigrav repulsors that can successfully navigate the KSC course in KerbinSide Air-Race!

The challenge is posted here--but here's video of my attempt:

I love it. I won't be entering it of course, mainly because I have to be very careful with my memory management which means no air-race assets, and I'm too busy developing while trying to take a summer math class to finally end all my math requirements, FOREVER!!! But I look forward to seeing if anyone else enters. Keep us updated here too. I think you need some of those super-efficient radiators from some of the radiator mods out there. One thing to note of course is that air friction and slope-gravity friction is all you're getting to slow you down so, once you reach a top safe velocity over the water, and are going in a straight line, you can actually cut your throttle way down and save yourself the extra heat generated by the engine. I love the use of the air brakes to help control turning. I remember trying to build an anti-grav speeder back in the day before we had any of the heat and aero stuff to work with, and it was pretty tough.

- - - Updated - - -

Back to something else: it has been mentioned sometimes, do you already have a plan about damage models? Tracks espe ially are perfect for having more than one damage state. :)

I'd love to see it in the future, even considering I really really hate broken wheels... especially on probe rovers since we don't have anything like a maintenance arm capable of repairing wheels like you can with a kerbal, but I can see it eventually being possible. Especially if the damaged state could include partially-functioning states. I have a few ideas for controlling appearance using a hidden resource that is depleted with every over-rough collision which could contain a texture and/or model swap for certain objects in the part which would simulate the visual damage. Introduce a little random slippage or occasional brake-application to the damaged part (and maybe an occasional failure to respond to steering) at certain ranges of the tracked resource, and you've got a great setup for damage stuff. easy maintenance too, since internally you'd simply be "refueling" the part with the invisible and weightless fuel source and forcing the part to refresh it's state based on that resource. I believe heat-shields (before stock implementation) used a similar system to decide how protected the craft was.

However, the modelling/texturing needed to make this happen is quite extensive.

- - - Updated - - -

Indeed! The lights may not even make it, but the particles are going to look fantastic once tweaked. New wheels still need a lot of love in the texturing department too.

Keep the lights implemented though, even if we end up disabling them by default. If the end user can use them, we can provide a way to activate them. Better to have a way of producing that repulsor glow in-house than forcing them to make use of extra light parts on the craft to produce the same effect.

Link to comment
Share on other sites

I love it. I won't be entering it of course, mainly because I have to be very careful with my memory management which means no air-race assets, and I'm too busy developing while trying to take a summer math class to finally end all my math requirements, FOREVER!!! But I look forward to seeing if anyone else enters. Keep us updated here too. I think you need some of those super-efficient radiators from some of the radiator mods out there. One thing to note of course is that air friction and slope-gravity friction is all you're getting to slow you down so, once you reach a top safe velocity over the water, and are going in a straight line, you can actually cut your throttle way down and save yourself the extra heat generated by the engine. I love the use of the air brakes to help control turning. I remember trying to build an anti-grav speeder back in the day before we had any of the heat and aero stuff to work with, and it was pretty tough.

Thanks for the encouragement! FWIW I find Air-Race isn't very memory-intensive. I've also found that Astronomer has some very useful performance tweaks, including a recommendation to use a patcher to allow KSP to access a full 4 Gb of memory on x64 systems. I've used it successfully and the extra half-gigabyte has made crashes few and far-between, even with all the mods I use. OTOH, if you're using your KSP game for development work, I'm sure you've got better use for your game memory.

I'm using Nertea's Heat Control mod for its radiators, and I'm likely to add its heat pipe system to ensure the heat is spread evenly. I'd go as far as to add a heat exchanger, but since there isn't a Mk2 shaped exchanger yet, I'm holding off.

For straightaways I'll keep your advice in mind for the future. I was loathe to throttle down for the most part, however, since I needed the engines to help steer the craft.

Check out my YouTube channel for some of the Project Manta videos I made--that was the first speeder I had and, for all its blockiness, it was rather good at the task.

Link to comment
Share on other sites

The bottom of the repulsor looks amazing, such a shame it's only on the underside. I have read most of the recent posts but can't say I fully understood that much of it :) Will the be a (relatively easy) method to get the dust effects onto stock/other mods wheels? It seems to be a "once you've seen it everything must have it " deal. Great stuff as usual.

I hope I'm not spoiling too much--but I've seen the dev build, and that includes a new dual-sided repulsor with an even more awesome texture that will get your SF fantasies flowing. Patience! :cool:

- - - Updated - - -

The problem with HC is that it isn't compatible with 1.0.4 yet, at least nertea hasn't released an update yet I don't think.

It works on my KSP 1.0.4 build, although I'm not sure if Nertea has taken in account the thermal model changes in KSP 1.0.3. It might not matter.

Link to comment
Share on other sites

Ah, I love this thread!

Loving the video, Lita! Keep us posted on entries :D

There are some new repulsors, Darren ;) I think you like them!

I'll get back to you once I've had a spare half hour to read another filibuster post, Gaalidas ;)

Thanks for all the help and encouragement everyone! Means a lot.

Edited by lo-fi
Link to comment
Share on other sites

I wasn't aware it was dual-sided. I thought it was just set on a gimbal so it would always face down.

So, I've been looking at GUI options for a few hours now and I'm frustrated. Everyone adds the button to the app-launcher in a completely different way it seems, and if they support Blizzy as well, then it becomes down right impossible to figure out which way is up. why can't it be as simple as "icon=icon_name" and "onToggle=this_action" instead of all these undocumented method arguments that mean absolutely nothing to the ordinary human being!

Edited by Gaalidas
Link to comment
Share on other sites

Post something promising up and let's see if we can make sense of it. I'd go with stock toolbar.

Oh, and regarding DustFX on other wheels... Comes as standard if they're driven with the KF plugin now. There's an MM patch for stock, plus a few others. Will need updating, but they all work rather well. Happy to resurrect old, forgotten wheels too, so suggestions welcome :)

Edited by lo-fi
Link to comment
Share on other sites

Thanks for the encouragement! FWIW I find Air-Race isn't very memory-intensive. I've also found that Astronomer has some very useful performance tweaks, including a recommendation to use a patcher to allow KSP to access a full 4 Gb of memory on x64 systems. I've used it successfully and the extra half-gigabyte has made crashes few and far-between, even with all the mods I use. OTOH, if you're using your KSP game for development work, I'm sure you've got better use for your game memory.

The second to last post in that thread asserts that this will have no effect, since 32-bit applications either can address 2Gb or 4Gb of memory (less some overhead in the latter case). This appears to be in agreement with https://msdn.microsoft.com/en-us/library/aa366778.aspx (and my own understanding).

Link to comment
Share on other sites

The KF parts seem to have everything covered except landing gears, I find myself always using the Baha adjustables. That would be my request if it's possible and they're not already on the list.

Link to comment
Share on other sites

Post something promising up and let's see if we can make sense of it. I'd go with stock toolbar.

Indeed, stock toolbar was my aim. I'm just having problems figuring out how to use it properly since all the examples I've seen are either for a single toggle on button press, or a complicated stock/blizzy combo with GUI that's way more complicated than what we need. It seems every mod I look at which has a GUI decided to support both toolbars and also decided not to name their methods in a way that makes it easy to figure out what is doing what. It's all driving me absolutely nuts.

Link to comment
Share on other sites

I was looking at the old thread for the original tracks mod and remembered a feature i really missed, the throttle control option. If you could add this i would be real happy. :D

Link to comment
Share on other sites

It seems every mod I look at which has a GUI decided to support both toolbars and also decided not to name their methods in a way that makes it easy to figure out what is doing what. It's all driving me absolutely nuts.

I sometimes have the same problem. Maybe I should start collecting and making simple code samples for others to learn from.

Ok so you want to make a button for the stock toolbar? It's not that difficult once you figure it out.

The object which does most of the work for you is named ApplicationLauncher. You create a ApplicationLauncherButton for your mod, register that with the ApplicationLauncher and hook onto the button events.

First you prepare some global objects you'll need later on:

private ApplicationLauncherButton appButton = null; // the toolbar button itself
private Texture2D texture = null; // nice image which will be displayed in the button

Second the ApplicationLauncher seems to be loaded in an asynchronous manner. Therefore you don't know when it's ready. Fortunately Squad added some kind of queue in which you can put a method. Once the Launcher is ready your method will be called.

override void Awake()
{
// Retrieves an image named toolbar_button which KSP loaded automatically during game start.
// Do not specify a file type suffix (e. g. ".png")!
// The image must be supported by KSP (.png, .tga, .dds and maybe some others).
texture = GameDatabase.Instance.GetTexture("myModDir/Images/toolbar_button", false);

// Hook on the ApplicationLauncher and wait until it is ready
GameEvents.onGUIApplicationLauncherReady.Add(SetupAppButton);
}

The methods onTrue() and onFalse() will be called when the toolbar button is pressed down and released again. The button will be only visible in the VAB and SPH scenes and displays the texture we loaded before.

void SetupAppButton()
{
// only do stuff when in the VAB/SPH and there's still no button
if (HighLogic.LoadedSceneIsEditor && appButton == null)
{
// add a new toolbar button
appButton = ApplicationLauncher.Instance.AddModApplication(onTrue, onFalse, null, null, null, null, ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB, texture);
}
}

This method either accepts a texture or a PackedSprite (whatever this is) for displaying an image on the button.

public ApplicationLauncherButton AddModApplication(RUIToggleButton.OnTrue onTrue, RUIToggleButton.OnFalse onFalse, RUIToggleButton.OnHover onHover, RUIToggleButton.OnHoverOut onHoverOut, RUIToggleButton.OnEnable onEnable, RUIToggleButton.OnDisable onDisable, ApplicationLauncher.AppScenes visibleInScenes, PackedSprite sprite)

Member of ApplicationLauncher

Summary:

Add a MOD(3rd party) application to the Application Launcher. Use ApplicationLauncherButton.VisibleInScenes to set where the button should be displayed.

Parameter:

onTrue: Callback for when the button is toggeled on

onFalse: Callback for when the button is toggeled off

onHover: Callback for when the mouse is hovering over the button

onHoverOut: Callback for when the mouse hoveris off the button

onEnable: Callback for when the button is shown or enabled by the application launcher

onDisable: Callback for when the button is hidden or disabled by the application launcher

visibleInScenes: The "scenes" this button will be visible in. For example VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW;

sprite: The 38x38 PackedSprite animation to use for the button icon. Use ApplicationLauncherButton.PlayAnim() to play the animation.

Notes:

Note that the application launcher is destroyed when the player exits to the main menu. If the player then loads up a new save the application launcher will be recreated and you will have to re-add your button. Register for GameEvents.onGUIApplicationLauncherDestroyed and GameEvents.onGUIApplicationLauncherReady to detect when the application launcher has been destroyed and when it has been re-created.

---

public ApplicationLauncherButton AddModApplication(RUIToggleButton.OnTrue onTrue, RUIToggleButton.OnFalse onFalse, RUIToggleButton.OnHover onHover, RUIToggleButton.OnHoverOut onHoverOut, RUIToggleButton.OnEnable onEnable, RUIToggleButton.OnDisable onDisable, ApplicationLauncher.AppScenes visibleInScenes, UnityEngine.Texture texture)

Member of ApplicationLauncher

Summary:

Add a MOD(3rd party) application to the Application Launcher. Use ApplicationLauncherButton.VisibleInScenes to set where the button should be displayed.

Parameter:

onTrue: Callback for when the button is toggeled on

onFalse: Callback for when the button is toggeled off

onHover: Callback for when the mouse is hovering over the button

onHoverOut: Callback for when the mouse hoveris off the button

onEnable: Callback for when the button is shown or enabled by the application launcher

onDisable: Callback for when the button is hidden or disabled by the application launcher

visibleInScenes: The "scenes" this button will be visible in. For example VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW;

texture: The 38x38 Texture to use for the button icon.

Notes:

Note that the application launcher is destroyed when the player exits to the main menu. If the player then loads up a new save the application launcher will be recreated and you will have to re-add your button. Register for GameEvents.onGUIApplicationLauncherDestroyed and GameEvents.onGUIApplicationLauncherReady to detect when the application launcher has been destroyed and when it has been re-created.

Now you could react on the button state:

void onTrue()
{
Debug.Log("Toolbar button is pressed");
}

void onFalse()
{
Debug.Log("Toolbar button is released");
}

To guarantee a safe unloading you'll have to override the OnDestroy method or hook on the GameEvents.onGUIApplicationLauncherDestroyed event (the later is probably the better way):

override void OnDestroy()
{
if (appButton != null)
{
ApplicationLauncher.Instance.RemoveModApplication(appButton);
appButton = null;
}
}

All methods except Awake() and OnDestroy() can be named as you like.

Edited by *Aqua*
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...