magico13

[1.4.1] ScrapYard - The Common Part Inventory - 1.1.0.107 (2018-03-18)

Recommended Posts

No idea if there is anything you can do about this, but I'll report it anyway (I'm going to add a "please note" to UPFM for now).

When you return to the VAB after a flight, and KSP automatically loads the Auto-Saved ship (you know, when you go to the VAB and a craft is already loaded? Usually just after you've done a launch) - SY is not up yet, and it's functions don't work properly.

So in practical terms this means the following:

a) Auto-Apply inventory doesn't work on an auto-loaded vessel (you have to click the SY button again)

b) for UPFM the failure rates are off because when I query the new builds, I get zero.

For parts that are placed in the VAB by the player, rather than being auto-loaded it works fine (or if you click the SY button to make it update).

Edited by severedsolo

Share this post


Link to post
Share on other sites

I think I can probably just have SY do stuff when the editor loaded event fires. The auto-loaded vessel has caused me several troubles already.

Share this post


Link to post
Share on other sites

Sorry, another issue.

Does ScrapYard really have to be constantly checking when Auto-Apply inventory is clicked? Couldn't you listen to onEditorPartPlaced instead?

It's firing the OnSYInventoryAppliedToVessel event every time (even if nothing has changed) and causing lag in the editor (mostly due to UPFM, but I'd rather not turn off the logging for that event if I don't have to)

Edited by severedsolo

Share this post


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

Sorry, another issue.

Does ScrapYard really have to be constantly checking when Auto-Apply inventory is clicked? Couldn't you listen to onEditorPartPlaced instead?

It's firing the OnSYInventoryAppliedToVessel event every time (even if nothing has changed) and causing lag in the editor (mostly due to UPFM, but I'd rather not turn off the logging for that event if I don't have to)

It should only be doing it at most twice a second and then only when OnEditorShipModified has fired... I'll look into it.

 

Edit: Well, it looks like it fires the onEditorShipModified event when it's done applying the inventory, which then tells it to apply again and then causes an endless loop. I'll fix that tonight.

Edited by magico13

Share this post


Link to post
Share on other sites
3 hours ago, magico13 said:

It should only be doing it at most twice a second and then only when OnEditorShipModified has fired... I'll look into it.

 

Edit: Well, it looks like it fires the onEditorShipModified event when it's done applying the inventory, which then tells it to apply again and then causes an endless loop. I'll fix that tonight.

This sounds like it could be related to a problem I experienced this AM with this aand procedural wings, the game would start to lag wit every adjustment of wing size. Let me know if more info would help. 

Share this post


Link to post
Share on other sites

Well, the processing SY does isn't small, so it could be adding some lag even under normal conditions. I used half a second since it felt the most comfortable while still being a decent amount of time (without that setup it runs multiple times a frame. Like, hundreds of times a second). If you've got Auto-Apply on and are getting lag you can turn it off and see if the lag stops, if it does then that's probably why.

Share this post


Link to post
Share on other sites

Thanks, I did figure that out. Is there a reason to auto apply continuously rather than just when the Build button gets clicked?

Share this post


Link to post
Share on other sites
6 minutes ago, Nightside said:

Thanks, I did figure that out. Is there a reason to auto apply continuously rather than just when the Build button gets clicked?

It's for a couple reasons. One is because you're supposed to choose parts out of the inventory as you build, the automatic option was added as a stop-gap until that is working (but will likely stay in). Another is that when you're overriding funds it will cause the cost display to update correctly. And a third is that other mods that might use ScrapYard can display different things based on the current vessel that are pertinent information. For that last one, KCT is a clear example as it shows the build time for the current vessel and that's highly dependent on if you're using inventory parts. UPFM I believe has plans (or is currently) showing you the failure chance of parts while in the editor, which is a design decision. If you don't care about all that, you can just manually click the Apply button when you're done and ready to build. I don't intend to have it auto-apply at build time since the decision of which parts to use (if any) is supposed to ultimately be an active part of building the vessel, so if you don't want inventory parts you shouldn't be forced to use them, but I might consider adding a pop-up at build time asking if you'd like to apply the inventory if you haven't already, just in case you forgot.

 

Also, I made a new update. This one is for KSP 1.3 only. It's got the auto-apply (which was previously just in dev builds), added a "reset parts" button that resets the current vessel back to brand new parts (auto-apply kind of prevents that from sticking though), and fixed several bugs.

Edited by magico13

Share this post


Link to post
Share on other sites

I like being able to apply inventory only at the at the end of a build, as with all my mods I already run at about 30fps max.

Share this post


Link to post
Share on other sites
9 hours ago, magico13 said:

 

Also, I made a new update. This one is for KSP 1.3 only. It's got the auto-apply (which was previously just in dev builds), added a "reset parts" button that resets the current vessel back to brand new parts (auto-apply kind of prevents that from sticking though), and fixed several bugs.

The lag is alot better, thanks. I'm definitely noticing the "scrapyard is doing alot of work" thing you talked about when applying the inventory, but it's only when a part is placed now, so is definitely dealable (I've also had this session open for a while, so might be a memory thing at my end).

Just to REALLY be a pain in the bum, is there any chance you could fire an event when the player clicks the "Reset Parts" button? UPFM is assuming that the parts are still the inventoried ones, and I'm not really sure how else to determine that new parts have been used in the editor (it all sorts itself out in the Flight Scene)

Edited by severedsolo

Share this post


Link to post
Share on other sites

I have always exactly 0 times recovered for all crewed capsules (KSP 1.2.2, SY 0.9.4.51), even when I apply part inventory. All other part seem to get inventorized just fine. Is this the intended behavior?

Share this post


Link to post
Share on other sites
5 minutes ago, Pand5461 said:

I have always exactly 0 times recovered for all crewed capsules (KSP 1.2.2, SY 0.9.4.51), even when I apply part inventory. All other part seem to get inventorized just fine. Is this the intended behavior?

Let me guess, you are using TAC life support?

That issue was just fixed in the new 1.3 build magico put out, it was down to a rounding error in the vessel cost comparisons.

Share this post


Link to post
Share on other sites
1 minute ago, severedsolo said:

Let me guess, you are using TAC life support?

Close enough. Kerbalism.

Found the post about this issue. So, it's going to be there for most configurable parts, it seems.

Share this post


Link to post
Share on other sites
24 minutes ago, Pand5461 said:

Close enough. Kerbalism.

Found the post about this issue. So, it's going to be there for most configurable parts, it seems.

Try this build, it's the last for 1.2.2: http://magico13.net:8080/job/ScrapYard/55/

51 minutes ago, severedsolo said:

Just to REALLY be a pain in the bum, is there any chance you could fire an event when the player clicks the "Reset Parts" button?

Would it be fair to just fire OnSYInventoryAppliedToVessel again, or would you prefer a different event? I should probably just make an event that fires for every part whenever the ModuleSYPartTracker is changed in the editor, but that'll fire a lot when applying inventory, which is why I opted for the other call.

Share this post


Link to post
Share on other sites
10 minutes ago, magico13 said:

Would it be fair to just fire OnSYInventoryAppliedToVessel again, or would you prefer a different event? I should probably just make an event that fires for every part whenever the ModuleSYPartTracker is changed in the editor, but that'll fire a lot when applying inventory, which is why I opted for the other call.

That would be fine, I'm already listening to that event anyway, so would mean zero changes at my end.

Share this post


Link to post
Share on other sites
1 hour ago, severedsolo said:

That would be fine, I'm already listening to that event anyway, so would mean zero changes at my end.

Made the change through GitHub. It should be firing that now in the latest dev build.

Share this post


Link to post
Share on other sites

I think I'm missing something, but is there an option to view one's inventory? I saw that it is hidden in the cfg, but when I made it visible through that it just brought up a blank window with no option to remove or hide it. Is this a future addition? 

Share this post


Link to post
Share on other sites
2 hours ago, PhoenixSpaceIndustries said:

I think I'm missing something, but is there an option to view one's inventory? I saw that it is hidden in the cfg, but when I made it visible through that it just brought up a blank window with no option to remove or hide it. Is this a future addition? 

Yeah, that's the next thing I'm working on. Definitely not ready yet, sorry.

Share this post


Link to post
Share on other sites

I don`t know if it is UPFM: Untitled Part Failure Mod or Scrap Yard but I have a lot of errors in my log like this:

Quote

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object:get_name ()
  at Untitled_Part_Failure_Mod.BaseFailureModule.Initialise () [0x00000] in <filename unknown>:0
  at Untitled_Part_Failure_Mod.BaseFailureModule.OnSYInventoryAppliedToVessel () [0x00000] in <filename unknown>:0
  at EventVoid.Fire () [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)
EventVoid:Fire()
ScrapYard.Utilities.InventoryManagement:ApplyInventoryToVessel(IEnumerable`1)
ScrapYard.ScrapYard:VerifyEditor()
 

 

and this:

Quote

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

True

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

False

 

 

You can find the full Log here:

output_log.txt

I will crosspost this with scrap upfm.

Share this post


Link to post
Share on other sites

@magico13 Just an observation for you, ran into a situation last night, I built a plane, applied the scrapyard inventory to it, and then set KCT to build it. a few moments later, I realized I'd made an error, canceled the build, made a change, then attempted to re-apply inventory, but there was no change? seems like if you cancel a build with KCT you lose any applied scrapyard parts? At least that seems to be what's happened. I don't know if that's a bug, or behavior that wasn't considered, which I'd understand, or a design limitation of scrapyard, which also wouldn't surprise me. If this had already come up somewhere and you know, and I've just been a Numpty and missed that discussion, sorry. just wanted to let you know.

Share this post


Link to post
Share on other sites
33 minutes ago, vardicd said:

seems like if you cancel a build with KCT you lose any applied scrapyard parts?

If you scrap a vessel that is in progress, it is supposed to loop through all the parts and send any that were from the inventory back into the inventory. If you edit an in-progress vessel I don't think it will behave properly right now.

Share this post


Link to post
Share on other sites
3 minutes ago, magico13 said:

If you scrap a vessel that is in progress, it is supposed to loop through all the parts and send any that were from the inventory back into the inventory. If you edit an in-progress vessel I don't think it will behave properly right now.

no this was a complete scrap. I stopped the construction in progress completely, made edits to the saved plane template in the SPH, and then started a completely new plane building, but when I tried to reapply scrapyard parts before starting the build, nothing changed. the first time I was able to lower the build time to 8 days, after the scrap and rebuild, it took the full 41 days, scrapyard didn't save me any time or money.

Share this post


Link to post
Share on other sites
Just now, vardicd said:

no this was a complete scrap. I stopped the construction in progress completely, made edits to the saved plane template in the SPH, and then started a completely new plane building, but when I tried to reapply scrapyard parts before starting the build, nothing changed. the first time I was able to lower the build time to 8 days, after the scrap and rebuild, it took the full 41 days, scrapyard didn't save me any time or money.

Were any parts replaced with their inventory versions? You can check by right clicking them and looking for "Inventoried: true" rather than "Inventoried: false". I'll try to look into it, but if you see it again send me a log since it's pretty verbose about that.

Share this post


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