Closed MOARdV closed 7 years ago
Wiring up a GLOBAL that is interchangable with PERSISTENT is going to be a lot of effort. I think a better approach will be to add a configuration to JSIActionGroupSwitch that tells it to broadcast a persistent variable. There will likely be some oddities when craft dock - particularly, if the values in the two craft differ, which ever craft makes a change first will override the other's setting - but I've already spent a large amount of time trying to reconcile that problem with no success.
I tried to use this option, and it looks like it works but causes an exception:
[EXC 22:04:06.175] NullReferenceException: Object reference not set to an instance of an object
JSI.RPMVesselComputer.SetPersistentVariable (System.String name, System.Object value)
JSI.RasterPropMonitorComputer.SetPersistentVariable (System.String name, System.Object value, Boolean broadcast)
JSI.JSIActionGroupSwitch.Click ()
JSI.SmarterButton.OnMouseDown ()
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)
config:
PROP
{
name = swTumbleAVAS_ON
// action
MODULE
{
name = JSIActionGroupSwitch
// animationName = SwitchTumbleAnim
switchTransform = SwitchColider
actionName = dummy
initialState = false
perPodPersistenceName = AVAS_ON
perPodPersistenceIsGlobal = true
// switchSound = ASET/ASET_Props/Sounds/button-30
}
MODULE
{
name = JSICallbackAnimator
variableName = PERSISTENT_AVAS_ON
VARIABLESET
{
animationName = SwitchTumbleAnim
scale = 0.5,1.1
}
}
....
ASET stuff: https://www.dropbox.com/s/i3cq94ms8nfmw14/ASET_Dev-26-11-2016.zip?dl=0
Fixed.
As a side-effect of redesigning the part / vessel module interface, I broke the global behavior of persistent variables. In v0.26.0, a persistent value applied across the entire vessel, not on a per-part basis. In v0.26.1 (as of right now), persistent variables are per-part.
I should add a GLOBAL variable type that behaves as a persistent var, but it broadcasts its state to other parts on the same vessel. There is a performance penalty for that capability, so I don't want to make it apply to all persistent vars; however, making sure existing code will work with both PERSISTENT and GLOBAL_ may be more effort.