#Kerbal Life-Support System (KLSS)
1 messages · Page 3 of 1
Yeeted the stock ResourceFlowRequest shenanigans from my mod, was annoying and didn't provide anything useful
ResourceContainerGroup.RemoveResourceUnits is my new best friend
Made my code shorter and easier to understand too
Life-support supplies ignore cross-feed and stuff, but eh, makes everything way easier
What's the difference between one and the other?
For Orbital Survey I've noticed that the ResourceFlowRequest tends to break on very high warp factors, 10000+ I think. So a better way would be nice
For KLSS: I want to be able to "ignore" overflow for waste resources, ie set their production to zero when full
With ResourceFlowRequest this didn't work well and it would require me sending multiple requests each time
With "direct resource editing" it works seamlessly
I think this is caused by the AcceptanceThresholds
I'm trying to figure it out too for my recyclers which are stock resourceconverters
Good to know, I might try tweaking that to see what will change
If you manage to make it work let me know, I'm looking into it on my side but two brains are better than one
Ah another difference: directly editing the ResourceContainerGroup should be less performance-intensive than using the ResourceFlow system (no need to compute flow graphs and stuff like that, an equal amount of the resource is taken from/ added to all containers on the vessel)
Equal meaning, if you want to take 10 resources and you have 2 tanks, do you remove 5 from each or 10 from each?
(p.s. I didn't have time yesterday to try this)
5 from each, the total requested amount is split evenly across all containers in the group
It's nice for LS and stuff like Electric Charge where we don't really care about container priority and stuff like that
But for stuff like fuel the flow requests are definitely needed (well they were made for that I think)
Regarding the high time warp issues, I still haven't found a configuration that is stable at warp >=100 000x :/
Alright, that's good to know! Yeah, it's not crucial for EC to follow priority. Would be nice one day when we get to RO playmodes where you have to min/max resource utilization, but good enough for now.
hmmm I broke my Unity
I tried setting up my stuff by taking inspiration from the SW Template UI project but I might have borked something along the way
But why, that is the question
If I remove the factory from my control Unity loads fine
using UnityEngine.UIElements;
namespace KerbalLifeSupportSystem.Unity.Runtime
{
/// <summary>
/// Life-Support UI entry horizontal divider
/// </summary>
public class LifeSupportEntryDividerControl : VisualElement
{
private const string ClassName = "ls-entry-divider";
public LifeSupportEntryDividerControl()
{
AddToClassList(ClassName);
}
public new class UxmlFactory : UxmlFactory<LifeSupportEntryDividerControl>
{
}
}
The control for reference
huh that's weird
Unity sometimes spazzes out when you don't have asmdefs for your code (especially when using ThunderKit and imported KSP2) and messes up the load order
so I just use them out of habit for everything
you can just make one by right clicking in the folder with your code in Assets and creating an Assembly Definition
UI rework taking longer than I thought, maybe because I want to add some features and I haven't touched UI code in a long while ahah
awesome!
some progress (taking some inspiration from the great Wayfarer's Wings UI)
Nice! Those are all things that I'm definitely planning to implement in UITK 3.0
All the custom controls!
This is awesome!!
That would be great, plus we could have all the mods streamlined to consistent UI, great UX for players ❤️
it will be much better now that we actually have a solid foundation for UITK in 2022.3
I kinda didn't want to get into the custom controls a lot because of how buggy the UITK preview package was
and now the devs are also working on unifying the game's UI more and more, so that also helps me a lot
not having to pick from 5 different styles
A month late, but done: https://wiki.spacewarp.org/wiki/Configuring_the_reentry_effects
some more progress, I'll need to look into Click Through Blocking and Input Locking for all of that stuff
input locking is built into UITK for KSP2
click through blocking will be added in the next release, for now you can use @atomic geyser's extension method
I might as well make a 2.5 release with just the click through blocking, it's a very useful feature, no reason to wait for 3.0 with it
It works for all unity base inputs?
(don't know how extensions and stuff like that works)
I specifically call it only for text fields
but you can call the method on other elements yourself
Oh extension methods look cool
They are! You can just add a method to any (non-static) class
the DisableGameInputOnFocus method is an extension for VisualElement
so you can use it with anything
though it relies on the element having FocusIn and FocusOut events
if those don't happen, then it won't do anything
I've run into a problem where an inactive vessel that used to be self-sufficient (with enough greenhouses and recyclers to maintain infinite time) will start to show a finite time in the life support window. But the strange thing is that even though it has a specific timeperiod left, the counter doesn't go down over time even when the game is not paused. If I go to the vessel, turning on and off the recyclers don't seem to have an affect on the life support window, which still shows the constant time left. when the recycler is on, there is an unfilled {u1} token in the water output. See the screenshot below:
if I try to do a quick save and restore at this point~~, the game hangs.~~ I'm able to reload, and the {u1} artifact goes away, but the ship still doesn't seem to be calculating KLSS statistics and toggling the recycler again brings back the {u1} artifact.
The work around I have found that seems to work is to:
- Restore from before I went to the affected vessel.
- Crate a replacement vessel in the VAB
- Teleport the replacement vessel to the problem vessel
- Kerbals go from the old vessel to the new one via EVA
- Go to tracking station and delete the bad vessel
I've had this happen a number of times. Would a save game be helpful? I could give you one that has it before I went to the affected vessel if that would help
BTW I love this mod! I really like the extra parts and having the additional design considerations to satisfy the kerbal's needs. Thanks so much for it!
Here's my save game in case it is helpful. Affected vessel is Starship-9.
Thanks for the report and savegame, I'll look into it!
more UI progress
(work on my mods is slow 'cause motivation is not very very high)
Oh! I would say that your work is inspiring and I can’t wait for the UI adaptation, KLSS is so good ❤️
I think the controls are done, now to tie all of this with some nice logic
I need a grid table for my markdown renderer
seems very nice ❤️
Looks awesome!!
Hmmm my UI asset bundle is 46MB now, did something change with UitkForKsp2?
Ohh I see
the workaround is to never directly reference the font assets, instead use the provided variables
that will make sure the fonts don't get copied
And a few restarts of unity after changing that
Yeah I saw that variables tend to make the UI Builder very unstable for some reason
Don't know if it's variables, but I have been having issues where unsaved progress was deleted when saving because of some Font warnings
that usually only happens to me when some of the USS or UXML is changed from outside of Unity
as for the font warnings, honestly no clue why these happen I think it's basically whenever the font atlases get updated because you added some new text to the UI, and so the newly used characters get added to the pre-computed portion of the (otherwise) dynamic atlas
ah yeah that did the trick thank you
Hmmm I think my multi-project setup is broken, I'll take a look at the template again
Hmmm everything is very broken, I'll probably move to a clean new project
not that I can see
oh wait
forgor to call it 🥹
oh lmao
that would do it
it's there in the template, but I assume you just copied over the plugin file with your own
I copied the snippets of code I needed
And forgot this line lol
alright that's better, but now to find out why it's opened by default
well, it is unless you hide it in the code when you first load it
Ohh okay, imma just add a lsMonitorController.IsWindowOpen = false; then
that's better
some styling needs fixing
also I'll add a "show empty vessels" toggle
and maybe a "show active vessel on top"
These toggles would be definitely useful
PS: I think on your top bar there is a Flex Shrink: 1 setting which is shrinking the tabs & search field
iirc if you set flex-shrink: 0 it should keep its height
@silver jungle are there game-like toggles in UitkForKsp2?
there are the ones with the .toggle class
though it seems like they're mostly getting rid of this style of toggles with the UI unification, so I'll probably try to rework them to look like the other type
these ones?
yeah that's the new(er) ones
more progress, need to get filtering & sorting trigger done next
also increase opacity a bit
ugh the old UI was so ugly in comparison x)
Is the logo going to stay the same ?
It's wierd to have a colored logo
I agree. Who would use a color logo! That's just wierd.
Join the Dark Side
I mean, really...
Lemmie guess... You've got cookies?
I like my color logo 
Only 2 colors, not much data needed
No, just that any resistance is futile
I like it too, and fully support your choice to be color divergent
Your biological and technological distinctiveness will be added to our own.
And we managed to cross the franchises, that's a big no no, bad leonardfactory 🙂
"I'm Homer of Borg! You will be assim... Oooh! Doghnuts!"
Hahah
I said that knowing that I was crossing a line I shouldn't cross
😄
LOL

ok switch statements with patterns are pretty cool
C#'s pattern matching is quite useful
C# is awesome
Agreed
I'm writing Java rn, and I hate ittttt
Java isnt that bad its pretty similar to me
Isnt kotlin jus tlike a newer version of it
Hmmm I upgraded my KLSS project to C# 12 and now it looks like changes to my code don't affect the mod in-game
and all of them run on JVM
scala????
similarly to how C#, VB and F# are all very different languages that all run on .NET
Is .NET 8.0 allowed for mods?
looks like python to me
we use it in SpaceWarp just fine
or javascript
I'm confused about that then 
are you rebuilding the solution?
Pretty sure I am?
(as opposed to just building)
ah
you might also want to delete the build and dist folders, and then run nuget restore
just to clean stuff up
this is needed to force all the post build events to always run
since sometimes VS can just decide it doesn't need to rebuild everything
I map ctrl-shift-f9 in rider to force rebuild
same
I think I broke smthg
what's that before?
I just upgraded my projects to C# 12 
installed .NET8
changed stuff in the csproj
use upgrade-assistant tool thingy
there shouldn't really be any need to change the csproj to be honest
well, that is if your LangVersion is set to latest
it will just automatically go from supporting 11 to 12
and I have no clue what the upgrade assistant thing is
found the issue, I was setting TargetFramework to 8.0 ><
I think I got everything working as it should!
ahhh yeah that would do it
Mono doesn't support the newer .NET releases afaik
so we must build it as .NET Standard 2.1
Hmmm Starship-9 doesn't seem to have enough EC production to keep all the recyclers running
ah, try using infinite electricity. I have an unpublished mod that you don't have that has a generator as part of it. Pretty sure that isn't the problem... things are locked and don't count down. It isn't just that it isn't recycling.
if you aren't able to replicate it with infinite electricity maybe it is an interaction with my mod, but I don't think so
I suspect it has something to do with having multiple ships launched based on the same blueprint because I have only seen it when I have more than one team out
Hmm okay I was able to reproduce the issue on the Mk2 vessel
water: u1 same as you
I'll look into it right away
awesome! thank you!
One more thing, I'm not sure if it makes a difference, but these are my settings for lifesupport:
since you haven't had the issue on your game, maybe it's somehow related because I have easier settings set?
ok, great! replicating an issue is usually the hard part
But since I am using the game's stock ResourceConverter for recyclers I don't know what's on me and what's on the game being broken ><
I am not sure it is the resource converters. I've used those too in patch only mods. Even if the resource converter is off, it isn't counting down once it has the issue. It's like something on the consumption side is exceptioning out
I am not seeing the issue of "time not counting down" however
Even on a ship that already has the {u1} issue? If you turn off all converters??
yeah
ok, that is strange.
What I'm seeing in the ls monitor is flickering between infinity and some time
Sometimes
And sometimes it changes based on if I'm time warping or not
That is what happens for me when it is working, but then it freezes to something non-infinite when the converters do the {u1} thing, regardless of whether they are enabled
I just had it happen on one again. This time I just had one team out, but I undocked some satellites and was positioning them when it transitioned from working (with the flickering as you described) to stuck. When I switched back the converters output section did not have the issue, but when I toggled it off and on, it did.
Could it have something to do with starved converters? I'm not sure, but this might be what happens: I start out, and forget to turn on the recyclers. Then I enable them, typically at around 120% of what I need to keep up. Slowly over time the recycler catches up recycling the CO2 and waste water. It might be when it transitions to the flickering and then I toggle between vessels when the error occurs that somehow corrupts something to do with the vessel and from then on, consumption and recycling are both frozen. Not 100% sure of the timing here, but that is about what happens in my experience
By turning all recyclers off, letting EC recharge, and then turning then back on I have stabilized the situation aof a vessel
were you ever able to replicate the freezing of the count down timers?
No
Hmmm.... let me see what I can do on my side. I'm going to uninstall my mod in case it is causing a problem and switch on infinite electricity to see what I experince then.
I think I'll first push a new release of KLSS with the new UI, then you could try it again with the new version
Were you able to replicate the {u1} issue independently of my saves?
I have never seen it elsewhere, let me try some stuff
Also, how do your patch only mods affect resource converters? Do you add converters to parts or do you modify all converters? (modifying all converters will probably have an effect on KLSS)
I add resource converters to specific parts. I actually used your code as a ref, and wonder if I did something wrong like use an id from KLSS by accident but I thought I found everything. I'm disabling it and will see whether I can reproduce it without it. I have a hunch I've sent you on a wild goose chase and will update you shortly
Hmmm... so unfortunately removing my mod and cycling the converters didn't resolve the issue. Maybe it isn't my mod, but some other mod? Which of the following mods do you not have in your game:
I also have CommNext in addition to the above, but I had the issue before I installed that one.
As for how I use converters, I have this cheaty patch that adds converters to some fuel tanks. This stuff is lifted directly from KLSS. I think I moved everything KLSS specific out of it, but if you want to take a look here it is.
but like I said I removed this patch from the game and still couldn't cycle the converters to resolve the issues
Yeah if you're not modifying KLSS's recyclers I don't see how this could cause any issues
try turning all recyclers off (including composter & greenhouse), letting some EC recharge and then turning some recyclers on again
nope, just shamelessly lifted from yours but not using KLSS tiems
So EC is stuck at the highest value, maybe it is related
it isn't going down when I toggle
that just means you're producing enough to keep it full
I am definitely not producing enough if the converters are using the power
but I do have a little generation that is on that would handle other stuff
I took out all mods except the following and I still can't recover my save that is already having the issues. In the save I sent you that was Starship-9. Note that Mk2 and Starship-13 were not experiencing the issue in the save game I sent to you. Even with only these mods, I still don't show starship-9 as counting down after carefully stopping all recyclers including the greenhouse and composter. So I'm at a loss and think we should drop it until/if someone else reports the issue.
If that happens and I can be of help with testing stuff, feel free to reach out. Thanks for looking at this!
@olive sinew thank you btw for your translations for this mod, I have a few more strings to be localized if you have the time:
Key,Type,Desc,English,Chinese (Simplified),French
KLSS/Notifications/ResourceGraceStarted,Text,,"A vessel has run out of ""{0}""",,"Un vaisseau est à court de ""{0}"""
KLSS/Notifications/ResourceExhausted,Text,,"A Kerbal on board ""{0}"" has died from lack of ""{1}""",,"Un Kerbal à bord de ""{0}"" est mort de manque de ""{1}"""
KLSS/UI/AppBar/Title,Text,,Life-Support,,Support de vie
KLSS/UI/Monitor/Title,Text,,LIFE-SUPPORT,,SUPPORT DE VIE
KLSS/UI/Monitor/FilterVessels,Text,,Vessels,,Vaisseaux
KLSS/UI/Monitor/FilterKerbals,Text,,Kerbals,,Kerbals
KLSS/UI/Monitor/FilterBoth,Text,,Both,,Tout
KLSS/UI/Monitor/HeaderName,Text,,Name,,Nom
KLSS/UI/Monitor/SettingShowEmpty,Text,,Show empty vessels,,Voir vaisseaux vides
KLSS/UI/Monitor/SettingActiveOnTop,Text,,Active vessel on top,,Vaisseau actif en haut
Oh god while testing I saw what the Mohole was called in French and uh I don't know what to do with the info
"Mohorifice", like it makes sense but it's weird

(also you're welcomed to add translations to Community Resources if you want and if you have time, this is where the localized resource names for KLSS are from)
orifice is kind of a hole
but like its wierd
Done and created a pull request
Nice, thank you!
Also done
ok someone make a sequal to deep freeze, sleeper ships would be epic
sleeper ship to laythe, land and thaw out the crew, use their onboard supplies to survive for a year, freeze them and return them to kerbin
Hi! I wanted to follow up to say that since I have upgraded to version 0.6.0, I have now replicated your experience with my save where I initially saw the {u1} but it went away after cycling the recyclers. And everything is now counting down as it should. Plus, the new GUI is great! I think this version resolved all the issues I had, I haven't seen the {u1} come back. Thanks so much!
Glad to hear your issues were resolved!
Question: is there a way to see life support estimates for a ship while in the VAB?
Yes, you can open the life-support monitoring UI in the VAB by clicking the button in the app bar tray at the bottom of the screen like in flight mode
Hmm, I thought it wasn't showing me the craft I was working on, I'll check again
Maybe the craft had no command pod or crew capacity?
Let me know if it doesn't behave as expected
Maybe the game got a bit confused because I had several assemblies in the space and was switching between them, or maybe I just misread a line
Will do
Currently the life-support UI in the VAB only shows the selected assembly iirc, it might be a bit buggy as it isn't a part of the mod I investigated very thouroughly
Will try to set up part variants for the three types of specialized storage parts tmrw (the tiny, the Toblerone and the Cygnus)
Alright
Well itll be at least a few hours till I can get Spring Cleaning on CKAN, so that at least doesnt put a time pressure on me
Just ping the netkan wrangler role
And i know this isnt your job , but there's a bug that allows you to control your vessel even without vessel control
Yeah that would be a good fit for Community Fixes ^^
#1208120894254358608 message
Could this be possible someday ?(maybe with Interstellar update?)
Yeah that's definitely possible, but I'll keep that for later yeah
hmmm I think I broke something
ah yeah I see many issues lol
better lol (some stuff got wonky when copy/pasting game objects in unity
Yup
6 fewer parts in the OAB letsgo
@olive sinew sorry to bother you, I have a few new entries to localize if you have time at some point
Key,Type,Desc,English,Chinese (Simplified),French
KLSS/Variants/TankType,Text,,Tank Type,,Type de Stockage
Parts/Subtitle/KLSS_storage_0v_radial,Text,,Portable Supplies Storage,,Stockage de Provisions Portatif
Parts/Description/KLSS_storage_0v_radial,,,The PSS-10 is an extra small radially attached supplies pack. Perfect for quick rover expedition on another world.,,Le PFS-10 est un petit pack de provisions attaché radialement. Parfait pour les expéditions en rover.
Parts/Subtitle/KLSS_storage_2v_radial,Text,,Triangular Supplies Container,,Conteneur de Provisions
Parts/Description/KLSS_storage_2v_radial,,,The TFC-300 is a medium size radially attached supplies container. This is the kind of chocolate-shaped storage space you'll need for your inter-colonial resupply missions.,,Le TFC-300 est un conteneur de provisions attaché radialement. Ce conteneur de la forme d'une fameuse barre chocolatée est parfait pour réapprovisionner vos colonies.
Parts/Subtitle/KLSS_storage_2v_1x2,Text,,Medium Supplies Storage,,Stockage de Provisions Moyen
Parts/Description/KLSS_storage_2v_1x2,,,The MWS-200 is a medium-diameter supplies storage module. This is what was used on the famous Kygnus resupply vessel.,,Le MFS-200 est un module de stockage de provisions de taille M. Notablement utilisé pour le vaisseau Kygnus.
(you can either send them here where you can or submit a PR on the repo, whatever is easiest for you)
The medium part storage MSS-200's icon is so cool
PR sent. Can't wait to try out the part switch!
@sudden oriole quick Premonition question: is it possible to access and modify an instance's private fields in a postfix patch?
I mean you can get a reference to the instance in a postfix patch, it just has to be an argument other than the first
and from there publicization is the recommended way to access stuff
I'm not sure I understood what this means precisely
having the Publicize="true" attribute on your KSP2 GameLibs reference
so that you can see and modify private and protected fields
Ahh right didn't have that set
Thank you!
hmmm light dark magic
gray magic
(after that I'll need to add:
- stopping Kerbals from being able to do experiments
- stopping kerbals from being able to go on EVA
)
When on EVA, being on strike will only prevent from doing experiments I think, otherwise it'd doom them if they can't move to a pod
Ok scratch stopping Kerbals from going on EVA, would require advanced stock UI patching shenanigans and it's not worth the effort imo
Urgh the function checking if an experiment is possible is horrible too
hehe no more science if kerbal is hungy
So Tim is No Crew
yeah 'cause he went on strike
If he's in EVA how would he do that
If he's in a vessel he can't control it
He can only move in EVA
another vessel can dock to his without the control of the vessel to be rescued
Yep
He cannot control the vessel he's in
But he can move in EVA
sounds like that
Well uh then you'll have kerbals adrift in space lol
Sounds like a them problem
and on planets ?
On planets?
well you wont drift
ah true
if there's no food just kick everyone out
Well you can, won't change much lol if you're out
@olive sinew sorry to bother you again, should be the last time for this update, but I've got one final localization item:
Key,Type,Desc,English,Chinese (Simplified),French
KLSS/Notifications/ResourceExhaustedStrike,Text,,"A Kerbal on board ""{0}"" went on strike from lack of ""{1}""",,"Un Kerbal à bord de ""{0}"" est en grève à cause d'un manque de ""{1}"""
You can send the Chinese version here directly when you have the time 🙇♂️
Key,Type,Desc,English,Chinese (Simplified),French
KLSS/Notifications/ResourceExhaustedStrike,Text,,"A Kerbal on board ""{0}"" went on strike from lack of ""{1}""","载具""{0}""上的一名乘员因缺少""{1}""而罢工","Un Kerbal à bord de ""{0}"" est en grève à cause d'un manque de ""{1}"""
Here you are, sorry for replying late.
Kerbal's are translated into 乘员?
Thanks! And no problem I was asleep anyways x)
Now onto writing up the release notes
If you're not available I can ping the other netkan wranglers
well, because it only can be one variant at a time
and food is the default one
to see the other capacities, just put the part somewhere in your workspace and switch the variant to see the values in the part manager
oh
well, either way, it's a question for #1208120894254358608 rather than this mod
the mod can't control the information shown in the statistics for variants
What am i to do here?
well, I think the idea is to provide some sort of a way to see in the R&D (and VAB part picker, since it's the same popup, really) what stats the other variants have
That should be possible i suppose
