Jump to content

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


sarbian

Recommended Posts

hi there, I have a question to which I couldn't find the answer

in order to rename a module, would something like this work?

@example[oldname]:FINAL

{

@name = newname

}

or should I remove the whole block and add another identical but with a different name?

!example[oldname]{}:FINAL

example

{

name = newname

//bunch of stuff

}

Link to comment
Share on other sites

I am having trouble adding a resource to a part. I want to make a version of a tank that has only liquid fuel. Here is my code:


+PART[fuelTankSmallFlat]
{
@name = fuelTankSmallFlatLiquid
@TechRequired = nuclearPropulsion
@entryCost = 5000
@cost = 250
@title = FL-T100L Fuel Tank
@description = With the advent of nuclear propultion, oxidiser is no longer needed for interplanetary missions. Our engineers have followed suit and made liquid-only versions of many popular fuel tanks.

@RESOURCE
{
name = LiquidFuel
amount = 100
maxAmount = 100
}
}

- - - Updated - - -

the part will appear in-game, but it will have the default fuel values

Link to comment
Share on other sites

I think it should be like this:

(?? Being the amount of LiquidFuel you would like it to have.)


+PART[fuelTankSmallFlat]
{
@name = fuelTankSmallFlatLiquid
@TechRequired = nuclearPropulsion
@entryCost = 5000
@cost = 250
@title = FL-T100L Fuel Tank
@description = With the advent of nuclear propultion, oxidiser is no longer needed for interplanetary missions. Our engineers have followed suit and made liquid-only versions of many popular fuel tanks.

[B] !RESOURCE[Oxidizer] {}[/B]

[B]@RESOURCE[LiquidFuel][/B]
{
[B]@amount = ??[/B]
[B]@maxAmount = ??[/B]
}
}

From the examples in the first post:


@PART[SomePart] // change Some PART
{
@mass = 0.625 // change SomePart's mass to 0.625
@description = SomePart: now uses Xenon!

@MODULE[ModuleEngines] // change SomePart's ModuleEngines MODULE
{
@maxThrust = 2.25 // change maxThrust to 225

@PROPELLANT[LiquidFuel] // change its LiquidFuel propellant
{
@name = XenonGas // use XenonGas instead
@ratio = 1.0 // change the ratio
}
!PROPELLANT[Oxidizer] {} // remove the Oxidizer propellant completely.
}

RESOURCE // add a new resource to this part
{
name = ElectricCharge
amount = 100
maxAmount = 100
}
}

Edited by KerbMav
sarbian is always right
Link to comment
Share on other sites

Edit : ninjaed, but there is still an error :)

+ duplicate the part, so you also get the original RESOURCE nodes and since you did not use @ inside the LiquidFuel node you duplicated the values. Have a look at the module manager cache file to see the result.

I would do that :


+PART[fuelTankSmallFlat]
{
@name = fuelTankSmallFlatLiquid
@TechRequired = nuclearPropulsion
@entryCost = 5000
@cost = 250
@title = FL-T100L Fuel Tank
@description = With the advent of nuclear propultion, oxidiser is no longer needed for interplanetary missions. Our engineers have followed suit and made liquid-only versions of many popular fuel tanks.

// Delete the Oxidizer node
-RESOURCE[Oxidizer] { }

// Edit the LiquidFuel node
@RESOURCE[LiquidFuel]
{
@amount = 100
@maxAmount = 100
}
}

Link to comment
Share on other sites

Ok, I tried that, and it got rid of the Oxidiser, but I still have only the default LF value.

+PART[fuelTankSmallFlat]
{
@name = fuelTankSmallFlatLiquid
@TechRequired = nuclearPropulsion
@entryCost = 5000
@cost = 250
@title = FL-T100L Fuel Tank
@description = With the advent of nuclear propultion, oxidiser is no longer needed for interplanetary missions. Our engineers have followed suit and made liquid-only versions of many popular fuel tanks.

!RESOURCE[Oxidizer] {}

@RESOURCE [LiquidFuel]
{
amount = 100
maxAmount = 100
}
}

Link to comment
Share on other sites

Edit : ninjaed, but there is still an error :)

And why -RESOURCE instead of !RESOURCE ? Redundant?

Ok, I tried that, and it got rid of the Oxidiser, but I still have only the default LF value.

Heyah young one, school is important, especially when I see the typos you made! :wink:

Check the changes at the fuel amounts, the @ was missing as sarbian pointed out.

wouldn't it be simpler to just add a cfg with a new part instead?

He can keep the MM config file in his own folder and copy it to a new version after an update/reinstall without having to move through all Squad part folders.

Edited by KerbMav
Link to comment
Share on other sites

And why -RESOURCE instead of !RESOURCE ? Redundant?

Both works the same.

wouldn't it be simpler to just add a cfg with a new part instead?

He can keep the MM config file in his own folder and copy it to a new version after an update/reinstall without having to move through all Squad part folders.

That and the fact that this is the MM thread. Nice Curse logo by the way.

Link to comment
Share on other sites

He can keep the MM config file in his own folder and copy it to a new version after an update/reinstall without having to move through all Squad part folders.

I'm a bit lost here

let's say you want to make a part like the stock Mk1 Liquid Fuel Fuselage (cfg file here), but with Oxidizer instead of liquid fuel

can't you just put a cfg in your folder with inside:

PART{

name = MK1Oxidizer

module = Part

author = C7studios // or whatever you want

scale = 0.0125

rescaleFactor = 1

node_stack_top = 0.0, 75.0, 0.0, 0.0, 1.0, 0.0

node_stack_bottom = 0.0, -75.0, 0.0, 0.0, -1.0, 0.0

node_attach = 0.0, 0.0, -51.0, 0.0, 0.0, 1.0, 1

TechRequired = aerodynamicSystems // or whatever you want

entryCost = 4600 // or whatever you want

cost = 550 // or whatever you want

category = FuelTank

subcategory = 0

title = Mk1 Oxidizer Fuselage // or whatever you want

manufacturer = C7 Aerospace Division // or whatever you want

description = A standard fuselage that carries fuel for spaceplanes. This one is chock-full of jet fuel. Not as resistant as its counterparts, but jet fuel is more efficient than the other fuels, without mentioning lighter.

attachRules = 1,1,1,1,0

mass = 0.15

dragModelType = default

maximum_drag = 0.2

minimum_drag = 0.3

angularDrag = 2

crashTolerance = 20

breakingForce = 50

breakingTorque = 50

maxTemp = 2000 // = 3000

fuelCrossFeed = True

bulkheadProfiles = size1, srf

MODEL

{

model = Squad/Parts/Structural/mk1Parts/mk1Fuselage

scale = 1.25, 1.25, 1.25

}

RESOURCE

{

name = Oxidizer

amount = 150 // or whatever you want

maxAmount = 150 // or whatever you want

}

}

granted, it's a bit longer (more characters) than making a MM config but it have some advantages:

1- if you forget to put in MM and load the game you won't lose any craft since the game will find the parts anyway and won't remove the crafts that use it

2- if stock KSP adds/removes/changes resources to the part if you are using a MM config you will have to change it, if you are adding a new part you don't need to worry

3- it's much quicker to do since you don't need to worry about how MM will read your cfg file

4- you may even copy the model in your custom folder so that if stock changes/removes the part your custom part will be always safe

unless there is a major problem I'm missing :D

anyway this is just a suggestion, maybe you do rather use MM :)

- - - Updated - - -

That and the fact that this is the MM thread.

Don't get me wrong, I love MM I make an heavy use of it and I would never undermine it's utility, I was just giving what I thought was a good advice

I hope you didn't find it rude :)

Nice Curse logo by the way.

Sarcasm? :D

Edited by Sigma88
Link to comment
Share on other sites

1- You must put your file in the same dir as the model and texture (unless you change your cfg to use MODEL node but it requires edits that are way more complex than a MM patch).

2- Not if you write your config right. I wrote the patch I use in my main game in .24.5 and they did not change much. And if the part change in other ways (like adding a contract test module as they did in 0.90) you don't have to do anything.

3- MM does not read the file. KSP does.

4- it is a lot easier for end user to handle when you distribute a mod. You have all your mod file in a specific folder and they can uninstall the mod just by deleting the folder

5- It lets you do wide part editing without overwriting stock file or conflicting with other mods. Some mod need to add a module to a lot of part and MM make this easy

Sarcasm? :D

From me ? Come on!

Link to comment
Share on other sites

Just a small bug report. Not sure if this was always the case as I wasn't modifying this particular resource before 1.0, but the "EVA Propellant" resource has a space in it that MM doesn't seem to like, so something like this:


@RESOURCE_DEFINITION[EVA Propellant]

Will generate a MM error during load, but with no reporting as to the cause other than the file name that contains the patch.

Worked around it with this:


@RESOURCE_DEFINITION[EVA*]

So not an issue for me, but just wanted to give a head's up on this in case someone else runs into it.

Link to comment
Share on other sites

Hey guys, need a quick MM help if at all possible. I searched the thread, but failed to find anything to answer my question (probably my own failure at searching :P)

Trying to change a ResorceName in a module that has two sub nodes with the same name not exactly sure the best way to address them.

config example:




MODULE
{
name = ExConverter
StartActionName = Start Metal Conversion
StopActionName = Stop Metal Conversion
INPUT_RESOURCE
{
ResourceName = MetalOre
Ratio = 0.09581
}
INPUT_RESOURCE
{
ResourceName = ElectricCharge
Ratio = 10
}
OUTPUT_RESOURCE
{
ResourceName = Metal
Ratio = 0.699431
}
}

The goal is to change the first INPUT_RESOURCE to the stock Ore, but not sure how to accomplish that. I know about the tag system, but not sure its usable if the orginal cfg doesnt have tags.

Any help is appreciated. Thanks!

Link to comment
Share on other sites

Id like to point out that the new modulemanager BREAKS SAVE GAMES when disabled. With 2.6.1 i could enable it alongside some mods, and then when i was running some uber large part counts i could move it out of the save directory and run the same save bone stock.

I believe it has something to do with the new tech tree and physics features, not that i consider these bad, but they are doing something to the save games you run modulemanager on that you need to keep modulemanager installed or itll break the save game making it impossible to create craft.

Until this is fixed im sticking to 2.6.1, it still works and given i never use any tech tree/physics mods, nor do i even play career/science for that matter, i prefer the ability to enable/disable MM as i please instead of having saves permanently addicted to MM and refusing to get off the drug nomatter what i do.

Link to comment
Share on other sites


@RESOURCE_DEFINITION[EVA Propellant]

Spaces in names for indexing are indicated by '?' characters. eg.

@RESOURCE_DEFINITION[EVA?Propellant]

- - - Updated - - -

The goal is to change the first INPUT_RESOURCE to the stock Ore, but not sure how to accomplish that. I know about the tag system, but not sure its usable if the orginal cfg doesnt have tags.

Either of these approaches should work


@PART
[*]
{
@MODULE[ExConverter]
{
@INPUT_RESOURCE,0 [COLOR=#ff0000]// first INPUT_RESOURCE node[/COLOR]
{
@ResourceName = newName
}
@INPUT_RESOURCE:HAS[#ResourceName[MetalOre]] [COLOR=#ff0000]// HAS/NEEDS work on subnodes, not just the top node[/COLOR] [COLOR=#ff0000](can't index it but there should be no duplicates in this application)[/COLOR]
{
@ResourceName = newName
}
}
}

As it's the first node, just using @INPUT_RESOURCE may also work (but is not recommended)

Edited by Crzyrndm
Link to comment
Share on other sites

@RESOURCE_DEFINITION[EVA?Propellant]

Thanks man. I was not aware of that, as I had never run into it before. Is that a single-character wildcard, or is it specifically for spaces?

Apologies for the erroneous bug report then.

Edited by FlowerChild
Link to comment
Share on other sites

FlowerChild: It's a single character wildcard.

Note that it's not MM's fault: KSP truncates all node names at the first space, so @RESOURCE_DEFINTION[EVA Propellant] is already truncated to @RESOURCE_DEFINITION[EVA by the time MM gets to see the nodes; the truncation is done on file load by KSP.

Link to comment
Share on other sites

Okay, I'm having a few (well, actually one) Problems with variables, I think.

I'm trying to write a small patch that adds FSfuelSwitch to stock tanks.

@PART[fuelTank3-2]:NEEDS[Firespitter]:HAS[!MODULE[FSfuelSwitch]] {
// original values
resLF = #$/RESOURCE[LiquidFuel]/amount$
maxLF = #$/RESOURCE[LiquidFuel]/maxAmount$
resO = #$/RESOURCE[Oxidizer]/amount$
maxO = #$/RESOURCE[Oxidizer]/maxAmount$

// combined LF+O values
resComb = resLF
resComb += resO
maxComb = maxLF
maxComb += maxO

// create FSfuelSwitch
MODULE {
name = FSfuelSwitch
resourceNames = LiquidFuel,Oxidizer; LiquidFuel; Oxidizer
//resourceAmounts = maxLF,maxO; maxComb; maxComb
//initialResourceAmounts = resLF,resO; resComb; resComb
resourceAmounts = 100,100; 200; 200
initialResourceAmounts = 100,100; 200; 200
basePartMass = 4
tankMass = 0; 0; 0
tankCost = 0; 0; 0
displayCurrentTankCost = false
hasGui = true
availableInFlight = true
availableInEditor = true
showInfo = true
}

// delete temp variables
!resLF = null
!maxLF = null
!resO = null
!maxO = null
!resComb = null
!maxComb = null

// delete original resources
!RESOURCE[LiquidFuel] {}
!RESOURCE[Oxidizer] {}
}

I used the example from page 142, but it doesn't quite work.

You see, I commented my initial code (resourceAmounts & initialAmounts with variables) out, as it didn't work. The FSfuelSwitch-MODULE itself works fine, as the dummy-code with 100 and 200 as values worked as expected.

Where did I went ...... and ....ed things up? :(

Edit:

Yeah, for one tank this is overengineered, but one might assume I want to extend the functionality to more than just the jumbo-tank ;) also more resources.

Edit: I'd also appreciate any comment on the code, I'm not that experienced and just winged the whole @PART:NEEDS:HAS-thing, dunno if that's actually done well :D

Edit: In case it helps, fsFuelSwitch did show the expected GUI in the Tweakables (also showed the available resources in the tooltip)when I used the variables in the code, but it didn't show any actual resources in the Tweakables.

Edit: Okay, it's getting weirder and weirder...

	resComb = #$resLF$
resComb += #$resO$
maxComb = #$maxLF$
maxComb += #$maxO$

// create FSfuelSwitch
MODULE {
name = FSfuelSwitch
resourceNames = LiquidFuel,Oxidizer; LiquidFuel; Oxidizer
resourceAmounts = #$maxLF$,#$maxO$; #$maxComb$; #$maxComb$
initialResourceAmounts = #$resLF$,#$resO$; #$resComb$; #$resComb$

Ingame, FSfuelSwitch is now displaying

"LiquidFuel 100/100" (no Oxidizer),

"LiquidFuel 75/75",

"Oxidizer 200/200"

I even deleted (not only out-commented) the "dummy-lines" with 100,100;200;200, just to make sure... So no Idea how those numbers end up in-game... Halp! :(

Edited by cy-one
Link to comment
Share on other sites

arg, I really need to edit that example.

All the key are processed before the code, so when you deletes them they are not here for grabbing by the node. And you node variable call are wonrg.


@PART[fuelTank3-2]:NEEDS[Firespitter]:HAS[!MODULE[FSfuelSwitch]] {
// original values
resLF = #$/RESOURCE[LiquidFuel]/amount$
maxLF = #$/RESOURCE[LiquidFuel]/maxAmount$
resO = #$/RESOURCE[Oxidizer]/amount$
maxO = #$/RESOURCE[Oxidizer]/maxAmount$

// combined LF+O values
resComb = #$resLF$
resComb += #$resO$
maxComb = #$maxLF$
maxComb += #$maxO$

// create FSfuelSwitch
MODULE {
name = FSfuelSwitch
resourceNames = LiquidFuel,Oxidizer; LiquidFuel; Oxidizer
resourceAmounts = #$/maxLF$,#$/maxO$; #$/maxComb$; #$/maxComb$
initialResourceAmounts = #$/resLF$,#$/resO$; #$/resComb$; #$/resComb$
basePartMass = 4
tankMass = 0; 0; 0
tankCost = 0; 0; 0
displayCurrentTankCost = false
hasGui = true
availableInFlight = true
availableInEditor = true
showInfo = true
}

// delete original resources
!RESOURCE[LiquidFuel] {}
!RESOURCE[Oxidizer] {}
}

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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