Jump to content

[1.3](Jun08/17) ModActions: Control your vessel (including other mods) via ActionGroups.


Diazo

Recommended Posts

How difficult is it to add a mod action for a third party mod? I have an action I would like to perform in an action group that requires clicking a single button in a window for a mod (the mod window is accessed with a button in the part right click menu for the stock parts that the mod adds modules to, but the action I want to perform is a button in that mod window that opens up).

Edited by Errol
Link to comment
Share on other sites

@Errol It isn't too hard really, I'd have to look at the code of the mod in question so I can hook the action into the button, but it's only about 5 lines of code.

I also have an open offer to help other people out with actions and actiongroups if the mod is being actively maintained and that might be able to get the action added into the other mod itself.

D.

Edited by Diazo
Link to comment
Share on other sites

This is the mod in question:

(Semi-)Saturatable Reaction Wheels - Download/Source

From:
 

There is an optional .cfg included (you must rename the file from .txt to .cfg to get this feature) wherein you can discharge the reaction wheels by spending monoprop. Here is the code from that .cfg with the module in question:

 

@PART[*]:HAS[@MODULE[RWSaturatable]]:AFTER[RWSaturatable]
{
	MODULE // This module enables discharging momentum through resource use. Change file extension to .cfg to use
	{
		name = MomentumDischargeThruster
		thrusterPower = 0.05 // pct of momentum limit to discharge per second
		thrusterTransformName = delete
		atmosphereCurve
		{
			key = 0 240
		}
		PROPELLANT
		{
			name = ElectricCharge
			ratio = 10
		}
		PROPELLANT
		{
			name = MonoPropellant
			ratio = 1
		}
	}
}

 

I am by no means a modder. My limit is being barely able to understand MM code. 

Edited by Errol
Link to comment
Share on other sites

Version 1.4b

Gituhub download.

-Add Saturable Reaction Wheel momentum dumping via resource consumption.

@Errol As requested.

@santiagokof From our conversation back on December 7th, the actions for Extending/Retracting landing gear are included in this mod. (Not new in this version, just the first chance I've had to check.)

Happy KSP'ing all.

D.

Link to comment
Share on other sites

@Diazo, Just play testing with this right now. Appears not to be working as expected. The toggle RCS thrust action shows up in the action editor for SAS parts, but it appears not to be toggling the momentum discharge thruster. Also I'm noticing that in the .action file there seem to be enable and disable actions you added, but I only see the toggle RW option in the action editor. 

Edit: I should probably also say that I'm playing in KSP 1.2.1, and am also not seeing the mod actions button on the stock toolbar, nor on blizzy's toolbar. Will try again in a vanilla 1.2.2 install next.

EDIT2: Alright, works never mind. Works flawlessly in 1.2.2, my bad. I guess this will be the kick I need to start migrating over to 1.2.2, I was going to wait for KCT to release an official 1.2 version, but oh well, better now than never. 

Edited by Errol
Link to comment
Share on other sites

@Diazo I just released a new mod:  

I set it up expecting that ActionsEverywhere could be used.  I see that this mod replaced that, and as of right now, it doesn't work.  I'll take a look at the source to see how difficult it would be to add the actions.  There are two, Set DIRECT and Set RELAY, which need to be usable.

21 hours ago, Diazo said:

@Errol It isn't too hard really, I'd have to look at the code of the mod in question so I can hook the action into the button, but it's only about 5 lines of code.

I also have an open offer to help other people out with actions and actiongroups if the mod is being actively maintained and that might be able to get the action added into the other mod itself.

D.

Calling for help :D

Link to comment
Share on other sites

So in further testing last night I found out that it wasn't the KSP version that was messing it up, it's another mod. After getting it working in a vanilla 1.2.2 install I threw all my mods back in and then the mod actions window doesn't show up at all in editor. I'm going to try re-introducing them one at a time to find the conflict, will report back when I find it. 

Link to comment
Share on other sites

If you open the console (Alt-F12), are their any errors being generated?

You can also upload the output_log.txt for me to look at to see if I can spot anything. (It's in the KSP_x64_Data sub-directory in KSP.)

D.

Link to comment
Share on other sites

No errors generated by your mod that I can notice in the console. 

EDIT: So I figured what is going on for me. The modactions folder doesn't like to be outside the diazo folder. I usually do that so that it is easier to keep track of my game data folder when I am trying to update things. Would you consider not having it set up such that the folder structure of gamedata>diazo>modactions is a requirement? Anyway though, appears to be playing just fine with the rest of my mods now. 

 

 

Edited by Errol
Link to comment
Share on other sites

Yes, the mod must stay where it is as to load all the .actions files because I had to hardcode the location.

As for changing the location I'd really rather not, I'm pretty sure doing so would cause issues with CKAN and the like so I'd rather not risk it.

D.

Edited by Diazo
Link to comment
Share on other sites

  • 3 weeks later...

Version 1.5

More updates to support the new wheel system. (From KSP 1.1)

-Wheel steering enable/disable/toggle and steering direction enable/disable/toggle.

-Friction control enable/disable/set value. Friction control works on a value from 0 to 5 and the value it is currently set to can not be viewed in game, although whether Friction Control is on or off can be seen in the part right-click menu.

Github download.

Added some actions that were missed when I originally updated this mod for the new wheel system in KSP 1.1, thanks to @supergameplayer for pointing them out.

Happy KSP'ing all.

D.

Link to comment
Share on other sites

  • 4 weeks later...

Hmmm, I'm not sure about doing that.

It is probably technically possible for me to code that, the issue is that it would have significant overhead and that I'd be worried about breaking something.

Module Animate Generic is what controls the animation, it is usually triggered by other code on the part which checks what state it is in.

Take a stock antenna. 0 is stowed, 1 is deployed and decimal values happen in between. Now when you give the game a "send data" command, it commands the antenna to deploy, waits until fully deployed, sends data, then retracts the antenna.

If you set an animation limit, the antenna never fully deploys so your send data command hangs on "waits until fully deployed". I'm not sure what this would do to the game.

What do you need this for? Is there another way to accomplish it?

D.

Link to comment
Share on other sites

@Diazo

I have a VTOL jet  engine from QuizTech Aerospace that is built to be the main engine is the F35. It has an animation to go from conventional flight to VTOL. So it obviously rotates 90* down. The real jet  can also set the nozzle at 45* for short take off and when transitioning from VTOL to conventional flight mid air. It is not possible to keep my hands on the controls, click and imprecisely drag the limiter and watch my plane. That's why I love action groups and wanted to be able to quickly set the limit. Though I had not considered the other implications of affecting the MAG module, so I can understand why it wasn't in already and why you still may not want it. What if it was implemented but you don't have a MM.cfg to enable it, but leave it to players to enable who understand the risk,  or specifically not target parts with data transmission? Just some thoughts. Thanks! 

Edited by Svm420
Link to comment
Share on other sites

Alright.

Looking at that most recent version of that mod (linuxgurugamer's maintenance thread), those engines don't actually use ModuleAnimateGeneric, they use AnimatedEngine from BD Armory.

I'd have no problems hooking into that module as it is dedicated for engines and doesn't pose the issues that ModuleAnimateGeneric does.

The catch is I'm not familiar with that module so I'm not as certain how I'd handle the code.

I'll see if I can at least poke at it this weekend, but real life is pretty busy already.

D.

Link to comment
Share on other sites

Weird, it's split for some reason.

Some use the AnimateEngine, some use the ModuleAnimateGeneric.

That's an issue for this mod as it works off PartModule, I'd have to code this twice to support both types of engines.

Probably doable still, but still need to actually look at it to see.

D.

Link to comment
Share on other sites

  • 2 weeks later...

@Diazo

I had a thought why are you concerned with antennas? They don't use ModuleAnimateGeneric anymore. They use ModuleDeployableAntenna. I don't see how they would be affected, but maybe there is some underlying programming/coding I don't know or understand. Thanks!

Link to comment
Share on other sites

You are correct in recent versions of KSP, antennas have moved to using ModuleDeployableAntenna.

I was pulling from the fact that the last time I had worked with them they were still on ModuleAnimateGeneric and I was using them as an example of how this mod can't be limited to "just these parts", this mod adds the actions for every part in the game that carries a given partModule.

D.

Link to comment
Share on other sites

2 hours ago, Diazo said:

You are correct in recent versions of KSP, antennas have moved to using ModuleDeployableAntenna.

I was pulling from the fact that the last time I had worked with them they were still on ModuleAnimateGeneric and I was using them as an example of how this mod can't be limited to "just these parts", this mod adds the actions for every part in the game that carries a given partModule.

D.

 

Right, I understood. I just wondered if there was some other potential conflict, or if that was all. I thought if there weren't any more potential issues that you may have a different opinion about implementing it. Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
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...