#Space Warp

1 messages · Page 8 of 1

wicked wyvern
#

oh yeaah

#

nice

#

SpaceWarp SDK incoming klueless

sacred jasper
#

@wicked wyvern Even better looking

wicked wyvern
#

awesome!

mossy kraken
#

Thats sick!

timber cedar
#

xddd wtf did you type as an example

sacred jasper
#

Ohhh CustomPropertyDrawer

#

Ffs why is unity stuff hard to find

sacred jasper
timber cedar
#

uhhhuh

sacred jasper
#

Unity uses a yaml format for components?

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 967700971, guid: 06dd3d5416bf43ea368cc39ff96e6d5a, type: 3}
  m_Name: I2Languages
  m_EditorClassIdentifier: 
  mSource:
    UserAgreesToHaveItOnTheScene: 0
    UserAgreesToHaveItInsideThePluginsFolder: 0
    GoogleLiveSyncIsUptoDate: 1
    mTerms:
    - Term: Parts/Title/some_part
      TermType: 0
      Languages:
      - This
      Flags: 
      Languages_Touch: []
    - Term: Parts/Subtitle/some_part
      TermType: 0
      Languages:
      - is
      Flags: 
      Languages_Touch: []
    - Term: Parts/Manufacturer/some_part
      TermType: 0
      Languages:
      - a
      Flags: 
      Languages_Touch: []
    - Term: Parts/Description/some_part
      TermType: 0
      Languages:
      - part
      Flags: 
      Languages_Touch: []
    CaseInsensitiveTerms: 0
    OnMissingTranslation: 1
    mTerm_AppName: 
    mLanguages:
    - Name: English
      Code: ENG
      Flags: 0
    IgnoreDeviceLanguage: 0
    _AllowUnloadingLanguages: 0
    Google_WebServiceURL: 
    Google_SpreadsheetKey: 
    Google_SpreadsheetName: 
    Google_LastUpdatedVersion: 
    GoogleUpdateFrequency: 3
    GoogleInEditorCheckFrequency: 2
    GoogleUpdateSynchronization: 1
    GoogleUpdateDelay: 0
    Assets: []
sacred jasper
#

Honestly might be worth having mods be able to register their own loaders for space warp

sacred jasper
#

@wicked wyvern @mossy kraken should I create a repository on the github for the "sdk"

wicked wyvern
#

I'm all for it 👍

mossy kraken
#

Go for it!

gilded kettle
#

doing the translation and the colors patch updates rn btw

#

pr will be soon

sacred jasper
gilded kettle
#

@sacred jasper should i change public methods on ColorsPatch to internal?

#

and leave just the API as public?

#

theres no methods that change critical information but still

sacred jasper
#

So, I think I have to programatically create the mod list UI for space warp but nothing else

#

I.E. w/ UITK

wicked wyvern
#

Why is that?

sacred jasper
#

Actually yeah, nvm

gilded kettle
#

SpaceWarp/ModList/Header,Text,,spacewarp.modlist,spacewarp.modlist
This one i kept the same because else it owuld be, spacewarp.listademods

wicked wyvern
#

Yep that makes sense not to translate

gilded kettle
#

idk it seems to extensive, most people know what a mod and a list is so shrug

#

translation pr done

#

just gotta test colors with the changes

sacred jasper
#

Just wait until I start doing translations in an addressables bundle

#

/hj

#

Shit I can't actually do much space warp UI work until tuesday or late tomorrow

gilded kettle
#

want it ready for 1.1.0?

sacred jasper
#

Yeah

gilded kettle
#

tbf we can wait till wednsday to release 1.1.0

#

i dont see why not

#

i have wednsday never knew how to write that shitty word

wicked wyvern
#

"whensday" munley

#

English is weird

sacred jasper
#

Addressables really do be breaking my unity projects tho

#

as it breaks TKs addressables browser

gilded kettle
#

btw, a patches Init(MethodBase) is called as soons has Harmony.CreateAndPatchAll right?

#

kinda abbreviated this a lot but yeah

sacred jasper
#

I'm having a hard time understanding what you just said

gilded kettle
#

ok wiat

#
    private static bool Init(MethodBase original)
    {
        if (original is null)
        {
            return true;
        }

        _partHash = new Dictionary<string, Texture[]>();
        _propertyIds = new[]
        {
            Shader.PropertyToID("_MainTex"),
            Shader.PropertyToID("_MetallicGlossMap"),
            Shader.PropertyToID("_BumpMap"),
            Shader.PropertyToID("_OcclusionMap"),
            Shader.PropertyToID("_EmissionMap"),
            Shader.PropertyToID("_PaintMaskGlossMap")
        };

        _ksp2Opaque = Shader.Find(KSP2_OPAQUE_PATH);
        _ksp2Transparent = Shader.Find(KSP2_TRANSPARENT_PATH);
        _unityStandard = Shader.Find(UNITY_STANDARD);

        Logger = BepInEx.Logging.Logger.CreateLogSource(displayName);

        return true; ///TODO: add config to enable/disable this patch, if disabled return false.
    }```
#

this method, its quite essential for the whole ColorsPatch

#

on SORRY i had to call Init, even tho its called when the patch is created

#

i wonder if the same issue will happen on SpaceWarp

#

as far as ive tested no, but you never know

#

quick fix would be to call init on SpaceWarpManager

#

btw Normals looking good, will pr the colors patch too

#

ignore the misspainted area lmao

sacred jasper
#

I mean yeah, just call init somewhere in SWs load process

gilded kettle
#

fuch im still getting this...

#

when i commit to spacewarp

#

even tho its my branch

sacred jasper
#

Check your remote?

gilded kettle
#

no luck, hmm let me recreate the branch maybe

sacred jasper
#

Gods, making an editor script for parts is going to be fun :3

gilded kettle
#

i imagine lmao

sacred jasper
#

I have to figure out how to convert between the json and PartCore data

#

And then add tools to get the JSON from PartCore data

#

Then add custom editors for every module

gilded kettle
#

did this fucker create a branch named ColorsPatch

gilded kettle
sacred jasper
#

then add editor gizmos cuz y'know

wicked wyvern
#

Technically it sounds like it shouldn't be too difficult since the JSON contains just the serialized objects

gilded kettle
#

also
whoever has all 6 textures on the parts gets this message

        if (count == 6)
            LogMessage($"\t\tWoW Much Textures!");
wicked wyvern
#

For the part modules at least

wicked wyvern
#

"Come to Brazil" is a good one lol

sacred jasper
#

unity editor gizmos

#

wait this isn't google

sacred jasper
#

Cool I can't just do this

if (!GUILayout.Button("Save Part JSON")) return;
        var core = (serializedObject.targetObject as CorePartData)?.Core;
        if (core == null) return;
        var json = IOProvider.ToJson(core);
        var t = new TextAsset(json);
        AssetDatabase.CreateAsset(t, $"Assets/{core.data.partName}.json");
#

Unless

timber cedar
sacred jasper
#

KSP2 literally doing reflection to load unity converters lmao

private static List<JsonConverter> CreateDefaultConverters() => (List<JsonConverter>) Assembly.Load("Newtonsoft.Json.UnityConverters").GetType("Newtonsoft.Json.UnityConverters.UnityConverterInitializer").GetMethod("CreateConverters", BindingFlags.Static | BindingFlags.NonPublic).Invoke((object) null, new object[1]
    {
      (object) ScriptableObject.CreateInstance<UnityConvertersConfig>()
    });
#

Why isn't it working for me though

#

Gods this is too much of a pain

#

I'm not working on this just yet

timber cedar
#

you should vc

sacred jasper
#

Nah, I'm headed to bed

timber cedar
#

even better idea

gilded kettle
sacred jasper
gilded kettle
#

Is it also a direct conversion? or nah?

#

what is missing?

#

oh i see, the types are missing

sacred jasper
#

Then afterwards I can get to work on editor gizmos for stuff

gilded kettle
#

hmm i wonder, cant you just do GetType()?

sacred jasper
#

Such that you can see COM in the editor and such

gilded kettle
#

then for assembly get the one from AsmDef

#

and version just leave it 0

sacred jasper
#

Possibly, I need to write a custom converter I suppose

gilded kettle
#

i think its still a direct conversion

#

is just that u need to add the class reference before

#

Ie:

#
          {
            "Name": "Data_DeployableControlSurface",
            "ModuleType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
            "DataType": "SORRY.Modules.Data_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
            "Data": null,
            "DataObject": {
              "$type": "SORRY.Modules.Data_DeployableControlSurface, SORRY",
                "IsDeployed": {
                    "ContextKey": "IsDeployed",
                    "storedValue": false
                },
                "ModuleType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
                "DataType": "SORRY.Modules.Data_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
                "IsActiveInStagingProp": {
                    "ContextKey": null,
                    "storedValue": false
                }
            }
          }
#

Version can be 0.0.0.0

#

And then its a direct conversion of all the public and private[SerializeField] fields

#

now idk how you will get the ModuleType and DataType

#

also how you will get the Assembly name...

sacred jasper
#

Its a getter

#

Assembly name
type.GetAssembly()...

gilded kettle
#

oh ok

#

hmm tbh, i think that you could just have the Part Core Data editing for now

#

since the line # is always the same

sacred jasper
#

Yes, but like if I could automatically detect modules and such, I could build up the part data completely programatically

#

I have an idea too

gilded kettle
#

go for it! :D

sacred jasper
#

Gods, I wish I had a debugger in the unity editor though

gilded kettle
#

i do think theres one

#

you can just debug it with visual code iirc

#

at least for OnInspector() works

wicked wyvern
gilded kettle
#

yeah exactly

sacred jasper
#

Cool, then I can actually see if what I want to set exists

sacred jasper
#

But honestly I might just auto detect modules in any case

gilded kettle
#

@sacred jasper this would cause SpaceWarp to not load at all right?
[Error : BepInEx] Could not load [Space Warp 1.0.1] because it has missing dependencies: com.bepis.bepinex.configurationmanager (v17.1 or newer)

wicked wyvern
#

yep, Configuration Manager is a dependency

gilded kettle
#

ok, so the person on the forum has a botched install

sacred jasper
#

How did they botch the inbuilt config manager

#

Its literally packaged with it

wicked wyvern
#

possibly they could have been trying to delete all mods to figure out which one is causing errors or something to that effect, and deleted everything in the plugins folder except for SpaceWarp

gilded kettle
#

he said he "Removed all other mods"

wicked wyvern
#

yep

#

makes sense

gilded kettle
#

probably thought that it was one of the mods

#

it reallly should be on another folder tho

#

also SpaceWarp should be on BepInEx folder imo but idk if thats possible

wicked wyvern
gilded kettle
#

no its not 🙄

wicked wyvern
#

it is though?

gilded kettle
#

SpaceWarp is better than the other plugins

wicked wyvern
#

it's just that SW has a dependency on it

#

we'd have to write yet another preload patcher for BepInEx to allow loading SW + CM from a different folder

#

and it'd just make things more messy in my opinion

#

you install library plugins into BepInEx/plugins like everything else

#

and SpaceWarp is just that - a library plugin

gilded kettle
#

yeah i mean as long as players dont delete the configuration manager should be ok

#

its just like deleting the Squad folder on KSP1

wicked wyvern
#

well, except BIE mods will still work without SW and CM

#

so it's just an optional plugin, not like deleting the actual stock game's content

gilded kettle
#

but mods dependent on SW wont obivously

wicked wyvern
#

I'd compare it more so to deleting ModuleManager from KSP1

#

you could have mods that work without it, and the game will still run, but most mods depend on it

#

@sacred jasper want me to get on some UITK SpaceWarp work?

#

I know you did some work on the modlist already

sacred jasper
#

Go for it

#

I barely did anything tbh

#

Just mocked up what it would look like somewhat

wicked wyvern
#

we still haven't got it completely down (the light colors), but at least we can get started since the feature is there

#

I'm still also thinking through the API for the UI lib

#

for now I'll just probably keep it very simple and just abstract this portion of the code into a static method or something like that

sacred jasper
#

So what I'm looking for doesn't exist, meaning I'm going to have to serialize it myself

gilded kettle
#

you can just create a new() and serialize that @sacred jasper

#

imagine, at the end of part core data
button with new module
dropdown with modules

sacred jasper
#

No, no I know what I am doing

gilded kettle
#

modder selects the module, new()

#

preach then cheese lord

sacred jasper
gilded kettle
#

great

#

now just serialize the datas

#

they are already serializable so it should be easy

#

and i think its a direct conversion too

#

this will be so helpful tho specially for attachment nodes and CoM,P,D,B,R

sacred jasper
#

Oops I crashed unity

#

Meaning I have to do the fun thing of reimporting

#

fuck, I didn't have the scene saved so now I have to reset up the part

gilded kettle
#

Great i cant fucking debug ksp2 for some reason

#

i will never fix the gridfin i feel

#

when i attatch dnpsy it crashes

wicked wyvern
#

have you put it into debug mode?

#

debugging from Rider works for me fine, so it should from dnySpy, too

sacred jasper
#

Dakota is going to see my editor scripts at some point and hire me on the spot /j

wicked wyvern
#

they gotta have some sort of a better workflow for creating parts and stuff, I wish they'd release at least some parts of it for modding at some point

sacred jasper
gilded kettle
#

hmm

sacred jasper
#
public override void OnInspectorGUI()
{
    base.OnInspectorGUI();
    if (!GUILayout.Button("Save Part JSON")) return;
    if (!_initialized) Initialize();
    var core = (serializedObject.targetObject as CorePartData)?.Core!;
    var targetGO = (serializedObject.targetObject as CorePartData).gameObject;
    if (core == null) return;
    // Clear out the serialized part modules and reserialize them
    core.data.serializedPartModules.Clear();
    foreach (var child in targetGO.GetComponents<PartBehaviourModule>())
    {
        child.GetType().GetMethod("AddDataModules", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(child, new object[] {});
        core.data.serializedPartModules.Add(new SerializedPartModule(child,false));
    }
    var json = IOProvider.ToJson(core);
    File.WriteAllText($"{Application.dataPath}/{core.data.partName}.json", json);
    AssetDatabase.Refresh();
    EditorUtility.DisplayDialog("Part Exported", $"Json is at: {Application.dataPath}/{core.data.partName}.json", "ok");
}
gilded kettle
#

ur missing the context keys

sacred jasper
#

context keys?

gilded kettle
#
              "IndependentThrottlePercentage": {
                "ContextKey": null,
                "storedValue": 0.0
              },```
#

its a parameter from ModuleProperty

#

should be easy to get

#

its basically the same as the name of the property

sacred jasper
#

they are important I presume?

gilded kettle
#

you dont even set it when creating a moduleProperty



        [LocalizedField("SORRY/DCS/DEBUG/IsDeployed")]
        [KSPState(CopyToSymmetrySet = true)]
        [FormerlySerializedAs("isDeployed")]
        [Tooltip("Current Control Surface State")]
        public ModuleProperty<bool> IsDeployed = new ModuleProperty<bool>(false, true);
#

i mean idek why they exist but yeah they are

#

its the same as the name of the property

#

so if you just copy it over it should be fine

#
                "IsDeployed": {
                    "ContextKey": "IsDeployed",
                    "storedValue": false
                },
#

see? the same

sacred jasper
#

I see where it is set, I'm just assuming its never called cuz serialization

gilded kettle
#

also

#

      "Generates": [],
      "Contains": []

This probably wont cause isses, but on Stock parts its passed as null iirc

#

from gridfinM.json


    "resourceSummary": {
      "Consumes": null,
      "Generates": null,
      "Contains": null
    },
sacred jasper
#

It'll be fine

gilded kettle
#

yeah probably, just pointing it out in case an error appears

#

contextkey is how you identify the moduleProperties in game tho

sacred jasper
#

I'm having the conversion mostly be automatically done in the same way it reads it so

#

Again I can see where it is set

gilded kettle
#

i just wonder if it will read as a List with no entries or as a null object

#

cuz if it reads as a list it might cause issues cause it might search for things inside it

#

but thats up for testing tbh

sacred jasper
#

Fixed context keys

#
foreach (var data in child.DataModules.Values)
{
    data.GetType().GetMethod("RebuildDataContext", BindingFlags.Instance | BindingFlags.NonPublic)
        ?.Invoke(data, new object[] { });
}
#

Had to add that nested into the foreach loop

gilded kettle
#

can i try this on a part? to see if it loads?

sacred jasper
#

Sure lemme just build a unity package rq for it

gilded kettle
#

i was gonna try with that json xD but sure!

sacred jasper
#

Oh, yeah, just try w/ the json

#

but I can build one rq

#

Do tell me how it goes

gilded kettle
#

will do, gotta match the modules on the json

#

also gotta reimport KSP2 to unity :D

sacred jasper
gilded kettle
#

loading the game

#

i can't leave it as it is since the part already exists

sacred jasper
#

I was just using it as a test

#

The converter doubled up on these interesting

#

does the same in the game so

gilded kettle
#

oh no

#

thats like that in the game

#

it worked btw

#

but yeah, the non capitalized is the private field

#

and the capitalized is the public field that can be changed depending on size, rotation etc

sacred jasper
gilded kettle
#

but they still store the original drag model

#

good job!

sacred jasper
#

I literally just did the reverse of what KSP does, reading it

gilded kettle
#

yeah lmao its a direct conversion

#

with a few more adds but yeah

sacred jasper
#

A direct conversion if you set everything up

gilded kettle
#

CoM and attachment nodes shouldnt be hard

sacred jasper
#

Shouldn't if I can figure out editor gizmos

gilded kettle
#

u can just let the player set a transform to be them and then just read the position

#

DrawGizmos doesnt work?

#

OnDrawGizmos()

#

you also have OnSelectedDrawGizmos() but idk if it will work for a editor script

sacred jasper
#

Gizmos are for monobehaviours

#

Hmm

public class MyScriptGizmoDrawer
{
    [DrawGizmo(GizmoType.Selected | GizmoType.Active)]
    static void DrawGizmoForMyScript(MyScript scr, GizmoType gizmoType)
    {
        Vector3 position = scr.transform.position;

        if (Vector3.Distance(position, Camera.current.transform.position) > 10f)
            Gizmos.DrawIcon(position, "MyScript Gizmo.tiff");
    }
}
gilded kettle
#

should work

#

u could get the yellow and black CoM icon for that then

#

with the DrawIcon

sacred jasper
#

Oh handles are kinda what I want actually

#

Handles and gizmos together would help

gilded kettle
#

should be doable? MAYBEEE

#

unity editor editing is such a mess

#

#1088816954426527775 its ur fault

sacred jasper
sacred jasper
sacred jasper
#

I'll do handles at a later date, gizmos should be fine for now

#

just to view the CoM and everything

sacred jasper
#

@gilded kettle Center of mass and center of lift gizmos

#

And an attempt at CoT

#

Gonna remake it likely

wicked wyvern
#

wow, cheese out here doing the damn thing

#

👏

sacred jasper
#

If only I had an actual model to test it on

#

Might remove the thrust viewer though for now

#

And basic drag cube visualization

sacred jasper
wicked wyvern
#

had to do some irl work first but now I'm working on cleaning up the UITK library and adding some of the API methods

sacred jasper
#

Ooo fun I just found a better way to render drag cubes I think

sacred jasper
#

(nope)

gilded kettle
sacred jasper
#

its a 50% transparent cube

gilded kettle
#

the wireframe cube is very good at those things

#

its used all over unity for bounds

#

but transparent cube is also verygood since you can see when a mesh is going out of bounds

#

@sacred jasper are the gizmos in yet?

sacred jasper
gilded kettle
#

hmm i dont see them...

#

should be at 0,0,0

#

no errors besides these

#

i think im missing the icon

#

just moved one of them and that icon flew around

#

also custom modules dont work, but this is not critical since if the person made their own module they should know how ot create the json

      {
        "Name": "PartComponentModule_DeployableControlSurface",
        "ComponentType": "SORRY.Modules.PartComponentModule_DeployableControlSurface, SORRY, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null",
        "BehaviourType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null",
        "ModuleData": []
      },```
#

wait let me test something, might actually be a problem with inherited classes

#

nop the problem is with custom modules

sacred jasper
gilded kettle
#

yup, but the body is not the same as the stock ones

sacred jasper
#
protected override void AddDataModules()
    {
      base.AddDataModules();
      this.DataModules.TryAddUnique<Data_Engine>(this.dataEngine, out this.dataEngine);
    }

Should look something like this

#

It's the only way to have that module data in there basically

gilded kettle
#

that doesnt work on custom modules, it throws a null reference on this.dataEnigne

gilded kettle
#

even if i create it before

#

i'll show u how it looks

#

same happened to Data_Hinge on #1088816954426527775

sacred jasper
#

Alright, what does the function look like for you?

gilded kettle
#
        public override void AddDataModules()
        {
            base.AddDataModules();
            if (this.DataModules.TryGetByType<Data_DeployableControlSurface>(out this.dataDeployableControlSurface))
            {
                return;
            }
            this.dataDeployableControlSurface = new Data_DeployableControlSurface();
            this.DataModules.TryAddUnique<Data_DeployableControlSurface>(this.dataDeployableControlSurface, out this.dataDeployableControlSurface);
        }
#

DataModules usually already has the module

#

actually it always has the module

#

the last bit is only for safety

#

either way just the last bit still throws a null reference iirc

sacred jasper
#

Not in how I'm doing it won't have

gilded kettle
#

when the json is compiled, it creates the dataModule and stores it in DataModules

#

hmm true

#

well hmm

#

idk? i'll try to make the AddDataModules as default and see if it works

sacred jasper
#

addData should already be made

#

or dataDeployableControlSurface

#

ohh I see whats happening

#

basically do this

this.dataDeployableControlSurface ??= new  Data_DeployableControlSurface();
this.DataModules.TryAddUnique<Data_DeployableControlSurface>(this.dataDeployableControlSurface, out this.dataDeployableControlSurface);
#

@gilded kettle try that

gilded kettle
#

Oh that might actually be it wtf totally forgot about them

#

i hate that BepInEx doenst give you the exception that made it stop....

#

actually, the mod doenst appear on the logs at all, can it be that the dll got deleted? happened to Sticks too

sacred jasper
gilded kettle
#

oh sorry was trying to make my part load

#

let me test

#

had to reimport KSP2 and now it says Multi-Object editing is not supported

#

@sacred jasper still nop :(

sacred jasper
#

Odd?

gilded kettle
#
      {
        "Name": "PartComponentModule_DeployableControlSurface",
        "ComponentType": "SORRY.Modules.PartComponentModule_DeployableControlSurface, sorry, Version=0.2.3.0, Culture=neutral, PublicKeyToken=null",
        "BehaviourType": "SORRY.Modules.Module_DeployableControlSurface, sorry, Version=0.2.3.0, Culture=neutral, PublicKeyToken=null",
        "ModuleData": []
      },
#

you can try with the dll to debug it

sacred jasper
#

Can you send me the full script

sacred jasper
gilded kettle
#

will do as soon as i reimport KSP for the 10th time

sacred jasper
#

That is so f-ing annoying that that has to be done

gilded kettle
#

nope no luck

#

maybe when creating the monobehaviour

#

it should create the data as well

#

but it isnt

#

which is wierd because the stock modules dont either

#

but in game that works

sacred jasper
#

super odd

#

How do you have the part set up in the editor

#

like can you screenshot the inspector

gilded kettle
#

yeah a sec

#

all in the partName game object

sacred jasper
#

Actually wait I have the scripts I can debug this after lunch

gilded kettle
sacred jasper
gilded kettle
#

data deplyable just has a Request handle label

sacred jasper
#

Alright, time to do debugging in the unity editor after lunch

gilded kettle
#

lmao good luck, anything u need im here!

sacred jasper
#

@gilded kettle do you have the partcomponent script?

gilded kettle
#

yup

sacred jasper
#

can you send it to me

gilded kettle
wicked wyvern
#

Oh yeah munix, speaking of UI, I'm trying to figure out how to hook mod config into the settings menu
about this, do you mean basically replicating the Configuration Manager but within like a custom tab of the in-game Settings menu?

gilded kettle
#

are u trying to test the json already? :O

#

That would be so much better

#

also it would be good if we could separate per mod, just like KSP1

wicked wyvern
#

a good way to achieve this without cluttering the native Settings menu could be to have like a toggle somewhere at the top of the tab list in the Settings menu that would switch between game settings and mod settings

sacred jasper
#

And TK does not

sacred jasper
wicked wyvern
#

just Photoshop haha

sacred jasper
#

Yeah specifically like that

#

@gilded kettle when I converted the script to use a non publicized version of KSP2s assemblies ... it worked first try??

#
using System;
using System.Reflection;
using I2.Loc;
using KSP.IO;
using KSP.Modules;
using UnityEngine;

namespace SORRY.Modules
{
    [DisallowMultipleComponent]
    public class Module_DeployableControlSurface : Module_ControlSurface
    {
        private static readonly FieldInfo DragField =
            typeof(Module_ControlSurface).GetField("dataDrag", BindingFlags.Instance | BindingFlags.NonPublic);

        private Data_Drag _dataDrag => (Data_Drag)DragField.GetValue(this);
        
        public override Type PartComponentModuleType => typeof(PartComponentModule_DeployableControlSurface);


        protected override void OnInitialize()
        {
            base.OnInitialize();
            AddActionGroupAction(SetControlSurfaceActiveState, KSP.Sim.KSPActionGroup.Brakes, "Toggle Control Surface", dataDeployableControlSurface.IsDeployed);
            AddActionGroupAction(SetControlSurfaceActiveStateOn, KSP.Sim.KSPActionGroup.None, "Activate Control Surface");
            AddActionGroupAction(SetControlSurfaceActiveStateOff, KSP.Sim.KSPActionGroup.None, "Deactivate Control Surface");
            UpdatePAMControlVisibility();
        }
        protected override void AddDataModules()
        {
            base.AddDataModules(); 
            dataDeployableControlSurface ??= new Data_DeployableControlSurface();
            DataModules.TryAddUnique(dataDeployableControlSurface, out dataDeployableControlSurface);
        }

        protected override void CtrlSurfaceUpdate(Vector3 vel, float deltaTime)
        {
            if (dataDeployableControlSurface.IsDeployed.GetValue())
            {
                base.CtrlSurfaceUpdate(vel, deltaTime);
            }
        }

        private void SetDragCubes(bool deployed)
        {
            _dataDrag.SetCubeWeight("Deployed", deployed ? 1f : 0f);
            _dataDrag.SetCubeWeight("Retracted", deployed ? 0f : 1f);
        }

        public override string GetModuleDisplayName()
        {
            return LocalizationManager.GetTranslation("PartModules/ControlSurface/Name", true, 0, true, false, null, null, true);
        }

        private void SetControlSurfaceActiveState(bool newState)
        {
            animator.SetBool("Deployed", newState);
            dataDeployableControlSurface.IsDeployed.SetValue(newState);
            SetDragCubes(newState);
        }
        private void SetControlSurfaceActiveStateOn()
        {
            SetControlSurfaceActiveState(true);
        }
        private void SetControlSurfaceActiveStateOff()
        {
            SetControlSurfaceActiveState(false);
        }

        protected override void UpdatePAMControlVisibility()
        {
            base.UpdatePAMControlVisibility();
            dataDeployableControlSurface.SetLabel(dataDeployableControlSurface.IsDeployed, "Debug/IsDeployed");
        }

        public Animator animator;
        [SerializeField]
        protected Data_DeployableControlSurface dataDeployableControlSurface = new Data_DeployableControlSurface();
    }
}

(Storing this here for testing purposes)

#

Gods I have to import the entirety of BIE and SW

#

Okay so why the fuck does the imported version not work

gilded kettle
#

😭 wtf

#

so you got it to work on editor?

#

you're doing an amazing work btw

wicked wyvern
#

@sacred jasper finished the first API version, in the end I added more than I was planning at first, but it should now be good enough (with minor additions) for some time (#1085537097714245662 message)

#

I'll get started on the actual SpaceWarp UI tomorrow

gilded kettle
#

1.1.0 is set to release tomorrow right?

mossy kraken
#

Not sure if 1.1.0 is ready to be released. Depends on the scope for the update.

wicked wyvern
#

I'm not sure if cheese wants to wait for the UI or not

#

because that will most likely take a couple of days

gilded kettle
#

its mostly cuz i was gonna start working on the custom shader settings importer

mossy kraken
#

You can just start work on it, fork it and build it and create a branch for it in your mods repo

#

We usually release at the end of the week. Often Sundays

#

With 2 ish weeks between each minor release

sacred jasper
#

I just created a custom importer API for space warp lol

#

Allows you to define your own addressables importers and assets/whatever importers for all mods to use

#

And I made space warp use it

wicked wyvern
#

nice

#

UITK could technically then use it to parse mods' .uxml and .uss files into assets, I assume

sacred jasper
#

It'd technically have to be a separate mod than UITK as it depends on Space Warp, but yes

wicked wyvern
#

oh yeah true

sacred jasper
wicked wyvern
#

that's good to know

sacred jasper
#

I love lambdas, functional programming is kinda based

#

Even if Im capturing state in lambdas

timber cedar
#

no

#

bad

#

not oop

sacred jasper
wicked wyvern
sacred jasper
wicked wyvern
#

A totally different question - would you mind if I hosted a SpaceWarp named Nuget server? While many things can be uploaded on nuget.org, I'd like to have something similar to the BepInEx Nuget server, where we could have all the KSP2 modding related packages including the publicized UITK package (like BIE Nuget hosts publicized UnityEngine.Modules - but just the default ones)

#

Alternatively if not under the SpaceWarp name, can totally just make it something generic about KSP2 modding, but would still like your opinion on it

sacred jasper
#

Honestly sounds like a good idea

wicked wyvern
#

I made a free account on cloud.oracle.com which will allow me to host a Docker container with the same Nuget server implementation that BIE is using

storm quail
#

Cheese, how is part tools going? I can take a look at the code on github if you are still having problems with custom modules.

wicked wyvern
#

and would just need to purchase a domain to get this set up

sacred jasper
#

Currently debugging custom modules with SORRY.dll

#

It works with converted editor scripts but not dlls as I said

wicked wyvern
#

which shouldn't be too much of a hassle at like 7-12€/year for something like .org or .dev

sacred jasper
#

OHHH @gilded kettle I JUST REALIZED THE ISSUE WITH DLLs

#

I bind to a non public method

#

but they are built against publicized dlls

sacred jasper
#

so I can't call the addmodule shit

#

I'm an idito

storm quail
#

Nah bro you good

sacred jasper
#

Gods I am failing at C# today

#

I got it to serialize correctly c:

storm quail
#

Up[load to github immedietly, I beg of you

sacred jasper
#

I will

#

gimme one moment to make sure gitignor is correct and everything

sacred jasper
#

Ohh,

#

the github repo doesn't have the gizmos

#

but its fine

#

why is the source code in a completely different format than it is on my machine?

#

ohh I didn't push lol

#

but the package is correct

storm quail
#

Thank you

#

!

gilded kettle
#

that makes a lot of chance lmao

#

how do i change it?

#

like in my dll

sacred jasper
gilded kettle
#

oh ok cool, thx damn

#

u rlly do be coding huh

sacred jasper
#

This fix was like 2 extra lines of code on my end

#

Reflection in the unity editor be fun

wicked wyvern
#

getting there

#

it took ages, since the free-only tier on Oracle Cloud only has ARM64 VMs, so I had to mess around with some Docker stuff to get .NET and ASP working correctly, but I've got it now

wicked wyvern
#

now to deal with HTTPS

sacred jasper
wicked wyvern
#

yep, got that + ssl certificates for two years for $30

#

not a bad deal

#

which means SpaceWarp better last at least two years 😛

sacred jasper
#

Side note

#

I was looking at uploading packages and noticed powershell

#

You can call C# functions w/in an assembly from powershell

wicked wyvern
#

huh that's cool

sacred jasper
#
$code = @"
using System;
namespace HelloWorld
{
    public class Program
    {
        public static void Main(){
            Console.WriteLine("Hello world!");
        }
    }
}
"@
 
Add-Type -TypeDefinition $code -Language CSharp    
iex "[HelloWorld.Program]::Main()"
#

This is a valid powershell script

wicked wyvern
sacred jasper
#

Add-Type makes me feel as if Powershell is just a .NET repl

wicked wyvern
#

honestly it's probably not too far from that

sacred jasper
#

PowerShell V3 and later compile the parse tree (the AST) to a LINQ expression tree, which is then compiled to a bytecode, which is then interpreted.

wicked wyvern
#

yeah just reading the same page rn

sacred jasper
#

Unfortunately you cant compile it to an assembly

#

Also valid powershell

#
class Device {
    [string]$Brand
    [string]$Model
    [string]$VendorSku

    [string]ToString(){
        return ("{0}|{1}|{2}" -f $this.Brand, $this.Model, $this.VendorSku)
    }
}

class Rack {
    [int]$Slots = 8
    [string]$Brand
    [string]$Model
    [string]$VendorSku
    [string]$AssetId
    [Device[]]$Devices = [Device[]]::new($this.Slots)

    [void] AddDevice([Device]$dev, [int]$slot){
        ## Add argument validation logic here
        $this.Devices[$slot] = $dev
    }

    [void]RemoveDevice([int]$slot){
        ## Add argument validation logic here
        $this.Devices[$slot] = $null
    }

    [int[]] GetAvailableSlots(){
        [int]$i = 0
        return @($this.Devices.foreach{ if($_ -eq $null){$i}; $i++})
    }
}

$rack = [Rack]::new()

$device = [Device]::new()
$device.Brand = "Fabrikam, Inc."
$device.Model = "Fbk5040"
$device.VendorSku = "5072641000"

$rack.AddDevice($device, 2)

$rack
$rack.GetAvailableSlots()
#

Just a casual object oriented shell

#
class Device {
    [string]$Brand
    [string]$Model
    [string]$VendorSku

    Device(
        [string]$b,
        [string]$m,
        [string]$vsk
    ){
        $this.Brand = $b
        $this.Model = $m
        $this.VendorSku = $vsk
    }
}

[Device]$device = [Device]::new(
    "Fabrikam, Inc.",
    "Fbk5040",
    "5072641000"
)

$device
#

W/ constructors

#

And static methods

class Device {
    [string]$Brand
    [string]$Model
}

class Rack {
    hidden [int] $Slots = 8
    static [Rack[]]$InstalledRacks = @()
    [string]$Brand
    [string]$Model
    [string]$AssetId
    [Device[]]$Devices = [Device[]]::new($this.Slots)

    Rack ([string]$b, [string]$m, [string]$id, [int]$capacity){
        ## argument validation here

        $this.Brand = $b
        $this.Model = $m
        $this.AssetId = $id
        $this.Slots = $capacity

        ## reset rack size to new capacity
        $this.Devices = [Device[]]::new($this.Slots)

        ## add rack to installed racks
        [Rack]::InstalledRacks += $this
    }

    static [void]PowerOffRacks(){
        foreach ($rack in [Rack]::InstalledRacks) {
            Write-Warning ("Turning off rack: " + ($rack.AssetId))
        }
    }
}
#

And inheritance
Class Derived : Base {...}

little bay
#

you can't use it to make DLLs

#

but it can consume anything from .NET

sacred jasper
timber cedar
gilded kettle
#

Would be awesome

wicked wyvern
#

alright, after fighting with the certificates for some time, I finally realized I'm just dumb and the certificate I have is a single-domain cert, not a wildcard one

#

so at least now I know that's working

wicked wyvern
gilded kettle
#

would it be ok to create an extension of BaseSpaceWarpPlugin for part mods?

#

that way i could integrate the part declaration and make it the same for all

#

for now its only on the mods Plugin class, each person would have to add the CM config to it

sacred jasper
#

CM Config?

gilded kettle
#

basically this

#

        var configValue = Config.Bind<string>("Parts", "partNames", string.Empty, "Add your parts name here (part1, part2, part3, ...)");

        if (Config.TryGetEntry<string>("Parts", "partNames", out var entry))
        {
            if (!entry.Value.IsNullOrWhiteSpace())
            {


                string[] parts = entry.Value.Split(',').Select(a => a.Trim()).ToArray();

                if (parts is not null && parts.Length > 0)
                    Colors.DeclareParts(MyPluginInfo.PLUGIN_GUID, parts);
            }
            else
                Logger.LogWarning("No parts were declared");
        }
#

with the inherited BaseSpaceWarpPlugin i could add this and a couple more useful methods like GetAllParts

#

this could also be in the baseplugin tho

wicked wyvern
#

Just to make sure - you know these settings are meant to be user settings and as such they can change them at any time through the Mods menu in-game, right?

gilded kettle
#

yup!

#

but since we have no easy way of telling what mods adds what parts

#

they are all loaded the same unfortunately

#

either the cm config or a .json under the mods folder

#

or hardcode it which isnt optimal imo

wicked wyvern
#

I mean you could do almost the same thing, just with a custom file instead of the user config

#

so that they can't accidentally mess it up

gilded kettle
#

yeah ik, im not against that

#

but currently spacewarp doenst read .jsons and .txts

#

it would be better to not add a new IO

wicked wyvern
#

well it's just a matter of File.ReadAllText("filepath")

#

I don't think you need an abstraction for that

gilded kettle
#

hmm

#

my thing is more to make all part mods have the same structure

#

cuz like that a modder could have their parts elsewhere and read them there

#

tbh i think im overthinking, maybe hardcoding it wouldnt be bad

#

parts dont change that frequently (unless ur testing)

wicked wyvern
#

I still don't think I understand

gilded kettle
#

its basically a way to know what parts are from what mods

wicked wyvern
#

instead of the part names being in BepInEx/config/<mod_id>.cfg , they would be for example in BepInEx/plugins/<mod_id>/parts.txt or whatever you choose

gilded kettle
#

yeah that seems good! but would be nice to be in either BaseSpaceWarpPlugin or smiliar

wicked wyvern
#

Yeah I'm not against having a subclass like BasePartSpaceWarpPlugin or something

gilded kettle
#

i'll work on that

#

tbf would be better to have that on BaseSpaceWarpPlugin

wicked wyvern
#

(of course that's just my opinions, cheese could have a different one)

gilded kettle
#

but i undestand the separation

#

@sacred jasper thoughts on a BasePartsSpaceWarpPlugin class for part mods?

wicked wyvern
#

you could technically just add a virtual method like public virtual string[] GetDeclaredParts => new string[]{};

#

which mods that want to declare parts would have to override

gilded kettle
#

true

sacred jasper
#

You could just add a loading step that loads part names from a file

gilded kettle
#

the class would also be for part mods only methods and extensions

#

like ie: disabling a part or changing settings for a part etc etc

sacred jasper
#

At this point it circles back around to the module manager esque thing we were discussing

gilded kettle
#

well true

#

either way i think that the virtual string[] GetDeclaredParts is a good addition to BaseSpaceWarpPlugin

sacred jasper
gilded kettle
#

for part mods or in general?

#

for part mods yeah, but theres only 2 for now so its no biggie

#

in general, no? i think?

wicked wyvern
wicked wyvern
#

it should work the same way as these, you also don't have to override all/any of them

#

but testing it is a good idea anyway

sacred jasper
#

@gilded kettle you can use the new loading API to define a loader for part names as well if we don't/can't override that

#
/// <summary>
/// Registers a per mod loading action
/// </summary>
/// <param name="name">The name of the action</param>
/// <param name="action">The action</param>
public static void AddModLoadingAction(string name, Action<BaseSpaceWarpPlugin> action)
{
    LoadingActionGenerators.Add(p => new ModLoadingAction(name,action,p));
}
#

This API call being the one you want to use

gilded kettle
#

oh great actually i think that would be better

#

also thats amazing, i can put Colors Texture loading per mod on that

#

also TUX configs

#

damn that will be so useful

#

but still i think the override is important so that mods can get other mods part names etc

#

ie: Remote Tech 2 adding their own component to any part that is an antenna

#

but again, circling back to MM

sacred jasper
#

Yeah that's still something we need to investigate
How to do a module manager esque system

#

I mean, we could start by writing a bespoke parser for KSP1s module manager syntax and change it

@PART[*] /// This means any and all parts 
{
    %MODULE[HitpointTracker] // this means add update or modify, in this case add a hitpoint tracker module
    {
        ArmorThickness = 120  //// this section will be specific to whatever you are doing or the module you want to fit
        maxHitPoints = 8000
        ExplodeMode = Never
    }    

}
#

Or we could go another route

wicked wyvern
#

I think we should use JSON from the start tbh

#

ideally we'd cache any mod configuration .json files + applied patches (could use https://jsonpatch.com/ format for that at least in the beginning until we have something more powerful) into a bundle-like format when changes are detected

sacred jasper
#
[
  {
    "match": "*",
    "actions": [
      {
        "type": "add_module",
        "module_name": "HitpointTracker", // This could be done better, maybe a fully qualified path
        "module": {
          "ArmorThickness": 120,
          "maxHitPoints": 8000,
          "ExplodeMode": "Never"
        }
      }
    ]
  }
]
#

So something like that?

wicked wyvern
#

I know that @late condor linked a .NET library for creating/modifying Unity asset bundles

#

not sure how well it works

late condor
wicked wyvern
#

thanks 👍

late condor
#

It depends on what you mean by how well it works

sacred jasper
#

Patching the JSON is a nonstarter I think?
Its also encoded in the prefab

late condor
#

It works quite well imo, but its not the easiest to use for a lot of reasons

#

If this is in reference to patching assets files, or addressable bundles files, that doesn't really seem like a good way to go

gilded kettle
#

"module_name" maybe could be like the parts references

wicked wyvern
#

not really patching existing ones, more so creating a custom cache bundle

gilded kettle
#

Class full name, assembly name, version, publicize etc

late condor
wicked wyvern
#

pretty much

#

but doing it at runtime

late condor
#

Yeah, you can certainly do it with AssetsTools.net, I wouldt really suggest it though unless you're interested in taking on a challenging and time consuming project

sacred jasper
#

As I said this seems like a nonstarter

wicked wyvern
#

well to be fair anything even similar to module manager is basically near impossible with the way assets work in this game

#

You'd have to somehow extract all JSON files from all asset bundles, addressable or not, apply the mods' patches, save them all into a custom bundle, and then somehow patch the game to read all JSON from that instead of the actual bundles

sacred jasper
#

The last part is the easiest actually

#

We can just call readandupgradepart on all parts

gilded kettle
sacred jasper
wicked wyvern
#

well I was talking about a more general approach, not just parts, since Module Manager doesn't just deal with parts

sacred jasper
#

This is the function I'm talking about

#

I'm talking about a parts system for now, but yeah

wicked wyvern
#

but I guess it could be doable for just parts in the beginning

gilded kettle
#

havent played with that yet

sacred jasper
#

Is partcore duplicated?

gilded kettle
#

it looks like it from the method

#

seems like it gets the said part, upgrades an instance of partcore and returns the upgraded instance

#

but again idk cuz havent checked it yet

wicked wyvern
#

might want to bring @sweet raft into the conversation since they said they wrote the first versions of Module Manager for KSP 1, and had some ideas for the successor

#

(when they're online that is)

mossy kraken
#

Prob good to hear what Hephaistos has to say indeed

sweet raft
#

Hallooo

#

Yeah, you def want to be able to at LEAST patch all addressable json files

#

Parts, physics, game settings, etc

#

Also, 2 things that would have made mm much less of a nightmare in the beginning

#
  • a full scripting language (may as well use javascript / node.js)
#
  • live inject-and-reload hooks
#

So ideally, the new jsonmanager should be able to be called live, with an API that exposes "patch and reload" requests to other mods, and with a UI in the game settings menu that lets you select/deselect each patch thats been applied, change the application order, and force a flush/reload.

#

The current preferences for which patches to apply and which to suppress can itself be saved as a .json preferences file

#

Did all that make sense?

sacred jasper
sweet raft
#

Is json lua-native?

sacred jasper
#

No but we can provide a moonsharp function for loading it

sweet raft
#

My reason for prefering js is that json is native to js

#

Which means that the patch nodes and patch scripts can exist in the same file without context switching

#

And "how to address" syntax is already handled natively

#

Also, there are several javascript interpreters for Lua, and even more for C#

#

Aha, looks like unity.jslib is the right path

sacred jasper
#

@wicked wyvern thoughts on loading another scripting language interpreter into KSP2?

wicked wyvern
#

I mean I'm not against it, especially if it's just mostly used on startup

#

Depends on the performance I guess?

#

We want loading to stay as fast as possible, and not turn the game into another KSP1 half-hour-loading-times nightmare

#

I'm on a train again so I'm here but the connection will be shaky

late condor
#

Maybe I'm misunderstanding something here, but if the objective is to modify the contents of part json files, and all part jsons are in addressable bundles and have their own address.

Whats stopping you from just overriding the address per IGs instructions, and then computing the modified part json and saving the result to a folder to loading from in the future to avoid unnecessary computation?

wicked wyvern
#

Well what Module Manager does is not just replace the part definition (or many other things than that), you can specify for example that for part X, you want its module Y's property Z to be set to 10x its original value

late condor
#

That had no bearing on my point really

#

When you're replacing a ResourceLocator you can replace it with a custom implementation of IResourceLocation, which can handle the processing of multiple data files however is needed to compute the final result that you save for future use

#

You're "simply replacing the part json" in the end, but its that layer that handles all the computation of the complex part modification

#

you don't need, and I'd go as far as to argue, you don't want, to modify the sources of any of the json, only intercept and replace the final result

#

and as far as saving those results and speeding up loading, you can just zip them in a zero compression zip so that you remove all IO overhead feasible

sacred jasper
#

I'm not sure its as simple as replacing the json, but hmm

sweet raft
#

That feels like a caching implementation decision

late condor
#

if other things need to be intercepted, it will just be more things to intercept

sweet raft
#

Im talking about base features

late condor
#

i'm talking about the entire stack

#

from reading multiple json files that modify a base json file to providing the final json result

sweet raft
#

The main lesson for MM was that there are a minimum number of features required to service mods, and if you dont bundle them all in a coherent package, you get a nightmare later

wicked wyvern
#

I'm still unsure about how the loading of the game's json that is to be patched would work

sweet raft
#

Im gonna be a bulldog about that

late condor
sweet raft
#

Like, let me say this more simply: architecture is AT LEAST 20x more important than implementation, here. Probably more like 100x to 1000x

late condor
#

if architecture is more important, then adding scripting languages that split up the user base is a bad choice

sweet raft
#

So I want us to stay laser focused on architecture, and then worry about implementation only when architecture is rock solid and feature complete

sweet raft
#

I feel a little flustered, so Im not sure I can convey all of my experience adequately

wicked wyvern
#

So basically we'd use the default locator in the patching process, then register a custom one which has the addresses replaced with the modified files, and that will have precedence when the game tries to load them?

late condor
#

If I'm an expert in C# and know nothing of LUA, then having both means that some people will know C# and some will know LUA, and everyone will have a different view on things because implementations will not be 100% equal due to fundamental language differences

sweet raft
#

But maintaining mm was a nightmare for all these reasons

late condor
#

it makes it harder to support things for everyone

#

less people can help less people

sweet raft
#

Thats... Not... Huh.

#

Okay so wait

late condor
#

if everyone is working from the same basis, everyone learns the same knowledge and workflow

sweet raft
#

Can we pause for a minute?

#

I might be lacking a chunk of basic human experience here

late condor
#

but this is irrelevant, adding languages isn't important at all right now

sacred jasper
#

I dont know if anyone here knows what the other person is arguing about

wicked wyvern
#

I mean we can just have people write the patches in C# and compile them with Roslyn at runtime lol

sweet raft
#

Hold up, I need to understand smth about ppl

#

So as I was uh

wicked wyvern
#

But it sounds a bit contrived for working with JSON

sweet raft
#

HOLD. UP. I need to understand smth and I need Twiner to help me

#

Then we can get back to this.

wicked wyvern
#

Sure, y'all have fun with this lol, I'll get back to the UI

sweet raft
#

So, I just fired up LUA and learned it this morning, so I could understand better the decision weights

#

You seem to be suggesting that not knowing a specific language is a kind of impedement?

#

Is that accurate?

late condor
#

well it is, but thats not what I meant no

sweet raft
#

What did you mean then? Im very confused.

#

Like, MM @cfg was literally its own language, its a domain specific language but still

#

As of Sarbian its turing complete

#

And ppl learned that immediately

#

(its not SUPPOSED to be turing complete so pls dont have ppl mess w it too hard, constructing a loop would be impolite)

late condor
#

if you're an experienced programmer then the language is fairly irrelevant other than when languages do stupid shit like start array indexes at 1 which most languages don't do.
However that doesn't matter because most modders are not experienced programmers and so they will have to learn whatever tool they have to use to get the job done.
If there are more tools, there are more things people have to learn and there is cross talk with using different languages to accomplish goals.
Doing something custom from the outset is a generally bad idea because data transformation tools that are well developed, well documented and sort of easy to use.
Re: How Standard Proliferate.

But my comments about the architecture of the system has nothing to do at all with programming languages, or data transformation langauges, just the architecture of how you would set up the scaffolding you need before you can even look at those aspects

#

If you want to avoid domain specific tools for the actual data transformation, then use something like XSLT which is well documented and very powerful

sweet raft
#

Right so. In my intuition, and maybe this is a weird way to look at it, if we have json we already have js, we are just pretending we dont

late condor
#

no

#

you don't already have js

wicked wyvern
late condor
#

Json is a plain text data format

#

its not interchangeable with javascript in any way

wicked wyvern
#

it only makes sense to have its own Projects thread

sweet raft
#

I see json, I immediately assume I can address it dynamically using js syntax

#

I know thats wrong in point of fact but it being wrong usually bugs me enough to import a js interpreter

#

Ok, lets move

timber cedar
#

yes u can xd

#

i have it

#

on every single website

sacred jasper
timber cedar
#

um guys

wicked wyvern
#

I'm trying to get the dumb certbot from Let's Encrypt working on Oracle Cloud

#

it's pain

timber cedar
#

the subdomain would run on my machine

#

all my certs are fine

wicked wyvern
#

that has nothing to do with this, we're talking about certificates

#

lol

#

but the DNS records are set on the the OC

timber cedar
#

i’m confused

#

you can’t use lets encrypt?

#

and again, that doesn’t matter because i would host the subdomain

#

just route it to mine through the dns record

#

you know you can have multiple

wicked wyvern
#

sure, then just give me an IP and I'll set the record

timber cedar
#

:D

wicked wyvern
#

better not be downloading any viruses 😛

timber cedar
#

lol

wicked wyvern
#

@timber cedar added the DNS record

#

I presume nothing is running on the IP yet?

timber cedar
#

kk

#

there is

#

but i route it

#

dw

wicked wyvern
#

alright

timber cedar
#

nginx for the win

wicked wyvern
timber cedar
#

yessir

wicked wyvern
#

alright

sacred jasper
#

@wicked wyvern i just realized something, should I add an addressables resource locator for Space Warps asset manager, I dont see how useful it would be but

wicked wyvern
#

as in not registering catalogs in the default one but in a custom one?

sacred jasper
#

Ehh, ill explain later

wicked wyvern
#

lmao sorry if I'm too dumb to get it

sacred jasper
#

I mean just implement a resource locator that looks into the AssetManagers assets

wicked wyvern
#

oh yeah, I guess that makes sense

#

how would you assign addresses?

sacred jasper
#

Well, the same as the path in the assetmanager

wicked wyvern
#

sure, why not I guess

sacred jasper
#

So @wicked wyvern you've been working on the UI, how does it look if you have any previews?

wicked wyvern
#

honestly I haven't even started, I went from wanting to make that Nuget package for the UI Toolkit .dlls to figuring out the custom Nuget server to now figuring out certificates

#

but I'll just get started on it now, nothing prevents us from using the Nuget server without HTTPS I guess, and I'll hopefully figure it out later

#

I was trying to set up the Let's Encrypt certbot for automatic free certificate request and renewal on the Oracle Cloud but any way I approached it I just got to errors to which I couldn't find any solutions online

timber cedar
#

also @sacred jasper we are making a mods.spacewarp.org for a kinda showcase of the best mods

#

something like that

#

might make it the landing page

#

with an "about" section

sacred jasper
wicked wyvern
#

definitely

timber cedar
#

yeah

wicked wyvern
#

I mean it could all be on the main domain

#

with the mod showcase below or on another page

timber cedar
#

thats the point of subdomains ^

wicked wyvern
#

idrc, as long as cheese is happy with it

#

I just provide the domain

sacred jasper
#

Its just a showcase?

timber cedar
#

i mean i guess

#

thats really long

#

ig

#

also a blog would be nice

wicked wyvern
#

after much pain and many tears, finally the nuget server is running with SSL lol

#

thanks to some help from @timber cedar

timber cedar
#

np ^

wicked wyvern
#

the first actual package, and the whole reason I did this whole thing, to be able to override dlls from the BIE nuget package UnityEngine.Modules

#

and it is indeed working

#

now I can finally build Ksp2Uitk with 0 .dll references, just all nuget

#

and that means I can finally get to the UI lol

sacred jasper
#

We should upload spacewarp to this site

timber cedar
#

you mean the spacewarp nuget?

sacred jasper
#

I don't know if I have permission to upload there

timber cedar
#

can you give me the nuget?

#

ill try

sacred jasper
#

just download it off of microsofts nuget service

timber cedar
#

true

sacred jasper
#

damn dotpeek is somewhat good

timber cedar
#

ofc its good

#

@sacred jasper

timber cedar
#

@sacred jasper

gilded kettle
#

is it possible, with harmony, to change enums?

#

im guessing no but

wicked wyvern
#

yeah you can't

#

only methods can be patched (including property getters and setters)

#

you'd have to make your own enum and patch all the methods where it's used

gilded kettle
#

fuck, then adding extra Size labels might be harder than i though

fallow gulch
#

@timber cedar DM'd me asking for the Blender file I used to make the logo, they're not on right now, so here it is for anyone else who wants/needs it:

gilded kettle
#

@sacred jasper is there any doc on the language used in the SpaceWarpDocs?

gilded kettle
#

I've planned the Custom Parts per module tutorial, but idk what i can do with that language

#

ok

little bay
#

they're just numbers, you can just cast an int to the enum type and it'll act like that enum

gilded kettle
#

i needed to change the Size enum that they have (X,M,L)

#

wait so lets say they have 1,4,8,16 set up

#

if i cast 2 it will still be valid?

little bay
#

yes

gilded kettle
#

my understanding was that enums ONLY had the numbers set to them

#

ok

#

and ie if i get the name 2

#

will i get the number as a string?

little bay
#

yeah

gilded kettle
#

ok greak ig i can do something about it then huh

little bay
#

you just have to patch where it's used to fix that

#

you don't actually need to swap out the entire enum

gilded kettle
#

also theres the json parser, in the config they put XS in the enum field, i wonder if i puto 2 it will get converted

little bay
#

or you can be cursed and patch the methods on the Enum class

gilded kettle
#

Great then i'll make a Size "Injector" :D thx

timber cedar
#

@sacred jasper im remaking the logo
what should the bottom text be instead of "A KSP Modloader"
(better channel)

sacred jasper
#

A KSP2 Modding API

timber cedar
#

ok ^

gilded kettle
# little bay should be

Actually its not doable, at least not between them since they’re all from 0-8, so only bigger sizes would be added

sacred jasper
#

Damn

little bay
#

are they sorted by their value or something?

gilded kettle
little bay
#

you can force them to be sorted some other way

fierce compass
#

It shouldn't be hard to add, where should I do it? I haven't actually used SpaceWarp before.

#

@sacred jasper

sacred jasper
#

Oh and @fierce compass make sure you are on the 1.1.0 branch

fierce compass
#

My IDE really doesn't like that project. Do you need VS '22 or something?

wicked wyvern
#

oh yeah

#

you do

#

it uses C# 11 features, that's why

wicked wyvern
#

Rider is superior for sure, but it's also like $20 a month which not everyone will want to pay

sacred jasper
#

oh i get it for free

wicked wyvern
#

I mean yeah, if you can get the student license, that's great

#

but can't use it for commercial purposes then, and since I use the JetBrains IDEs for work, I just have a full paid license

timber cedar
fierce compass
sacred jasper
#

The thing with spacewarps game loading system @fierce compass is that it uses functional things when generating actions and such

#

Literally functions that take mods and return actions is the main one

#

but thats likely not as necessary for save loading

#
Loading.AddAssetLoadingAction("bundles","loading asset bundles",AssetBundleLoadingAction,"bundle");
Loading.AddAssetLoadingAction("images","loading images",ImageLoadingAction);

But like these 2 would be hard to do without per mod stuff

wicked wyvern
#

#🔴mod-dev message

#

We could make an API for fetching all the mod infos, right?

#

So that one mod can read what others are loaded

fierce compass
#

I was really just suggesting having PatchInitializationsIL use the new API instead of doing IL editing
(Re: Game loading)

sacred jasper
#

How are we looking on 1.1.0 planned features

wicked wyvern
#

Struggling a bit with the UI right now, in Unity Builder it's looking just fine, but when I put it into the game, the KSP theme doesn't get applied

sacred jasper
#

Ive done it in unity

wicked wyvern
#

well it should be working, since to each new UIDocument I always assign PanelSettings which have the default theme set to KerbalUI

#

and I'm also getting a million of those in Unity and no idea what they're supposed to mean, I was designing the UI just in the Builder so it's not like I accidentally messed up something in the UXML/USS itself

#

I'll just try to port over as much of the code as I can to a new project and hope that helps

gilded kettle
#

@sacred jasper did a pr for some defaults that have to set else parts will look off

wicked wyvern
#

lol the issue was that apparently sometimes the UI Builder just sets length values to "NaNpx" instead of the number you input

#

fun

#

getting rid of all of them fixed most of the issues

sacred jasper
#

Alright so we are gonna release 1.1.0 today

gilded kettle
sacred jasper
#

@wicked wyvern

wicked wyvern
#

working on the UI but not sure I can get it done today

#

will try my best

#

I have been pretty busy with work

#

sorry about that

sacred jasper
#

I can release it without UITK for this release if its not possible

wicked wyvern
#

yeah it might be for the best, even if I do get it working today, it would still be better to test it for a while first

sacred jasper
#

Gotcha

#

Well I'll likely release it in about one hour

wicked wyvern
#

#200 for 1.1.0, nice 😆

sacred jasper
#

Oh I didn't even notice that

#

Space Warp V1.1.0
Changes

  • Added mod state toggling back to UI
  • Added API for color patching for modded parts
  • Added loading API for mods to define their own game and save loading states
  • Added localization to space warp, supports English and Brazillian portuguese for now

Upcoming Plans

  • UITK integration into space warps windows for better looking UI
#

I think that's how I am going to describe the release in the release

wicked wyvern
#

wait actually that reminds me

sacred jasper
#

Fixed typo in brazilian

wicked wyvern
#

did the version comparison thing get fixed?

gilded kettle
#

Good 😠

sacred jasper
#

It should've

wicked wyvern
#

good, I just didn't remember if anyone made a commit for it, I just know I tested my code locally

sacred jasper
#

It works for me

wicked wyvern
#

yep I see your commit for it

#

guess that could also be mentioned in the changelog, since some people were asking why their mods are in red

sacred jasper
#

Ah yeah

#

I added that to the release notes and am about to do full release ping

wicked wyvern
#

awesome

sacred jasper
#

Whoo now I can take a break :)

gilded kettle
#

Actually its 2 ls in brazillian

sacred jasper
gilded kettle
#

Yup lmao sorry

sacred jasper
#

And the spellchecker lied to me

gilded kettle
#

Brazil is with 1 so

wicked wyvern
gilded kettle
#

But for languague is different i think

#

Im so confused wtf

#

When did they change??

#

Mandela effect much

wicked wyvern
#

😆

wicked wyvern
#

@sacred jasper #🔸mod-loader-discussion message

sacred jasper
wicked wyvern
#

I think with things like this + the needed 1.0.1 hotfix with last release, it might not be a bad idea to start always making a pre-release like a day or two earlier for modders to test, and implement any needed last-minute changes before release

sacred jasper
#

This isn't something we can easily fix w/o having to do manual centering

sacred jasper
#

@wicked wyvern or @gilded kettle could either of you try to replicate the sound issue?

wicked wyvern
#

yeah actually

#

same for me it seems

#

no sound

sacred jasper
#

Odd it seems like something I should've noticed when testing

wicked wyvern
#

yeah I thought the same, but then I have the music muted and I mostly just tested UI stuff on the Main Menu screen lately without going in-game

#

so I might have missed it

sacred jasper
#

We don't even do anything with sound

#

Maybe there is a bug in the loading patching

#

I can't really look into it atm

#

As I am about to be busy for the rest of the day

#

I'll try one thing rq though

#

It wasn't what I thought

#

Its not the loading patch

#

so what can it be

#

I don't have the time to git bisect it right now as I said

wicked wyvern
#

I'll try to have a look

#

but yeah, can confirm that 1.0.1 sound works and 1.1 doesn't

#

tried with both

sacred jasper
#

Okay, so it is somehow my fault

df97bf6882ce09e4e9a6af6d928df233efd13d77 is the first bad commit
commit df97bf6882ce09e4e9a6af6d928df233efd13d77
Author: Lexi <[email protected]>
Date:   Tue Mar 28 12:44:52 2023 -0400

    Added an API for defining mod loading actions

 SpaceWarp/API/Loading/Loading.cs                   | 119 +++++++++++++++++++++
 SpaceWarp/Patching/BootstrapPatch.cs               |  13 ++-
 .../Patching/LoadingActions/AddressableAction.cs   |  41 +++++++
 .../LoadAddressablesLocalizationsAction.cs         |  49 ---------
 .../Patching/LoadingActions/LoadAssetAction.cs     | 110 -------------------
 .../Patching/LoadingActions/ModLoadingAction.cs    |  33 ++++++
 SpaceWarp/SpaceWarpManager.cs                      |  70 +++++++++++-
 SpaceWarp/SpaceWarpPlugin.cs                       |   4 +-
 8 files changed, 275 insertions(+), 164 deletions(-)
 create mode 100644 SpaceWarp/API/Loading/Loading.cs
 create mode 100644 SpaceWarp/Patching/LoadingActions/AddressableAction.cs
 delete mode 100644 SpaceWarp/Patching/LoadingActions/LoadAddressablesLocalizationsAction.cs
 delete mode 100644 SpaceWarp/Patching/LoadingActions/LoadAssetAction.cs
 create mode 100644 SpaceWarp/Patching/LoadingActions/ModLoadingAction.cs
#

Wait do I cause a null thing somewhere in the fucking thing

#
[LOG 19:11:42.800] WwiseUnity: Wwise(R) SDK Version 2021.1.10 Build 7883.
[LOG 19:11:42.804] WwiseUnity: Setting Plugin DLL path to: C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2/KSP2_x64_Data\Plugins\x86_64
[LOG 19:11:42.817] WwiseUnity: Sound engine initialized successfully.
[LOG 19:11:42.930] Modlog : Unable to locate the mods directory!
[LOG 19:11:43.249] [Graphics] Screen Resolution set to (0, 1)
[LOG 19:11:43.261] [System] Initializing Game Instance completed in 0.5734s.
[LOG 19:11:43.593] [Audio] [AkLanguageBankReloader] Current WWise Language is : English
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager about to set audio settings!
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetMasterVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetMusicVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetSFXVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetVoiceVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetKerbalCommVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetAmbienceVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetUIVolume 100
[LOG 19:11:43.644] [Debug] [AudioSettings] KSPEventAudioManager audio settings set!
#

Thats the only mention of sound/audio

#

But @wicked wyvern as I said I gtg

#

that should be enough to see what went wrong though

wicked wyvern
#

got it

sacred jasper
#

At least you know the commit

wicked wyvern
#

I read through the diff a couple of times and saw absolutely nothing suspicious

wicked wyvern
# sacred jasper ``` [LOG 19:11:42.800] WwiseUnity: Wwise(R) SDK Version 2021.1.10 Build 7883. [L...

for some reason I was assuming that there wasn't more to this in the logs but now I checked for myself and see this:

[LOG 21:26:52.588] WwiseUnity: Wwise(R) SDK Version 2021.1.10 Build 7883.
[WRN 21:26:52.590] WwiseUnity: Platform specific settings cannot be found for <Windows>. Using global settings.
[EXC 21:26:52.598] NullReferenceException: Object reference not set to an instance of an object
    AkCommonPlatformSettings.get_AkInitializationSettings () (at <e43ddaa261164e408c576121c269cf5b>:0)
    AkWwiseInitializationSettings.InitializeSoundEngine () (at <e43ddaa261164e408c576121c269cf5b>:0)
    AkSoundEngineController.Init (AkInitializer akInitializer) (at <034701ab4b354a619603fe6d965e8c00>:0)
    AkInitializer.OnEnable () (at <034701ab4b354a619603fe6d965e8c00>:0)
    UnityEngine.Object:Instantiate(KSPAudioInitializer, Transform)
    KSP.Game.GameInstance:InitializeDependencies(String&)
    KSP.Game.StartupFlow.InitializeGameInstanceFlowAction:DoAction(Action, Action`1)
    KSP.Game.Flow.FlowAction:Do(Action`1, Action`2)
    KSP.Game.Flow.SequentialFlow:NextFlowAction()
    KSP.Game.Flow.SequentialFlow:Update()
[LOG 21:26:52.684] Modlog : Unable to locate the mods directory!
[LOG 21:26:53.099] [Graphics] Screen Resolution set to (0, 1)
[LOG 21:26:53.111] [System] Initializing Game Instance completed in 0,7032s.
[ERR 21:26:53.137] [Audio] [Audio] SetAudioListeningMode failed to set audio listening mode to Normal
    UnityEngine.Debug:LogError (object)
    KSP.Logging.KspLog:Error (KSP.Logging.LogFilter,object)
    KSP.Logging.GlobalLog:Error (KSP.Logging.LogFilter,object)
    KSP.Audio.KSPAudioEventManager:SetAudioListeningMode (KSP.UI.AudioSettingsMenuManager/AudioListeningModeEnum)
    KSP.Audio.KSPAudioInitializer:Initialize ()
    KSP.Audio.KSPAudioInitializer:Start ()
sacred jasper
#

I did a search in notepad for Audio

#

So we somehow break the InitializeGameInstanceFlowAction?

wicked wyvern
#

But it's weird since SpaceWarp doesn't touch that

#

specifically this is the method where it goes wrong

#

the platform settings should be found but aren't

gilded kettle
#

have you figured it out?

wicked wyvern
#

not yet

gilded kettle
#

in 1.1.0?

wicked wyvern
#

nope, nothing even close to audio

#

something must have broken the loading of the assets that this needs

#

like the prefab

gilded kettle
#

im thinking that the KSP0.1.1 broke something, shouldnt be on our end then

wicked wyvern
#

oh no it works fine with SpaceWarp 1.0.1

#

so it's definitely on our end

gilded kettle
wicked wyvern
#

yeah that's the commit where it broke

#

we know that

#

but not exactly what is causing it

gilded kettle
#

im guessing a prefix thats not returning the original method?

#

let me check his commit

wicked wyvern
gilded kettle
#

do we know which asset isnt being loaded?

wicked wyvern
#

it might not even be an issue with an asset, I was just guessing (although I can't imagine what else the commit could have broken)

gilded kettle
#

im guessing this

            {
                flow.AddAction(new LoadAddressablesAction(plugin));
                flow.AddAction(new LoadLocalizationAction(plugin));
                flow.AddAction(new LoadAssetAction(plugin));
                foreach (var action in Loading.LoadingActionGenerators)
                {
                    flow.AddAction(action(plugin));
                }
            }

            flow.AddAction(new LoadAddressablesLocalizationsAction());

            // flow.AddAction(new LoadAddressablesLocalizationsAction());
            foreach (var action in Loading.GeneralLoadingActions)
            {
                flow.AddAction(action);
            }
            foreach (var plugin in SpaceWarpManager.SpaceWarpPlugins)
            {
                flow.AddAction(new InitializeModAction(plugin));

wicked wyvern
#

somewhere here there's a NullReferenceException

gilded kettle
#

we're loading something before the plugins

#

what a fucking mess wtf

#

[WRN 21:26:52.590] WwiseUnity: Platform specific settings cannot be found for <Windows>. Using global settings.

#

did this get loaded on earlier versions?

#

might just be that global settings is null and they're reliyng on the windows settings

wicked wyvern
#

yes, that is supposed to be working

wicked wyvern
timber cedar
#

where is that method?

gilded kettle
#

well gonna try commenting each line to see where the problem is dogPray

#

[EXC 21:26:52.598] NullReferenceException: Object reference not set to an instance of an object AkCommonPlatformSettings.get_AkInitializationSettings () (at <e43ddaa261164e408c576121c269cf5b>:0) AkWwiseInitializationSettings.InitializeSoundEngine () (at <e43ddaa261164e408c576121c269cf5b>:0) AkSoundEngineController.Init (AkInitializer akInitializer) (at <034701ab4b354a619603fe6d965e8c00>:0) AkInitializer.OnEnable () (at <034701ab4b354a619603fe6d965e8c00>:0)

wicked wyvern
#

class AkWwiseInitializationSettings

timber cedar
#

so are we calling Wwise inside of spacewarp?

#

no right?

wicked wyvern
#

nope

timber cedar
#

how did the issue happen then

#

xd

wicked wyvern
#

the game does during the loading

timber cedar
#

what could be the difference between 1.0.1 and 1.1.0 if we dont call it

wicked wyvern
#

and since SpaceWarp modifies the loading of the game, somewhere there must be some issue

timber cedar
#

there is the error message about it finding multiple of them

#
[WRN 14:12:54.326] WwiseUnity: There are multiple AkWwiseInitializationSettings objects instantiated; only one will be used.
wicked wyvern
#

didn't even see that

timber cedar
#

yeah

#

it makes me think that we might be going back in the flow two times some how

#

something gets recalled

wicked wyvern
#

yeah it looks that way

distant plaza
#

Also, with 1.1.0 all vessels and debris are prefixed with a 'CelestialBody/'. I don't think that was intentional.

timber cedar
#

lmao

wicked wyvern
#

oh lord

#

looks like localization might be the culprit

timber cedar
wicked wyvern
#

(or just a symptom klueless )

#

"CoroutineFoo"

#

that's inside the GameManager class lol

timber cedar
#

"CoroutineFoo"

#

💀

#

is it the issue xd

wicked wyvern
#

no no

#

but it's funny

timber cedar
#

i didnt think so klueless

#

yeah