Jump to content

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


sarbian

Recommended Posts

1 hour ago, KerbMav said:

Turns out my patch works just fine (now, after already forgetting what Starwaster told me).


@tankCost[*,;] = 5000
@tankCost[*,;] *= #$basePartMass$

But FSfuelSwitch must do something else that kerbs it afterwards.

I forget about FSFuelSwitch but is it possible some of their fields might be set negative on occasion? For instance, in Real Fuels, a -1 baseMass for the tank module means that it uses the part.mass instead of calculating basemass + tank masses... maybe FSFS does something similar? Why not look at your ModuleManager.ConfigCache and see if it's got negative values for that or any of the other values you're operating on?

Link to comment
Share on other sites

5 hours ago, Starwaster said:

ModuleManager.ConfigCache

Original line from the part.cfg and full .cfg:

tankCost = 225280;89600;38400;102400;40960;19200000;256000;1822720;1024000;320000;512;2022400;896000;4096000;256000;64000;1280;38400;1280;2560;32000000;1920000;64000;64000
Spoiler

PART
{
// --- general parameters ---
name = C3_Kontainer_04
module = Part
author = RoverDude

// --- asset parameters ---

rescaleFactor = 1
MODEL
{
    model = UmbraSpaceIndustries/Kontainers/Assets/Kontainer
    texture = Kontainer_11, UmbraSpaceIndustries/Kontainers/Assets/Kontainer_03
    scale = 4,4,4
}

// --- node definitions ---
// definition format is Position X, Position Y, Position Z, Up X, Up Y, Up Z
node_stack_side   =     0.0, 0.0,-2.0,         0, 0,-1,    3
node_stack_side_1 =     0.0, 0.0, 2.0,         0, 0, 1,    3
node_stack_side_2 =    -2.0, 0.0, 0.0,        -1, 0, 0,    3
node_stack_side_4 =     2.0, 0.0, 0.0,         1, 0, 0,    3
node_attach = 0,0,-2,0,0,1,3
node_stack_top = 0.0, 4, 0.0, 0.0, 1.0, 0.0, 3
node_stack_bottom = 0, -4, 0.0, 0.0, -1.0, 0.0, 3

breakingForce = 2072
breakingTorque = 2072


// --- editor parameters ---
TechRequired = heavierRocketry
entryCost = 7600
cost = 63360
category = none
subcategory = 0
title = Kontainer (05.0m)
manufacturer = USI - Logistics Division
description = Shipping container for transporting various goods

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,1,1,1,0

 

// --- standard part parameters ---
mass = 16
dragModelType = default
maximum_drag = 0.20
minimum_drag = 0.15
angularDrag = 2
crashTolerance = 8
maxTemp = 2000
bulkheadProfiles = size4,srf

    MODULE
    {
        name = FStextureSwitch2
        textureNames = UmbraSpaceIndustries/Kontainers/Assets/Kontainer_00;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_01;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_02;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_03;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_04;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_05;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_06;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_07;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_09;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_10;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_11;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_12;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_13;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_14;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_15;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_16;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_17;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_18;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_20;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_23;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_22;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_19;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_21;UmbraSpaceIndustries/Kontainers/Assets/Kontainer_24
        objectNames = Kontainer
        textureDisplayNames = MetallicOre;Uraninite;Substrate;Minerals;Karbonite;Commodities;MaterialKits;Metals;Polymers;Supplies;Ore;Machinery;Recyclables;SpecializedParts;Fertilizer;Hydrates;Gypsum;Dirt;Silicates;Silicon;RefinedExotics;ColonySupplies;Organics;Rock
        useFuelSwitchModule = true
        fuelTankSetups = 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
        repaintableEVA = true
        nextButtonText = Next Cargo
        prevButtonText = Previous Cargo
        moduleID = 2
    }

    MODULE
    {
        name = FSfuelSwitch
        resourceNames =MetallicOre;Uraninite;Substrate;Minerals;Karbonite;ExoticMinerals,RareMetals;MaterialKits;Metals;Polymers;Supplies;Ore;Machinery;Recyclables;SpecializedParts;Fertilizer;Hydrates;Gypsum;Dirt;Silicates;Silicon;RefinedExotics;ColonySupplies;Organics;Rock
        resourceAmounts = 128000;128000;128000;128000;128000;64000,64000;128000;128000;128000;128000;25600;128000;128000;128000;128000;128000;128000;128000;128000;128000;128000;128000;128000;128000
        initialResourceAmounts = 0;0;0;0;0;0,0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
        tankCost = 225280;89600;38400;102400;40960;19200000;256000;1822720;1024000;320000;512;2022400;896000;4096000;256000;64000;1280;38400;1280;2560;32000000;1920000;64000;64000
        basePartMass = 16
        tankMass = 0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
        hasGUI = false
    }

    MODULE
    {
        name = USI_ModuleResourceWarehouse
    }
    MODULE
    {
        name = USI_ModuleRecycleBin
    }
    MODULE
    {
        name = ModuleWeightDistributableCargo
    }
}

My Cache for the same part:

tankCost = 80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000;80000

All the same for:

@tankCost[*,;] = 5000
@tankCost[*,;] *= #$/mass$

Edit: Ahm ... without doing anything the prices are actually the same - but for Rock resource where it is double the cost.

@RoverDude What are you doing to me? :D

All I wanted to do was change two resources to fit into Simple Construction - but the Kontainer-4 for RocketParts would cost 3Mf+ empty ...

Edited by KerbMav
Link to comment
Share on other sites

1 hour ago, KerbMav said:

All the same for:


@tankCost[*,;] = 5000
@tankCost[*,;] *= #$/mass$

That patch first sets each item in the tankCost list to 5000 then the second line multiplies each item in the tankCost list by the part's mass (16) so end result as you see is every value in the list set to 5000 * 16 = 80000. What are you trying to get it to do?

Link to comment
Share on other sites

6 minutes ago, Aelfhe1m said:

That patch first sets each item in the tankCost list to 5000 then the second line multiplies each item in the tankCost list by the part's mass (16) so end result as you see is every value in the list set to 5000 * 16 = 80000. What are you trying to get it to do?

Exactly that. Yet in the VAB the price goes wild for each part, some thousands into the negatives.

Even if I do nothing - or edit the cost of the part itself, ignoring FuelSwitch - it does work for all resources but Rock (double price) and RocketParts (57,xx times the price) - for the empty container even.

Spoiler

@PART[*]:HAS[@MODULE[FSfuelSwitch]:HAS[#resourceNames[MetallicOre;Uraninite;Substrate;Minerals;Karbonite;ExoticMinerals,RareMetals;MaterialKits;Metals;Polymers;Supplies;Ore;Machinery;Recyclables;SpecializedParts;Fertilizer;Hydrates;Gypsum;Dirt;Silicates;Silicon;RefinedExotics;ColonySupplies;Organics;Rock]]]
{
    @cost = #$mass$    
    @cost *= 4000
    
    @MODULE[FStextureSwitch2]
    {
        @textureDisplayNames[7,;] = Metal
        @textureDisplayNames[13,;] = RocketParts
    }
    
    @MODULE[FSfuelSwitch]
    {
        @resourceNames[7,;] = Metal
        @resourceNames[13,;] = RocketParts
        //@tankCost[*,;] = 5000
        //@tankCost[*,;] *= #$/mass$
        //@tankCost[*,;] *= #$basePartMass$
    }    
}

 

Edited by KerbMav
Link to comment
Share on other sites

@KerbMav I haven't played around with FireSpitter tanks much (I prefer MFT) but a little experimenting suggests that in order to get the same dry cost for each tank type you need to set the tankCost based on the amount of resource and the cost per unit for that resource.

A simple example:

@PART[fuelTankSmallFlat] // FL-T100
{
	
	MODULE
    {
        name = FSfuelSwitch
        resourceNames =LiquidFuel;Oxidizer;XenonGas;MonoPropellant
        resourceAmounts = 100;100;100;100
        initialResourceAmounts = 0;0;0;0;
        tankCost = 80;18;400;120 // unit costs per resource are 0.8, 0.18, 4 and 1.2 as defined in /GameData/Squad/Resources/ResourcesGeneric.cfg
        basePartMass = 16
        tankMass = 0;0;0;0;
        hasGUI = true
    }
}

The tank should always cost 150 funds empty but the price full will be that plus cost of 100 units of the chosen resource

Edited by Aelfhe1m
Added part title
Link to comment
Share on other sites

Heureka!

Spoiler

@MODULE[FSfuelSwitch]
    {
        @resourceNames[13,;] = RocketParts
        @tankCost[13,;] = #$resourceAmounts[13,;]$
        @tankCost[13,;] *= 1.5
    }   

@Sigma88 @Starwaster @Aelfhe1m

Thank you for joining me on this journey. :wink:

Addendum: In the end I decided to get SimpleConstruction into line and make it use Metals instead of Metal ...

Now - why are RocketParts so damn cheap compared to the material used to make them ...

Edited by KerbMav
Link to comment
Share on other sites

2 hours ago, Cpt Kerbalkrunch said:

Tried to install this last night, but google kept blocking it; saying that it was trying to redirect me and steal information or something. It's listed as being necessary for SVE (which I just installed), so I'm not sure what to do. Any help would be appreciated. Thanks.

Ignore Google and go there anyway

Link to comment
Share on other sites

1 hour ago, Starwaster said:

Ignore Google and go there anyway

He clarified over in the SVE thread that it was a warning about an expired certificate – from Chrome (e.g. Google), I guess.  I checked today and there's a new certificate just issued today, so it looks like it's been resolved for now.  The certificate is from Let's Encrypt, though, so it needs to be renewed every 90 days.  The software that handles that (e.g. certbot) might be waiting a little too long before renewing.  (Or maybe it switched over to the new certificate before its validity period began.)

Link to comment
Share on other sites

8 hours ago, Wyzard said:

He clarified over in the SVE thread that it was a warning about an expired certificate – from Chrome (e.g. Google), I guess.  I checked today and there's a new certificate just issued today, so it looks like it's been resolved for now.  The certificate is from Let's Encrypt, though, so it needs to be renewed every 90 days.  The software that handles that (e.g. certbot) might be waiting a little too long before renewing.  (Or maybe it switched over to the new certificate before its validity period began.)

Let's Encrypt have updated their protocol a while ago and I did not update my clients (I don't use certbot). The cert should be renewed every 30 days but that failed for the last 2 month...

Link to comment
Share on other sites

7 minutes ago, KerbMav said:

@sarbian or anyone else: Is there a function to round a value down/cut of anything behind the decimal?

There is no specific function to do that but you can do it with regular expression replacement, here is an example where I remove everything after the decimal point:

https://github.com/blowfishpro/B9-Aerospace/blob/8e0aec6a322b5be30025f551930c5b71998f3263/GameData/B9_Aerospace/B9_Aerospace-Globals.cfg#L68

Link to comment
Share on other sites

On 10/25/2013 at 8:02 AM, sarbian said:

If your mod includes a DLL put all your MM patch nodes in the :FOR[yourMod] pass.

If your mod does not include a DLL, then pick a name for your mod THAT DOES NOT CONFLICT WITH ANY OTHER MOD'S DLL, and then put all your MM patch nodes in the :FOR[yourMod] pass.

If you do this, other mods can use :BEFORE[yourMod] and :AFTER[yourMod] to politely modify things furthr at the correct sequence.

Can :FOR[MyNewModName] stop a patch from being loaded (no DLL)? I'm seeing that right now. If I change this:

@Kopernicus:AFTER[Kopernicus]

to this:

@Kopernicus:AFTER[Kopernicus]:FOR[MyNewModName]

then my changes disappear from the game. If I remove the :FOR clause, then they come back. (I also tried @Kopernicus:FOR[MyNewModName]:AFTER[Kopernicus], and the result was the same.) Do I need an additional block somewhere specifying when MyNewModName should be loaded when it's not a DLL?

Link to comment
Share on other sites

21 minutes ago, HebaruSan said:

Can :FOR[MyNewModName] stop a patch from being loaded (no DLL)? I'm seeing that right now.

You can only have one of BEFORE/FOR/AFTER. 

A mod entry is created for each dll name, each folder directly under GameData and each FOR[xxx].

So you can not combine FOR to declare a new mod and call it at a specific timing with an AFTER BEFORE. Which is kinda stupid actually but it may be a bit late to fix it...

Link to comment
Share on other sites

15 minutes ago, sarbian said:

You can only have one of BEFORE/FOR/AFTER. 

Thanks! That clarifies a lot.

15 minutes ago, sarbian said:

A mod entry is created for each dll name, each folder directly under GameData and each FOR[xxx].

So you can not combine FOR to declare a new mod and call it at a specific timing with an AFTER BEFORE. Which is kinda stupid actually but it may be a bit late to fix it...

So if my file is GameData/MyNewModName/MyNewModName.cfg, then can other mods still use :BEFORE[MyNewModName] even if I never use :FOR[]?

Link to comment
Share on other sites

2 minutes ago, HebaruSan said:

Thanks! That clarifies a lot.

So if my file is GameData/MyNewModName/MyNewModName.cfg, then can other mods still use :BEFORE[MyNewModName] even if I never use :FOR[]?

Yep, because of the folder name.

Link to comment
Share on other sites

10 minutes ago, KerbMav said:

@blowfish So do I just add a line with


 @maxAmount ^= :\.\d+::

or do I have to change anything for my needs?


maxAmount = 18
@maxAmount /= 3.14
@maxAmount *= 2.09

 

yeah, that should work, it basically just finds a period followed by one or more numbers and removes them

Link to comment
Share on other sites

26 minutes ago, DStaal said:

Yep, because of the folder name.

20 minutes ago, sarbian said:

Yes and Yes.

Excellent, thanks! Next question: I'd like my patch to be loaded after RealSolarSystem, if it's installed, otherwise after Kopernicus. (Kopernicus uses parent-milliradius units for certain values, so it's simple to fit them to different scales.) Is there a concise way to manage multiple dependencies, some of which are optional?

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...