#Patch Manager
1 messages · Page 4 of 1
Oh so if I'm guessing right they are displayed directly with the order coming from the xxxx part of xxxx-family? (away from computer can't look into the code rn)
Likely
It needs like 7 patches
Pretty much the same that i did for LOABE patching of the labels
I have a working version already for it
speaking of which, LOABE is still broken afaik
Yeah, havent had the time yet
just wanted to let you know
Am out of home rn 😔
I think it's the only mod not fixed for 0.1.4 afaik
lmao
@maiden wraith
public static void Patch(AssemblyDefinition assembly)
{
GetCategoryDefinitions();
var type = assembly.Modules.SelectMany(x => x.Types).First(x => x.FullName == "PartsCategories");
var start = type.Fields.Count(field => field.IsStatic);
foreach (var definition in CategoryDefinitions)
{
var categoryField = new FieldDefinition(definition.Key,
FieldAttributes.Static | FieldAttributes.Literal | FieldAttributes.Public | FieldAttributes.HasDefault,
type) { Constant = start };
start += 1;
}
}
Is something like this how you added the fields to the enum?
Nop
It has like 8 diffrent references
Where it discards if not in the default range
Oh gods
If they didnt use enums
Btw, both the category and the family arw enums on their unity editor
Can you make a list with all the families and categories pls cheese?
it's on the wiki
All the 90 families?
It is on their unity editor i think, its a custom script
well then we have no idea to know all of them
Idk how to write this forum suggestion
I dont see them actually inputing by text ngl
I gathered all the ones that are currently used in the game
Just get from the parts json
yeah but that probably isn't even close to all of them
I have a script that goes through all part jsons and gets all the unique values
... part families are a private list...
https://wiki.spacewarp.org/wiki/Category:Core_Part_Data specifically this category
gathered the category, family, size category, stage type and staging icon asset address data
from the part jsons
But it does generate on an unknown familky
Wow munix is currently the only one to have edits to the wiki in the past 30 days
Hopefully linking the wiki in the modslist for 1.5 will help witht hat
Which is ... pain
yeah
Anyways ... back on topic, is there much more we should do for a prerelease
Documentation and examples ... yeah fair, but I can work on those still after prerelease, and help people with stuff which will help me with documentation
one thing I think would be nice would be an adapter for galaxy definitions and celestial bodies
even if it won't work 100%
I don't know if thats yet necessary for a prerelease
the reason I'm saying it is that there was recently someone asking for basically the same thing: #1091980188096675911 message
though I guess they could always just use the json one
Thats ... for tech trees
oh I am dumb lmao
for some reason I just saw Hyperion and connected it to https://discord.com/channels/1078696971088433153/1087240037021777960
welp nevermind
I need more sleep

This is my WIP documentation so far
Its based off of a markdown file though so I can use something like that for an online documentation
Yeah, I'm likely going to put it somewhere on the web in markdown
Would it be worth moving Antlr to its own separate library?
I honestly don't know
just finished reading through it
looks awesome
these are all patches for the labels btw
half of those have a "if not on the enum, return error"
panic not implemented
munix
can you check psl
if this class still exists?
i might be going crazyt
actually
i think i just had re-exported the 1.3.2 source code
nope it doesn't
Now that we'll have patch manager soon and there are mods in the works with custom resources, I was thinking of creating Community Resources that mods could use to have a common ground for new resource definitions.
Reading through the docs...
So new resource would be defined like so:
@new("Stormlight")
:resources {
displayNameKey: "Resource/DisplayName/Stormlight";
abbreviationKey: "Resource/Abbreviation/SL";
isTweakable: true;
isVisible: true;
massPerUnit: 0;
volumePerUnit: 0;
specificHeatCapacityPerUnit: 2010;
FlowMode: 4;
transferMode: 1;
costPerUnit: 0.8;
NonStageable: false;
resourceIconAssetAddress: "";
vfxFuelType: "Pressurized";
}
And then mods could hook up to community resources to get definitions like so:
@use '_community_resources.patch';
Is this correct?
A mod wouldnt even have to include the library
Just depend on the community resources mod
Because the resources get added to the games corpus of resources
And new resources would be added to GameManager/(snip)/ResourceManager and ResourceDefinitionDatabase?
They should be yes, those are populated by the resource definition assets
yeah they will
I mean they would if they would use the new resource to patch some part that they will define, no?
The resource is used as a string for the resource name, so no not really
Alright, even better
Also about libraries ... outside of the current mod you are in
They are namespaced like mod_id:libraryfile
But to answer your original q, yes that would be how to define a resource
Made a PR for when you get the chance 
@stiff crater
🤩
Will look at it tomorrow, I need to go to sleep rn x)
Anyways time to test falkis patches
@desert stirrup I know you are sleeping but your patches seem to have worked
Food
{
"version": 0.1,
"useExternal": false,
"data": {
"name": "Food",
"displayNameKey": "Resource/DisplayName/Food",
"abbreviationKey": "Resource/Abbreviation/FD",
"isTweakable": true,
"isVisible": true,
"massPerUnit": 1,
"volumePerUnit": 5,
"specificHeatCapacityPerUnit": 10,
"flowMode": 0,
"transferMode": 1,
"costPerUnit": 0.8,
"NonStageable": false,
"resourceIconAssetAddress": "",
"vfxFuelType": "NoFuel",
"FlowMode": 4
}
}
Water
{
"version": 0.1,
"useExternal": false,
"data": {
"name": "Water",
"displayNameKey": "Resource/DisplayName/Water",
"abbreviationKey": "Resource/Abbreviation/H20",
"isTweakable": true,
"isVisible": true,
"massPerUnit": 1,
"volumePerUnit": 1,
"specificHeatCapacityPerUnit": 1000,
"flowMode": 0,
"transferMode": 1,
"costPerUnit": 0.8,
"NonStageable": false,
"resourceIconAssetAddress": "",
"vfxFuelType": "NoFuel",
"FlowMode": 4
}
}
Oxygen
{
"version": 0.1,
"useExternal": false,
"data": {
"name": "Oxygen",
"displayNameKey": "Resource/DisplayName/Oxygen",
"abbreviationKey": "Resource/Abbreviation/O2",
"isTweakable": true,
"isVisible": true,
"massPerUnit": 1,
"volumePerUnit": 1,
"specificHeatCapacityPerUnit": 1000,
"flowMode": 0,
"transferMode": 1,
"costPerUnit": 0.8,
"NonStageable": false,
"resourceIconAssetAddress": "",
"vfxFuelType": "Pressurized",
"FlowMode": 4
}
}
Waste
{
"version": 0.1,
"useExternal": false,
"data": {
"name": "Waste",
"displayNameKey": "Resource/DisplayName/Waste",
"abbreviationKey": "Resource/Abbreviation/WST",
"isTweakable": true,
"isVisible": true,
"massPerUnit": 1,
"volumePerUnit": 1,
"specificHeatCapacityPerUnit": 10,
"flowMode": 0,
"transferMode": 1,
"costPerUnit": 0.8,
"NonStageable": false,
"resourceIconAssetAddress": "",
"vfxFuelType": "Pressurized",
"FlowMode": 4
}
}
I also put a PR into your mod to structure it better and give it a swinfo
Worked right from the start? No way, that's a first 😛
Well mostly, your patches did have flowMode erroneously capitalized
I was wondering: how is the order the patches are applied decided? (and does it matter, like if I have a patch that adds a resource from Community Resources to all command pods wouldn't CR's patches need to be applied before mine?)
There is a stage system where patches can define stages are given integer values
I need to add an @before and @after, but if you coordinate those values with other mods it should be fine, or make a common stage definition library
And patches that define new assets always run before patches that modify things due to how the system needs to work
That make sense Safarte?
Yes, so by default if no stages are defined it's based on definition dependencies if I understood correctly?
And a Community Patch Stages library would indeed be pretty useful
Or maybe it could be included with PM?
That would be easy enough
If there are no stages its defined based off of order within file and order that main mod is loaded with spacewarp which is based off the main mods dependencies
The patches dependencies are if specific mods exist
This feature is still something wip im working on so it should be more fleshed out soon
Its also likely good practice to give stages granular priorities ... like instead of 1 use 100
Because this means that once I add before and after stuff ... that it can actually insert stuff between those stages
I feel like specifically the patch ordering, stages and before/after stuff is what we could use feedback on from KSP1 modders the most
I know they had some pretty strong opinions on how MM does it (wrong)
And it might be the most complex issue of the whole system
A complex dependency/soft dependency system :p
Ohh thats my fault
I broke something in a patch I made just before the prerelease ... give me one millisecond
@north mist can you disable oauth access restriction on KSP2community
Done
Try this version
It fixes the error I made
Still borked with the same error :/
I made you an admin so you should just be able to do anything with the organization now
Even the line number is the same, is the zip you sent me the new version?
It should've been, I did press build but somehow it didn't for me
Okay, I deleted the old artifacts and rebuilt
@stiff crater did this work for you?
Yes the game loaded! (now to get my patch to work, but let's talk about this in https://discord.com/channels/1078696971088433153/1145349899777478759)
Oh by the way, @upbeat hare if you have the md for the docs, we can make them a PM wiki page and you can keep editing it there
I put a PR out for adding @require functionality
Its going to immediately need to be updated once SW 1.5 is a thing
i see
Newly added resources are assigned IDs before the stock resources (ID1, ID2, ID3...). I hope that doesn't cause issues down the road...?
hopefully
Should be fine
I dont see them hardcoding any ids
Yeah anywhere that has resource IDs, has them being generated from the name
which makes sense, as idk if you can control addressables ordering to that sort of granularity
no
wait
no it shouldnt
they dont get acessed by ID number
but by ResourceName
tho, it would be good practice to add the after
it doesn't matter
as I said you can't control addressables order with that granularity
And its actually a lot harder to add them after, because I add the addressables to the cache in an async way and I need the new things to be created before I run any patches
fair
but yeah it shouldnt make a diffrence in game since every id is gotten via the resource name
alright so time to start getting the nuget package ready
this will be annoying af
UitkForKsp2 nuget packages are already annoying enough as it is
the issue is that we read the version from the swinfo, but when the nuget package is being built by MSBuild, it isn't set for some reason
so the packages get always built as version 1.0.0
and you just have to hardcode the version in a <Version> property somewhere
and I have no clue how to solve that
Thats annoying
Also, my reason for putting resource units out of pm is 2 fold
Its not a base game config
And it shows how to make PM addons
Anyways, once you get the nuget package set up, ping me
Quick question: what would be the syntax to add a new object to an array field, for example adding a new PAMModuleVisualsOverride here?
Ahh ... I was gonna need to add a thing for that field, lemme check code rq for how to do it rn
Alright so @stiff crater in the current version its kinda janky because I need to add some checks for arrays to be able to use +syntax by default
@use 'builtin:list';
:parts ... {
PAMModuleVisualsOverride: $value:append(
{
PartComponentModuleName: "...",
ModuleDisplayName: "...",
ShowHeader: true,
ShowFooter: false
}
);
}
and to append multiple, there is an list.append-all function used like $value:append-all([...])
That will work for now, in the future it should be something like the following for generic arrays
+ignored {
//...
}
I feel like that might be more confusing than the current syntax
Hmm, I don't know how to make a generic addition, unless I allow + without anything afterwards as a valid thing
like
+ {
}
couldn't it work like a "+=" operator, like it does for numeric values?
you can do value: +10; right?
so something like
value: +{
...
}
Yeah that could work
I mean actually @north mist @stiff crater you can alredy do the following
value: +[
{
}
]
List concatenation is a thing like that
I forgot I implemented that with the plus operator lol
case DataValue.DataType.List when rightHandSide.IsList:
{
// If every value is immutable a shallow copy should be fine
var newList = new List<DataValue>(leftHandSide.List);
newList.AddRange(rightHandSide.List);
return newList;
}
Yeah lmao, you can just do that
No need for builtin:list library for that either
I think I did an oopsie
:parts {
@if $$crewCapacity > 0 {
+Module_LifeSupportRecycler {
+Data_LifeSupportRecycler {}
}
PAMModuleSortOverride: +[
{
PartComponentModuleName: ""PartComponentModule_LifeSupportRecycler",
sortIndex: 40
}
];
PAMModuleVisualsOverride: +[
{
PartComponentModuleName: "PartComponentModule_LifeSupportRecycler",
ModuleDisplayName: "KLSS/LSR/DisplayName",
ShowHeader: true,
ShowFooter: false
}
];
}
}
Accidentally put 2 quotes
Oh right x)
seeing the patch, I love how this is all coming together though
I feel like with PM we could see a surge of new mods and new types of mods
I might try to do a syntax highlighting extension for VS Code for PM, is the grammar definition of the language centralized somewhere?
There are antlr grammars in the repo
ah yeah a LS would be better
For reference before I add them into the pdf here is every single builtin library with their functions so far
builtin:debug
debug-log(value) - logs value to console
serialize(value) - serializes a value
builtin:dictionary
dictionary.set(dict,key,value) - copies a dictionary and sets dictionary[key] to value
builtin:functional
get-function(name) - gets a function from the global environment with that name and returns it as a closure
closure.invoke(closure,...) - Invokes a closure with the `...` arguments
closure.bind(closure,...) - Binds the arguments `...` to the left side of the closure and returns a new closure
closure.right-bind(closure,...) - Binds the arguments `...` to the right side of the closure and returns a new closure
builtin:list
list.append(list,value) - copies a list and appends the value to it
list.append-all(list, values) - copies a list and concatenates it with values
list.create(...) - creates a new list with the arguments as its members
list.sort(list,[comparator]) - sorts a loist with an optional comparator function, follows the C# convention
list.map(list,function) - map a function onto a list
list.reduce(list,initial,function) - reduce a list using a function
list.length(list) - get the length of a list
builtin:reflection
typeof(value) - returns the type of value as a string
builtin:type-conversion
to-bool(value) - returns whether or not value is truthy
to-real(value) - converts a value to a real number
to-integer(value) - converts a value to an int
to-string(value) - converts a value to a string
Difference between
function($value,...) and $value:function(...)
-> $value:function(...) calls either function($value,...) or typeof($value).function(...)
So if $x is a list, $x:sort() would call list.sort($x)
syntax highlighting has nothing to do with parsing syntax
@stiff crater knock yourself out, it wont interfere with my thing
my thing adds errors when syntax isnt correct
Munix, thoughts on this btw?
This is whats already implemented
I should try creating an automatic documentation generator for the builtin functions lmao
awesome
btw here's the wiki page: https://github.com/KSP2Community/PatchManager/wiki/Reference
it will probably make more sense to split the document into separate pages by the top level headings, but for now it's on one page
I need to add how to define closures to the function section lol
$closure: @function(...) {}
Is literally how it is done though
so if you want, you can just keep editing the wiki
and you'll get VCS with it at least
I'll likely move to that, no need to gen pdfs anymore, or I can just copy and paste
And now closures are documented
should I try to add the Nuget generating stuff to the 0.1.1 branch and then release the package along with the hotfix?
Yeah, likely the best idea
Can't wait till SW 1.5 for when I can link patch manager documentation in the modlist
Also yeah, same
I forgot to write that you need to do
closure.invoke($closure,...) or $closure:invoke(...)
instead of
$closure(...)
fixed now
The reason for the x.y function names is actually so I can do a minimal form of overloading
oh my god
it took almost an hour of searching and back and forth with ChatGPT
but I got it
lmao
Nuget version is finally generated from swinfo
it's so stupid, too
regularly I do this
Apparently we can do syntax highlighting from the LS using Semantic Highlighting, might be easier than converting the grammar to TextMate manually
and the solution was this
had to use Output to directly write the output into the PackageVersion property, and had to do it right before PrepareForBuild
it is beyond me why with BeforeTargets="Pack" it just doesn't work
but this does
now I just need to test if the package really works, and I can release it
yeah, that's what I was thinking too
Ah nvm it's an extension of normal syntax highlighting, still have to translate the grammar to TextMate
It allows for more correct syntax highlighting like this accroding to the docs
makes sense
I dont think so as it takes a document and outputs tokens
Oh, I'm gonna read the doc in more details then before concluding anything more x)
A language server or syntax highlighter would be great though
If I were any good at it, id make my own
Btw @stiff crater or @frail star put the source under the KSP2 community repo for that
Hows the nuget package going?
they are different things, so “and”
still having some issues with the multiple dlls
Sounds about right...
Gonna be a pain making the SW 1.5 package
the task generates this nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>PatchManager</id>
<version>0.1.0</version>
<authors>munix</authors>
<licenseUrl>https://raw.githubusercontent.com/jan-bures/PatchManager/main/LICENSE</licenseUrl>
<icon>icon.png</icon>
<readme>README.md</readme>
<description>Package Description</description>
<tags>ksp2 mod library</tags>
<repository type="git" url="https://github.com/jan-bures/PatchManager" />
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="PatchManager.Core" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="PatchManager.Generic" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="PatchManager.Parts" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="PatchManager.Resources" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="PatchManager.SassyPatching" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="PatchManager.Shared" version="1.0.0" exclude="Build,Analyzers" />
<dependency id="BepInEx.PluginInfoProps" version="2.1.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>
but the version of all the DLLs is 0.1.0
so it can't find a match
Thats kinda dumb
it's probably also caused by the auto-generation of Version from swinfo
that seems to be the root of all KSP2 modding evil

loll
no luck so far
the easiest solution would be to just build separate nuget packages for every DLL
but I kinda hate that
but that might actually still not get rid of the issue
I'll try it
yeah of course it didn't
now I just have 8 packages which have wrong dependencies
jesus christ
it worked well enough the other way around, generating the swinfo from the .csproj file
but that's also less than ideal
I'm stating in the specific case of a library with multiple modules, autogeneration doesn't seem to be the best idea
so do I just give this up and hardcode the version?
If it stops a headache inducing amount of issues, yes, and we can always look at it later
I mean considering there was a solution for the version of the generated package, I'm assuming there also has to be one for the dependencies' version
but I can't figure it out
As I said, hardcoding it for now, and looking at it later if you want to, might be better for now
sure
the only reason why I'm doing it anyway is to make sure we can't forget to update the version in one place but not the other
not the end of the world
we just have to mind that
I've done that a lot with space warp
I think I've learned not to
Not 100% ideal, but it not broken at least
I'm just disappointed that I figured out like 50% but not the other 50% lmao
Thats fair
I feel like to completely understand MSBuild I'd have to study it for 20 years under the guidance of an ancient warlock or something
Legit
Did you get it to work w/o the autogen?
still working on that, even with the correct versions, there's still an issue of the multiple assemblies in one package
so now I'm rewriting it to be generated from a .nuspec file instead of using the .csproj files
I know that works because I use it to build the game assemblies' nupkg
Might need to do that for spacewarp soon
holy fucking shit
did munix level up his class in msbuild warlock?
I've been trying for the past hour or so to figure out why specified files one by one like "my/build/folder/PatchManager.dll" in the nuspec file worked, as well as "my/build/folder/**/*.dll", but not "my/build/folder/*.dll"
it just wasn't copying anything
and you know what the fix was
"my\build\folder*.dll"
it needed fucking backslashes to work
at least I would understand if the other two things also didn't work without backslashes
but they do
it's only if you use the single non-recursive wildcard
Now imagine if it needs forward slashes to build on linux
Based and microsoftpilled

it's there
😭
why doesn't it work
both the nuspec and the actual folder structure inside the nupkg look exactly like all the other Nuget packages we use
Is it case sensitive?
it isn't
but I have the same case as the other packages anyway
if I hadn't already felt old after my birthday, I sure do now, because I feel like this thing has already shortened my lifespan by at least 20 years
targetFramework seems to be specfically for dependencies
stay in school, don't do Nuget, kids
@upbeat hare can you write some more example patches, so i can verify some stuff for the LS
nuget will make you want to do drugs
Do you have these 2 alreadyy
I never want to do anything like this again
looks over at spacewarp 1.5
but it's pretty universal so I can include it in the template
and it doesn't require duplication of version
thats good
no i need to add more support for this lol
@north mist you got the nuget to work?
That does have a lot of the more arcane syntax, like closures
and I'll upload it
@frail star there is actually a syntax error in the test1.patch
@use 'builtin:list';
@use 'builtin:dictionary';
@use 'builtin:dictionary';
@new("Stormlight")
:resources {
displayNameKey: "Resource/DisplayName/Stormlight";
abbreviationKey: "Resource/Abbreviation/SL";
isTweakable: true;
isVisible: true;
massPerUnit: 0;
volumePerUnit: 0;
specificHeatCapacityPerUnit: 2010;
flowMode: 4;
transferMode: 1;
costPerUnit: 0.8;
NonStageable: false;
resourceIconAssetAddress: "";
vfxFuelType: "Pressurized";
}
@function ReplacePropellants($modes, $from, $to) {
@return $modes:map(
@function($object) {
@if ($object["propellant"]["mixtureName"] == $from) {
@return $object:set("propellant",$object["propellant"]:set("mixtureName",$to));
} @else {
@return $object;
}
}
);
}
:parts {
* > resourceContainers {
@if ($current:length() > 0) {
+Stormlight {
capacityUnits: +100.0;
initialUnits: +100.0;
}
}
}
#engine_3v_hydrogen_swerv > Module_Engine {
$useless: $current:debug-log();
engineModes: ReplacePropellants($current, $value, "Hydrogen", "Stormlight");
}
#engine_3v_hydrogen_swerv > resourceSummary {
Consumes: ["Stormlight"];
}
}
Here it is without the error
You are making a ls for a functional programming language lol
yeah lmao
i have a good framework setup
i just need to spend a couple hours adding definitions
You also have access to the antlr grammar
true, i probably could use the grammar
no lol

hallowed be thy name lord m$
yay
figured that out
uh, cheese, where are the grammars stored
or do they compile into the dll?
in which case ill need to download them with the extension
The g4 files are there
so they dont exist in the mod folder, mkay
ill need to download them with the extension
thats fine
pushed the 0.1.1 prerelease out
@north mist do I have to register it like this?
Yeah, but that should work for all the labels in the cache
Or maybe I'm misunderstanding what you're specifically doing?
for some reason the cache has a label the game doesn't know about
Huh
Ah
Dependency ordering stuff
Always fun
You know, that looks like its parsing an expression
oh no
9+ errors
💀
yeah....
something might be a little wrong
oh shit
nvm
i know why....
yeah
thats a lot better
just one error
idk why it exists though
BECAUSE YOU ARE PARSING IT AS AN EXPRESSION NOT A STATEMENT
so its thinking its a closure
sorry caps
lol
im just loading in the antler bindings
and using them
im not actually doing anything 💀
Anyways, I made a PR, now I 
yeah cheese, there is actually something you missed
you need an EOF
lol
i might have just been dumb
hm
ignore what i just said for a moment i am having a crisis
maybe im just dumb
tbh
i thought i saw a antlr example that used a EOF
but its giving me an error for the EOF
ok apperently i was having serious trip, beacuse i just reloaded vscode and its gone
syntax highlighting hitting different
Oh boy
i am loosing my grip on reality.
I can see 
the progress is happening
all at the cost of my sanity
i could have done this in like 30 minutes, but nooooo
i wanted to setup a full ass framework for all of it
$object is a parameter tho :p
they are treated the same rn
im still finishing up my script for converting g4 into highlighting json
im not really confident about the script
we'll see
wait
bru
i just realized, i can just get a scss highlight json
lol
and modify it a bit
Something to note: as patches are not applied to the state of parts in the savefile, they will not affect already launched vessels. Is that how MM worked also in KSP1 or were the patches also applied to already launched vessels?
NVM I'm spreading misinformation, my life-support module is just not showing up in the flight PAM
@north mist should I go ahead and release PM 0.2.0, and then allow you to build the nuget?
Alright, go ahead, I'll finish lunch and build the nuget package (though it's easy, you just have to build the solution in Release and it should pop up in solutionDir/nuget)
Wait, I think I forgot something
Called updating the swinfo version
give me a second
Uploaded
Perfection
@north mist do you think I should add
:parts {
%Module_Engine {
%Data_Engine {
...
}
}
Capability?
For create or modify
I think it would be nice
Then I'll add it
@frail star hows that LSP going?
pretty good
i’m finishing up syntax highlighting
then i’ll do semantic highlighting
and then code completion
I should add a math library to patch manager
Mostly so I can do stuff like
$HO_RATIO: normalize-vector(6.0,1.0);
yes!
and a whole chemistry library
need to be able to do
$HO_RATIO: stoichiometric-ratio("H2","O2");
ah yes
@upbeat hare question
"Test" this is obviously valid
but is
"te
st"
``` valid
do you have multi-line strings
beacuse the antlr doesnt have a rule against it
Yes, its allowed
Can't wait to have this in VSCode though, it will make writing patches a lot easier
lol
yeah
im gonna stop working on the highlighting for now
i setup the framework and stuff
and im just too lazy to write all the regex 😭
im going to do code completion
wtf is the lsp?
Allows us to actually have syntax highlighting/code completion/error checking inside of VSCode
Aight, now that I am once again in the mood to write code
Lets look at dem celestial bodies
"assetKeyScaled": "Celestial.Ike.Scaled.prefab",
"assetKeySimulation": "Celestial.Ike.Simulation.prefab",
This stuff here is whats gonna have to be built into addressable bundles, and is why scaling celestial bodies is nigh on impossible without a patch
Let me look if there is any information on celestial bodies prefabs that can assist withthat
Alright, so the scaled prefabs seem to be 1k radius spheres
(Checked with Kerbin, Jool, and Ike
This system is confusing me
What about it?
Like, I was getting bugs from changing the radius of a planet, but I don't understand why
What bugs? The planet not appearing?
Physics glitching near the surface
Yeah thats were pqs an cbt comes
They kinda balance it out
Same isse planety and i came accross (and a lot others)
But I don't see anything in the PQS Renderer data that mentions radius or anything
Hell, the radius comes straight off the celestial body data
Hmmm, no this is just confusing
The scaled asset is only used in the map 3d view
Which, I might want to make a patch to modify the scale of later, but aaaa
Also interesting, and would make for a cool mod
Galaxy definitions can be changed per save file
therefore you can select what type of galaxy you want
Why does kerbol use the scaled asset while everything else uses the sim asset
The prefab key there isn't used in any case
But legitimately .... I don't see duplicated radius definitions or anything
That's what Galaxy Tweaker did
I was helping Hyperion with that
Hmmm, its not the pqs renderer thats the issue is it, its the collider?
They are generated via the pqs iirc
I'll give up on this for the moment and work on a math library
i’m still working on the core completion but i can give you a basic extension that just has syntax errors and like extremely basic highlighting
@use 'builtin:math';
$value: normalize(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
Is now possible
Also, just general math functions are possible
Like sin, cos, pow, log, etc...
I still find it cool how I wrote an entire serialization/deserialization system for the language lol
Welp, I'm gonna first update PM to support the in progress SW 1.5 and work on this
Wait ... I need an SW 1.5 prerelease package to make that easy on me aaaaa
I'll just do a test to see what version spacewarp is
Umm, kerbin does not have a circumference measured in the AU amount
Gods, what the fuck do I do to fix this
Actually, I think I'm starting to understand
I'm ... getting it
I didn't fix it but I narrowed down the issue
Also gosh, I need that unity explorer that doesn't mess with time warp
Falki just made one recently
#🔴mod-dev message
actually let me put that into #🔴tools-and-resources, seems like something that shouldn't get lost in modding chat
Like (this is from non testing install) I need it to look like this somehow and I don't understand the magic for that
If I remove the inner atmosphere component it looks like this
Then if I scale up all the clouds
Oh gosh, this entire cloud rendering system is something
Okay, so this field in the AtmosphereModel script, is likely whats contributing to the funkiness
Alright, now I got a plan
or I thought I did
You know ... i need to be able to edit the non-json data ...
And I can't easily do this in a patch ... unless it has to run each time
Which means the atmospheric scale fixing and such ... would work better as a patch manager addon as I'd have to do something like the following
@new("kerbin")
:atmosphere_replace {
BottomRadius: 600.0 * 2.5;
AtmosphereHeight: 60.0 * 2.5;
}
And intercept load calls, such that those values are replaced
As I can't just calculate this after the fact, easily
yeah, it makes sense
we kinda knew we'd have to do some Harmony patching for a lot of the stuff
So the basic json assets are in scope for PM, but the atmosphere stuff ... likely will get pushed to a kopernicus equivalent?
Aight, we should likely allow for @before '...' and @after '...' for patch ordering
And in the quotes it is before that referenced stage gets run if it exists and after that referenced stage gets run if it exists
and the idea is to let mods define custom stages that other mods can then refer to?
(They already can)
got it
What should happen if two patches from different mods are conflicting and the modders did not provide stage order information?
I feel like the user should be notified and be able to manually define a load order but I'd love to hear what you all think about this
Umm ... how would we detect this?
Hmm it would require keeping a list of modified json objects in RAM during patching and checking if some are modified multiple times and by whom at the end I guess
OK, Resources made. Now to figure out PM.
@upbeat hare is there any sort of example I should look at? This is probably easy, but I'm not sure where to start. Suppose I'd just like to take a simple Xenon tank and make an Argon one. Like fueltank_0v_inline_xenon. What would I need to do to make a copy of that and have it hold Argon?
You ... can't copy it unfortunately
Not yet at least
I can see the utility in it, but it would likely have to be a PM addon
OK, then for just testing purposes (to make sure I've got the resources added correctly), how can I modify an existing tank like the fueltank_0v_radial_xenon?
I'd want to pick a tank I'm not currently using on a test craft - so that one would work
:parts #fueltank_0v_inline_xenon > resourceContainers > Xenon {
name: "Argon";
}
should work
Ok, but where I do put that?
In any patch file, you can even just make a new one
Oh, so I could just drop a patch file into any mod, and if I've got Patch Manager it will run it?
Yep
So I can put this in SPARK and not polute other mods!
I'm starting to get it!
Cool!
One more question then. I can whip up a tank fairly easily I think - it's one of the simplest parts to make. Do I make it hold whatever and then use PM to convert it to Argon, or with the resource defiend am I able to make it use Argon or Lithium or whatever directly?
You can make it use whatever directly
Cool!
I think I have an idea of how to do part copying
It will be in base PM out of necessity
But it will be a bit complex
Because to copy a part, there are a few other things you need to copy, or replace, the model for one
It didn't work... Or I'm not doing it right - probably the latter. I double checked the part name in the game's json, so AFAIK that's right, but when I look in the parts picker it still say's is holding Xenon
Place down the part
[Error :Patch Manager] Failed to generate an asset due to: PatchManager.SassyPatching.Exceptions.InterpreterException: C:\Kerbal Space Program 2 Debug\BepInEx\plugins\CommunityResources\patches\recipes.patch:24:4: System.ArgumentException: Could not determine JSON object type for type <>f__AnonymousType0`2[System.String,System.Double].
at Newtonsoft.Json.Linq.JValue.GetValueType (System.Nullable`1[T] current, System.Object value) [0x000f2] in <394015232cf841bc8e43c6c98d8e6545>:0
at Newtonsoft.Json.Linq.JValue..ctor (System.Object value) [0x00000] in <394015232cf841bc8e43c6c98d8e6545>:0
at Newtonsoft.Json.Linq.JContainer.CreateFromContent (System.Object content) [0x0000c] in <394015232cf841bc8e43c6c98d8e6545>:0
at Newtonsoft.Json.Linq.JContainer.AddInternal (System.Int32 index, System.Object content, System.Boolean skipParentCheck) [0x00048] in <394015232cf841bc8e43c6c98d8e6545>:0
at Newtonsoft.Json.Linq.JContainer.Add (System.Object content) [0x0000c] in <394015232cf841bc8e43c6c98d8e6545>:0
at Newtonsoft.Json.Linq.JObject..ctor (System.Object content) [0x00011] in <394015232cf841bc8e43c6c98d8e6545>:0
at PatchManager.Resources.Selectables.RecipeSelectable.AddElement (System.String elementType) [0x00001] in C:\Users\arall\PatchManager\src\PatchManager.Resources\Selectables\RecipeSelectable.cs:76
at PatchManager.SassyPatching.Nodes.Selectors.ElementAdditionSelector.<SelectAll>b__2_0 (PatchManager.SassyPatching.Interfaces.ISelectable selectable) [0x00000] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Nodes\Selectors\ElementAdditionSelector.cs:25
at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () [0x0002a] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at PatchManager.SassyPatching.Nodes.Selectors.ElementAdditionSelector.SelectAll (System.Collections.Generic.List`1[T] selectables) [0x00002] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Nodes\Selectors\ElementAdditionSelector.cs:25
at PatchManager.SassyPatching.Nodes.Selectors.ElementAdditionSelector.SelectAll (System.Collections.Generic.List`1[T] selectables) [0x0001e] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Nodes\Selectors\ElementAdditionSelector.cs:29
at PatchManager.SassyPatching.Nodes.Statements.SelectionBlock.ExecuteOn (PatchManager.SassyPatching.Execution.Environment environment, PatchManager.SassyPatching.Interfaces.ISelectable selectable, PatchManager.SassyPatching.Interfaces.IModifiable modifiable) [0x0009c] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Nodes\Statements\SelectionBlock.cs:171
at PatchManager.SassyPatching.Nodes.Statements.SelectionBlock.ExecuteCreation (PatchManager.SassyPatching.Execution.Environment snapshot, System.Collections.Generic.List`1[T] arguments) [0x0008c] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Nodes\Statements\SelectionBlock.cs:99
at PatchManager.SassyPatching.Execution.SassyGenerator.Create (System.String& label, System.String& name) [0x00001] in C:\Users\arall\PatchManager\src\PatchManager.SassyPatching\Execution\SassyGenerator.cs:46
at PatchManager.Core.Assets.PatchingManager.CreateNewAssets (System.Action resolve, System.Action`1[T] reject) [0x0001c] in C:\Users\arall\PatchManager\src\PatchManager.Core\Assets\PatchingManager.cs:287
Ahh, so I've goofed up the recipes.patch...
Does this part point to line 24? "recipes.patch:24:4"
Line 24 column 4
// 6 units of hydrogen to 1 unit of oxidizer, normalized @new("Hydrolox", true) :resources { displayNameKey: "Resources/DisplayName/Hydrolox"; abbreviationKey: "Resource/Abbreviation/HO"; +Hydrogen { unitsPerRecipeUnit: 0.986394; } +Oxidizer { unitsPerRecipeUnit: 0.164399; } }
Wait, no, I know that bug...
thats my fault
for sure
in PMs own source code
Or rather community resources I think
No, PM
Goddamnit
I'm dumb
You're not - this is just wickedly complex and you're juggling a lot.
On the plus side you've got eager early adopters like me who will help us surface these things!
var obj = new JObject(new
{
name = "Unknown",
unitsPerRecipeUnit = 0.00
});
Of course this is the fucking issue
Newtonsoft.Json hates anonymous objects
See how smart you are? I'd have never guessed that in a million years.
var obj = new JObject
{
["name"] = "Unknown",
["unitsPerRecipeUnit"] = 0.00
};
There, thats the fix for that line, but its quite a lot uglier
If it works, then it's beautiful!
Alright, pushed to dev branch of PM
Made a PR for someone to look at
Also, can you zip up the cache folder from your latest run for me to look at?
Like the cache folder under patch manager
There might be another bug
As I thought, it didn't even patch the fuel tank
Schloshrat, where did you put the file for the patch, and can you send the full patch file
I'm thinking it honestly might be the name selector that causes an issue...
If you remove the #... it will change every ion tank to xenon hopefully
Could you try that for me
Like this?
:parts fueltank_0v_radial_xenon > resourceContainers > Xenon { name: "Argon"; }
No, just remove that entire name there
So its
:parts > resourceContainers
Itll change every xenon tank, but I need to know if its a name selection issue
OK, but I've failed so far in my attempts to fork the dev branch and compile with the fix
I mean, I've forked it, but my local copy is only the main branch...
Hmm, whats wrong?
I did a fork of all branches, and can see all of them on GitHib, but in vs I've only got main.
Is there an update button?
Not that I see. It's like I can pick that branch, but then don't see any files.
Ss?
Nvm, it was vs being stupiod I think
I closed it and reopened and Isee m to see them now.
Thats correct
I think I did a build. Which file has your change so I can make sure that's in here
Resources/selectables/recipeselectable
like this?
internal ResourceSelectable(string data)
{
_originalData = data;
JObject = JObject.Parse(data);
Classes = new() { "resource" };
Children = new();
var resourceData = JObject["data"];
Name = (string)resourceData["name"];
ElementType = "resource";
}```
Its in RecipeSelectable.cs
And the add element function
Ahhh! This!
public override ISelectable AddElement(string elementType)
{
var obj = new JObject
{
["name"] = "Unknown",
["unitsPerRecipeUnit"] = 0.00
};
var child = new JTokenSelectable(SetModified, obj, tok => tok["name"].Value<string>(), "ingredient");
Children.Add(child);
Ingredients.Add(obj);
return child;
}```
If so, then I'll put that in and see what the patch does
I'm not sure that will fix the patch tbh, itll fix the recipes patch, but im not sure about your patch
Not only that, I didn't even know I should have cleared it!
Should I clear it and try again?
please do
No effect on tanks. Sending log.
I must have broken it somehow
I don't think it's running at all
Yeah, something is wrong there
There's nothing in the cache folder
Wait, patch manager isn't even being loaded by bepinex
no it is
I'm blind
Can you send KSP2.log
[ERR 12:17:22.769] AssetProvider unable to find assets with label 'resource_units'.
UnityEngine.Debug:LogError (object)
PatchManager.Core.Patches.Preload.AssetProviderPatch/<>c__DisplayClass0_01<UnityEngine.TextAsset>:<LoadByLabel>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1<System.Collections.Generic.IList1<UnityEngine.TextAsset>>) (at C:/KSP2Mods/PatchManager/src/PatchManager.Core/Patches/Preload/AssetProviderPatch.cs:35) DelegateList1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1<System.Collections.Generic.IList1<UnityEngine.TextAsset>>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1<System.Collections.Generic.IList1<UnityEngine.TextAsset>>)
UnityEngine.ResourceManagement.ResourceManager:Update (single)
MonoBehaviourCallbackHooks:Update ()
What about the resource_units error?
Thats a side effect from community resources due to PM not running
I'm sorry, but I can't continue to help on this for a bit, I have some chores to do, and a movie to watch with a friend after that...
FYI - rolling back to the previous PM and taking out the recipes.patch (I don't think I need it for this), I saw that of course the resources are getting defined, but this still didn't address the part patching. I'll take a shot at making a super simple tank as a new part and defining it to use Argon or Lithium.
Yep, I can make an Argon tank!
Maybe not perfectly though...
Leaves a little bit to be desired, huh?
Like actually having some usable argon in it?
Huh, I thought I fixed the size thing?
At least the localization is working now
Still no actual resource inside it either - thought I had that fixed too.
We have resource!
And we have size!
I'm sure the numbers are all whack - and the model is weaksause, but it does seem I'm able to get these in the game.
Once we sort out the recipe patch business I may be able to turn out some nifty engine variants that use these new fuels!
Maybe this will help tone down the ludicrously OP MPD-1?
Not much surprise here, Lithium works too - though I really ought to make it's own mesh for this. I think a lithium "tank" should be very different as it actually holds ingots of metallic lithium that are slowly vaporized to deliver a gaseous form of the fuel. That's actually one of the technical hurdles preventing lithium powered ion thrusters from being used today. It's hard enough to handle that junk safely here let alone in space.
Yeah, I'll debug PM tomorrow, I'm busy for the rest of the day
No worries! I've made lots of progress and have some more part modelling ahead of me. When PM is working with recipies again then I'll be ready to give those a shot and see if I can make engines that use these new fuels. Enjoy your movie and your time with your friend(s)!
Hey Cheese, if we can sort out the PM business with reciepies and resources, then I'm ready to test with a bunch of Lithium tanks and a Lithium engine. I think all I need here is for LithiumEC to be a working recipe and then I can get that working.
Any luck?
Is there anything I could do to help?
Sorry ... I've been having a week where its hard to focus on stuff
No luck
Well that doesn't sound like much fun. I hope your week improves!
Hey, sounds like there's not been a lot of progress on this one lately - more frustration than actual progress at least. I'm getting ready to push out an update to SPARK, so I'll make this next update not require PM or CR, since I think CR depends on PM, and neither are fully released yet. If there's anything I can do to help move this along please let me know as I'd very much like to see PM and CR released!
Aight, not much you can do to help rn, though I should be able to look into it later today or tomorrow
Alright ... yeah I kind of realize I forgot to, or got completely sidetracked
Not to worry I will look into it today
@digital cloud try the dev build of PM with SW 1.5?
Will do!
Not sure if I'm doing it right, but I got this result.
[Error :Patch Manager] Failed to generate an asset due to: System.NotImplementedException: The method or operation is not implemented. at PatchManager.Resources.Selectables.RecipeSelectable.Serialize () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.Resources\Selectables\RecipeSelectable.cs:88 at PatchManager.SassyPatching.NewAssets.NewGenericAsset.get_Text () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\NewAssets\NewGenericAsset.cs:30 at PatchManager.SassyPatching.Execution.SassyGenerator.Create (System.String& label, System.String& name) [0x00029] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\Execution\SassyGenerator.cs:49 at PatchManager.Core.Assets.PatchingManager.CreateNewAssets (System.Action resolve, System.Action1[T] reject) [0x0001c] in C:\KSP2Mods\PatchManager\src\PatchManager.Core\Assets\PatchingManager.cs:302
[Error :Patch Manager] Failed to generate an asset due to: System.NotImplementedException: The method or operation is not implemented.
at PatchManager.Resources.Selectables.RecipeSelectable.Serialize () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.Resources\Selectables\RecipeSelectable.cs:88
at PatchManager.SassyPatching.NewAssets.NewGenericAsset.get_Text () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\NewAssets\NewGenericAsset.cs:30
at PatchManager.SassyPatching.Execution.SassyGenerator.Create (System.String& label, System.String& name) [0x00029] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\Execution\SassyGenerator.cs:49
at PatchManager.Core.Assets.PatchingManager.CreateNewAssets (System.Action resolve, System.Action1[T] reject) [0x0001c] in C:\KSP2Mods\PatchManager\src\PatchManager.Core\Assets\PatchingManager.cs:302
[Error :Patch Manager] Failed to generate an asset due to: System.NotImplementedException: The method or operation is not implemented. at PatchManager.Resources.Selectables.RecipeSelectable.Serialize () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.Resources\Selectables\RecipeSelectable.cs:88 at PatchManager.SassyPatching.NewAssets.NewGenericAsset.get_Text () [0x00000] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\NewAssets\NewGenericAsset.cs:30 at PatchManager.SassyPatching.Execution.SassyGenerator.Create (System.String& label, System.String& name) [0x00029] in C:\KSP2Mods\PatchManager\src\PatchManager.SassyPatching\Execution\SassyGenerator.cs:49 at PatchManager.Core.Assets.PatchingManager.CreateNewAssets (System.Action resolve, System.Action1[T] reject) [0x0001c] in C:\KSP2Mods\PatchManager\src\PatchManager.Core\Assets\PatchingManager.cs:302 `
Why is there crap like "System.Action`1[T] reject) [0x0001c]" in the log?
Why does an automated log include something with a ` in the name?
That's just stupid.
Way to fuck up MD
Anyway, all the materials seem to come in, but there are three recipies, and none of those come in.
I tried to make sure I was on the dev branch, but I'm not 100% sure I did that right.
Cuz thats the type name
Thats how generic type names just get outputted
anyways, try with the newest commit?
@digital cloud if you didn't see
Doing it now
Not sure what I've done wrong but now I'm not getting the new resources or any recipies.
Forgot to clear out the cache
There should be a cache folder under the patch manager, just delete that
done. launching now
Wheeeee!
[Info :Patch Manager] Generated an asset with the label resources, and name LithiumEC: { "version": 0.1, "useExternal": false, "isRecipe": true, "data": { "name": "LithiumEC", "displayNameKey": "Resources/DisplayName/LithiumEC", "abbreviationKey": "Resource/Abbreviation/LE", "resourceIconAssetAddress": "", "vfxFuelType": "NoFuel", "ingredients": [ { "name": "Unknown", "unitsPerRecipeUnit": 1 }, { "name": "Unknown", "unitsPerRecipeUnit": 1 } ] } }
I can now play with Lithium fueld engines!
I think
Hmmm....
Ahh, thats my fault again
That's not supposed to be like that....
Yeah, Hydrolox is the same way as is ArgonEC..
So if you want to try rebuilding, then deleting the cache and launching again, it should likely work
Doing that rn!
launching...
[Info :Patch Manager] Generated an asset with the label resources, and name Hydrolox: { "version": 0.1, "useExternal": false, "isRecipe": true, "data": { "name": "Hydrolox", "displayNameKey": "Resources/DisplayName/Hydrolox", "abbreviationKey": "Resource/Abbreviation/HO", "resourceIconAssetAddress": "", "vfxFuelType": "NoFuel", "ingredients": [ { "name": "Hydrogen", "unitsPerRecipeUnit": 0.986394 }, { "name": "Oxidizer", "unitsPerRecipeUnit": 0.164399 } ] } }
and
That looks right!
`
[Info :Patch Manager] Generated an asset with the label resources, and name LithiumEC: { "version": 0.1, "useExternal": false, "isRecipe": true, "data": { "name": "LithiumEC", "displayNameKey": "Resources/DisplayName/LithiumEC", "abbreviationKey": "Resource/Abbreviation/LE", "resourceIconAssetAddress": "", "vfxFuelType": "NoFuel", "ingredients": [ { "name": "Lithium", "unitsPerRecipeUnit": 1 }, { "name": "ElectricCharge", "unitsPerRecipeUnit": 1 } ] } }
Looks good for me!
ArgonEC looks good too. I'll take these for a spin and see if they really do work!
OK, the problem may be at my end - I don't know yet, but I'm getting Engine does not have a valid Mixture defined spamming in my log if I select anything that uses LithiumEC, and in the parts picker I'm getting this
For one of my other engins burning Xenon it looks like this
Hmm, how is it defined in text and can I see the logs?
Hmmm
This is XenonEC
{ "_comment": "flowMode is integer: 0 - NULL, 1 - NO_FLOW, 2 - ALL_VESSEL, 3 - STAGE_PRIORITY_FLOW, 4 - STACK_PRIORITY_SEARCH, 5 - STAGE_STACK_FLOW_BALANCE", "_Comment2": "transferMode is integer: 0 - NONE, 1 = PUMP", "_commentDescription": "Compound resource for most basic jet engines", "version": 0.1, "useExternal": false, "isRecipe": true, "recipeData": { "name": "XenonEC", "displayNameKey": "Resource/DisplayName/Xenon", "abbreviationKey": "Resource/Abbreviation/Xe", "resourceIconAssetAddress": "", "ingredients": [ { "name": "Xenon", "unitsPerRecipeUnit": 1 }, { "name": "ElectricCharge", "unitsPerRecipeUnit": 1 } ], "vfxFuelType": "Pressurized" } }
Pushed a commit that changes that
OK, grabbing now.
Remember to nuke the cache (it doesn't do that cuz no actual patch files or versions have changed)
Ahhh... That's why it didn't work... On sec, nuking and re-testing
I should really add a config option to always rebuild cache
Awesome!
Holy Shit! My plume is RED!
I do NOT no why... I kinda like it though...
Not the right color, but that tank definitely holds Lithium (and not water), and the engine is "burning" lithium!
That thing is soooooo OP.
I swear I've got the same mass, Isp, and thrust as what Nertea has in NFP...
Granted, it needs some real thermal management, but even with that it would have thrust out the ying yang
Most players seem to like their thrust that way, but this is OP!
Lol
But yeah, fucking awesome
Is this pushable?
How close to a release?
I think this may be a watershed moment for KSP2 modding.
I honestly wanted to really finish up planet stuff before a release, but I'm not sure how soon could do that
Should we look into the weird Module merging issues when reloading a save first?
Also a few other things insofar as needing to have the SW 1.5.1 nuget package up so I can set it as a dependency
That would be very nice to have, definitely. For me, this is a game changer with the electric engines. I think it's a very big deal for life support and other things too.
How about a PM roadmap? In a first release perhaps it allows for new resources and recipies and what not, then in a future planned release it's doing planets?
I'm not really sure what the roadmap would be, but something where we can stake a claim for this is what it does now, and this is what we've got planned.
I can see where the planets part may really impact the game when science gets here.
On this one, I'm not 100% sure on how feasible this is to fix, I've tried, but I can try some more
Thats a fair idea
The other thing I was waiting for tbqh was a mod to release alongside PM to show what it can be used for, which either KLSS or SPARK can fulfill
I'll look into it myself too, I want to try adding all the fields from the module definition in my patch just in case it doesn't fill the null fields with the default values correctly
So, some more testing to be certain it's ready. No need to be overly hasty here
I'll have a version of SPARK ready to drop with dependencies for PM and CR.
Oooo! I need to work on Argon fueld VASIMR engines!
More toys....
One can never have to many of those amiright?
Lol true
Are the fixes to recipe patching merged in main / in a pre-release? (trying to fix the Community Resources non-stageable resources UI fix thingy and the mod is erroring out a bunch because of broken recipes)
If not I can just build PM locally real quick no problem
They are currently in dev
Ok so I'm trying to wrap my head around the "module patches not applied to vessels that are not directly launched from VAB" bug and it seems to happen because the PartBehaviourModules' Data is null when Init() calls ModuleDataList.TryAddUnique.
Was this also the previous assessment? Also, do we know where the PartBehaviourModules are instanciated / where their Data is usually initialized?
It happens normally when the json merging magic happens, I could see if I can get a better location than that
Btw in PM this magic happens in PatchManager.Parts.Patchers.PartModuleLoadPatcher or is there other places related to that?
Thats where I was tryna fix it
Is it in KSP.Sim.impl.PartComponent.MergePartModuleData?
I think so
Oy what the hell were they on when they wrote that
I'm gonna need a few hours trying to wrap my head around this stuff
Is there a way to inspect a JSON generated by Patch Manager?
Just look in the cache that PM makes
Roger that, thanks!
Uh a bunch of things do not seem to be initialized properly in the generated json
I'll try initializing all of this in my patch to see if it fixes the bug
But that can't be just it, I had issues with a Data_ResourceCapacities too even though there's nearly nothing in the DataObject for this one...
Uh also, I made a patch to add resources to eva_kerbals and it didn't seem to work correctly I don't know why, here are my patch and the generated part data
Okay nevermind that I was a dumb dumb I forgot to import my constants library ><
Yeah that's not it, the ResourceCapacities generated by PM is identical to one from a stock part so the null fields are not the (only) issue
Makes sense, itd be weird if it werent identical
I'll need to check again when I get back home but iirc if you launch a new craft with custom modules, then save, then reload that save, the craft loads with the usual null data issue
That feels like a very odd bug
For stock modules added with PM I mean
Hmmm ... specifically stock?
Ah no for all I think, I just added a null check to AddModuleData in my custom module
(a very dirty fix would be to add such null check & initialization to stock modules maybe)
Nvm that would mean data is not correctly loaded from save files
i dont understand how stock craft arent nulled??
The data for those are, right? Pretty sure I had issues with those
I mean the data for added modules
I'll check when I'm home in ~45min
Btw I need to look at how eva_kerbal is loaded because it is nulled too. I had assumed it'd work like a launched vessel but no
Fun? fact: the data is nulled on save game load after restarting the game, but if it's during the same session as when the vessel was launched it works perfectly??
h-huh
Ah and launching a stock craft from the VAB is okay (expected)
But when launching directly from a launchpad from the KSC screen it's "partially" broken
Like no errors but the converter is broken
oh god this will be insane to deal with
what do saves look like
The pod of the partially broken craft doesn't have its ResourceConverter
My mod should add a Module_LifeSupportConsumer and a Module_ResourceConverter to all crewable parts
So for the situations that definitely generate null data we have:
- starting an EVA
- loading a save game with vessels launched before the last game reboot
do I forget any?
And when launching stock crafts directly from a launchpad menu, PM doesn't seem to properly add the module (half-broken-ish)
#🔴mod-dev message
Well if we need more reason for planet support :p
Line?
But yeah, after we fix this bug, planets are my top priority
Also @stiff crater that file does have your full name in it
Ah indeed, let me re-send it rq
(my name is not a big secret, pretty easy to find, but let's be safe)
The part that's missing the converter definition starts on line 27 389
There are other crafts in the save that were launched from VAB so should have the more correct data
(except a bunch of null stuff from not correctly initialized fields)
So did this part have a converter before restart?
Kind of? Like in this ss
The converter is kinda here but missing some stuff
Like the mode dropdown
Let me ask, what was the process to make this buggy craft?
Did you launch a craft from the VAB, save game, reboot game, and load save?
And were the mods changed at any point there
From KSC, from Launchpad menu, launch a stock craft (with KLSS installed)
Ahh, then I think I understand
If I do this the data is fully null in game and the module doesn't load
Crafts have to go through the VAB for the default json merging to occur, when loading a saved craft from a craft save file, that json never gets merged as its assumed to already be in there
That doesn't make sense to me tbh, like even if you had the module on the craft beforehand?
Well the module is here, but when loading the save AddModuleData fails because the data field of the Module is null
And was that with or without KLSS being installed on the first launch?
With it installed
I'm sorry to ask more of you, but can you grab a save file from before and after that as well?
Before and after what precisely? (just to be sure)
Launch it and save, then reboot and load the game and I suppose save if you can
Looks fine on the first one
No diffs in the files expect for some float values here and there
Not only loading, it also happens on new EVAs (but the eva_kerbal vessel creation flow might be similar to save loading)
So it gets nulled out...
The weird part is that it works well if the game is not rebooted, for the loading part
Hmmm, does the game cache part prefabs with added modules?
🤷♂️ No idea
The big question is: when is this protected field normally initialized and why is it not for added modules after rebooting / when going on EVA
It being null at the moment of AddDataModules (called on PartBehaviourModule.Init, which is called at PartBehaviour.Start) is what is breaking the Module
Looking at this ... this is called on the cached object, so yeah it does cache the prefabs
But me adding the modules to the prefab shouldn't be an issue
Its initialized in the editor :p
Hence the [FormallySerializedAs] and the [SerializeField]
Thats meant for someone to set up the default data within the unity editor
Ohh so the C# class is instanciated in the part prefab kind of? (I'm still very new to Unity stuff 🙇 )
Yep
Which means ... hmm maybe we have to hijack that
But hmm, thats quite a bit of reflection
When PM adds modules to prefabs does it initialize those serialized fields?
No.
It should, shouldn't it?
That would solve the issue, but how would we do that?
Well actually, I do know how ... as I said, a bit of reflection magic
Aaaaa, I only got 20 mins before I told someone I'd speak to them in VRChat
But the fix is on my mind
Would it be scalable/modular/adaptable (not sure of the right word here) or would it require doing stuf for each and every stock module?
Nice!
I could just do a simple fix looping over fields and looking for one that extends from PartData and then initialize that with the data value from the json
(it extends from ModuleData to be precise but yeah that sounds good)
Yeah, I was just saying stuff likely incorrect
So that would hopefully fix the first bug
The "partially incorrect modules when not launching from VAB for a vessel pre-dating a mod install" one feels a bit more difficult to deal with
Unless it is possible to highjack the launching process to force a json merge somewhere?
Well anyways, it's already past 1am I'm going to sleep. If you need more saves / logs, I'll be able to send those tomorrow
Alright, well can you try tomorrow the latest dev branch?
For the SerializedField not being loaded fix?
My computer is still on I can try now!
Aight, I did speedrun this fix btw, so it might not work
Want me to build the dev branch or are you able to pull and build it?
I have PM locally dw
Gotcha
Thanks for hunting down where the issue comes from for me, its much easier to fix when I know exactly what the issue is
Thats completely odd to me, what I did shoulda worked :/
I'll work on it more tomorrow
Hmm, likely will have to do some print debugging
Meaning I shall also need to make a custom patch for testing purposes, but what?
Anyways yeah, goodnight safarte, I need to go now as well
'night!
Itll be a bit till I can work on it today
Hmm, would you mind sending me a version of KLSS to test this with though, so I can do the testing myself?
If not, I can figure out someway to make something to test with
Yep, 2s
Thank you!
Testing now
@stiff crater how does the error manifest itself in game? as I'm not seeing anything obviously wrong?
In fact I see these logs which seems correct
(That was after a restart of the game)
In fact I do see some stuff happening to EVA_kerbal as well
Huh, what does the REsource converter look like in PAM for a pod?
Let me relaunch but I didn't see anything obviously wrong
Maybe I have some cache shenanigans with BepInEx
Yeah that looks perfect
And I see all the resources on Valentina Kerman as well
That may be an issue on my side, I need to check my patches




