Jump to content

[1.8.x-1.12.x] Module Manager 4.2.3 (July 03th 2023) - Fireworks season


sarbian

Recommended Posts

This is probably a quick question, but I can't find the syntax so looking for help.

I have a quick patch to add the 1.11 ModuleInventoryPart to any parts that currently have ModuleKISInventory and what I'd like to do is read the number of slots in the KIS version (which is x by y rows) and use math to add the same total number of Stock Slots to that part. Also do the same thing for Volume.  Pointers to sample code appreciated!

@PART[*]:HAS[@MODULE[ModuleKISInventory],!MODULE[ModuleInventoryPart]]
{
    MODULE
    {
        name = ModuleInventoryPart
        InventorySlots = #$../MODULE[ModuleKISInventory]/slotsX$
        @InventorySlots *= #$../MODULE[ModuleKISInventory]/slotsY$
        packedVolumeLimit = #$../MODULE[ModuleKISInventory]/maxVolume$ 
    }
    
}

Link to comment
Share on other sites

  On 12/19/2020 at 11:30 PM, Atlas Gaming said:

This is probably a quick question, but I can't find the syntax so looking for help.

I have a quick patch to add the 1.11 ModuleInventoryPart to any parts that currently have ModuleKISInventory and what I'd like to do is read the number of slots in the KIS version (which is x by y rows) and use math to add the same total number of Stock Slots to that part. Also do the same thing for Volume.  Pointers to sample code appreciated!

@PART[*]:HAS[@MODULE[ModuleKISInventory],!MODULE[ModuleInventoryPart]]
{
    MODULE
    {
        name = ModuleInventoryPart
        InventorySlots = #$../MODULE[ModuleKISInventory]/slotsX$
        @InventorySlots *= #$../MODULE[ModuleKISInventory]/slotsY$
        packedVolumeLimit = #$../MODULE[ModuleKISInventory]/maxVolume$ 
    }
}

 

Expand  

This all looks correct to me, what in particular isn't working about it?

p.s. code blocks make it a lot easier to read

Link to comment
Share on other sites

Have I got this syntax correct with the nested HAS commands? I'm trying to write a patch for all crewable parts that have a science container - ie specifically not including the external command chair as it doesn't have a ScienceContainer. Wrote this looking at the wiki and think I've got it right, but thought it worth checking.

@PART[*]:HAS[    @MODULE[ModuleCommand],#CrewCapacity[>1]   :HAS[  @MODULE[ScienceContainer]    ]          ] {}

Link to comment
Share on other sites

Hey I'm looking for a couple commands and not finding them in this forum...

First is there an If () {} type command to test conditions before applying a patch?

Second is there a round or ToInteger command?

Or a Div function... or really a list of all the math functions included?

 

Edited by Atlas Gaming
Link to comment
Share on other sites

@Atlas Gaming, I am usually able to use :HAS[] in combination with NEEDS as the basis to apply a patch.  Do you have anything in particular?

I do not know about rounding, but I have found this really clever way to get an integer that is functionally a floor function using regular expressions in Kerbalism.  Think it works through just truncating anything after the point.

@rated_ignitions ^= :\.\d+:: // Floor value to get an integer

@cyberKerb, think it should be as I don't think the > implies greater than or equal

@PART[*]:HAS[@MODULE[ModuleCommand],#CrewCapacity[>0],@MODULE[ModuleScienceContainer]] {}

 

Link to comment
Share on other sites

  On 12/23/2020 at 3:18 AM, hemeac said:

@cyberKerb, think it should be as I don't think the > implies greater than or equal

@PART[*]:HAS[@MODULE[ModuleCommand],#CrewCapacity[>0],@MODULE[ModuleScienceContainer]] {}

 

Expand  

Oops - yep - you're right about that. Thanks for the catch! I'm guessing I got the brackets correct then cheers :) 

Link to comment
Share on other sites

Example would be calculating the number of crew spots in a capsule based on volume.

Volume of 3.4m/crew for instance... so total volume would be a decimal, and I'd want to round it down to an integer after doing the division to see how many crew it could support. (ignore seats and stuff for now)

  This may do it... never though to use RE

  On 12/23/2020 at 3:18 AM, hemeac said:

@rated_ignitions ^= :\.\d+:: // Floor value to get an integer

Expand  

 

Edited by Atlas Gaming
Link to comment
Share on other sites

  On 12/23/2020 at 3:23 AM, Atlas Gaming said:

Example would be calculating the number of crew spots in a capsule based on volume.

Volume of 3.4m/crew for instance... so total volume would be a decimal, and I'd want to round it down to an integer after doing the division to see how many crew it could support. (ignore seats and stuff for now)

  This may do it... never though to use RE

 

Expand  

@Atlas Gaming I came across it randomly, has been really handy for displaying thrust and ISP statistics in descriptions after altering them with multipliers.  There's some other good bits in the code that may come in handy:
 

https://raw.githubusercontent.com/Kerbalism/Kerbalism/master/GameData/KerbalismConfig/System/Reliability.cfg

Link to comment
Share on other sites

In case it helps: this mod seems to work OK for me in KSP 1.11

I've briefly tested it, with the following list of things installed:

KSP 1.11.0.3045 win x64 (Steam)
Making History 1.11.0
Breaking Ground 1.6.0

Chatterer v0.9.99 - Keep talking!
Click Through Blocker 0.1.10.14
Docking Sounds!! 2.1.12.27690 (10/7/16)
E.V.E. Redux 1.11.1.1 (from blackrack) + Configs-1.2.2.1 (from WazWaz)
Final Frontier 1.10.0-3485 + KerbFleet Custom Ribbons 1.2.0
Kerbal Alarm Clock 3.13.0.0
Module Manager 4.1.4
PlanetShine v0.2.6.2 Oct 19, 2019
Rover Wheel Sounds (Revived) v1.8.1.11.20.19 (from DoctorDavinci, .dll overwritten with the one from MAFman)
Scatterer - atmospheric scattering 0.0722
Texture Replacer 4.3
ToolbarController 0.1.9.4
[x] Science! v5.26

Also, thank you very much to the developer(s) of this mod!

Link to comment
Share on other sites

In another thread, @Sovetskysoyuz noticed that a  patch that I posted (as a workaround on the bug-tracker) using Module Manager 4.1.4 at risk with the new KSP 1.11.0,
did not have effect when he loaded KSP, even though it worked for me when I tested it by re-running Module Manager through alt-F11 :

@PHYSICSGLOBALS {
    @partRBMassMin = 0.005  // no effect on initial load of KSP, but takes effect upon alt-F11 reload
    @dragMultiplier = 0     // always works
    @liftMultiplier = 0     // always works
}

From the log, it appears the Module Manager applies the patch without errors.  And all changed entries appear in 'ModuleManager.Physics' and 'ModuleManager.ConfigCache'

[LOG 18:16:08.271] :LEGACY (default) pass
[LOG 18:16:08.275] Applying update /mass/@PHYSICSGLOBALS to /Physics.cfg/PHYSICSGLOBALS

Maybe the new parameter  'partRBMassMin' is read at a different time than the other variables are read from 'Physics.cfg'

Edited by OHara
repair link
Link to comment
Share on other sites

Has anyone produced a patch to reduce fuel tank max temperature but exclude spaceplane parts MK2 and MK3?

EDIT:  This works.

@PART[*]:HAS[#category[FuelTank]]:Final
{
	@maxTemp = 1200
}
@PART[Size3*,externalTankRound,externalTankCapsule,bluedog_DeltaIV_DCSS_5m,bluedog_DCSS_Tank]:Final
{
	@maxTemp = 1200
}
@PART[mk3Fuselage*,adapterMk3*,adapterSize3*,adapterSize2-Mk2]:Final
{
	@maxTemp = 2700
}

 

Edited by NyanTurian
solution found
Link to comment
Share on other sites

  On 12/29/2020 at 6:29 PM, OHara said:

Maybe the new parameter  'partRBMassMin' is read at a different time than the other variables are read from 'Physics.cfg'

Expand  

Ugh, I'll look, if KSP is accessing this before MM has a chance to do its thing then there might not be anything to be done, but maybe it can be set later too.

E: hmm, not seeing anything obviously different here, can you provide more info about what about it doesn't seem to be getting picked up?

Edited by blowfish
Link to comment
Share on other sites

  On 1/2/2021 at 8:28 AM, blowfish said:

can you provide more info, about what about it, doesn't seem to be getting picked up?

Expand  

For the the bug-report I made the simplest craft (link) that I could think of, to show the problem when this new 'partRBMassMin'  has its large default value.   To test if a MM patch to reduce partRMBassMin has the desired effect, one has to load that craft and see which direction it tips over.

Now I notice that even the alt-F11 reload does not always have the effect on the craft -- the first alt-F11 reload after starting KSP takes effect, but then I cannot reverse the change in a further alt-F11 reload.

If I use the alt-F12 menu to write ModuleManager.Physics, the file produced always shows a value for 'partRBMassMin' matching the most recently loaded cfg file.  But if I load a craft and test, the behavior often does not match that expected from the recently loaded cfg.   

I have no reason to expect that modders will want to adjust partRBMassMin.   (I hope Squad will remove this parameter in the course of resolving the reported bug).  The only reason I used a MM patch was to post workaround for the bug, safer than editing Physics.cfg directly.

Link to comment
Share on other sites

  On 1/4/2021 at 12:58 AM, OHara said:

For the the bug-report I made the simplest craft (link) that I could think of, to show the problem when this new 'partRBMassMin'  has its large default value.   To test if a MM patch to reduce partRMBassMin has the desired effect, one has to load that craft and see which direction it tips over.

Now I notice that even the alt-F11 reload does not always have the effect on the craft -- the first alt-F11 reload after starting KSP takes effect, but then I cannot reverse the change in a further alt-F11 reload.

If I use the alt-F12 menu to write ModuleManager.Physics, the file produced always shows a value for 'partRBMassMin' matching the most recently loaded cfg file.  But if I load a craft and test, the behavior often does not match that expected from the recently loaded cfg.   

I have no reason to expect that modders will want to adjust partRBMassMin.   (I hope Squad will remove this parameter in the course of resolving the reported bug).  The only reason I used a MM patch was to post workaround for the bug, safer than editing Physics.cfg directly.

Expand  

Okay I figured out what's happening - MM is delaying replacing physics until the space center, which means that when the part loader reads those values it gets the stock ones.  If you reload the game database it might get the values from the first load.  I can't see any reason why MM shoudln't be able to do the physics thing immediately, so the solution is probably just to do that.

Link to comment
Share on other sites

  On 1/9/2021 at 8:09 PM, blowfish said:

Okay I figured out what's happening - MM is delaying replacing physics until the space center, which means that when the part loader reads those values it gets the stock ones.  If you reload the game database it might get the values from the first load.  I can't see any reason why MM shoudln't be able to do the physics thing immediately, so the solution is probably just to do that.

Expand  

Please check if it would not break TechTree first.  [There should be a reason for the Physics Database and the TechTree being loaded (and reloaded) every time you enter in the Space Centre scene]

Edited by Lisias
post edit (in brackets)
Link to comment
Share on other sites

Once upon a time, MM created a cache of it's patch configuration and only re-solved if the patches were altered. Is this still the case? Mine is doing a fresh solve at every load even if I haven't changed anything. 

Link to comment
Share on other sites

  On 1/11/2021 at 8:29 AM, peteletroll said:

@Omnipius, check the Logs/ModuleManager/ModuleManager.log file, it says what changed.

Expand  
[WRN 00:04:28.827] Errors in patch prevents the creation of the cache
[LOG 00:04:28.940] ModuleManager: 204742 patches applied, found <color=orange>2 errors</color>
2 errors related to GameData/KerbalismConfig/Support/SXT.cfg

Is there a way to override that warning and force cache creation?

I'm also trying to sort out what's wrong with SXT's Kerbalism config:

[LOG 00:01:27.289] Applying update KerbalismConfig/Support/SXT/@PART[SXTDepolyRTGI,SXTDepolyRTGII]:NEEDS[ProfileRealismOverhaul,SXT]:FOR[RP-0-Kerbalism] to SXT/Parts/StationsBases/Electrical/RTG/part.cfg/PART[SXTDepolyRTGII]
[ERR 00:01:27.290] Error - Cannot parse variable search when inserting new key capacity = #$../MODULE[ModuleGenerator]/OUTPUT_RESOURCE[ElectricCharge]/rate$
[LOG 00:01:27.290] Applying update KerbalismConfig/Support/SXT/@PART[SXTDepolyRTGI,SXTDepolyRTGII]:NEEDS[ProfileRealismOverhaul,SXT]:FOR[RP-0-Kerbalism] to SXT/Parts/StationsBases/Electrical/RTG/partBasic.cfg/PART[SXTDepolyRTGI]
[ERR 00:01:27.290] Error - Cannot parse variable search when inserting new key capacity = #$../MODULE[ModuleGenerator]/OUTPUT_RESOURCE[ElectricCharge]/rate$

 

Link to comment
Share on other sites

  On 1/11/2021 at 8:57 AM, Omnipius said:

Is there a way to override that warning and force cache creation?

Expand  

Yes. By fixing the patches with errors. I don't know of any other way.

 

  On 1/11/2021 at 8:57 AM, Omnipius said:

I'm also trying to sort out what's wrong with SXT's Kerbalism config:

Expand  

This is something you will need help from the SXT's maintainer - but asking help from the Kerbalism guys should help too, as something on Kerbalism could had changed and nobody remembered to update the SXT's support for it.

Link to comment
Share on other sites

I'm trying to write a patch to create 0.625m versions of the stock 1.258m fuel tanks.

I wrote this to make a 0.625m version of the FL-T100 Fuel Tank, and it worked perfectly:

  Reveal hidden contents

So I copy-pasted it 3 times and changed the entries to make copies of the FT-200, FT-400 and FT-800.

  Reveal hidden contents

When I run this however, I get 4 errors.

  Reveal hidden contents

I can't for the life of me see why these patches differ from the first. Can someone tell me what I am doing wrong?

I am using a clean install of KSP 1.10.1 with no mods (other than Module Manager) on Windows 10.

Edited by DialoMalison
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...