navot

[1.4.1] Control Surface Toggle

Recommended Posts

9 minutes ago, navot said:

@Warezcrawler Thank you for giving me some pointers! I updated my mod and tried running it in KSP 1.3, but it didn't work (not a big deal but it would have been nice if it ran). Did these functions change between 1.3 and 1.4 or is it something different in my mod that causes this?

I don't think they changed from 1.3 - I at least have not found any documentation of changes. KSP Interstellar uses it.

https://github.com/sswelm/KSP-Interstellar-Extended/blob/master/FNPlugin/PluginHelper.cs#L21
https://github.com/sswelm/KSP-Interstellar-Extended/blob/master/FNPlugin/PluginHelper.cs#L45-L55

I don't know if you have used events yet. If not I recommend you read this from 1.2.2.

Also the short version of using build in KSP events

//Register you mod to the event
void OnStart
{
	GameEvents.onVesselSituationChange.Add(OnVesselSituationChange);
}
//Remember to unregister to avoid problems
void OnDestroy()
{
	GameEvents.onVesselSituationChange.Remove(OnVesselSituationChange);
}
//And add the method you register to the event
void OnVesselSituationChange(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> change)	//<-- Arguments in the method depends on the event you are using.
{
	//Do something when the event fires
}

 

Share this post


Link to post
Share on other sites

@navot Looks like this is not really compatible to FAR.

I will try it with a changed config the next session:

GameData\ControlSurfaceToggle\ControlSurfaceToggle.cfg

@PART[*]:HAS[@MODULE[ModuleControlSurface]]
{
	MODULE
	{
		name = ModuleCSToggle
	}
}

@PART[*]:HAS[@MODULE[FARControllableSurface],!MODULE[ModuleCSToggle]]:NEEDS[FerramAerospaceResearch]:AFTER[FerramAerospaceResearch]
{
	MODULE
	{
		name = ModuleCSToggle
	}
}

I hope that works.

Actually the log is spammed with this:

Exception handling event onVesselSituationChange in class CSToggleController:System.NullReferenceException: Object reference not set to an instance of an object
  at ControlSurfaceToggle.ModuleCSToggle.enableCS () [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.ModuleCSToggle.enableGlobal (Boolean printMessage) [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.CSToggleController.UpdateCurrentAtmosphereState (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameEvents+HostedFromToAction`2[Vessel,Vessel+Situations]].Fire (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException: Object reference not set to an instance of an object
  at ControlSurfaceToggle.ModuleCSToggle.enableCS () [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.ModuleCSToggle.enableGlobal (Boolean printMessage) [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.CSToggleController.UpdateCurrentAtmosphereState (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameEvents+HostedFromToAction`2[Vessel,Vessel+Situations]].Fire (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
EventData`1:Fire(HostedFromToAction`2)
Vessel:updateSituation()
Vessel:Initialize(Boolean, Boolean, Boolean, Boolean)
Vessel:Initialize(Boolean)
Part:decouple(Single)
LaunchClamp:Release()
LaunchClamp:OnActive()
Part:ModulesOnActivate()
Part:force_activate(Boolean)
Part:force_activate()
KSP.UI.Screens.StageManager:ActivateStage(Int32)
KSP.UI.Screens.StageManager:ActivateNextStage()
MuMech.MechJebModuleStagingController:OnUpdate()
MuMech.MechJebCore:Update()
 
(Filename:  Line: -1)

or this, depending the situation:

Exception handling event onVesselSituationChange in class CSToggleController:System.NullReferenceException: Object reference not set to an instance of an object
  at ControlSurfaceToggle.ModuleCSToggle.enableCS () [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.ModuleCSToggle.enableGlobal (Boolean printMessage) [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.CSToggleController.UpdateCurrentAtmosphereState (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameEvents+HostedFromToAction`2[Vessel,Vessel+Situations]].Fire (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException: Object reference not set to an instance of an object
  at ControlSurfaceToggle.ModuleCSToggle.enableCS () [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.ModuleCSToggle.enableGlobal (Boolean printMessage) [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.CSToggleController.UpdateCurrentAtmosphereState (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameEvents+HostedFromToAction`2[Vessel,Vessel+Situations]].Fire (HostedFromToAction`2 data) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
EventData`1:Fire(HostedFromToAction`2)
Vessel:updateSituation()
Vessel:LateUpdate()
 
(Filename:  Line: -1)

or even just this:

Module ModuleCSToggle threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object
  at ControlSurfaceToggle.ModuleCSToggle.setup () [0x00000] in <filename unknown>:0 
  at ControlSurfaceToggle.ModuleCSToggle.OnStart (StartState state) [0x00000] in <filename unknown>:0 
  at Part.ModulesOnStart () [0x00000] in <filename unknown>:0 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Full log:
https://www.dropbox.com/s/idntw13dj7e4p03/2018-06-15_1 KSP.log.7z?dl=1

 

Edit:

nope, doesn't work with FAR.

now it works, but I got other issues - well ...

Spoiler

 

 

Edited by Gordon Dry
ofc I had to fix a missing bracket

Share this post


Link to post
Share on other sites

@Gordon Dry Sorry for taking so long to respond. Did all your issues with this mod resolve them self?

I don't have any experience with FAR, but I think I heard somewhere that it disables the control surfaces in space by itself. If that's the case (again, not sure) the patch should check if FAR is installed, and if it is not add ModuleCSToggle to the parts. I'll probably look into that in the coming days

 

Share this post


Link to post
Share on other sites

I just noticed there's a mod "Smart Actuation" by @TheRagingIrishman in ckan. Does anyone know if there's any major(or minor) difference between that mod and this mod? Sorry to ask here, there's no official thread for Smart Actuation(yet?) I use a lot of mods and would prefer to not have mods installed that do the same thing. No offense. Thank you kindly!

Share this post


Link to post
Share on other sites

@Jesusthebird I found a thread for the mod. It is called Smart Actuators here. I didn't know this mod existed when I made this mod, so the features are probably pretty similar, but he says he wants to also disable engines gimbaling when they are off, which is something I'm not planning to add to this mod.

Edited by navot

Share this post


Link to post
Share on other sites
4 hours ago, navot said:

@Jesusthebird I found a thread for the mod. It is called Smart Actuators here. I didn't know this mod existed when I made this mod, so the features are probably pretty similar, but he says he wants to also disable engines gimbaling when they are off, which is something I'm not planning to add to this mod.

Thank you. Much appreciated!

Share this post


Link to post
Share on other sites
On 8/8/2018 at 9:34 AM, navot said:

@Jesusthebird I found a thread for the mod. It is called Smart Actuators here. I didn't know this mod existed when I made this mod, so the features are probably pretty similar, but he says he wants to also disable engines gimbaling when they are off, which is something I'm not planning to add to this mod.

@navot

I've been using your mod for a while now, but the one thing I also wanted was automatic disabling of the engine gimbaling.

I've looked at both mods, and feel that your is more efficient; while Smart Actuators has code which reduces the control surface movement instead of just disabling it, but it requires more overhead from the game.

I've written an addition to this which will disable the engine gimbaling, and was wondering if you would like me to send a PR to your repo.

Let me know

Share this post


Link to post
Share on other sites
17 hours ago, linuxgurugamer said:

@navot

I've been using your mod for a while now, but the one thing I also wanted was automatic disabling of the engine gimbaling.

I've looked at both mods, and feel that your is more efficient; while Smart Actuators has code which reduces the control surface movement instead of just disabling it, but it requires more overhead from the game.

I've written an addition to this which will disable the engine gimbaling, and was wondering if you would like me to send a PR to your repo.

Let me know

that would be a nice addition.

Share this post


Link to post
Share on other sites
On 3/2/2019 at 4:43 AM, linuxgurugamer said:

@navot

I've been using your mod for a while now, but the one thing I also wanted was automatic disabling of the engine gimbaling.

I've looked at both mods, and feel that your is more efficient; while Smart Actuators has code which reduces the control surface movement instead of just disabling it, but it requires more overhead from the game.

I've written an addition to this which will disable the engine gimbaling, and was wondering if you would like me to send a PR to your repo.

Let me know

@linuxgurugamer First off, I just wanted to say a quick thank you for all your work and the contributions you make to so many different mods!

I'd really like to see your changes to make this mod also disable gimabling, but I'm not sure if I should put it in this mod, just because of the name "Control Surface Toggle".
I think the options to avoid name confusion would be:

  • make a new mod with your changes, that just disables the gimbaling
  • make your version with gimbaling and control surface disabling a new mod altogether under a  new name, and discontinue this mod
  • put the changes in @TheRagingIrishmans Smart Actuation mod, if that is something he'd be willing to do.
  • just put the changes in this mod and not care about the name

I haven't worked on this mod for quite some time, so I really wouldn't have a problem with discontinuing this mod or you making your current version a new mod.

Let me know what you think would be best

Share this post


Link to post
Share on other sites
4 hours ago, navot said:
  • make a new mod with your changes, that just disables the gimbaling
  • make your version with gimbaling and control surface disabling a new mod altogether under a  new name, and discontinue this mod
  • put the changes in @TheRagingIrishmans Smart Actuation mod, if that is something he'd be willing to do.
  • just put the changes in this mod and not care about the name

@TheRagingIrishman's Smart Actuation mod already has the functionality, so that is not really an option :-)

With these changes, both mods do the same thing, although differently.  I prefer this mod because it has less of a performance impact.

I'll adopt this, but will need a little time to come up with a new name

Share this post


Link to post
Share on other sites
4 minutes ago, JadeOfMaar said:

@navot @linuxgurugamer Well I'm hyped. :) And I know a few players who'll enjoy a current mod that handles both elevons and engines.

Just a bit more testing, it now controls control surfaces (which includes airelons, elvons), engines, AND airbrakes

Share this post


Link to post
Share on other sites

:o airbrakes too! Whose idea was that? It makes sense.

Share this post


Link to post
Share on other sites

I am open to suggestions for renaming this, since it now works with control surfaces, airbrakes and engine gimbaling

Share this post


Link to post
Share on other sites
Posted (edited)
3 hours ago, linuxgurugamer said:

Just a bit more testing, it now controls control surfaces (which includes airelons, elvons), engines, AND airbrakes

Can the engine gimbaling be made either toggle-able, an action group, tweakable, or just disabled (this mod's effect) when the engine is producing thrust/the throttle is set to anything other than zero? For when you are doing a manoeuvre burn that requires engine gimbals for control (eg. playing with a part failure mod that causes your RCS or reaction wheels, or both, to become inoperable).

Edited by Errol

Share this post


Link to post
Share on other sites
50 minutes ago, Errol said:

Can the engine gimbaling be made either toggle-able, an action group, tweakable, or just disabled (this mod's effect) when the engine is producing thrust/the throttle is set to anything other than zero? For when you are doing a manoeuvre burn that requires engine gimbals for control (eg. playing with a part failure mod that causes your RCS or reaction wheels, or both, to become inoperable).

Going to break this up into individual questions:

Is the engine gimbaling toggleable?  Yes, it is in the stock game

Can the engine gimbal toggling be controlled by an action group? Yes, this is stock already

Is this a tweakable?  No

If the throttle is set to 0, gimbaling is disabled.  If not, then it checks the fuel flow, if an engine is NOT having any fuel flow, then it is disabled.  However, if manually disabled, it will stay disabled.

And, it is possible to enable both control surfaces and engine gimbaling manually, regardless of the state of the engine or throttle

 

Share this post


Link to post
Share on other sites

Since nobody had posted any ideas, what do people think about "Intelligent Controllers" as a new name for the mod?

Share this post


Link to post
Share on other sites

Sorry, I'm late to the renaming party.

PMS - Pointless Motions Squashed.  Hmm, something seems wrong with this name. :/

NMQ - Needless Motions Quiesced.  Nah, no need to make some folks grab a dictionary.

UMB! - Unneeded Motions Begone!  Sounds too much like something you'd spray on the rocket before liftoff.

Seriously, tho... I think "Intelligent Controllers" is kinda generic.  How's "AECS Motion Suppressor" (Aerobrake, Engine and Control Surface Motion Suppressor)  Not nearly as snazzy, but it is a bit more descriptive.

 

Share this post


Link to post
Share on other sites
Posted (edited)
3 hours ago, linuxgurugamer said:

Since nobody had posted any ideas, what do people think about "Intelligent Controllers" as a new name for the mod?

S.L.A.P.

Space Limited Actuation Pauser

(This mod stops control surfaces and other parts from slapping your space station when docked in orbit..)

Edited by Errol

Share this post


Link to post
Share on other sites

I did a poll, and this one won:

AECS Motion Suppressor (Aerobrake, Engine and Control Surface Motion Suppressor)

 

Will try to get it released tomorrow

Share this post


Link to post
Share on other sites

@linuxgurugamer, can you make it so that you can turn off the control surfaces by action group.

Share this post


Link to post
Share on other sites
4 hours ago, Tabris said:

@linuxgurugamer, can you make it so that you can turn off the control surfaces by action group.

 

Yup

Share this post


Link to post
Share on other sites

Hi everybody,

I've released, new thread is here:

Please move all discussion there.

@navot could you ask the moderators to lock this thread?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.