#Patch Manager

1 messages · Page 7 of 1

upbeat hare
#

@north mist i just thought of another use for this

#

Having completely different part definitions depending on installed mods

north mist
#

like, for something like RO configs for parts?

upbeat hare
#

Yeah

#

Or like having your parts have modules from other mods if they are installed

north mist
#

wouldn't it be easier in both these use cases if there was just one definition and then extra patches for the extra cases, though?

upbeat hare
#

Yes, but its still a possibility of something you can do

north mist
#

the best I can think of is if the asset addressing thing was added, you could then very easily create multiple completely different parts using the same model

#

which for example RO does a lot

upbeat hare
#

Thats gonna be a weird thing to do, for that we would need a way to copy assets to another location (or at least rename them)
Like we can have a base asset, and then copy and rename for every asset made off that model

north mist
#

why would we need to?

#

you mean in case someone decides to edit the assets at runtime for some reason?

upbeat hare
#

Cuz of how the game searches for the assets

#

Though I had another idea of injecting the load point of parts to load a superset of PartData that has a "PrefabAddress" and an "IconAddress" field

north mist
#

yeah that's basically exactly what I meant

upbeat hare
#

So we have a RelocatablePartData that extends part data or whatever (or we just look into the json file when loading part data)

#

Its gonna be a bit of a complex one though

#

For the patch itself

#

Harmony patch that is

#

And then when patching parts, we add this field if it doesnt exist already

#

So that people can easily select a different model for a part

north mist
#

yeah

#

this should also enable people to create duplicates of stock parts without distributing the assets

#

which would be nice

upbeat hare
#

Yep

north mist
#

I can take a look at this thing tomorrow

#

I would do it right now but I have to at least look over the stuff for tomorrow's exam once lmao

upbeat hare
#

For the purposes of that, just assume every parts_data jsonhas an extra 2 fields called PrefabAddress and IconAddress

upbeat hare
north mist
#

looks good!

upbeat hare
#

What do you think of me inlining the tooltips in the comments?

north mist
#

yeah I like that a lot

upbeat hare
#

This took no small amount of formatting work lol

#

I'm adding an API into KSP2UnityTools btw to output an object as a patch manager patch

#

But I'll complete that fully tomorrow

north mist
#

I'm wondering, would it be possible (maybe optionally with a toggle) to leave out the fields that have default values?

upbeat hare
#

Maybe, but I don't see the point

#

You want to see every value in case you want to edit some

#

Plus it helps others know where to look/patch

north mist
#

yeah I guess

#

it was mainly because the PartData looks really crowded and the majority of the fields there is not being changed

#

at least not by current mods

upbeat hare
#

I suppose but meh, it's not too important

north mist
#

though, I have another suggestion, then

#

how about sorting it alphabetically?

#

that way it'd be way easier to find what you're looking for

#

without having to ctrl+f everything

#

(the top level fields I mean, at least)

upbeat hare
#

I suppose thats possible yeah

#

Not too hard as well

#

Except prefab/asset address will always be on top

north mist
#

yeah, that's fine

upbeat hare
#

And the resources/modules always on the bottom

north mist
#

and that makes sense

#

though I also wonder if it should be more like, the few fields that are absolutely necessary being on top, and then the rest sorted

#

(I know I'm complicating this, sorry lol)

upbeat hare
#

I getcha

#

I'll see what I can do

#

Dnd now tho

north mist
#

have fun

north mist
#

Alright so I basically wrote the code for what we were talking about, but of course, it's not going to be as simple as I thought (and honestly it was stupid of me to completely forget this stuff)

#

The icon part is simple, but the mesh isn't

#

Because there is no guarantee how many meshes and in what hierarchy there will be in any prefab

#

Unless we're talking just completely replacing the entire game object

#

Then it might be doable with just removing its CorePartData and all PartComponentModules and replacing them with the proper ones

#

I'll continue working on it tomorrow, gotta go sleep now

upbeat hare
#

I said prefabaddress for a reason, its just completely changing out the prefab gameobject

north mist
#

I mean that doesn't really imply changing out the whole object, since the prefab address is the only way to access the new meshes and textures, but yeah, gotcha

upbeat hare
#

@north mist instead of sorting the fields, I instead injected the headers into the file

north mist
#

oh that's awesome!

#

is the partName field filled in automatically from the @new("...")?

upbeat hare
#

Yes

north mist
#

even better, less room for mistakes

upbeat hare
#

mhm

north mist
#

I just finished lunch so I'll get back to the game object stuff

#

seems like changing the module manager to internal caused some exceptions

#
[Error  :Patch Manager] System.MissingMethodException: Method not found: void PatchManager.Shared.Modules.ModuleManager.PreLoadAll()
  at SpaceWarp.Patching.LoadingActions.PreInitializeModAction.DoAction (System.Action resolve, System.Action`1[T] reject) [0x00050] in <39f0697ba36b449aa19b27f13be09abd>:0 
#

then there's also this one

MissingMethodException: Method not found: void PatchManager.Shared.Modules.IModule.BindConfiguration(SpaceWarp.API.Configuration.IConfigFile)
UnityEngine.GameObject:Internal_AddComponentWithType(GameObject, Type)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:DMD<BepInEx.Bootstrap.Chainloader::Start>()
UnityEngine.Application:.cctor()
UnityEngine.InputSystem.InputManager:InitializeData()
UnityEngine.InputSystem.InputManager:Initialize(IInputRuntime, InputSettings)
UnityEngine.InputSystem.InputSystem:InitializeInPlayer(IInputRuntime, InputSettings)
UnityEngine.InputSystem.InputSystem:.cctor()
#

uhh

#

now I just completely deleted the PM folders from my game folder, rebuilt, and I'm somehow getting completely different exceptions that freeze the game loading

#

what is happening

north mist
#
[Error  :Patch Manager] System.TypeInitializationException: The type initializer for 'PatchManager.SassyPatching.Execution.Universe' threw an exception. ---> System.ArgumentException: An item with the same key has already been added. Key: list.map
  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x0015a] in <eef08f56e2e042f1b3027eca477293d9>:0
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <eef08f56e2e042f1b3027eca477293d9>:0
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0009e] in <de4a1a1490a74771a34fee0d1d586658>:0
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <de4a1a1490a74771a34fee0d1d586658>:0
  at PatchManager.SassyPatching.Execution.ManagedPatchLibrary..ctor (System.Reflection.IReflect libraryClass) [0x00008] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager.SassyPatching\Execution\ManagedPatchLibrary.cs:14
  at PatchManager.SassyPatching.Execution.Universe..cctor () [0x000fa] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager.SassyPatching\Execution\Universe.cs:56
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at PatchManager.Core.Assets.PatchingManager.GenerateUniverse () [0x0004a] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager.Core\Assets\PatchingManager.cs:41
  at PatchManager.Core.CoreModule.PreLoad () [0x00007] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager.Core\CoreModule.cs:74
  at PatchManager.Shared.Modules.ModuleManager.PreLoadAll () [0x00018] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager.Shared\Modules\ModuleManager.cs:67
  at PatchManager.PatchManagerPlugin.OnPreInitialized () [0x00001] in E:\KSP Stuff\KSP 2 Modding\Mods\PatchManager\src\PatchManager\PatchManagerPlugin.cs:71
  at SpaceWarp.Patching.LoadingActions.PreInitializeModAction.DoAction (System.Action resolve, System.Action`1[T] reject) [0x00050] in <39f0697ba36b449aa19b27f13be09abd>:0
[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
PatchManager.Core.Assets.PatchingManager.RebuildAllCache (System.Action resolve, System.Action`1[T] reject) (at E:/KSP Stuff/KSP 2 Modding/Mods/PatchManager/src/PatchManager.Core/Assets/PatchingManager.cs:322)
KSP.Game.Flow.GenericFlowAction.DoAction (System.Action resolve, System.Action`1[T] reject) (at <483cd9805b7642b5be13e081b9a5d1b4>:0)
KSP.Game.Flow.FlowAction.Do (System.Action`1[T] resolve, System.Action`2[T1,T2] reject) (at <483cd9805b7642b5be13e081b9a5d1b4>:0)
(wrapper dynamic-method) KSP.Game.Flow.SequentialFlow.DMD<KSP.Game.Flow.SequentialFlow::NextFlowAction>(KSP.Game.Flow.SequentialFlow)
KSP.Game.Flow.SequentialFlow.Update () (at <483cd9805b7642b5be13e081b9a5d1b4>:0)
#

don't think these are caused by that change

upbeat hare
#

Or that a DLL is being loaded twice

north mist
#

I'll just manually bisect the commits in dev, since main works fine

upbeat hare
#

No wait

#

that first error is me being dumb

#

See the error here?

north mist
#

oh lol

upbeat hare
#

The second error is because I have to create the Universe later than the loading actions...

#

That's going to be an annoying one to fix

#

let me fix these 2 and you can do your stuff

north mist
#

alright, thanks

upbeat hare
#

Wait what

#

PreLoad is called in preinitialize

#

Which is before any loading actions

#

This is the line throwing a null reference exception

#

The Universe is created in PreLoad

#

Which doesn't finish

#

because of the other error

north mist
#

makes sense

upbeat hare
#

I fixed the other error

#

so it should work now

north mist
#

got it, will try

#

yep works fine now, thanks

upbeat hare
#

By the way this is what I've added to the KSP2UnityTools UI

#

Y'know all we need to add to patch manager is a png loader and an fbx loader ... and uhh yeah, suddenly we have unityless parts mods

north mist
#

yeaaah but I'd rather avoid that

upbeat hare
#

Yeah, and also like loading fbx at runtime seems to require a paid plugin

north mist
#

though I'm thinking it may be worth it trying to somehow benchmark how much of a difference in loading times it would be, and how much of a difference our TextAsset cache already is compared to pure addressables

north mist
#

if it came down to it

upbeat hare
#

theres also .mu

#

But yeah we could support .obj

#

The problem then is loading all the materials and such

north mist
#

me, an artist:

#

we should support Paint 3D's .glb

north mist
upbeat hare
north mist
#

I guess that could work

upbeat hare
#

But ... text asset loading is leagues faster than image/model assets if I had to guess

north mist
#

but if we were to do this, I would still rather have it in a specialized "dev" plugin

#

that would make it clear it's not meant for production use, by something like adding a watermark

#

or, if it is possible, only allowing it to run with debug mode enabled

#

I think that would be good enough to prevent any misuse

#

it would give devs a way to do quick iteration without opening Unity

#

and then they'd just have to open Unity and rebuild addressables once per release

upbeat hare
#

Ill be honest i almost never use debug mode when developing mods

#

Its too much a hassle

north mist
#

I just always have it enabled on all my game instances lmao

upbeat hare
#

And having multiple installs takes too much space

north mist
#

ok icons are working, time to test the prefabs

upbeat hare
#

That quick munix

#

goddamn

north mist
#

tbh the way I did it was extremely easy

#

at first I was trying to force the custom subclasses of PartCore/PartData into the game systems but it's honestly not worth all the effort of copying all fields from the original objects to the new ones, etc., so I just used a regex to grab the new values directly from JSON and store them in internal dictionaries per partName

upbeat hare
#

Or instead just reading the json file, storing it into a jObject, checking if it has the key or not

#

and if it doesn't then just default the value to the partName.prefab/partName.png

north mist
#

this is interesting lol

#

not sure I've seen it before

#

the loading screen disappears like 2 seconds before the loading bar

upbeat hare
#

I've seen it before

north mist
#

ughhh of course it's full of messy async stuff that's hard to patch

#

(the prefab loading)

upbeat hare
#

aaaaaaaaaaaaaaaaaaaaaaaaa

north mist
#

I feel like 90% of our issues with Patch Manager would be solved if they just had a AssetProvider.LoadSync(...) method lol

#

but that's not really on them, it's mostly the way the Addressables API is made

upbeat hare
#

Yeahh

#

Also once you are done with this, I am going to create a custom adapter for Data_Engine such that you can PM index the engine modes a lot easier

#

As in you can index the engine modes at the top level just like a module data

#

Meaning the array here, just becomes a +Engine ... (or +(mode_id))

#

And I will reflect that in KSP2UnityTools as well

north mist
#

sounds good

upbeat hare
#

It's mostly cuz it irked me how hard it would be to patch engine modes normally

#

Anyways, I am going to go for now, ping me once you get prefab overriding working and its commited so I can work on this

north mist
#

I mean you probably can, I'm working in a separate branch and I don't think there should be any conflicts

upbeat hare
#

Alright, I still need to go for a bit tho

upbeat hare
#

Alright I created the data_engine adapter

#

now I am going to test it with that crazy part I made using KSP2UnityTools and see how it goes

north mist
#

I need a nap because I slept for like 4 hours last night, but I'll try to take a look at the issue with the materials after that

upbeat hare
#

(just going to test the generated json file)

#

but I need to grab food first

upbeat hare
#

There we go, with the engine mode as well

#

Bro what

north mist
#

That's an interesting one lol

upbeat hare
#

I forgot to add negation for integers into the code

#

god damn, whats up with this aaaaa

#

I see now

#

ffs

#

I'm just going to skip over all null fields

upbeat hare
#

This next patch manager update is gonna be a banger

north mist
#

sweet!

upbeat hare
#

Now I think my next step for documentation is documenting the entirety of parts_data and all the modules

#

I might generate a script to autodocument the modules

#

And then do manual editing of data_engine

north mist
#

wouldn't that be better on the regular wiki, with a link to it in the PM docs?

upbeat hare
#

I want to document them in PM terms rather than C# terms

#

That means describing it in terms of classes and elements and PM types

north mist
#

I guess, but it sounds like something that could be very useful also for people who don't care about using PM at all and just want to make a part in Unity

#

since the information is exactly the same, just structured slightly differently

upbeat hare
#

It isnt exactly the same
Because im more so documenting the structure of the json file and abstract pm object itself

#

Whatever its mostly gonna be auto documented anyways

upbeat hare
#

Also before I release the next update, I want to add a tech tree ruleset

north mist
#

one thing I'm kinda worried about is the visual side

#

like, it doesn't look like there's much room to add any custom nodes

#

we'll probably have to implement some rescaling

upbeat hare
#

I hope that they made those visuals procedural

north mist
#

I really hope so too

#

but something tells me that it's all hardcoded

upbeat hare
#

Thats gonna be fun to change if so

#

And then we may want to add more tiers as well

#

So we might have to add a scrollbar to the top

#

Or like a [<] and [>] button set

north mist
#

I think that should be relatively easier, since there already is a scrollbar for it on the bottom

upbeat hare
#

Alright then

#

I just hope that we dont have to add our own procedural ui code into patch manager aaaaaa

north mist
#

at that point it'd probably be better as a separate mod tbh

#

which registers its own ruleset for PM

upbeat hare
#

Yeah

#

Something like Tech Tree Patcher

#

Still one of my first things to do after the update

#

And maybe ill make a probe start mod for it

north mist
#

hell yeah, that's always good to have

#

I honestly actually really want to give a try to some sort of a story-driven mod utilizing the missions framework

upbeat hare
#

Ahh missions

#

Im going to have to add that to PM as well

north mist
#

yeaah

upbeat hare
#

Ill do that after tech

#

More important to do tech

#

Imo

north mist
#

yeah, definitely

#

custom missions will be very useful for planet packs

#

but that seems like something with still a long way to go

#

though I think we should focus on planets after getting all the science stuff done

#

since it really is like the biggest modding part of KSP after parts

upbeat hare
#

Yeahh

upbeat hare
#

Am writing the autodocumenter atm

#

I think this will be useful for this at least

upbeat hare
#

Wtf is this

#

screw it, I'm going to create a spacewarp mod with a document button

#

that will work

upbeat hare
#

ALright, guess I'll have to do this another way

#

@north mist here's an example of autogeneration

north mist
#

damn, that's cool

upbeat hare
#

Sorting through 106 files and touching them up when they need them is a bit of work

#

As some stuff wasn't properly grabbed or whatever

north mist
#

I added doc comments to all the public stuff that didn't have them so that PM now builds with 0 warnings

#

however, the new Data_Engine selectable is broken

#

with the same exception popping up multiple times for every single engine part

upbeat hare
#

wtf did I not fix that issue

#

@north mist try now

#

I forgot to push the fix

north mist
#

ahh

#

will try

#

yep that got rid of it

#

thanks 👍

upbeat hare
#

Yeah, I'm just a dumbass

#

Need to remember to push stuff

north mist
#

I'm happy now, all green

#

lol

upbeat hare
#

Have to update my autogen as it was calling all enums integers

upbeat hare
#

Yes I know it needs completion, but I don't know what every field does

north mist
#

can I just ask what a class selector for a simple type field like partName do?

#

just store the content of partName in $current/$$?

upbeat hare
#

yes

#

But basically the point of class selectors are to check if something has an element or field

#

It's more useful in generic json contexts I suppose

north mist
#

yeah gotcha

upbeat hare
#

But like I updated the type hints some more

north mist
#

oh nice, that's cool

upbeat hare
#

This is going to be fun to update come 0.2.0

north mist
#

LOABE
which has been broken for months

upbeat hare
#

I thought it worked still

#

shows how much I know

north mist
#

nope

upbeat hare
#

Well shit

#

we have to write our own then don't we

north mist
#

I mean @maiden wraith said he would have time for modding in the last two weeks of December so let's pray

upbeat hare
north mist
#

all I'm asking for is an update for LOABE and for the plume game objects for Merlin and Raptor in SORRY

upbeat hare
#
:science #tNode_1v_start {
    UnlockedPartsIDs: +[
        "KLSS_life_support_tank_1v_1x1",
        "KLSS_life_support_tank_2v_1x1",
        "KLSS_food_tank_2v_1x2",
        "KLSS_water_tank_2v_1x2",
        "KLSS_oxygen_tank_2v_1x2",
        "KLSS_food_pack_0v_radial",
        "KLSS_food_pack_0v_radial",
        "KLSS_water_tank_0v_radial",
        "KLSS_oxygen_tank_0v_radial",
        "KLSS_food_pack_2v_radial",
        "KLSS_water_tank_2v_radial",
        "KLSS_oxygen_tank_2v_radial",
        "KLSS_greenhouse_2v_long",
        "KLSS_composter_2v_short"
    ];
}

Copying here, syntax for adding your part to the tech tree

upbeat hare
#

#🔴mod-dev message

#

This inline with PMs scope I presume?

north mist
#

yeah, makes sense

#

I just hope the way they did the coordinates scales well with resolution

upbeat hare
#

Gods i love that we made this mod

#

It makes me doing simple patch mods so much easier

#

An entire programming language to edit the tech tree lol

north mist
#

it also breaks the loading of the SpaceWarp and the whole game

upbeat hare
#

me

#

aaaaaaaaaaaaaaaaaaa

#

Okay, I can at least fix that bug

north mist
#

I was going to ask why the version number of the DLL is 0.4.0.0

#

and immediately answered my own question

#

it's exactly because of the template issue I realized just a bit ago in SpaceWarp

north mist
#

PM works fine

upbeat hare
#

Alright, well, I fixed that error anyways

#

That wouldn't break anything anyways lol

#

@north mist can you add gh actions to this as well :3

#

Redid the science stuff as well to handle tech node deletion, will be working more on this tomorrow in tandem with wmcc

upbeat hare
#

Alright, I'm going to add the mission stuff and release a 0.6.0 soon, such that I can get started on wheres my crew capsule (I want to move the space walk mission later and add a lunar impactor mission in its place)

upbeat hare
#

The sheer amount of wrangling for missions I have to do

upbeat hare
#

So I figured that I'm going to make the element type/name on mission stages _{id}

#

So that it's easier to index them and such

north mist
#

Makes sense

upbeat hare
#

Aaaaaaaaaa this field is never used so I have to guess at it's usage from code

#

Ohh its to create more complex missions

#

that have different branches

#

but like they are only used in the tutorials\

#

I'll ignore them for now and add them later

#

mostly because thats going to be a complex thing to add

upbeat hare
#

Also I'll likely release this at the same time as I release WMCC, because WMCC is going to be my test for it

#

aaaaaaaaaa

#

i'm about to just disable syntax validation on this

#

For the moment it doesn't matter

#

I'll fix it but for some reason sinons language server hates me

#

ohh its because of dumb shit again where I have to rename something in the grammar

#

@frail star can you accept my PR and update the language server extension

#

Pretty please

frail star
#

🫡

upbeat hare
# frail star 🫡

One thing, I didn't update the version in the package itself, I likely shouldve

frail star
#

i can do it, what do you want it to be

upbeat hare
frail star
#

sure

#

0.6.0 then

#

and, should i push it to marketplace?

upbeat hare
#

yes please

frail star
#

oh never mind :P

#

it's 0.7.0

#

i guess

#

done!

upbeat hare
frail star
#

a couple minutes

#

accoridng to them

upbeat hare
#

alright

#

i'll wait a bit to write my patches then

frail star
#

it shows 0.7 if i look it up

upbeat hare
#

@frail star did you rerun the npm compile step????

#

because the highlighting is correct

#

but the error messages are wrong

frail star
#

:/

upbeat hare
frail star
#

lol

#

i should add the grammar to the vsce prepublish step

upbeat hare
#

add grammar and compiler to it please

frail star
#

yeah it has the compiler

#

just not the grammar

upbeat hare
#

yeahh, the grammar might be worth it, esp after I sanitized the grammar to not cause errors

frail star
#

could you give me that patch quickly, to see if it worked?

#

also, what do you think about adding hover-over descriptions to the builtins

upbeat hare
#
@create-config  "wmcc-unlocks", "tNode_1v_start": [
    "probe_0v_spherical_electricity", /* stayputnik tNode_0v_electronics */
    "storage_0v_battery_electricity_radial",
    "antenna_0v_16",
    "antenna_0v_16s",
    "engine_0v_methalox_spark", /* tNode_0v_rockets_01 */
    "fueltank_0v_inline_methalox",
];
@define-stage "wmcc_patch": @global;

@stage "wmcc_patch"
:tech {

}
upbeat hare
frail star
#

works for me now

upbeat hare
#

let me get you a list of builtins and their descriptions

frail star
#

ill push + publish

#

should make it a webhook

#

push to main = publish

upbeat hare
#

Builtins I'd want hover for

@use - Import a library, to import multiple libraries from a mod do mod:*
@function - Define a function to be used in your patches
@mixin - Define a mixin (A reusable selection block)
@set - Set the value of the object being modified
@merge - Merge a dictionary with the object being modified
@delete - Either delete the object being modified, or the variable this is being set to
@require - Perform a boolean expression on the loaded mods to conditionally enable a patch
@stage - Set the stage that a patch is running in
@define-stage - Define a stage to be used with the `@stage` builtin
@include - Include a mixin in your patch
@patch - Define a list of labels to be patched outside of those defined by rulesets
@new - Create a new instance of an object that a ruleset matches
@before - Make this stage run before another stage if that other stage exists
@after - Make this stage run after another stage if that other stage exists
@global - Define this stage to be a global stage (running after all mod stages)
@create-config - Create a config to be used within patches
@update-config - Update a previously created config
#

@frail star

frail star
#

understood

upbeat hare
#

and tell me when you have this update out so I can use it lol

frail star
#

ok its all done

#

published 0.7.1, which has the correct grammar

frail star
upbeat hare
#

gotcha

frail star
#

i have a good idea of how to do it

upbeat hare
#

Damn patch manager has a lot of libraries

frail star
#

looks nice lol

upbeat hare
# frail star looks nice lol

Also, could you add hovers for these rulesets as well

:parts -> Patch the parts in the game (label: parts_data)
:resources -> Patch the games resource definitions (label: resources)
:missions -> Patch the missions in the game (label: missions)
:science -> Patch the tech tree (label: techNodeData)
:json -> Patch any json asset in the game
frail star
#

yeah

#

so i kinda have two options here

#

either you write an official langref file, and i parse it to get that data.
or i just embed a langref into the project

upbeat hare
#

Hmmm, alright

#

I'll have to figure that one out

frail star
#

just saying, i mean a literal langref.html

upbeat hare
frail star
#

it has nothing to do with vscode at all

#

i think it'd be best for all of us, if we had a official langref file

upbeat hare
#

Which has a full syntax reference

frail star
#

langrefs are usually written in pure html, so that they can be parsed super easily

upbeat hare
#

aaaaa

frail star
upbeat hare
#

I'll work on that at some point, I have other stuff I'm working on rn

frail star
#

you would parse this ^ to get descriptions and such

north mist
#

@upbeat hare pretty sure this was literally the whole fix

#

when you pull it, just delete the old build and dist folders to get rid of all the old stuff and restore

#

if you encounter the issues again, lmk

upbeat hare
#

Aight

#

Anyways, I am currently cooking up a new tech tree

#

I'm going to reuse old nodes, but I'm likely going to rename them

#

or rather reorganize them I suppose

north mist
#

that makes me think it would be really nice if tech trees + missions were something that the user can choose at the start of the campaign and be able to have multiple campaigns with different ones

upbeat hare
#

that'd be really hard

#

at least on the tech tree part

#

because there is no master tech tree definition

north mist
#

I mean, we could do what we did with the PrefabAddress and IconAddress fields

#

and add a field for the ID of the tech tree to the nodes

#

and then in code check for it

upbeat hare
#

I guess yeah

north mist
#

well actually no

#

at least not that simple

#

since some would be modifications of the stock ones, and some would be new

#

we'd have to only allow to make duplicates instead of edits

#

that way the stock tree could remain intact and mods could reuse nodes from it by duplication or something

#

yeah this is more difficult than I first thought

upbeat hare
#

we might just have to design a master tech tree definition that is an asset that defines all the nodes in a tech tree

#

It's just a big list of nodes

north mist
#

yeah, that'd be a better way to go about it

upbeat hare
#

we might also want to actually define node relations there as well

#

and I suppose positions aaaa

#

this is a duplication of information, but we need these multiple definitons

upbeat hare
#

@north mist I made a PR

#

Also the fix (I think)

:missions #KSP2Mission_Secondary_Kerbin_Experiment > missionStages > _0 > ConditionSet > PropertyCondition {
  @if ($$Inputstring == "collector_1v_science_general") {
    isInput: true;
  } @else {
    RequireCurrentValue: true;
  }
}
upbeat hare
#

tho this will add a dependency on patch manager

north mist
#

by the way, I've been seeing lots of requests for some very simple, single-file patches by people who don't care about making a full mod, they just want to tweak some stuff in their install

#

maybe we could "relax" the swinfo.json requirements

upbeat hare
#

aaaaaaaaa, it uses those to determine a lot of stuff

north mist
#

I was kinda thinking we could mostly autogenerate it

#

and just add some top-level statements for things like version and ID

#

to the patch itself

#

that would be required if there's no swinfo

#

to enable single-file patches

upbeat hare
#

I'll look into it

trail cradle
#

is it possible to make jet engines produce more thrust

upbeat hare
#

It is

trail cradle
#

one word. How?

upbeat hare
#

Can you give me a minute please, I am currently quite busy and focused on fixing a bug

trail cradle
#

figured it out

north mist
#

one tiny thing

#

could we do a bit of log cleaning up?

#

and make stuff like this debug logs rather than info logs?

upbeat hare
#

Ah yeah

#

sure

north mist
#

the logs are getting unbearably long with so many mods logging every small thing tbh

#

it's fine in debug

#

but info is a bit much

desert stirrup
#

Are experiments ready to be patched with PM? I see there's ExperimentSelectable inside the Science folder.

desert stirrup
#

And how is it done (I didn't dig into it yet)? Do you add experiments to parts?

upbeat hare
#

You have to define an experiment definition

desert stirrup
#

ok, I've seen that part

upbeat hare
#

and add a Module_ScienceExperiment to parts

desert stirrup
#

ah there's a module for science experiments, nice

#

I'll look into it then

#

I have to see how to trigger them also. I'd like for Orbital Survey (mod) to trigger an experiment at given mapping percentages (like 25%, 50%, 75% and 100%)

#

I wish they named their "Orbital Survey" experiment differently sigh

upbeat hare
#

Just name yours orbital scan

desert stirrup
#

yeah, was thinking exactly that

#

and I'd like to add survey missions also, but later, first the experiment

upbeat hare
#

I should add a list.slice method

#

so I have the whole set of map,filter,reduce,sort,slice

desert stirrup
#

@upbeat hare, I'm trying to replicate what you've shown, but my experiment and science module isn't attached to parts. Don't know what I'm doing wrong. Maybe something in the definition of the experiment.
Experiment:

@new("orbital_survey_visual_mapping")
:experiments {
    DisplayName: "OrbitalSurvey/VisualMapping/DisplayName";
    DisplayRequirements: "OrbitalSurvey/VisualMapping/DisplayRequirements";
    ExperimentType: "Both";
    //DataFlavorDescriptions: "Data flavor descriptions text";
    //SampleFlavorDescriptions: "Sample flavor descriptions text";
    DataReportDisplayName: "OrbitalSurvey/VisualMapping/DataReportDisplayName";
    SampleReportDisplayName: "OrbitalSurvey/VisualMapping/SampleReportDisplayName";
    DataValue: 6;
    SampleValue: 14;
    TransmissionSize: 150;
    RequiresEVA: false;
}

Part patch:

:parts #antenna* +Module_ScienceExperiment +Data_ScienceExperiment {
    ExperimentsStandings: [];
    LastKnownValidSituation: {
        CelestialBodyScalar: 0.0,
        ScienceRegionScalar: 0.0,
        SituationScalar: 0.0,
        ResearchLocation: null,
    };
    Experiments: [
        {
            ExperimentDefinitionID: "orbital_survey_visual_mapping",
            CrewRequired: 0,
            TimeToComplete: 30.0,
            ContextualExperiment: false,
            ResourcesCost: [
                {
                    Rate: 1.0,
                    ResourceName: "ElectricCharge",
                    AcceptanceThreshold: 30.0
                }
            ],
            DenyInterruption: false,
            ExperimentUsesResources: true,
            DeployedBoolAnimatorParamName: "",
            CFXName: "fx_science",
            SFXEvent: "invalid"
        }
    ];
    NotifyOnCompletion: false;
    ResourceThresholdMultiplier: 0.25;
}
upbeat hare
#

You need the pam override for one

desert stirrup
#

Experiment definition gets created, I see it in the cache. Log says that PM is applying a patch to the part.

upbeat hare
#

Also, you need to define the valid situations

upbeat hare
desert stirrup
#

ok, valid situations are:

"ValidLocations": [
      {
        "BodyName": "",
        "ScienceSituation": "HighOrbit",
        "RequiresRegion": false,
        "ScienceRegion": ""
      },
      {
        "BodyName": "",
        "ScienceSituation": "LowOrbit",
        "RequiresRegion": true,
        "ScienceRegion": ""
      }
    ],

will do that

#

PAM override? You mean this:

PAMModuleVisualsOverride: +[
                {
                    PartComponentModuleName: "PartComponentModule_OrbitalSurvey",
                    ModuleDisplayName: "PartModules/OrbitalSurvey/Name",
                    ShowHeader: true,
                    ShowFooter: true
                }
            ];
upbeat hare
#

Yeah but for the experiment

#

Also there is a bug i need to hunt down with chained +x selectors

#

Where it doesnt create the second one

#

So you should nest it

+Module_ScienceExperiment {
    +Data_ScienceExperiment {
    }
}
desert stirrup
#

PAM override, do you mean where the experiment is defined? So here:

@new("orbital_survey_visual_mapping")
:experiments {
...
}

That sounds strange as I don't see this in any other experiment definition

upbeat hare
#

I mean like

PAMModuleVisualsOverride: +[
                {
                    PartComponentModuleName: "PartComponentModule_ScienceExperiment",
                    ModuleDisplayName: "OrbitalSurvey/VisualMapping/DisplayName",
                    ShowHeader: true,
                    ShowFooter: true
                }
            ];
#

On the part

desert stirrup
#

Ah so on the part, not in the definition of the experiment, ok

upbeat hare
#

Both of those together should show the experiment

desert stirrup
#

It would be nice add warnings if stuff is missing from the patch, like ValidLocations missing. VSCode extension didn't complain about that. Is that possible to do?

upbeat hare
#

That ... is possible but quite complex

desert stirrup
#

Alright, you're the wiz, I trust you 🙂

#

Well aaaaalright! Thanks @upbeat hare! 🙂

desert stirrup
#

Turns out neither PAMModuleVisualsOverride nor ValidLocations are needed to get the experiments to patch successfully.
It was the nested +Module... +Data that prevented patching.

upbeat hare
#

I need to track down that bug

#

I think its just a bug with how multiple selectors are handled

#

Honestly it might not be possible to fix with the current semantics of selectors

#

Because chaining like that is adding both to the parent part, not to eachother individually

desert stirrup
#

No need to solve it imo. I just used it cause I saw you doing it that way. It's more intuitive to me to nest it.

upbeat hare
#

I was writing stuff fast forgetting how semantics woek

hexed yarrow
#

Newbie question here... I'm trying to create my first patch file, but PatchManager seems to be scanning my mod directory but not finding the patch file. My mod diretory is in Kerbal Space Program 2\BepInEx\plugins\Dolphin. Inside that I have created a swinfo.json file like the wiki says, and a patches directory. In the patches directory I have a file named "pod_2v_cupola_crew.patch" which has the following content:

    * > Module_ReactionWheel {
        PitchTorque=*5;
        YawTorque=*5;
        RollTorque=*5;
    }
}```

I have gone into settings->mods->Patch Manager and set "Always Invalidate Cache" to "Yes".

When I restart KSP2, I see the following in BepInEx\LogOutput.log:

...
[Info   :Patch Manager] Loading patchers from C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\Dolphin
[Info   :Patch Manager] Loading patchers from C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\flight_plan
...
[Info   :Patch Manager] Registering all patches!
[Info   :Patch Manager] 0 patchers registered!
[Info   :Patch Manager] 0 generators registered!

You can see above that it didn't find my patcher even though it saw my plugin directory.  Am I interpreting that correctly?  My changes don't seem to take, and I'm not sure what I am doing wrong.
#

Also are there any example mods that already use patch manager which I could look at to get a feel for things? The docs actually seem pretty good on technical detail, but I haven't seen a working example and looking at one would probably help a lot.

desert stirrup
#

@hexed yarrow Hmm, everything you mentioned sounds right. Maybe your swinfo isn't properly formatted (https://pm.kerbal.wiki/getting-started-with-patch-manager.html#setting-up-a-modding-environment-to-develop-patch-manager-patches) ? Is the mod present in Main Menu -> Mods and without errors?
Best way is to start is from a SpaceWarp template and go from there; everything should be set up correctly with the template.
You can see examples of working patches in Orbital Survey and Kerbal Life Support System mods.

upbeat hare
#

We definitely need a banner aaaa

north mist
#

best I can offer rn is something very simple like this

#

(of course, colors can be changed)

#

or like this, with slighly different proportions and using one of the fonts I have in UitkForKsp2 that mimic the game fonts, that maybe fits a bit better since it's more angular

upbeat hare
#

Hmm that looks decent

north mist
#

any color preference?

upbeat hare
#

A bit of a darker purple

hexed yarrow
north mist
hexed yarrow
#

Here's my swinfo file, it is taken from the template you linked to, just changing a couple things:

    "spec": "2.0",
    "mod_id": "DolphinMod",
    "author": "Dolphin",
    "name": "DolphinMod",
    "description": "Does something",
    "version": "1.0.0",
    "ksp2_version": {
        "min": "0.2.0",
        "max": "*"
    },
    "dependencies": [
        {
            "id": "com.github.x606.spacewarp",
            "version": {
                "min": "1.5.0",
                "max": "*"
            }
        },
        {
            "id": "PatchManager",
            "version": {
                "min": "0.4.0",
                "max": "*"
            }
        }
    ]
}```
north mist
upbeat hare
upbeat hare
#

Can I see the patch file you are trying?

upbeat hare
#

I think that looks pretty decent

hexed yarrow
upbeat hare
#

Thats the first error I see

hexed yarrow
#

ah, ok thanks!

upbeat hare
#

And dont use =

#

Use :

#

Thatll cause a syntax error using equals, hence why PM isnt scanning your mod

hexed yarrow
#

ha, I told you I was a newbie!

upbeat hare
#

As to why PM isnt outputting syntax errors ... the PM syntax errors would be in KSP2.log due to some stuff I had to do

north mist
#

so this should work

:parts #pod_2v_cupola_crew {
    * > Module_ReactionWheel > Data_ReactionWheel {
        PitchTorque: *5;
        YawTorque: *5;
        RollTorque: *5;
    }
}
upbeat hare
#

Yes

upbeat hare
north mist
#

though that syntax will likely change soon

#

from

PitchTorque: *5;

to

PitchTorque *: 5;
hexed yarrow
north mist
upbeat hare
#

Dark mode logo for sure

north mist
#

oh I just made it transparent

#

to show it off with both backgrounds

upbeat hare
#

Ahh

#

Anyways im going to add that banner to the spacedock page

north mist
#

not this screenshot

#

ehh I uploaded it directly to SD

#

looks fine I think

upbeat hare
#

Yep, that looks pretty good

north mist
#

you can use the square one as a logo in the docs

upbeat hare
#

Gotcha

north mist
#

like this

upbeat hare
#

Gotcha

#

Ill do that soon enough

north mist
#

sure, it's definitely not something urgent

upbeat hare
#

Gods we are doing work on christmas

north mist
#

I'm directly back to the mission editor lol

#

since I have covid, I'm not doing all the family visits this year anyway

upbeat hare
#

Why I made that latest commit lol

@use "builtin:list";
@function not-in($values) {
    @return @function($check) {
        @each $v in $values {
            @if ($v == $check) {
                @return false;
            }
        }
        @return true;
    };
}
:science #node_id {
    UnlockedPartIds: $value:filter(not-in([/* ... */]));
}
north mist
#

lol

upbeat hare
north mist
#

it sure does

upbeat hare
upbeat hare
#

Im going to be adding a - operation to lists as well

#

Its just going to remove all the values in the rhs from the lhs

#

Also I somewhat want to make a free floating identifier (like for a function call) automatically convert into a string

#

But im not sure

#

So like

... {
    x: y;
}
/* same as */
... {
    x: "y";
}
#

Thoughts?

north mist
#

idk, I think it might lead to some confusion and misuse

upbeat hare
#

Thats fair
Its basically already done on the lefthandside of : exprs in dictionaries though

#

But yeah i get ya

#

My thoughts were its something I already try to do when writing patches, and that it would make enum values look cleaner

#

Like instead of
Category: "Science";
Category: Science;
But i can totally see the confusion

north mist
#

honestly I'm like 50/50 on this

#

not sure either way

upbeat hare
#

Note: this is something SCSS does

north mist
#

yeah, it's just a basic CSS thing

upbeat hare
#

Im like 65/35 on it myself

north mist
#

then sure, add it

#

I don't feel strongly about it

upbeat hare
#

Gotcha
I also need to add like #"..." and strings as element selectors as well at some point

#

Its been on my todo list

north mist
#

do we have escape sequences?

upbeat hare
#

Yes

north mist
#

nice

#

that should make that easier then

upbeat hare
#

I just use regex.unescape

#

Which supports all C# escape sequences

north mist
#

so something like #"\"hello there\"" should work

upbeat hare
#

Yes

north mist
#

awesome

upbeat hare
#

I should make function names be strings to remove any ambiguity, "hello, I am a function"(5)

north mist
#

oh my god

#

lmao

upbeat hare
#

It wouldnt even be hard to implement

#

Plus you already do get-function with the function name as a string

#

But yeah ill add this all (except for maybe functions as strings) for a PM 0.7.0 release

#

Maybe I'll do the breaking +: change then as well

north mist
#

CHEESE

#

😭

#

I finally had it all without warnings

upbeat hare
#

Oh I need to write documentation

north mist
#

lmao

#

I'm adding the release+nuget action to this

upbeat hare
#

Awesome!

upbeat hare
north mist
#

how is allowing spaces in function names good practice in any way, shape or form 😭

upbeat hare
#

For when you want your functions to include unicode characters

north mist
#

"👆 🟰 🤡 "()

upbeat hare
#

You might just need to put a BOM in front of your function name

north mist
#

sometimes you truly terrify me Cheese

upbeat hare
#

Good

north mist
#

release action added, project files cleaned up, some code cleanup regarding things like unused imports and such, and all warnings fixed

#

hopefully the action works, but we'll only know after the next release

upbeat hare
#

Yep

#

I can add the clean room disclaimer to PM now :3

#

You should add the release action into the template tbh

north mist
#

yeah I'm going to

upbeat hare
#

Aaa, Im gonna have to make a pr to all existing mods to switch around the prefix expressions

#

Plus tell the 2 people ive already taught to make patches that its going to change

north mist
#

yeah... that was my other issue with it

#

though it's better sooner than later

#

if we really want to make the change

upbeat hare
#

Im still 50/50 on it

upbeat hare
#

Should I add custom mission categories to patch manager?

north mist
#

I am all for it

upbeat hare
#

Alright, aaa, I am going to have to do preanalysis to the patches though

north mist
#

to just extend the enum with the new values?

upbeat hare
#

If I want more than a static set of categories

north mist
#

hmm

#

everything is done with switching on the enum, including rendering UI and stuff like that

#

so we'll have to patch everything that touches the enum, one way or another

#

I feel like it'd be easier to just look up the values in a custom dictionary or something, at that point

upbeat hare
#

I feel like it'd be easier to just change that property to a string

#

and prepatch a lot of stuff

north mist
#

yeah, or that

#

that way you don't have to analyze the patch files in a prepatch

upbeat hare
#

Yeahh

#

I'll put this on my todo list

#

likely after 0.7.0

desert stirrup
#
  1. What are FTUE missions?
  2. What would custom missions be? Missions that mods could trigger? How would that be different from secondary missions?
north mist
#

First Time User Experience

#

they're the PAIGE stuff when you enable the first time user thing in the campaign creation

#

I think

upbeat hare
north mist
#

so other than Primary, Secondary, Tutorial, and FTUE

#

for example you could add missions of the type "Scanning"

#

for Orbital Survey

#

and they'd get their own box in the mission control

upbeat hare
#

And I'll likely gen the loc key like MissionTypes/Scanning

desert stirrup
#

That's what I meant with my question. Why would we define another category in addition to Secondary? I'm not saying that I wouldn't do that, just curiour what you're aiming at

north mist
#

well, imagine building something like RP-1

#

and having all contracts in just 2 categories

#

or if a user installs 10 different mission packs at some point, imagine how cluttered the secondary missions would be

desert stirrup
#

Ok so similar to what KSP1 was doing, mods could have their own category. Might be even something players could toggle off it they don't want them

north mist
#

yep, pretty much that

desert stirrup
#

sounds good

upbeat hare
#

I was going to hide categories that don't have active missions

desert stirrup
#

"CommunityMissionsCatagories"

north mist
#

well, the idea is to let the modders use any string they want

upbeat hare
#

I mean, why would it be community, I was going to allow mods to define any category they want

#

I was literally going to change the mission type from an enum to a string

desert stirrup
#

I was kidding 🙂

#

Though there's a point to consider what would we do if different mods define the same string. Merge it or keep them separate.

upbeat hare
#

The patches won't know what mod the categories came from

#

anyways gtg for now

desert stirrup
#

They could know, but ok, there's no reason to do it, I agree.

upbeat hare
#

Aaaa I'm really 50/50 on this : + -> +: change

desert stirrup
#

I'm 100% for +:

upbeat hare
#

It's going to be fun pinging sinon to update the LS again lol

#

But I have added the following so far

:experiments #"orbital_survey" {
  DataType: Both;
}
#

I'm going to add string interpolation in selectors at some point

#

(At the same time I add a top level @each)

#

I'll honestly do it like the following

$"{$xyz:...} + {$y:...}"

Which gets passed to String.Format with like the followint

String.Format("{0:...} + {1:...}",xyz,y);
upbeat hare
#

alright, I'm implementing the +: thing

upbeat hare
north mist
#

I don't like it 😢

upbeat hare
#

It's better than ambiguity

#

I could just s/:/= but aaaa

north mist
#

noooo

#

that's even worse

#

keep +:

upbeat hare
#

Alright

north mist
#

let's get these breaking changes out of the way before 1.0

#

which by the way, I feel like the only puzzle piece that's missing now is celestial bodies and galaxy definitions

#

and then we're ready for 1.0

upbeat hare
#

Yeah

#

that's why this next version is 0.7.0 still

#

Also literally everywhere you can use a string now, you can use the unquoted string form

#
@define-stage stage;

@stage stage
:parts {
}

Example

north mist
#

alright, let's hope people don't try to use property names there

#

like

mass: mass + 2
#

since it kinda invites you to do that

upbeat hare
#

well variables are already known to be $ is the thing

#

also that would tell you an error

#

and if we syntax highlight it as a string

north mist
#

yeah, but the fact that the assignment also starts with no $ could lead someone to that conclusion

upbeat hare
#

because technically assignment is a string

#

thats shorthand for

"mass": "mass" + 2;
north mist
#

yeah

#

I think we better make this extra clear in the docs though

upbeat hare
#

Yep

#

extra clear in docs

#

syntax highlight as string

north mist
#

👍

upbeat hare
#

@frail star new PR for the language server

frail star
#

mmm

upbeat hare
#

btw, don't worry about a lot more things being highlighted as strings

frail star
#
@new("Stormlight")
@new(Stormlight)
upbeat hare
#

Yes

frail star
#

😬

#

no :grief:

upbeat hare
#

Yes

north mist
#

I was resisting a bit as well, but it makes sense since CSS considers most unquoted strings as strings, too

upbeat hare
#

I also did a lot of stuff in the opposite direction

#

so

."$type" {
}

is correct

north mist
frail star
#

wait

#

i just saw a person i know in the member list

#

from a completely different server

#

lol

north mist
#

that was not the conclusion to "wait" that I was expecting

#

lmao

frail star
#

i was trying to ping cheese, and i saw them

#

anyways

#

@upbeat hare

#

i am very mentally invested into optimizing my memeql, and i will do this in a bit

#

O(log n) best case is for weaklings

north mist
#

O(1) or bust

frail star
#

uh

#

sorry i mean, O(1) is best case

#

O(log n) is average

upbeat hare
#

Just upgrade the CPU to have a 1 terabyte xor gate

frail star
#

O(n) worst case 😬

#

still would probably be slower than my

#

simd comes so hard into play here

upbeat hare
#

What I am not looking forward to is string interpolation

stiff crater
#

Does the foo: +[bar]; -> foo+: [bar]; change have some level of backwards compatilibity or will all mods using this syntax break?

upbeat hare
north mist
#

there aren't that many, anyway

stiff crater
#

Just for info I won't be able to update KLSS until the 30th at the earliest

stiff crater
north mist
#

what if we submit a PR for it and give you a zipped release

#

yeah, that was my thoughts as well

upbeat hare
#

I'm going to be heading to grab breakfast for now tho

#

I have a ... really stupid idea

north mist
upbeat hare
#
if file is older than release date
    file.replace(": +"," +: ")
    file.save()
north mist
upbeat hare
#

I dont foresee any issues with this

north mist
#

I also fixed the build script to work with the action, and added the two other actions from the new template version

#

let's see what it does

upbeat hare
north mist
#

aaaaaaaaaaaa

upbeat hare
north mist
#

I forgot we do this sort of magic bullshit

#

can we just... copy them into plugin_template and commit them?

upbeat hare
#

I suppose we could

#

I was hoping to avoid that

#

~/.local/share/NuGet/plugins-cache is the nuget cache location on linux

north mist
#

huh why does MSBuild set the autogenerated property wrong

north mist
upbeat hare
#

wait

#

google was wrong

north mist
#

aafsjhsdfgjl

#

I know the issue

#

it's because we capitalize the folder name

#

and Linux is case sensitive

upbeat hare
north mist
upbeat hare
#

thats an easy fix then

north mist
#

yeah that was the whole issue

#

now it finds the file

#

lmao ok another easy fix

#

I just used the template's nuspec name which is Package.nuspec

#

but we have PatchManager.nuspec

upbeat hare
#

Oh lol

north mist
#

nice

upbeat hare
#

Anyways my next project is to make SW compile without warnings and have doc comments

#

we really just need a doxygen site for spacewarp

north mist
#

I already started work on it

#

so I'll at lease push what I have and you can continue, and I'll get on with the mission editor

#

though, could you please try to make the mission debug thing first, so I can release CF?

upbeat hare
#

Oh I was just going to write a patch to give myself that mission at the start

north mist
#

ah that works too

#

just want to verify the mission fix, doesn't really matter how

upbeat hare
#

Lol I can use the standalone patch system I just wrote

north mist
#

it's nice to have actions back for PM

#

I'm glad I put the effort into making all the nuget and powershell stuff work

upbeat hare
#

Testing the release action now

north mist
#

now it's time for the big one, the release action

#

yep

upbeat hare
north mist
#

ooh I know exactly what that is

upbeat hare
#

Yep

north mist
#

it's the SW specific path

upbeat hare
#

I'm half tempted to delete the release and try again lmao

north mist
#

why not tbh, you can just copy the markdown

upbeat hare
#

Going to force merge

north mist
#

lmao I made a PR but yeah, that's fine

upbeat hare
#

Attempt no. 2

north mist
#

I believe in it this time

#

hell yeah

upbeat hare
#

WOOOO

north mist
upbeat hare
#

Everything worked!

north mist
#

it wasn't without some small hiccups, but nothing major, I'm glad

upbeat hare
#

there was a deprecation warning in one of the steps

north mist
#

oh yeah I already have that action replaced in the template

#

let me make that change in dev

#

it's pretty cool that this also allows us to very easily do something like fix some small mistake in the code, just push the change into main, and create a release and then just grab it and upload it to spacedock (which we will also be able to automate), and all that without any dev environment set up or KSP2 installed

#

for example in situations like Safarte's right now, on vacation

#

in fact I think that in the next template version, I'd like to add a SpaceDock upload action

#

to make this complete

upbeat hare
#

Yeah

#

Fully automated release pipelining

#

Also awesome!

north mist
#

it could allow us to fully automate even solutions with Unity projects

#

like automatically building SpaceWarpUI

upbeat hare
#

That would be awesome

stiff crater
north mist
#

honestly out of everything I do here, the template is like my passion project

upbeat hare
#

It also prevents any malware from getting into the release zips in case the devs computer is compromised

#

not that that is a big concern

lethal dome
#

Hey Guys, long stint of absance but I am back. New update if fantastic, is it a known issue with the update that there is a bug with rebuilding the cache?

north mist
#

not that I'm aware of, what is it specifically?

hexed yarrow
#

I also hit it

#

EXC 15:07:43.710] NullReferenceException: Object reference not set to an instance of an object
PatchManager.Core.Assets.PatchingManager.RebuildAllCache (System.Action resolve, System.Action1[T] reject) (at <8466f18cf3c7417f87d171cc831cb24e>:0) KSP.Game.Flow.GenericFlowAction.DoAction (System.Action resolve, System.Action1[T] reject) (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
KSP.Game.Flow.FlowAction.Do (System.Action1[T] resolve, System.Action2[T1,T2] reject) (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
(wrapper dynamic-method) KSP.Game.Flow.SequentialFlow.DMDKSP.Game.Flow.SequentialFlow::NextFlowAction(KSP.Game.Flow.SequentialFlow)
KSP.Game.Flow.SequentialFlow.Update () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
[EXC 15:07:53.216] NullReferenceException: Object reference not set to an instance of an object
KSP.Rendering.CelestialBodyGIProbeManager.RemoveEvents () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
KSP.Rendering.LightingSystem.RemoveEvents () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
KSP.Rendering.GraphicsManager.RemoveEvents () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
KSP.Rendering.GraphicsManager.Cleanup () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
KSP.Rendering.GraphicsManager.OnDestroy () (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
[WRN 15:07:53.248] KSPAudio: Unable to find AudioInputDefinition for hotkey binding!

north mist
#

thanks for the report, I'm looking into it

hexed yarrow
#

I thought it was my mod because I hadn't changed the way to do something+=else; but I get it when I move my mod out of the way

#

it it possible to download the previous version?

lethal dome
#

Okay it loaded in after about 10 minutes. Just took a very long time.

north mist
#

that's probably the action timing out

lethal dome
#

Sorry for the bother.

#

If you need any logs let me know.

north mist
#

I just tested with cache deleted, and then with cache existing, and haven't hit the exception either way

#

could you please send the full logs?

lethal dome
#

Sure

#

Where will the logs sit?

north mist
#

C:\Users\username\AppData\LocalLow\Intercept Games\Kerbal Space Program 2\Player.log contains everything

hexed yarrow
#

I'll grab that.

north mist
#

yes

lethal dome
hexed yarrow
#

let me know if you want KSP2.log, that is where I found that stack trace

north mist
#

no need, this file should contain all that is in that one

#

and some extras

#

thank you both for the logs

hexed yarrow
#

no problem, thank YOU for the mod!

north mist
#

and I have already found the issue, thanks, this will be an easy fix

lethal dome
north mist
upbeat hare
north mist
#

sure

upbeat hare
#

Thank you

lethal dome
#

Works perfectly, want the log?

north mist
#

no need, thanks

#

glad it's fixed now

lethal dome
#

Thanks

#

Amazing as always

upbeat hare
#

Does the forum have an api

#

Can we auto forum post on update

north mist
#

actually... I worked on a mobile app for an Invision-based forum years ago

#

lmao

#

but the API has to be specifically enabled by the admins

#

which I very much doubt they have

upbeat hare
#

Darn

#

I just wanna be as lazy as possible

north mist
#

I would love that as well

upbeat hare
#

Setting up the spacedock uploader is the next step

north mist
#

definitely

upbeat hare
#

I already have the ksp2community bot username/pw in the secrets for spacewarp

desert stirrup
#

oh I thought you were going to remove support for : + but I've updated to 0.7.1 and it's still working

upbeat hare
#
  • just returns the value on the righthandside
#

I should add a check that the value is an integer/real

#

So

X: +5;

Does not do $value+5
It just returns 5

#

It might still be working as your things are the only overrides for example

#

But there is no code for parsing that stuff explicitly now

desert stirrup
#

ok, orbital survey is still working because

PAMModuleVisualsOverride: +[

is the same as

PAMModuleVisualsOverride: [

for the PAM override. Ok, gotcha

upbeat hare
#

Exactly

upbeat hare
#
@use 'builtin:list';
@use 'builtin:dictionary';
@function mult-by($ratio) {
  @return @function($v) {
    @return $v:set('value',$v['value']*$ratio);
  };
}
:parts #engine_id > Module_Engine > Data_Engine > Engine > atmosphereCurve > fCurve {
  keys: $value:map(mult-by(/* your ratio */));
}

I can't really do much better than this here, can I?

#

Maybe adding some curve builtins?

north mist
#

I suppose that might be helpful, since ISP will probably be a relatively frequent patch target

upbeat hare
#

Yeah, but I can't do anything about requiring function calls

#

This really do be looking like CSS lmao

upbeat hare
#

Fair enough

#

Also, I'm thinking, should I allow

$v:value

With no function call to be the same as

$v[value]
north mist
#

That's not a bad idea

#

Just using : as a general member access operator

upbeat hare
#

Umm, so I also need to do a hotfix soon

#

The single file patches aren't being hashed for cache invalidation

upbeat hare
#

Im still very glad I added higher order functions

upbeat hare
#

I'm thinking we might have to change our caching system a bit

#

We compute the cache ... after we check cache validity now

north mist
upbeat hare
#

Also @north mist patch manager is going to start using C# 12 from my next commit

north mist
#

sure

upbeat hare
#

It's basically just us 2 so it won't be an issue

vagrant kiln
#

hey, do u know if this supports float curve editing? if it has been tested

north mist
#

not sure if tested, but it should work

vagrant kiln
#
    "fCurve": {
      "keys": [
        {
          "time": 0.0,
          "value": 335.0,
          "inTangent": 0.0,
          "outTangent": 0.0,
          "inWeight": 0.0,
          "outWeight": 0.0,
          "weightedMode": "None",
          "tangentMode": 0
        },```
#

ok i will try to figure it out, thx

#

very good mod btw, its cool to finally have a MM style mod

#

took me a while to work out how to edit partmodule stats, but now its great

north mist
#

yeah, we basically looked at MM, and tried to do something similar but make it much more powerful, and base the syntax on an existing language (SCSS) to make it easier to learn

upbeat hare
#

I have a stupid idea once we fix caching

#

We should add the addressables catalogs and asset bundles for mods into the cache hash

vagrant kiln
#

what is the syntax for editing a field inside an object which is inside a list? e.g. Experiments: [ { "ExperimentDefinitionID": "AtmosphereSurvey", ... } ]

upbeat hare
vagrant kiln
#

like this? * > Module_ScienceExperiment > Data_ScienceExperiment { Experiments[0]: { ExperimentDefinitionID: "AtmosphereSurvey", }; }

upbeat hare
#

Nah, you might want to do this instead

vagrant kiln
#

bc that patches but then throws the weird error in the vab where it just shows the color picker

upbeat hare
#
@use "builtin:dictionary";
* > Module_ScienceExperiment > Data_ScienceExperiment {
            Experiments[0]: $value:set(ExperimentDefinitionID,AtmosphereSurvey);
        }
#

And then you can keep chaining :set

vagrant kiln
#

not working, maybe i need to update

upbeat hare
#

Can I see your full patch @vagrant kiln

#

And what version of PM

vagrant kiln
#

0.6

upbeat hare
#

Update to 0.7

#

though you will have to change all your : +/-/*// to +: -: *: /:

vagrant kiln
#

is that supposed to break splash screen skipper?

upbeat hare
#

@desert stirrup @north mist wtf

vagrant kiln
#

cannot live without that mod lol

upbeat hare
#

That mod is sentient I swear

#

but no it isn't supposed to break, I don't use it because it only works for 50% of people or something

vagrant kiln
#

just from updating, nothing else changed

upbeat hare
vagrant kiln
#

yeah i wanted to find those, where are they?

upbeat hare
#

You'll want to look under BepInEx/logoutput.log

vagrant kiln
#
  at SpaceWarp.Patching.LoadingActions.InitializeModAction.DoAction (System.Action resolve, System.Action`1[T] reject) [0x0000d] in <39f0697ba36b449aa19b27f13be09abd>:0 
[Error  :Space Warp] System.NullReferenceException: Object reference not set to an instance of an object
  at SpaceWarp.Patching.LoadingActions.PostInitializeModAction.DoAction (System.Action resolve, System.Action`1[T] reject) [0x0000d] in <39f0697ba36b449aa19b27f13be09abd>:0 ```
upbeat hare
#

Can you send the full log please

vagrant kiln
#

is there a patch manager log?

upbeat hare
#

I meant send the full logoutput.log

#

bepinex should say what happend

vagrant kiln
#

sorry nvm im a derp

#

[Error : BepInEx] Could not load [Patch Manager 0.7.1] because it has missing dependencies: com.github.x606.spacewarp (v1.7.0 or newer)

upbeat hare
#

Ah yes, update spacewarp

#

and likely uitk

vagrant kiln
#

nested fields inside objects inside lists are serious business, have to update everything lol

#

and pray the skipper still works

upbeat hare
#

Are you patching the engine modes?

desert stirrup
#

Arcane dark magic is breaking splash screen skipper. There is no hope for salvation.

upbeat hare
#
> Data_Engine > #mode-id {
}

Is the easiest way to get to an engine with a certain mode

> Data_Engine > engine_mode {
}

Gets all engine modes

vagrant kiln
#

phew it works at least

vagrant kiln
#

gotta go back to basics, nothing works except the tech tree

#
        PitchTorque: *0.02;
        RollTorque: *0.02;
        YawTorque: *0.02;
    }```
#

that used to work and i didnt think that syntax changed?

#

in 0.7

upbeat hare
#

It did change

#
* > Module_ReactionWheel > Data_ReactionWheel { 
        PitchTorque *: 0.02;
        RollTorque *: 0.02;
        YawTorque *: 0.02;
    }
upbeat hare
vagrant kiln
#

ah i get u now, thanks

#

ok seems to be working, thx, just a last question - how to delete the object with lookup by name inside the list, like * > resourceContainers { ElectricCharge { @delete; } }

upbeat hare
vagrant kiln
#

hm, the resource doesnt get deleted

#
    @if $$crewCapacity > 0 {
        * > Module_ReactionWheel { @delete; }
        * > resourceContainers > ElectricCharge { @delete; }
    }
}```
upbeat hare
vagrant kiln
#

np

upbeat hare
vagrant kiln
#

yup! tysm

upbeat hare
#

That needs to be changed, why did I use class there instead of element type or name like I do everywhere else

vagrant kiln
#

ok

#

i might not use it anyway since the life support mods probably need EC on the pods

upbeat hare
#

They don't

#

they just need it in the vessel

vagrant kiln
#

ok

#

do u need to change it, i can wait if u do

#

its not a big deal

upbeat hare
#

Nah, I'll change it in a backwards compatible way in a later update

vagrant kiln
#

kk

desert stirrup
#

Can I do something like this? And what would the syntax be?

$visual-parts: ["#antenna_0v_dish_ra-2", "#antenna_1v_parabolic_dts-m1", "antenna_1v_dish_hg55", "antenna_1v_dish_88-88"];
$biome-parts: ["antenna_0v_dish_ra-15", "antenna_1v_dish_ra-100"];

:parts $visual-parts {
    // do stuff
}
upbeat hare
#

The answer is not yet

#

But I want to

desert stirrup
#

Alright, good to know

upbeat hare
#

For reference, the syntax would be a top level each loop

desert stirrup
#

I'm also looking forward to having Builtin Library References filled in, lists, dictionaries and the rest

upbeat hare
#

But now that I have someone wanting it, ill move it up in priority

desert stirrup
#

I mean I have an easy backup solution, but it would have been nice

north mist
#

https://forum.kerbalspaceprogram.com/topic/221179-071-patch-manager/?do=findComment&comment=4353693 we also have someone wanting a way to replace the skybox with PM

#

lmao

upbeat hare
#

Thats ... just not possible

north mist
#

lmao that's what I told them

upbeat hare
desert stirrup
#

Also, I want to move all the constants Orbital Survey uses like min/ideal/max altitude to PM patches and I'm reading up on defining configs other mods could override, that would be a nice touch. But ideally I also need a way to access those value from inside my c# code, similar to how you'd do that in MM. Is this possible?

upbeat hare
#

Umm, you can access the builtin get config function directly

#

You just need a reference to the Universe which is patchmanager.core.assets.patchingmanager I think

#

It returns a DataValue which will hold your valur

desert stirrup
#

An API would be nice, I think that other modders would need that as well.

#

"Universe"? What is that? A namespace?

upbeat hare
north mist
#

well it kinda already is an API, I think we just need to document it

upbeat hare
desert stirrup
#

I don't know what that is 🙂

north mist
#

it's a class

desert stirrup
#

Ok, I'll add PM as a reference and look around

upbeat hare
north mist
#

can't you just use PatchManager.Core.CoreModule.CurrentUniverse?

#

oh but there's no easily accessible instance of the core

upbeat hare
#

I ... forgot to make that a static property facepalm