#Patch Manager

1 messages · Page 8 of 1

upbeat hare
#

@north mist can you make that static and release a hotfix lol, that should really be static

north mist
#

sure

desert stirrup
#
/// <summary>
/// This is the current universe that patch manager is using (used for interop reasons)
/// </summary>
[PublicAPI]
public Universe CurrentUniverse => PatchingManager.Universe;
upbeat hare
north mist
#

yeah dw

upbeat hare
#

Which we are hotfixing

#

Another success on the release action

#

We really just need a spacedock uploader

north mist
#

all done, Nuget is uploaded as well, so you can just update the reference version to 0.7.2 @desert stirrup

#

(and install the newest version in the game)

north mist
#

well, other than the forums

#

we need to bully nicely ask Dakota to open up the API

upbeat hare
#

Then we can autopost our unformatted markdown :3

north mist
#

lmao

#

I mean

#

then we could use a Markdown to HTML parser

#

and post it directly in HTML which the forum editor uses

upbeat hare
#

Ah true

#

Honestly that would be the dream

north mist
#

ikr

upbeat hare
#

Doing all this work just to automate all the tedium

north mist
#

shouldn't something like this work?

:parts #decoupler_??_radial {...}
upbeat hare
north mist
#

How come?

#

Wait no

upbeat hare
north mist
#

Yeah yeah I got confused

#

So it should work right

#

It doesn't seem to patch anything

upbeat hare
#

Debug logs

#

Builtin:debug has debug-log

north mist
#

Oh cool

#

Will do

upbeat hare
#

You can do like

:parts #decoupler_??_radial {
    $log: debug-log("Found " + $$partName);
}
#

Its how I debugged the engine mode stuff

#

Like 1 min till the game im at starts so really gotta dip

north mist
#

yeah the selector worked, I was just being stupid

upbeat hare
#

@desert stirrup String interpolation is shaping up to be fun

upbeat hare
#

For reference though, in the next updat this will look like

$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"];

@each $visual-part in $visual-parts {
  :parts #"#{$visual-part}" {
      // do stuff
  }
}
desert stirrup
#

As long as you're having fun, that's all that matters 🙂

upbeat hare
#

Just wait until I allow interpolation in functions and variable names (/j)

desert stirrup
#

This part

   #"#{$visual-part}"
upbeat hare
#

"#{...}" -> eval(...).ToString()

#

But yeah its SCSS string interpolatioj

#

I'm not sure how I'd shorten that tbh?
#$visual-part maybe but would I allow $$property there as well?

north mist
#

couldn't we just allow use of variables in selectors as they are?

#
@each $visual-part in $visual-parts {
  :parts $visual-part {
      // do stuff
  }
}
upbeat hare
#

That doesnt work because semantically id have to interpret that as a type not a name

#

So itd have to be #$...

upbeat hare
#

Pinging sinon to update the syntax yet again will be fun

desert stirrup
#

Custom modules, if I define a property like this:
public ModuleProperty<float> MaximumAltitude = new (0, true, val => $"{((float)val/1000):N0} km");
it still won't be read-only, it'll spawn with a slider in Flight scene (the true is for the isReadOnly parameter).
If I place a [KSPState] attribute, it WILL be read-only, but then the value is saved in state/save file, so if I change this value in a future update, it won't be updated in existing saves for existing vessels.
If I place [JsonIgnore] (like IG does in some of their modules) it will also be read-only, but now the property is completely ignored by Patch Manager and it defaults to 0.
If I place [KSPDefinition] it again is NOT read-only.
So the only solution I see is to place [JsonIgnore] and set the value through code. I can grab the config value defined in patch's constants, but the rest of the patch will look "barren". It will just have +Data_OrbitalSurvey {} and that's it. I was hoping to set the values directly with PM.

upbeat hare
desert stirrup
#

Hmm, that's true. I did that yesterday before I found a way to directly set the value for the property. I'll try it that way.

upbeat hare
#

so like

[KSPDefinition]
public float MaximumAltitude;
[JsonIgnore]
public ModuleProperty<float> MaximumAltitudeProperty = new (0, true, val => $"{((float)val/1000):N0} km");

Then copy maximumaltitude into the property

desert stirrup
#

Yeah it works like this. It's ugly, but it works.

desert stirrup
upbeat hare
#

How the fuck

#

Okay

upbeat hare
#

I'm now confused on how if statements ever worked in selection blocks

#

Give me a second

#

ahh nevermind

#

I need to implement the ISelectionAction with each/for/while

hexed yarrow
#

If I patch a part, will it affect parts already added to a vehicle?

upbeat hare
#

It should*

#

It wont change fuel amounts or whatever I dont think but anything labelled KSPDefinition in the decompiled code it will update

hexed yarrow
#

k, thanks!

#

also what is the best source of looking at existing part definitions? I'm using Text Asset Dumper, but not sure if there is anything in game I could be using.

upbeat hare
#

Text asset dumper is your best bet

hexed yarrow
#

great, thanks so much!

upbeat hare
#

@north mist i'm going to make a PR for the interpolation stuff, but maybe I should bang out a spacedock uploader first

#

Honestly, it might be a good idea to integrate the language server stuff into the project somehow

north mist
#

yeah, agree with both

upbeat hare
#

That'll be a later thing

#

I need to actually figure out how to do REST stuff with spacedock

#

I need to make http requests that have cookies

north mist
#

I wouldn't bet on it if it doesn't mention them anywhere on the page

#

you can just use curl tbh

upbeat hare
north mist
#

(but also whyyyyyy SpaceDock)

#

why not send a token

upbeat hare
#

SpaceDock doesn't have API tokens

north mist
#

I know

#

I mean an auth token as a response

#

after you send the login request

north mist
#

curl is one of the more basic tools

upbeat hare
#

Why the fuck does curl return the entire HTML of the site and then the response

#

curl curl

#

ohhh

north mist
#

lmao

upbeat hare
#

wait

#

changelog is wrong

#

other than that though?

#

Fixed that part

north mist
#

it looks good to me

upbeat hare
#

One way to find out if it works then

#

Sorry about the huge update again

#

a lot of it was all necessary for string interpolation

#

the other chunk is actually moving the +/-/* operators to just use operator overloads in the DataValue class

north mist
#

bold of you to assume I'll read every line of it

#

(ngl I actually do, but half the time I barely understand the inner workings of the whole thing so I just quickly scroll through it to see if I can notice any obvious mistakes)

#

lol

upbeat hare
#

Lol fair

#

well I do see one obvious mistake in something so give me a sec

north mist
#

lmao good thing I waited

upbeat hare
#

Fixed

#

This would've been a fun error

#

Anyways you are good to submit your review and then we can test the magical spacedock uploader

#

Need to do some sanitization

#

And to change the game version

#

I'm going to delete the release version and try again

#

Aaaaa wait the nuget repo

north mist
#

hm?

#

it doesn't look to me like you use the version check flag for the uploads so it shouldn't interfere

upbeat hare
#

Doesn't it terminate early if it fails?

north mist
#

does an action fail if its step has an if that's false?

#

I have no clue tbh

#

I was assuming it would just skip the step

upbeat hare
#

Lets try

north mist
#

but maybe not

upbeat hare
#

But the version check has an exit 1

north mist
#

ahhh I didn't notice that

#

why is that if even there then

upbeat hare
#

I'm going to remove the exit 1

north mist
#

yeah

upbeat hare
#

sed 's/@/%40/g' having to use sed is fun

north mist
#

lol

upbeat hare
#

attempt no. 2

#

The changelog definitely needs more sed work

#

The download is correct though

#

@north mist should I bring the same action over to Space Warp?

north mist
#

yeah definitely!

upbeat hare
north mist
#

I'll add it to the template, too, if you don't mind

upbeat hare
#

Go ahead

#

Use the dev branch

#

and do not forget the add mask action

#

Otherwise passwords will be leaked in the logs

north mist
#

of course

upbeat hare
#

I'm going to make some changes in the space warp version that I'm going to backport into the PM version

#

so hang on a second

north mist
#

sure thing, I'll add it later, I'm working on something else rn anyway

upbeat hare
#

going to use the spacedock api to query the latest game version

#

There that should work now

hexed yarrow
#

I see version 0.8.0 on spacedoc, but for some reason CKAN still thinks the current version is 0.7.3, so I can't upgrade using CKAN currently

#

Also on spacedoc it says: "the first test of our automatic uploader for SpaceDock, so if anything is wrong with the download, notify us." ... I wonder if it could be related or if it will clear in a bit

upbeat hare
#

The spacedock download seemed fine

north mist
#

yeah, shouldn't be related

upbeat hare
#

Don't tell me its that netkan thing

hexed yarrow
#

Can you guys see it in CKAN?

north mist
upbeat hare
#
spec_version: v1.34
identifier: PatchManager
$kref: '#/ckan/github/KSP2Community/PatchManager'
$vref: '#/ckan/space-warp'
x_netkan_version_edit:
  find: ^v
  replace: ''
  strict: false
license: MIT
tags:
  - plugin
  - library
depends:
  - name: SpaceWarp
install:
  - find: BepInEx
    install_to: GameRoot
    include_only:
      - patchers
      - plugins
x_netkan_override:
  - version: '0.7.3'
    override:
      ksp_version_max: '0.2.0'
---
spec_version: v1.34
identifier: PatchManager
$kref: '#/ckan/spacedock/3482'
$vref: '#/ckan/space-warp'
license: MIT
tags:
  - plugin
  - library
depends:
  - name: SpaceWarp
install:
  - find: BepInEx
    install_to: GameRoot
    include_only:
      - patchers
      - plugins
north mist
#

don't tell me it's what I said yesterday

#

lmao

#

of course it is

#

that was... not very well thought through on their side?

upbeat hare
#

I think its because we have an unbounded max version of KSP2

north mist
#

oh

#

I get the override now

#

I guess

#

but why was that not an issue until now

upbeat hare
#

Cuz the spacedock API gives a KSP2 version

north mist
#

oh boy

#

time to update the template to have 0.2 as max version then

upbeat hare
#

That's only slightly annoying

north mist
#

SpaceWarp will still load the mods right?

#

(if they're outdated)

upbeat hare
#

@hexed yarrow check now though

north mist
#

just marks them red

upbeat hare
#

yes

hexed yarrow
north mist
#

ok, and the remote supported KSP2 version check makes that easier to deal with

#

without having to update the mods

upbeat hare
#

Yep

north mist
#

yeah this is not as bad as I thought

hexed yarrow
#

Thanks so much!

vagrant kiln
#

i remember that someone posted an example of how to make a list and then loop thru it with the new syntax

#

do u know where that was, i cant find it

#

o here #1115274490490929172 message

north mist
#

I've noticed the wiki says that functions are created with @func, but it seems to actually be @function:

upbeat hare
#

Why did I say that aaaaa

#

Ill fix it when I get on my computer and add string interp reference

upbeat hare
#

Moving here, indexers for variables could be possible to implement, but a helluva pain

north mist
#

it would be nice for the sake of consistency

upbeat hare
#

they are easier for fields, as fields don't have the requirement of being immutable

north mist
#

while for variables you'd have to create a deep copy and modify just the one index, I'm assuming

upbeat hare
#

yep

#

well it only has to be as deep as the index, the immutable requirement allows us to share references like that

north mist
#

I see

#

but yeah, I think that at some point that + the nested indexers would be very nice QoL improvements (especially for non-programmers just trying to patch some stuff) over the nested set and map calls

upbeat hare
#

Question for oyu

#
/* Nothing before this */
$val[x]: 5;

Should this automatically create a dictionary like the following

$val: {
  x: 5
};

@north mist

#

It'd allow you to for example define vectors like the following

$normalized[x]: $vec[x]/$mag;
$normalized[y]: $vec[y]/$mag;
$normalized[z]: $vec[z]/$mag;
north mist
#

yeah that'd be cool

upbeat hare
#

Aight, I'll do this in the update after this next one I'm releasing

#

Speaking of which @north mist can you review my PR (it has zero warnings, and no antlr changes, so its short)

north mist
#

lmao sure

upbeat hare
#

And I'll likely ping you again when I make the Shoemaker PR after I clean that up

#

Now time to test my updated spacedock uploader

#

That didn't go as expected

#

I'm about to just write the stuff to a file, then read it when using curl

upbeat hare
#

We need 200 peoplre using this

torpid panther
#

is-it possible with patchmanager to make condition (IF...) on mod installed ?

#

with 2.5x Kerbolar System, i'd like to reduce my engines thrust like real ones

upbeat hare
#

Yes
Just do a
@require KerbolarUpscale before your patch block

#

But uhh, reducing thrust really only makes sense if you have accurate weights for everything

torpid panther
#

you right Cheese.

torpid panther
#

Hy. I will modify some part parameters. When players will update my mod, is patchmanager cache automaticly refresh ?

north mist
#

yes, it refreshes when any mod version changes

torpid panther
#

great job !!!

#

thanks munix

north mist
#

we need to get on those levels

stiff crater
# north mist

To really achieve feature parity with KSP1 we need loading time parity klueless

north mist
#

I mean, we really have no clue how much PM will affect the loading

#

we'd need to get to substantially higher part and patch counts to do proper benchmarks

stiff crater
#

Does PM compute the patches in a multi-threaded way? (like 1 thread per label or something like that)

north mist
#

not afaik

upbeat hare
#

Idk if unity would like that

north mist
#

it would be more complicated than just dividing them by labels

stiff crater
#

Ah it would have to take into account the dependency graph for patches too, might make it a bit complicated (but parallel scheduling of dependent task is an active research field with some nice results)

north mist
#

since patches can depend on each other's stages

upbeat hare
#

Actually dividing by label would make more sense

#

As there is no mechanism to transfer information from one label to another

north mist
#

what about things like configs?

#

those can theoretically be used in multiple labels, right?

upbeat hare
#

Yes theoretically
I havent implemented them yet for that yet

#

The current system runs each label one after another

stiff crater
#

Couldn't configs handled by some kind of "pre-processor" before the actrual computing?

upbeat hare
#

Not at the same time

upbeat hare
#

But unless I do 2 read stages, one for configs and one for the actual patches, there isnt really a way to transfer data between labels

upbeat hare
north mist
#

merged

upbeat hare
#

lets hope this works

#

going to try again

#

@north mist

north mist
#

woo

upbeat hare
#

wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[0].body' > ./changelog.md
You have to write the changelog into a file like this

#
- name: Update spacedock
  uses: KSP2Community/[email protected]
  with:
    username: ${{ secrets.SPACEDOCK_USER }}
    password: ${{ secrets.SPACEDOCK_PASSWORD }}
    game_id: 22407
    mod_id: 3482
    version: ${{ env.version }}
    zipball: ${{ env.zip }}
    changelog: ./changelog.md

Then pass it like this

north mist
#

awesome

upbeat hare
#

note that the update spacedock action ... requires jq to already be installed

upbeat hare
hexed yarrow
#

Do you need to do anything special when using a name selector with a dash? For example, what about the following selector:

:parts #adapter_4v_3v-4v {

This doesn't seem to work, and I suspect the dash between 3v and the second 4v.

north mist
#

I'm pretty sure it should work

#

@upbeat hare ?

upbeat hare
#

wrap it in quotes

north mist
#

forgot about that part

upbeat hare
#

:parts #"adapter_4v_3v-4v" {

#

Premonition works with patch manager

north mist
#

awesome

upbeat hare
#

Time to test it with shoemaker

#
[PremonitionAssembly("Assembly-CSharp")]
[PremonitionType("KSP.Assets.AssetProvider")]
internal static class AssetProviderPatch
{
    [PremonitionMethod("LoadByLabel")]
    [PremonitionTrampoline]
    [UsedImplicitly]
    public static void LoadByLabel<T>(
        string label,
        Action<T> assetLoadCallback,
        Action<IList<T>> resultCallback = null
    ) where T : UnityObject
    {
        if (AssetProvider.IsComponent(typeof(T)))
        {
            Debug.LogError("AssetProvider cannot load components/monobehaviours in batch.");
            return;
        }

        LoadPatchedAssetsAsync(label, assetLoadCallback).Completed += results =>
        {
            if (results.Status == AsyncOperationStatus.Succeeded)
            {
                resultCallback?.Invoke(results.Result);
                return;
            }

            Debug.LogError("AssetProvider unable to find assets with label '" + label + "'.");
            resultCallback?.Invoke(null);
            Addressables.Release((AsyncOperationHandle)results);
        };
    }

    private static AsyncOperationHandle<IList<T>> LoadPatchedAssetsAsync<T>(
        string key,
        Action<T> assetLoadCallback
    ) => Locators.LocateAll(key, out var patchedLocations)
        ? Addressables.LoadAssetsAsync(patchedLocations, assetLoadCallback)
        : GameManager.Instance.Assets.LoadAssetsAsync(key, assetLoadCallback);
}

By the way this is the entirety of our preload patching code now

#

I thought I had [MeansImplicitUse] labels on the attributes

#

I'll fix that by actual release time

north mist
#

oh wow I love that

#

what exactly does trampoline mean btw?

#

is that just for a complete replacement?

upbeat hare
#

Yes

#

I call it a trampoline because it just replaces the method body with a call to your method

north mist
#

I see

#

this is going to make patching soooo much easier

#

god

upbeat hare
#

It only involved a descent into madness on my part

north mist
#

I'm almost too scared to look at the source

#

lmao

upbeat hare
#

I really need to clean it up yet more

#

But go ... take a look

#

Premonition.Core is where the magic happens

upbeat hare
north mist
#

👍

upbeat hare
#

My plans for the next release are nested indexers with implicit dictionary/list creation, and custom "types" that can also have their own operator overloads

#

The latter is actually such that someone can say ... convert a Vector3 into PM and have it add/subtract correctly with a library

#

adding member functions to such, may be more of a pain but yeah

#

because I think I'd want to implicitly add them to the global namespace with the fully qualified type name thingamajiggy

#

but I suppose I could also just add them to the data structures

upbeat hare
#

@north mist can you confirm CKAN is not showing PM 0.9.3?

north mist
#

yeah it isn't

#

up now

north mist
#

we might want to add a loc term for "VAB/Messages/PartNotAvailable" here

#

it's not in the stock game yet, but it shows up when a missing part cannot be loaded in VAB (which is made possible by Patch Manager)

upbeat hare
#

Good idea

brazen oyster
#

Is it possible to add through PatchManager a new KSPDefinition on an existing partModule?

My need is to add a property IsRelay to Data_Transmitter, so that I can distinguish between antennas & relays.

Technically I can do it anyway adding a new Module, but I'm not sure it's better

north mist
#

not just by using patches

#

you'd need to Harmony patch the methods where the JSON gets deserialized, and then read that newly added property into some data storage of your own

#

since the Data_Transmitter class just doesn't have the property, it won't be deserialized automatically

#

I honestly think that a PM patch that removes all antenna modules from all parts and then adds a custom module would be more suitable for your use

brazen oyster
#

it's the same even if it's a definition? it's not something that should be saved (like the state)

brazen oyster
north mist
#

like I said, the class doesn't contain the property

#

so there's no way for Newtonsoft.Json to somehow save it into an object of the class

brazen oyster
#

Sure, seems right

#

I still have to dig down into the parts modding

north mist
#

welcome to the club of patching part modules, we hate it here

brazen oyster
#

hahaha

#

so much fun!

brazen oyster
desert stirrup
#

My use case was that I wanted certain values that are defined by a part to be displayed as static values (like field of view, min altitude, etc.) but the game kept creating them as sliders that players can change. They were really readonly only one I placed a [KSPState] attribute, but that woule mean that the value is written to the save game file and I didn't want to do that in case I wanted to change those values in another version. [JsonIgnore] was also an option, but that of course can't work with PM that parses jsons.

brazen oyster
#

So technically if you don't want to show the value it's not an issue, right? I'll probably will, just to be sure

desert stirrup
#

If you don't want to show the value then it doesn't need to be a ModuleProperty, so yeah, not an issue then

brazen oyster
#

Thank you @desert stirrup !

brazen oyster
#

I suppose the KSP Patch Manager extension for VSCode is not updated right?

upbeat hare
#

Not entirely...

#

It needs to be

#

But since the person who maintains it is barely active, its a lot of effort

brazen oyster
#

Gotcha

#

would it be possible to make a fork on GitHub like on KSP2Community? Would make it a bit easier to contribute

north mist
#

it definitely would

#

but Sinon insisted on keeping it on his private Git server for some reason

#

plus he's the author on the VS Code marketplace

#

so I don't think we can publish updates without him anyway

brazen oyster
#

this is for sure right

#

would it be possible in the meantime to keep the syntax highlight while disabling the language server?

brazen oyster
upbeat hare
#

Gotcha

#

You coulda done MIT for just the grammar, but GPL works here ig

#

Wait im being dumb am i

brazen oyster
upbeat hare
#

Grammar as in the textmate grammar

brazen oyster
#

oh yes

upbeat hare
#

Not the antlr grammar that is pulled from PM

brazen oyster
#

exactly

#

just syntax highlighting

brazen oyster
#

So, I'm trying to add some custom modules, howver I'd like to do this using stages

I'm currently doing it like this:

@use 'relay_mixins';
@use 'constants';

@stage 'CommNext:setup-relays';

:parts #antenna_0v_dish_ra-2 {
    @include override-range($commnext-RANGE-RA2);

    +Module_NextRelay {
        +Data_NextRelay {
            
        }
    }
    @include add-next-relay-visuals();
}

With the stage defined as

@define-stage "CommNext:setup-relays":
{
    @before "falki.orbital_survey";
};

However PM logs say:

line 4:30 extraneous input ';' expecting {'@require', '@stage', '@new', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
[Error  :Patch Manager] error parsing CommNext:relay_module.patch - 4:30: extraneous input ';' expecting {'@require', '@stage', '@new', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
line 7:48 mismatched input ';' expecting '}'
[Error  :Patch Manager] error parsing CommNext:relay_module.patch - 7:48: mismatched input ';' expecting '}'
line 14:4 extraneous input '@include' expecting {<EOF>, '@use', '@function', '@if', '@mixin', '@while', '@for', '@each', '@require', '@stage', '@define-stage', '@patch', '@new', '@create-config', '@update-config', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, VARIABLE, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
[Error  :Patch Manager] error parsing CommNext:relay_module.patch - 14:4: extraneous input '@include' expecting {<EOF>, '@use', '@function', '@if', '@mixin', '@while', '@for', '@each', '@require', '@stage', '@define-stage', '@patch', '@new', '@create-config', '@update-config', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, VARIABLE, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
line 14:36 mismatched input ')' expecting {'(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, RULESET, ELEMENT}
#

Could somebody help me understanding the errors?

#

I tried different combinations but I'm losing my head, plus I didn't find mods with staging in use

#

(these are the mixins by the way)

upbeat hare
#

it applies to the selection block, and the semicolon there can be conceptually thought of as separating the two

brazen oyster
#

oh ok

#

so I need the stage for each selection?

#

if I need to patch 3 different parts for example

upbeat hare
#

for each top level selection

#

yes

brazen oyster
#

thanks, going to try

upbeat hare
#

also

#

you are the first person I've seen using mixins

brazen oyster
#

oh!

upbeat hare
#

well other than me

brazen oyster
#

I love composability 😄

upbeat hare
#

i forgot I used a few

north mist
#

composition > inheritance

brazen oyster
#

plus DRY

upbeat hare
#
@mixin scale-curve-time($factor:$atmo-rescale-factor) {
    * > fCurve {
        m_Curve: $value:map(mult-time-by($factor));
    }
}

A mixin I wrote for scaling float curves

#

Where

@function mult-time-by($factor:$atmo-rescale-factor) {
    @return @function($curve-step) {
        @return $curve-step:set(time,$curve-step[time] * $factor);
    };
}
brazen oyster
#

Higher order functions

#

gosh

north mist
#

we should write a kernel in Patch Manager

brazen oyster
#

hahaha

#

Kinux

upbeat hare
brazen oyster
#

I love it

#

oh well, I'd love it more if I could get my patches working correctly, but you know

#
[Message:Patch Manager] Loading patch CommNext:relay_module.patch
line 6:48 mismatched input ';' expecting '}'
[Error  :Patch Manager] error parsing CommNext:relay_module.patch - 6:48: mismatched input ';' expecting '}'
line 13:4 extraneous input '@include' expecting {<EOF>, '@use', '@function', '@if', '@mixin', '@while', '@for', '@each', '@require', '@stage', '@define-stage', '@patch', '@new', '@create-config', '@update-config', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, VARIABLE, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
[Error  :Patch Manager] error parsing CommNext:relay_module.patch - 13:4: extraneous input '@include' expecting {<EOF>, '@use', '@function', '@if', '@mixin', '@while', '@for', '@each', '@require', '@stage', '@define-stage', '@patch', '@new', '@create-config', '@update-config', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, VARIABLE, RULESET, ENSURE, STRING_ENSURE, ELEMENT}
line 13:36 mismatched input ')' expecting {'(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, RULESET, ELEMENT}

I'm definitely doing something wrong here

@use 'relay_mixins';
@use 'constants';

@stage "CommNext:setup-relays"
:parts #antenna_0v_dish_ra-2 {
    @include override-range($commnext-RANGE-RA2);

    +Module_NextRelay {
        +Data_NextRelay {
            
        }
    }
    @include add-next-relay-visuals();
}
upbeat hare
#

I'll likely change that

#
* > atmospherePressureCurve {
    @include scale-curve-time()
}
* > BodyAltitudeTemperatureCurve {
    @include scale-curve-time()
}
* > BodyAltitudeSurfaceFluxCurve {
    @include scale-curve-time()
}
* > BodyAltitudeRelativeHumidityCurve {
    @include scale-curve-time()
}
#

like this I mean

brazen oyster
#

ahn, gotcha

#
[Error  :Patch Manager] Could not run patch: CommNext:stages.patch due to: Object reference not set to an instance of an object

Ok, progress!

upbeat hare
#

that's uhhh huh?

brazen oyster
#
@define-stage "CommNext:setup-relays":
{
    @before "falki.orbital_survey";
};
#

maybe the name?

upbeat hare
#

shouldn't be?

upbeat hare
brazen oyster
#

Let me see

upbeat hare
brazen oyster
#

Ah DAMN

#

I didn't put in patches/

#

but in patches/configs/

upbeat hare
#

that shouldn't matter

brazen oyster
#

oh ok

#

Plus now that I'm seeing the docs.. the stage would be executed only if there is OrbitalSurvey installed; I just wanted to order it before, so maybe I'm taking the wrong path

upbeat hare
#

the stage will execute before orbital survey if it is installed

#

but it will always execute

brazen oyster
#

Ha! Ok I misread the "it is ignored" here:

or @before "stage-name"; which forces this stage to run before the defined stage, if said stage is defined, otherwise it is ignored.
So the last sentence is referring to the "@before" condition, not to the stage, correct?

upbeat hare
#

yes

brazen oyster
#

ok, so well that would be exactly what I'd like to have 😄

#

I really don't get the error here

upbeat hare
#

ohhhhhhh

#

No

#

that's a bug

brazen oyster
#

ah, damned bugs

upbeat hare
#

wait no, is it?

#

it is

#

@munix I have a PR for you to review

brazen oyster
#

Woah

#

fast

#

❤️

upbeat hare
#

I forgot to actually uhh parse the @after/@before stuff

#

@brazen oyster new version should be released asap

#

give it like a minute or 2

brazen oyster
#

I'll test is asap! Thanks

brazen oyster
#

Ok, version installed! Just a question:

:parts .Module_DataTransmitter.Module_CommandPod

is this correct to choose parts which have both classes?

upbeat hare
#

Add a space

#

PM differs from (S)CSS where a . splits stuff in those, but PM treats it as part of the full name

#

so :parts .Module_DataTransmitter .Module_CommandPod

brazen oyster
#

ok!

#

so instead if I want "any of the two"

#

that would be :parts .Module_DataTransmitter , .Module_CommandPod

#

?

upbeat hare
#

:parts (.Module_DataTransmitter, .Module_CommandPod)

brazen oyster
#

gotcha

#

and when I see something like that (KLSS):

:parts ~#eva_kerbal ~#lab_2v_science_orbital ~#lab_2v_science_marine ~.Module_ResourceCapacities

It's everything that doesn't match any?

upbeat hare
#

Yep

brazen oyster
#

amazing, thanks

#

let see if 0.9.4 did it!

#

Worked perfectly! As you can see "Relay" is on the left since it has been loaded before Orbital Survey

#

I think this is.. the first ordering in KSP2 modding?

upbeat hare
#

Likely

brazen oyster
#

We'll remember this day when @after "falki.orbital_survey:zzzLoading" will come in year 2043

north mist
brazen oyster
#

Ok, now I just need to find out why CommunicationRange is not being modified.. damn

#
:parts #antenna_0v_dish_ra-2 {
    Module_DataTransmitter {
        Data_Transmitter {
            CommunicationRange: $commnext-RANGE-RA2;
        }
    }

It was too good to be true 😄

#

Ok, I think a need some help here.. sorry to bother you ;_;

  • selectors should be working correctly, since Relay is being added
  • I removed any mixin or constant, in order to do a clean test but "Max Range" remains the same
  • CommunicationRange is the property I'd like to override; it's a KSPDefinition , I checked and it's the variable used in the OAB Info panel
desert stirrup
#

You've checked parts_data.zip in PM's cache and the range isn't changed? Do the logs say that the patch is applied?

north mist
#

I can't say for sure because honestly a lot of the grammar is still a mystery to me due to the differences between it and SCSS (which I'm just used to more), but I think if you want to split and nest the selectors like this, it should look like:

:parts #antenna_0v_dish_ra-2 {
    * > Module_DataTransmitter {
        * > Data_Transmitter {
            CommunicationRange: $commnext-RANGE-RA2;
        }
    }
}
upbeat hare
#

That would be more accurate yes

brazen oyster
#

But I am a bit lost about Modules

#

since in the JSON there are only the serializedPartModules

#

Like that

north mist
#

or, you can just one-line it like

:parts #antenna_0v_dish_ra-2 > Module_DataTransmitter > Data_Transmitter {
    CommunicationRange: $commnext-RANGE-RA2;
}
#

(I think)

north mist
#

it's simplified for parts

#

so that you only need Module_XYZ to select a module of a part

#

and then from there you can select the Data_XYZ object

#

if you wanted to edit the pure JSON, you'd use the :json ruleset

brazen oyster
#

Makes sense, let me double check the PM cache and this "*" trick

north mist
#

but all the customized rulesets like :parts, :resources, and all the other undocumented ones do apply some transformations to make patching easier

brazen oyster
#

ok, in PM cache there is the next relay but CommunicationRange hasn't been modified

#

let's see with * selector

#

it worked!

#

Just to confirm this: both * > are needed

#

I'm writing it here since I'll forget that for sure

upbeat hare
#

@brazen oyster you are the one maintaining the syntax highlighting now?
I'm about to be making some additions to the syntax to make nested indexers possible, and with variables too (even creating dictionaries/lists when I need to)

brazen oyster
#

I could try to test it with new changes, sure

upbeat hare
#

@north mist thoughts on me removing how indexers currently work, I don't think I see anyone actually using the very convoluted way that they work

north mist
#

by indexers you mean stuff like this?

#selector {
    property[0][1]: "value";
}
upbeat hare
#

yeah

#

They work in a very convoluted way, that makes nesting them impossible

#

like you can select by class and stuff

#

Like on parts

... {
  serializedPartModules[.Module_Engine]: ...
}

Is possible

#

But like

#

holy crap I think its too convoluted for what it should be

#

Though what would be kind of cool is a

#selector {
  property[*][1]: "Value";
}
#

And that would be very easy to translate between variables and fields

north mist
#

I mean I feel like the other way (using nested set calls) is way more convoluted for the end users

#

but if you feel like the indexers are bad, then I guess remove them

upbeat hare
#

Noy

#

you forget what I mean

#

or rather misunderstand

#

I meant the way they currently work

#

I want to simplify them so they work how one would expect naturally, just indexing into the data object

#

rather than the stupid abstractions I have over them

north mist
#

ah

#

that makes sense

upbeat hare
#

b/c it makes stuff like nesting impossible with the current system

#

And I can implement syntactic sugar for map calls for example with this newer system

north mist
#

yeah that would be nice

upbeat hare
#

Yeah, you get what I mean now?

upbeat hare
#

Now that I'm home

#

I can fully implement this

upbeat hare
#

I think I want to add a syntactic sugar for filtering too, idk

$variable[(expresssion)?] *: 5; // Do a selected map
$variable ?: $value > 3; // Select all that is greater than three 
#

something like those 2

#

but hmmmmm

#

seems a bit too complex

#

I'm gonna just stick with the simple map expression

#

as

BodyAltitudeRelativeHumidityCurve[*][fCurve][m_Curve] *: $atmo-rescale-factor

Is inherently understandable, I think

upbeat hare
#

But rn

#

I'm trying to think of the logic such that

$x[1][2][3]: 5

Will automatically define $x as a list of lists of lists

#

mostly so that you can do the following

#
{
  $x[0]: /* Some long expression */;
  $x[1]: /* Some long expression */;
  $x[2]: /* Some long expression */;
}

If you really need to

upbeat hare
#

I think I know the logic I'm going to do for it

#

Recursion is "fun"

upbeat hare
#
@mixin scale-curve-time($factor:$atmo-rescale-factor) {
    * > fCurve {
        m_Curve[*][time] *: $factor;
    }
}

Gonna test in my kerbolar upscale mod by changing the curve scaling mixin to this

#

What do y'all think

#
          {
            "serializedVersion": "3",
            "time": 85567.46949355134,
            "value": 0.0,
            "inSlope": 0.0,
            "outSlope": 0.0,
            "tangentMode": 0,
            "weightedMode": 0,
            "inWeight": 0.0,
            "outWeight": 0.0
          }

With the patch

#
          {
            "serializedVersion": "3",
            "time": 70000.0,
            "value": 0.0,
            "inSlope": 0.0,
            "outSlope": 0.0,
            "tangentMode": 0,
            "weightedMode": 0,
            "inWeight": 0.0,
            "outWeight": 0.0
          }

Without

#

Hey, so I think my new syntax worked :3

north mist
#

nice

upbeat hare
#

yee
Hmm, I think it's quite an inuitive way to do a map selection, right?

north mist
#

yeah, much better than the nested function calls

upbeat hare
#

Yeah, and using functional programming in general for $value:map(...)

north mist
#

it's nice to have the full power of the language available, but it's also nice to have these shorthands

upbeat hare
#

Yeah, and this case is definitely a more common one that needed a shorthand

#

anyways, let me do some stuff, and update the documentation on indexers

#

and I shall make a PR for 0.10.0

#

Stuff being forum actions and discord webhook

north mist
#

sounds good

upbeat hare
#

Writerside apparently supports pdf export now

north mist
#

oh nice

upbeat hare
#

Alright @north mist PR made

#

I'm also thinking for the future, making a special type called a LazyConfig, which is instead what is returned from get-config that has a :resolve method, but is also automatically called when not in the global context, and being assigned to anything

#

Just to make configs easier to work with

north mist
#

was this intentional?

#

it doesn't seem to be used in the modified code

#

in PartModifiable.cs

upbeat hare
#

Rider likely said hello

north mist
#

lmao yeah

#

I was asking because I've had it happen multiple times

#

alright, done

upbeat hare
#

@brazen oyster whatever markdown your converter is using doesn't suppport code blocks nested in lists it doesn't seem?

#
<h2 id="release-v0100">Release v0.10.0</h2>
<p>This release changes how indexers work, it adds support for the following types of indexers</p>
<ol>
<li>Indexers in variable declarations</li>
</ol>
<pre><code>$x[5]: 3;
</code></pre>
<ol start="2">
<li>Nested indexers</li>
</ol>
<pre><code>$x[1][2]: 3;
</code></pre>
<ol start="3">
<li>Mapping indexers</li>
</ol>
<pre><code>$x[*] *: 5; // multiplies all values in $x by 5
</code></pre>
<ol start="4">
<li>Defining new lists and such using indexers</li>
</ol>
<pre><code>$y[0]: 3; // Creates $y as a list with its first element being 3
</code></pre>
<p><a href="https://spacedock.info/mod/3482/Patch%20Manager">Download on SpaceDock</a></p>

This is what it spat out

#

Release v0.10.0

This release changes how indexers work, it adds support for the following types of indexers

  1. Indexers in variable declarations
$x[5]: 3;
  1. Nested indexers
$x[1][2]: 3;
  1. Mapping indexers
$x[*] *: 5; // multiplies all values in $x by 5
  1. Defining new lists and such using indexers
$y[0]: 3; // Creates $y as a list with its first element being 3
Test
#

Like see how discord supports it

north mist
#

like it's not great, but it should work

upbeat hare
#

Yeah

#

but it's not what I was expecting aaa

north mist
#

the biggest issue is the forums styling

#

not the HTML itself

upbeat hare
#

Ahh

#

yeah

#

the forum puts classes on codeblocks

#

Your converter spits them out as unclassed pre blocks

north mist
#

that kinda makes me wonder what all could be put into the HTML there 👀

upbeat hare
#

This is what your converter does

#

Compared to the html generated by the forums

north mist
upbeat hare
#

Dewit

north mist
#

wow

#

this brings me back like 15 years

upbeat hare
#

Now I want to see you make a post with it

north mist
#

ngl I would if I weren't too lazy to set it up

north mist
#

just tested, PM breaks both KLSS and CommNext @upbeat hare

#

Attempting to add a value of type: None and a value of type: List which is not allowed

#

for both

upbeat hare
#

What

north mist
upbeat hare
#

Ah, shit, I think I know where that might be

#

This is on the part

#

@north mist

#

Im gonna tell you the fix

#

Give me a second

#

Alright

#

Before it says return null

#

There needs to be a check to see if the field is in the jobject

#

Something like

if (jObject.ContainsKey(fieldName)) return DataValue.FromJToken(jObject[fieldName]);
#

Can you add that rq

#

And force out a release

north mist
#

I assume this should do the job

upbeat hare
#

Yes

#

You can go ahead and do the release with whatever notes you wish

north mist
#

yeah that's better

upbeat hare
#

Alright, ideas for a 0.11.0 update

#

Mixin blocks for sure

#

and a god damn error counter ffs

#

I hate having to look in the logs to find if an error occured

north mist
#

lmao yes that would be helpful

upbeat hare
#

@north mist PR for you to review

north mist
#

are you keeping the @mixin-block syntax?

#

I see it's still in the grammar

upbeat hare
#

ah, wait, no

#

thanks for catching that

upbeat hare
north mist
#

awesome

#

approved

upbeat hare
#

I think at this point we need to start thinking about what is necessary for a 1.0.0 release

#

Cuz I think we are getting close to that

#

Does anyone who uses pm have any gripes or suggestions for stuff that you would want in before a 1.0 release?

north mist
#

I do wish we could somewhat simplify/unify some of the syntax

#

there are some specific things I was thinking about earlier

#

I'll need to find it

upbeat hare
#

Gotcha

upbeat hare
#

Oh before 1.0.0 I want to fix the ensure element selector

#

because rn it acts as

#
:parts {
  @if ($$serializedPartModules:contains("...") {
    // Do nothing
  } @else {
    +... {
      // Do stuff
    }
  }
}

When it should work as

:parts {
  @if ($$serializedPartModules:contains("...") {
    * > ... {
      // Do stuff
    }
  } @else {
    +... {
      // Do stuff
    }
  }
}
upbeat hare
#

Other ideas
I still want a kind of lazy get config that resolves after patches start or something, idk, because the only example of config usage is incorrect, as it reads the configs in the pre-patching period, instead of during the patch

#

And I suppose maybe some form of "resolve" operator there

north mist
#

one thing that I kinda wish we could get rid of are the compulsory asterisks

upbeat hare
#

I wish that too, but I had parsing issues when trying to not have them

#

Like I'd love an implicit asterisk before a > when at the start of a selector, but that was aaaaaaaaaaaa

north mist
#

these should ideally be identical

:parts #generator_0v_thermoelectric_radioisotope > Module_Generator > Data_ModuleGenerator {
    ResourceSetting[Rate] : 1234;
}
:parts #generator_0v_thermoelectric_radioisotope
    > Module_Generator
        > Data_ModuleGenerator {
            ResourceSetting[Rate] : 1234;
        }
    }
}
north mist
upbeat hare
#

I could try to look into it again

north mist
upbeat hare
#

SCSS works basically by concatenating selectors

#

I can't really do that here for many reasons

north mist
#
div {
  .my-class {}
}

is equivalent to

div {
  & .my-class {}
}

which is just

div .my-class {}
#

so maybe we could at least use the ampersand to be more consistent

#

similarly in SCSS you can use

div {
  &.my-class {}
}

to say

div.my-class {}
upbeat hare
#

idk?

#

tbh, I'd prefer just to deal with an implicit *
I don't even know what & means

north mist
#

idk, it depends on how far we want get away from CSS

upbeat hare
#

also the second example with no space, wouldn't work as well as that would be parsed as "div.my-class"

#

not "div"".my-class"

north mist
#

because * only really makes sense as a wildcard, like * div selects all divs that are not the root

upbeat hare
#

Then we do have a semantic difference here

north mist
upbeat hare
#

Yeah, no, theres no point of having * act like that

north mist
#

yeah, sure

#

what I mean is that if we're trying to capitalize on the familiarity of the language, it shouldn't use the same syntax for very different concepts

upbeat hare
#

I mean hmmm, but I was capitalizing on the simplicity rather than the full familiarity.

#

* makes more sense in the contexts where it is used, and someone who has minimal code knowledge will understand it to mean everything like that

north mist
#

I mean, sure, but in this specific instance, replacing * with & doesn't add any complexity, and adds to the familiarity

north mist
upbeat hare
#

I mean sure, but also consider that * can also just be thought of as the wildcard part of an identifier by itself

#

recall we have #xyz* and xyz* as both valid IIRC

#

* has the same meaning as #* basically

#

but the latter doesn't parse

north mist
#

huh

#

now I'm confused

upbeat hare
#

I'm saying there are other places where * is used

north mist
#

I mean

:parts #generator_0v_thermoelectric_radioisotope {
    #* > Module_Generator
        #* > Data_ModuleGenerator {
            ResourceSetting[Rate] : 1234;
        }
    }
}
#

this wouldn't make any sense even if it could parse

upbeat hare
#

Yes it would

:parts #generator_0v_thermoelectric_radioisotope
    #"*" > Module_Generator
        #"*" > Data_ModuleGenerator {
            ResourceSetting[Rate] : 1234;
        }
    }
}

Try this right now, I assure you it would work

north mist
#

why

#

how

#

I think I have a fundamental misunderstanding of how selectors work at all tbh

upbeat hare
#

because in names, * is a wildcard

#

it's too different things ending in the same result

#

I'm just trying to show another path to conceptualize what * means here

north mist
#

like seeing that, it basically reads to me like: using the parts ruleset, select the object with the ID/name of "generator_0v_thermoelectric_radioisotope", then select all its children with any name/id, select their direct children of the element/object type "Module_Generator", select all its children with any name/id, and select all their direct children of the element/object type "Data_ModuleGenerator"

upbeat hare
#

it means:
Using the parts ruleset, select all objects that match the name of "generator_0v_thermoelectric_radioisotope" and match any name, then select their direct children that match the element "Module_Generator" and any name, then select their direct children that match the element "Data_Module_Generator"

#

A space/a new block is an implicit and

north mist
#

lol I think I'm just forever going to struggle with PM

#

simply for the reason that I've been used to CSS/SCSS for like the past 15 years and now the same syntax and symbols mean completely different things

#

I understand that it's not always possible to make them match 100% but still

#

it's quite difficult for me to grasp/get used to

upbeat hare
#

Yeah, that's fair, It's like hearing a language that's very similar to your own but still hard to understand parts of if I had to guess?

north mist
#

well, more like hearing someone speak using words you know, but in (partially) nonsensical sentences

#

lmao

upbeat hare
#

But anyways, I will try to remove the * needed at the start of stuff

#

it annoys me too

north mist
#

I'm just worried that the further away we get from the "blueprint" of SCSS, the more confusing it will be to anyone who has any web development (or even USS) knowledge

upbeat hare
#

the hard part is that I have to parse

> x > y > z

as

(* > x) > y > z

And not

* > (x > y > z)

Or something like that

#

because the latter makes ... no sense

north mist
#

shouldn't the > operator be associative?

upbeat hare
#

Yes, the issue is the associativity when parsing that, thats what caused me to not do it at first

north mist
#

oh btw

#
:parts {
    @if $$crewCapacity > 0 {
        * > resourceContainers > .ElectricCharge { @delete; }
    }
}

this thing was really weird

#

that's what I couldn't remember earlier

#

the dot before the EC selector

upbeat hare
#

Because I made the containers classes contain the container type, which was a poor choice I made early on

#

It annoys me too

#

Dw

north mist
#

if I understand the intent of the class selector in PM, usually it should basically just mean ".x = filter the preceeding selector based on whether the element contains x", rather than actually selecting x, right?

upbeat hare
#

Yes basically

#

I guess the best way to put this though is each selector works on a list of selectables > ... for example takes all the selectables from its righthand side, gets all their children and filters it through ...

#

So when itd doing * > .ElectricCharge it takes everything in its input list, gets their children and filters all that contain electric charge to the result

#

But id normally use an element type in this case

#

I can see where this would be confusing

#

I should make a writeup about how all the internals actually work

north mist
#

oh by the way, I know we've definitely discussed this before, but what was the reason for changing the "and" syntax from <selector1><selector2> to <selector1> <selector2>?

upbeat hare
#

And its easier to read that way

north mist
#

ah yeah, that's what I thought

upbeat hare
#

When I look at a.b.c i see it as one unit, when I see a .b .c i see it as separate

north mist
#

I mean

#

it kinda is that though

#

a.b.c is a single element matching all three selectors, a .b .c is a sequence of 3 elements

upbeat hare
#

I suppose
But a lot of the functions like :set are defined as list.set, string.set, dictionary.set

north mist
#

I know you definitely won't like it, but if we wanted to, we could just force names that contain special characters like ~, . and # to be quoted, since that's now a thing in selectors

#

and we could use the usual syntax

upbeat hare
#

Well ~ and # already require being quoted

north mist
#

then that would make even more sense for .

upbeat hare
#

It would force the need to allow function names to be strings

north mist
#

but the grammars for the selectors themselves, and for the selector bodies should be nearly completely separate, no?

#

you can't call a function inside a selector, can you?

upbeat hare
#

No, but the tokenization process happens before parsing

north mist
#

is there no way to get around that with modes?

upbeat hare
#

No not easily

#

The grammar is in 2 files, there is nothing other than tokenization in the lexer grammar, there is no way for it to know if its a selector or a function name

north mist
#

I mean, looking at SCSS, they also use functions with dots:

upbeat hare
#

I see...

#

Ill think on this

north mist
#

I mean I can definitely understand not wanting to make major changes to the base syntax at this point

#

but also I feel like this is the time to do it, if we ever were to

#

before we put out a stable release

upbeat hare
#

I'm just trying to figure out a justification for it other than its like scss

#

Because parsing wise stuff will be a bit of a pain

#

As I said, I shall think on it

north mist
#

my other grievance with PM is the ambiguous @ syntax

#

sometimes it's used as a decorator/attribute/annotation, and other times it's a statement terminated with ;

#

I mean that by itself is not the worst thing, SCSS does something similar

upbeat hare
#

it's meant to just reserve keywords without breaking things

north mist
#

but it always at least applies to an explicit scope, like a function definition

#

I feel like something like this would be a bit clearer/more consistent maybe?

@new ResourceName {
  :resources {
    // ...
  }
}
upbeat hare
#

That doesn't work if it has more than one argument

#
@new("label","name")
:json {
  // ...
}

For example

north mist
#

I kinda feel like that inconsistency makes it even worse

#

the fact that the "call" is sometimes @new(label, name) and sometimes @new(name)

#

based on what's inside the "body"

upbeat hare
#

Well in this case :json will always be the first thing

upbeat hare
north mist
#

which I feel like is the issue, considering the ruleset is only specified after the parameters

#

I would probably prefer something more like @new json(label, name) and @new resources(name)

upbeat hare
#

I suppose that's ... possible

#

but aaaaaaaaaaa

north mist
#

I'm just basically thinking out loud

#

you don't have to take me seriously

upbeat hare
#

It's not that bad of a change, but I'm trying to think of how I would implement it

north mist
#

I'm just trying to identify the biggest inconsistencies/pain points from my perspective

#

but others might not consider those an issue at all

#

for all I know

#

we should hold like a "public forum" on the PM syntax

#

lmao

#

to get some more opinions

upbeat hare
#

Yeah

north mist
#

especially from people who actually use it

#

and from some non-experienced users

#

like on the KSP forums

upbeat hare
#

True, but who wants to write that up

#

remember the space warp 2.0 post

north mist
#

fucking hell

#

yeah I do

#

🥲

north mist
#

I have a question

#

I'm a bit confused about the missions ruleset

#

looking at this patch

#

it seems like it expects you can only have one condition of a type as part of a set

#

how would I select the n-th condition in a set?

upbeat hare
#

You are supposed to use conditonals to figure out the one you want

#

That selects all property conditions

north mist
#

oh, right

#

yeah that makes sense

upbeat hare
#

@north mist my investigation has led me to another few hints for you, i'll write them up later

#

One thing is how the model is set here

#

which that model gets passed to viewPrefabAssetKey

#

which if you go through that route, by postfix patching that method

#

the colors patch will automatically be applied

#

but this is only for the space simulation

#

I need to look at the same but for the OAB

#

and then if you like trampoline patch or something this method

#

And this method

#

these methods are the ones you want to replace or patch for switching out the prefab

#

If you target these places, the colors patch will automatically be applied

north mist
#

do you think this will work?

#

for now, at least

upbeat hare
#

Uhh no
Because commas will have to be replaced with semicolons on the first level down, and then a semicolon at the end

#

If you use a @set-value tho

#

It should work

north mist
#

ah yeah that's what I forgot

#
`@new(missions, ${missionData.ID})\n:json {\n@set-value ${data};}`
#

like so?

upbeat hare
#

Should, let me check
Did you read the messages I sent earlier btw? About the possible target points for prefabs

north mist
#

tbh I just skimmed through it quickly

#

because I was just trying to focus on getting the editor done today

north mist
#

gotcha

upbeat hare
north mist
#

sure, why not

#

thanks

north mist
#

could this also be done with @new(abc) :missions { @set ...; }?

#

or is the :json ruleset necessary here

upbeat hare
#

Lemme look rq

north mist
#

alrighty

upbeat hare
#

Can you ... indent the output ... please

north mist
#

there, better?

upbeat hare
#

Lmao yeah

upbeat hare
#

@north mist I have a very stupid idea, what if
string / string was the same as string + "/" + string

#

Because localization keys/addressables keys tend to follow that format

stiff crater
#

You've been doing too much JavaScript

upbeat hare
#

Disagree
I haven't touched js in forever

north mist
#

Eh I feel like that's making it a little bit too much of a magic blackbox

upbeat hare
#

Fair enough

stiff crater
#

@upbeat hare someone sent me these logs on the KLSS forum thread because the loading of their game was stuck and it seems to come from a Patch Manager error, any idea what could cause that?

upbeat hare
#

Idk what is causing the issue specifically

#

I don't see what could be causing it aaaaaa

#

I'd need them to be running a dev version of pm that shows what line of the error

upbeat hare
#

Hmmm, could a patch file validator for github be useful?

desert stirrup
#

@upbeat hare, I'm trying to use a mixin inside a top level each loop, but I'm getting an extraneous input error from patch manager:
line 492:8 extraneous input '@include' expecting {'@use', '@function', '@if', '@mixin', '@while', '@for', '@each', '@require', '@stage', '@define-stage', '@patch', '@new', '@create-config', '@update-config', '}', '(', '+', '*', '~', STRING, NAME, STRING_NAME, CLASS, STRING_CLASS, VARIABLE, RULESET, ENSURE, STRING_ENSURE, ELEMENT}

I can't figure out what's wrong. Looking at other examples of mixins and the docs, this should be valid syntax for it.

The first each keyword is getting an extraneous input error in VSCode, but that's just the syntax grammar not being up to date I think. If I use something else instead of the mixin, it runs fine.

upbeat hare
upbeat hare
desert stirrup
#

I don't know. I'm still grasping how PM works.
For mixins, I understood that they give a way to reuse other parts of codes, or in my case: I have a complex set of commands and all I want is to move them from this part. Same as in c# - I'd separate a part of code to a different method. Even if I want to use that method only once, it gives a bit cleaner way to write it. Would mixins be suited for this?

#

My full code will be creating a new mission object/asset/however we call it 🙂

upbeat hare
#

Hmmm
At the top level I think I'd rather use functions for this

#

That's not possible yet though

desert stirrup
#

What's the key difference between mixins and functions?

upbeat hare
#

Mixins work inside the environment they are included in, and act as a list of "selection actions", and take in the context of the selection block they are in

Functions work inside the environment they are defined, and act as a list of "statements", and dont require a selection block context

desert stirrup
#

Ok, for now I'll place my gigiantic block of statements inside that inner each loop. But it'd be nice to have separate it in a new function or mixin for better readability. And if in the future there's a need to repeat the gigantic block that creates objects, it would be even more valuable, so here's my vote to add this.

north mist