pellinor Posted May 1, 2016 Share Posted May 1, 2016 On 26.4.2016 at 0:02 AM, taniwha said: tweakscale support should not be necessary (tweakscale should just send the right message and everything should work). What message are you talking about? My understanding is that MFT already contains working code for MFT-TweakScale interaction using the TweakScale API. It was temporarily taken out of the release because of issues that no longer exist. And still is because noone on the MFT/realFuels side has found the time to look at the issue. @NathanKell : I think you did the removal. Is it still planned to eventually put this interaction code back in? Quote Link to comment Share on other sites More sharing options...
NathanKell Posted May 1, 2016 Share Posted May 1, 2016 @pellinor actually taniwha did. On the RF end, I will try to set up a similar message system to what taniwha did. And regarding the long-suffering @Svm420's issues, yes, those still persist AFAIK, and last I checked I couldn't tell if it was our side or yours, and due to crunch didn't get a chance to look deeper. Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 1, 2016 Share Posted May 1, 2016 (edited) 12 minutes ago, NathanKell said: @pellinor actually taniwha did. On the RF end, I will try to set up a similar message system to what taniwha did. And regarding the long-suffering @Svm420's issues, yes, those still persist AFAIK, and last I checked I couldn't tell if it was our side or yours, and due to crunch didn't get a chance to look deeper. Wow, this was fast. Looks like I missed that, just had in memory that the interaction came as its own dll in the past, and saw that the current MFT v5.7.3 does not contain any plugins other than modularFuelTanks.dll. Edited May 1, 2016 by pellinor Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 1, 2016 Author Share Posted May 1, 2016 I believe TS needs only to send an OnPartVolumeChanged event with appropriately configured data. I'm not quite certain what Procedural Parts does, but this is the code I setup to receive the event: [KSPEvent (guiActive=false, active = true)] void OnPartVolumeChanged (BaseEventData data) { string volName = data.Get<string> ("volName"); double newTotalVolume = data.Get<double> ("newTotalVolume") * tankVolumeConversion; if (volName == "Tankage") { ChangeTotalVolume (newTotalVolume); } } And this is one that MFT sends: public void RaiseResourceInitialChanged(PartResource resource, double amount) { var data = new BaseEventData (BaseEventData.Sender.USER); data.Set<PartResource> ("resource", resource); data.Set<double> ("amount", amount); part.SendEvent ("OnResourceInitialChanged", data, ); } Quote Link to comment Share on other sites More sharing options...
PortableGoogle Posted May 4, 2016 Share Posted May 4, 2016 Are all the stock mk2 and mk3 tanks and adapters compatible? Would this work with procedural fuel tanks? Does it work with all the resources in the community resource pack? For example could I use it to put whatever nuke fuel in procedural tanks (or even resources in procedural tanks too) and use mk2 and mk3 tanks to transport different resources to and from a USI base? Thanks Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 4, 2016 Share Posted May 4, 2016 On 1.5.2016 at 11:32 PM, taniwha said: I believe TS needs only to send an OnPartVolumeChanged event with appropriately configured data. I'm not quite certain what Procedural Parts does, but this is the code I setup to receive the event: And this is one that MFT sends: Seems I missed that post, sorry for the late reply. If I understand that right, these messages are a stock system that works on arbitrary event names and just looks for a corresponding kspEvent on each module. So the message would be "please multiply volume by a factor of X", how would I send that? Is the total volume a field of the part something that comes from MFT? Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 5, 2016 Author Share Posted May 5, 2016 pellinor: Correct, this is a stock system. However, the message tells MFT the total volume available, not a scale factor. I imagine what you could do is grab the totalVolume from the prefab's MFT module (via reflection to avoid linking issues), multiply by your scaling, then pass that to OnPartVolumeChanged. Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 5, 2016 Share Posted May 5, 2016 10 hours ago, taniwha said: pellinor: Correct, this is a stock system. However, the message tells MFT the total volume available, not a scale factor. I imagine what you could do is grab the totalVolume from the prefab's MFT module (via reflection to avoid linking issues), multiply by your scaling, then pass that to OnPartVolumeChanged. I'm now sending this message and it seems to work (TweakScale dev version). Had to to divide the volume by 1000 since those two 'totalVolume' numbers seem to use different units. As I understand this will currently support only MFT. And for RealFuels @NathanKell plans to hook into the same message, so the TweakScale part is fine now? Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 5, 2016 Author Share Posted May 5, 2016 RF uses the exact same code as MFT (just different cfgs, and a few extra modules), so everything should be good (except maybe that 1000x scaling, but I don't know. Hopefully @NathanKell can help out there). Quote Link to comment Share on other sites More sharing options...
NathanKell Posted May 5, 2016 Share Posted May 5, 2016 That's true for RF tanks. RF engines will need their own work. Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 5, 2016 Share Posted May 5, 2016 29 minutes ago, NathanKell said: That's true for RF tanks. RF engines will need their own work. Maybe we can agree on some "OnPartScaleChanged" or "OnPartRescaled" message that can be reused for other modules. Quote Link to comment Share on other sites More sharing options...
NathanKell Posted May 5, 2016 Share Posted May 5, 2016 @pellinor sounds good to me! If you pass me an absolute scale that should work fine. Note that in the editor I will fire an onvesselmodified event on receipt, so we need to avoid loops... Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 6, 2016 Author Share Posted May 6, 2016 MFT 5.7.4 out with a mass related fix. Quote Link to comment Share on other sites More sharing options...
ss8913 Posted May 7, 2016 Share Posted May 7, 2016 1 hour ago, taniwha said: MFT 5.7.4 out with a mass related fix. this is 1.1.2-compliant? Quote Link to comment Share on other sites More sharing options...
drtedastro Posted May 7, 2016 Share Posted May 7, 2016 3 hours ago, taniwha said: MFT 5.7.4 out with a mass related fix. Many thanks. Cheers. Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 7, 2016 Author Share Posted May 7, 2016 ss8913: indeed it is. Quote Link to comment Share on other sites More sharing options...
skald Posted May 7, 2016 Share Posted May 7, 2016 I'm getting some odd behavior. The only tanks that i have the option of changing are from the Talisar parts pack you updated. For those it works just fine, for everything else it doesn't. Seemed really strange considering you'd think if i broke something it wouldn't work at all. Any suggestions for where i can start looking? Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 7, 2016 Author Share Posted May 7, 2016 skald: It sounds like you do not have ModuleManager installed. Quote Link to comment Share on other sites More sharing options...
captinjoehenry Posted May 8, 2016 Share Posted May 8, 2016 Ok this mod does not work with size changing fuel tanks. No matter how you scale the fuel tanks it always holds the exact same amount of fuel and this issue extends to procedule fuel tanks as well. Quote Link to comment Share on other sites More sharing options...
nebuchadnezzar Posted May 8, 2016 Share Posted May 8, 2016 12 minutes ago, captinjoehenry said: Ok this mod does not work with size changing fuel tanks. No matter how you scale the fuel tanks it always holds the exact same amount of fuel and this issue extends to procedule fuel tanks as well. You need to update tweakscale. The latest version corrects this issue. Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 9, 2016 Share Posted May 9, 2016 @taniwha with the latest TweakScale and MFT I found the problem that scaling one tank sets the resource amounts of other tanks. I took two identical tanks, scaled one, and the MFT volume and resource amounts of both tanks changed. So the volume change message seems to travel from part to another. This is what I do to send the message, is that correct? My understanding is that the code should create an event that only affects the part my module is on. if (_prefabPart.Modules.Contains("ModuleFuelTanks")) { var m = _prefabPart.Modules["ModuleFuelTanks"]; FieldInfo fieldInfo = m.GetType().GetField("totalVolume", BindingFlags.Public | BindingFlags.Instance); if (fieldInfo != null) { double oldVol = (double)fieldInfo.GetValue(m) * 0.001d; var data = new BaseEventData(BaseEventData.Sender.USER); data.Set<string>("volName", "Tankage"); data.Set<double>("newTotalVolume", oldVol * ScalingFactor.absolute.cubic); part.SendEvent("OnPartVolumeChanged", data); } else Tools.LogWf("MFT interaction failed (fieldinfo=null)"); } Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 10, 2016 Author Share Posted May 10, 2016 You're not limiting the message to the one part. Add a 0 parameter to the call (limits the recursion depth): part.SendEvent("OnPartVolumeChanged", data, 0); Quote Link to comment Share on other sites More sharing options...
pellinor Posted May 10, 2016 Share Posted May 10, 2016 (edited) 12 hours ago, taniwha said: You're not limiting the message to the one part. Add a 0 parameter to the call (limits the recursion depth): part.SendEvent("OnPartVolumeChanged", data, 0); Ah, so this is what the extra comma in your quote was coming from! Thanks a lot. Edited May 10, 2016 by pellinor Quote Link to comment Share on other sites More sharing options...
taniwha Posted May 12, 2016 Author Share Posted May 12, 2016 New MFT (5.7.5) with a fix for MFT messing with staging (not sure of the details actually). Quote Link to comment Share on other sites More sharing options...
SteveD80 Posted May 14, 2016 Share Posted May 14, 2016 Anyone else use this mod with life support and turn a kerbodyne S3-14400 into a food/water/oxygen supply dump? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.