Jump to content

ilmcamam

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by ilmcamam

  1. Perhaps a bit of a strange use case, but is it possible to copy arbitrarily many of a top-level node?

    The MM_PATCH_LOOP {} functionality does not seem to trigger under any circumstances if the operation for the top-level node is copy. The example case given here, which would be perfect:

    Spoiler
    Spoiler

     

    Specifically:

    TEST
    {
    	name = Test
    }
    
    @TEST
    {
      copy = 5
    }
    
    $TEST[Test]:HAS[#copy[>0]]
    {
    	*@TEST[Test]/copy -= 1
    	
    	@name = #$name$$copy$	
    
    	MM_PATCH_LOOP {}
    }

     

    - does not seem to work, even explicitly as presented there (copy-pasted) - the relevant region of the config cache is as follows:

    Spoiler
    <preamble>
    UrlConfig
    {
    	parentUrl = TestPatches/test.cfg
    	TEST
    	{
    		name = Test
    		copy = 4
    	}
    }
    UrlConfig
    {
    	parentUrl = TestPatches/test.cfg
    	TEST
    	{
    		name = Test5
    		copy = 5
    		MM_PATCH_LOOP
    		{
    		}
    	}
    }
    <more patches>

     

    The log (expectedly) makes no mention of a loop -

    <unrelated before>
    [LOG 06:33:10.700] Applying update SXT/Patches/SquadPartTweaks/Satellite_Contract_Satisfaction/@Contracts to Squad/Contracts/Contracts.cfg/Contracts
    [LOG 06:33:10.702] Applying update TestPatches/test/@TEST to TestPatches/test.cfg/TEST[Test]
    [LOG 06:33:10.703] Applying copy TestPatches/test/$TEST[Test]:HAS[#copy[>0]] to TestPatches/test.cfg/TEST[Test]
    [LOG 06:33:10.705] Applying update VenStockRevamp/Patches/IVA-Placeholders/@PART[InflatableHAB]:HAS[!INTERNAL] to VenStockRevamp/PartBin/Data/Command.cfg/PART[InflatableHAB]
    <unrelated hereafter>

    The first update being the addition of the count, and then the copy, with no subsequent looping. Those are the only two mentions (barring the "what files changed" at the top of the MM section of ksp.log) of test.cfg.

    In my testing, barring the occasional user-error infinite loop, edit-looping works flawlessly.

    Is it possible to somehow replicate this another way? For instance, something akin to:

    @PART[*]:HAS[#condition]
    {
    	// somehow copy a different top-level node
    	*@TOPLEVEL[Copy]/attribute = foo
    }

    Swapping the *@ for a *$ (and changing name rather than some other attribute) merely introduces an error - is there a way to accomplish this, if the failing loop on a copy operation is intended behaviour?

    Edit: A test case on a fresh install of stock KSP (rather than a slightly out of date RP-1 installation) with MM downloaded through CKAN behaved identically:

    Spoiler

    Patch:

    Spoiler
    TEST
    {
    	name = Test
    }
    
    @TEST
    {
    	copy = 5
    }
    
    $TEST[Test]:HAS[#copy[>0]]
    {
    	*@TEST[Test]/copy -= 1
    	
    	@name = #$name$$copy$	
    
    	MM_PATCH_LOOP {}
    }
    TESTA
    {
    	name = Testa
    }
    @TESTA
    {
    	copy = 5
    }
    @TESTA[Testa*]:HAS[#copy[>0]]
    {
    	@copy -= 1
    	
    	@name = #$name$$copy$	
    
    	MM_PATCH_LOOP {}
    }

     

    Cache:

    Spoiler
    <stock game stuff>
    UrlConfig
    {
    	parentUrl = TestPatches/test.cfg
    	TEST
    	{
    		name = Test
    		copy = 4
    	}
    }
    UrlConfig
    {
    	parentUrl = TestPatches/test.cfg
    	TEST
    	{
    		name = Test5
    		copy = 5
    		MM_PATCH_LOOP
    		{
    		}
    	}
    }
    UrlConfig
    {
    	parentUrl = TestPatches/test.cfg
    	TESTA
    	{
    		name = Testa43210
    		copy = 0
    	}
    }
    EOF

     

    MM section of ksp.log:

    Spoiler
    #### BEGIN MODULEMANAGER LOG ####
    
    
    [LOG 07:16:52.596] Log started at 2022-06-08 07:16:52.596
    [LOG 07:16:54.173] Checking Cache
    [LOG 07:16:56.145] SHA generated in 1.970s
    [LOG 07:16:56.145]       SHA = A0-69-60-89-E5-62-88-CB-93-53-6B-EA-2A-C8-FB-E8-8F-10-B9-F9-A8-9B-C1-5F-5B-0C-50-F1-88-2B-52-29
    [LOG 07:16:56.149] Pre patch init
    [LOG 07:16:56.288] compiling list of loaded mods...
    Mod DLLs found:
      Name                                    Assembly Version         Assembly File Version    KSPAssembly Version      SHA256
    
      Assembly-CSharp                         0.0.0.0                  0.0.0.0                  1.12                     002870b4a4e4a332c16afa6334f5cae0b241d02bc910e3af2cc67dacd32a6fa6
      ModuleManager                           4.2.1.0                  4.2.1.0                  2.5                      2eb4963f73a5255163953a270026f50a8f1a7dd27f4bb0dd69dd4699d0f2268b
      KSPSteamCtrlr                           0.0.1.35                 0.0.1.35                                          1675fa4fcb61d014eb1babe7eed703e7f76a1008537ee57ca7cec65cd9ff94ac
    Non-DLL mods added (:FOR[xxx]):
    Mods by directory (sub directories of GameData):
      Squad
      TestPatches
    Mods added by assemblies:
    
    [LOG 07:16:56.293] Loading Physics.cfg
    [LOG 07:16:56.319] Extracting patches
    [LOG 07:16:56.374] Applying patches
    [LOG 07:16:56.375] :INSERT (initial) pass
    [LOG 07:16:56.427] :FIRST pass
    [LOG 07:16:56.427] :LEGACY (default) pass
    [LOG 07:16:56.428] Applying update TestPatches/test/@TEST to TestPatches/test.cfg/TEST[Test]
    [LOG 07:16:56.437] Applying copy TestPatches/test/$TEST[Test]:HAS[#copy[>0]] to TestPatches/test.cfg/TEST[Test]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA to TestPatches/test.cfg/TESTA[Testa]
    [LOG 07:16:56.438] Looping on TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa4]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa43]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa432]
    [LOG 07:16:56.438] Applying update TestPatches/test/@TESTA[Testa*]:HAS[#copy[>0]] to TestPatches/test.cfg/TESTA[Testa4321]
    [LOG 07:16:56.440] :BEFORE[ASSEMBLY-CSHARP] pass
    [LOG 07:16:56.440] :FOR[ASSEMBLY-CSHARP] pass
    [LOG 07:16:56.440] :AFTER[ASSEMBLY-CSHARP] pass
    [LOG 07:16:56.440] :BEFORE[KSPSTEAMCTRLR] pass
    [LOG 07:16:56.440] :FOR[KSPSTEAMCTRLR] pass
    [LOG 07:16:56.440] :AFTER[KSPSTEAMCTRLR] pass
    [LOG 07:16:56.440] :BEFORE[MODULEMANAGER] pass
    [LOG 07:16:56.440] :FOR[MODULEMANAGER] pass
    [LOG 07:16:56.440] :AFTER[MODULEMANAGER] pass
    [LOG 07:16:56.440] :BEFORE[SQUAD] pass
    [LOG 07:16:56.440] :FOR[SQUAD] pass
    [LOG 07:16:56.440] :AFTER[SQUAD] pass
    [LOG 07:16:56.440] :BEFORE[TESTPATCHES] pass
    [LOG 07:16:56.440] :FOR[TESTPATCHES] pass
    [LOG 07:16:56.440] :AFTER[TESTPATCHES] pass
    [LOG 07:16:56.441] :FINAL pass
    [LOG 07:16:56.441] Done patching
    [LOG 07:16:56.441] Saving Cache
    [LOG 07:16:56.537] Saving cache
    [LOG 07:16:57.517] ModuleManager: 8 patches applied
    
    [LOG 07:16:57.517] Ran in 3.343s
    [LOG 07:16:57.604] Done!
    
    
    
    #### END MODULEMANAGER LOG ####

     

     

    Just a sanity check to make sure it wasn't a specific issue with the install I was working with.

×
×
  • Create New...