Jump to content

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


sarbian

Recommended Posts

Well, to test out if the patch works as a generic patch is has to work with more than just a handful of parts.

But thanks to the hint about AND and OR in the same statement.

@KerbMav I tried it with FINAL because some (old) patch files like in RealFuels-Stockalike already got FINAL, but I pruned the most obscure one for now (GameData\RealFuels-Stockalike\Fuel_Conversions.cfg)

@Sigma88 mm configcache is inside the linked .zip, as always when I post logs

KSP.log
ModuleManager.ConfigCache
ModuleManager.Physics
ModuleManager.TechTree
output_log.txt
PartDatabase.cfg

 

Edited by Gordon Dry
Link to comment
Share on other sites

During launch it says this one has 3 errors - everything looks OK in the game, just as I want it to be.

And MM does not create a cache file for me anymore?

// Rate of consumption is 1.8 Supplies per Kerbal per hour at 0.0005/s
// app. 40 (43.2) per 24hrs , so either one (Earth) or four (Kerbal) days worth of Supplies
// Adds about x days worth of Supplies (per kerbal seat) to parts with crew capacity
// Ignores parts that already have Supplies RESOURCE declared as well as cryo pods

@PART[*]:HAS[!RESOURCE[Supplies],#CrewCapacity[>0],!MODULE[DeepFreezer]]
{
	// temporary key for calculations, is removed later
	tempCostSupp = 40
	@tempCostSupp *= 1
	@tempCostSupp *= #$CrewCapacity$
	
	RESOURCE
	{
		name = Supplies
		maxAmount = #$/tempCostSupp$
		amount = #$maxAmount$
	}
	
	RESOURCE
	{
		name= Mulch
		maxAmount = #$/tempCostSupp$
		amount = 0
	}
}

// Multiplies Supplies added above by 10 for pure cabins/quarters
@PART[*]:HAS[!MODULE[ModuleCommand],!MODULE[ModuleResourceConverter],!MODULE[ModuleScienceConverter],@RESOURCE[Supplies],#CrewCapacity[>0]]
{
	@tempCostSupp *= 10
	
	@RESOURCE[Supplies]
	{	
		@maxAmount = #$/tempCostSupp$
		@amount = #$maxAmount$
	}
	
	@RESOURCE[Mulch]
	{
		@maxAmount = #$/tempCostSupp$
	}
}

// Finally calculates costs of Supplies and adds to Costs, removes temporary key
@PART[*]:HAS[@RESOURCE[Supplies],#CrewCapacity[>0]]:FINAL
{
	@tempCostSupp *= 2.5
	@cost += #$tempCostSupp$
	-tempCostSupp = DELETE
}

 

Link to comment
Share on other sites

Lords of Kerbol, hear my prayers!

Found it ... in the oh so unimportant log ...

@PART[*]:HAS[@RESOURCE[Supplies],#CrewCapacity[>0]]:FINAL

This also finds parts that I did not touch, so there is no temporary key to remove.

@PART[*]:HAS[#tempCostSupp[>0]]:FINAL

And one more instance like that also changed and all is well ...

@sarbian Nothing to see ... just an old fool ...

Although - I am puzzled that this should throw an error, other things will not if they do not find what they are told to do?

Edited by KerbMav
Link to comment
Share on other sites

Do not laugh!

I'm actually trying to straighten some RealFuels flaws using that™ patch ...

Well, okay, you may laugh @ -78dB

Edit:

I have to take a break, until RealFuels is fixed and TANK shows resources in VAB which are present in MM cache file ...

Edited by Gordon Dry
Link to comment
Share on other sites

Hi all

Got a question regarding manipulation of a mesh texture using MM ... I'm having an issue changing textures on some parts when the mesh name has a space in it

Is there a work around for this use case ... as in is there a way to get MM to recognize the space in the name or am I pooched on parts with mesh names of this nature?

Link to comment
Share on other sites

40 minutes ago, DoctorDavinci said:

Hi all

Got a question regarding manipulation of a mesh texture using MM ... I'm having an issue changing textures on some parts when the mesh name has a space in it

Is there a work around for this use case ... as in is there a way to get MM to recognize the space in the name or am I pooched on parts with mesh names of this nature?

Do you have an example? I don't see why the space should be an issue

Link to comment
Share on other sites

1 hour ago, DoctorDavinci said:

Hi all

Got a question regarding manipulation of a mesh texture using MM ... I'm having an issue changing textures on some parts when the mesh name has a space in it

Is there a work around for this use case ... as in is there a way to get MM to recognize the space in the name or am I pooched on parts with mesh names of this nature?

You can use a ? in place of the space. That will let you run MM patches against it but doesn't guarantee that there won't be a problem internally with KSP. The proper solution to spaces is for people not to use them.

@Sigma88 Spaces are a problem for Unity URLs; when parsing them, nothing after the space is seen and they require special handling to deal with. Underscores can also be problematic internally and KSP replaces those with a dot. Module Manager can still parse those however.

Link to comment
Share on other sites

7 minutes ago, Starwaster said:

You can use a ? in place of the space. That will let you run MM patches against it but doesn't guarantee that there won't be a problem internally with KSP. The proper solution to spaces is for people not to use them.

@Sigma88 Spaces are a problem for Unity URLs; when parsing them, nothing after the space is seen and they require special handling to deal with. Underscores can also be problematic internally and KSP replaces those with a dot. Module Manager can still parse those however.

Ah ok it's a targetting issue? I wasn't sure from the question

Link to comment
Share on other sites

19 minutes ago, Starwaster said:

You can use a ? in place of the space. That will let you run MM patches against it but doesn't guarantee that there won't be a problem internally with KSP. The proper solution to spaces is for people not to use them.

I'll try that, thanks

10 minutes ago, Sigma88 said:

Ah ok it's a targetting issue? I wasn't sure from the question

It appears that if a model has a mesh name that has a space in it, MM doesn't want to recognize the space so it wont apply the changes that I'm calling for on the section of the model that has the mesh name with a space

Hope the ? works

Edited by DoctorDavinci
Link to comment
Share on other sites

On 8/7/2017 at 1:43 PM, DoctorDavinci said:

It appears that if a model has a mesh name that has a space in it, MM doesn't want to recognize the space so it wont apply the changes that I'm calling for on the section of the model that has the mesh name with a space

As explained earlier it is not a problem with MM but with how KSP parse the cfg. 

For a node definition the parser stops at the first space, line break or { (and possibility some other). So your 

@PART:HAS[#model[xxx yyyy]]

is parsed by KSP (and so seen by MM) as 

@PART:HAS[#model[xxx

 

Link to comment
Share on other sites

4 hours ago, sarbian said:

As explained earlier it is not a problem with MM but with how KSP parse the cfg. 

For a node definition the parser stops at the first space, line break or { (and possibility some other). So your 


@PART:HAS[#model[xxx yyyy]]

is parsed by KSP (and so seen by MM) as 


@PART:HAS[#model[xxx

 

That is what I am seeing with parts that have a space in the mesh name

Thanx for clarifying

Link to comment
Share on other sites

Hi,

I've wrestled through the many hints on texture replacements in this forum, but am still stuck. I hope you can help me. I tried:

+PART[landerCabinSmall]
{
    @name = MacLuky.LanderCanMk12
    @title = Mk1 Lander Can Refurbished
    @manufacturer = MacLuky Space Solutions
	description = After observing subway commuters during rush hour our lead engineer figured out how to add 2 more seats to the interior.
    @mass *= 1.02
    @entryCost *= 1.2
	@cost *= 1.2
	@CrewCapacity = 3

	!mesh = DELETE
    MODEL
	{
		model = Squad/Parts/Command/mk1LanderCan/model
		texture = ksp_s_landerCan_normal, MacLuky_Dev/LanderCanMk12/ksp_s_landerCan_normal
	}

	@INTERNAL
	{
		@name = MacLuky.LanderCanMk12.Internal
	}
}

The new IVA shows up just fine, but I can't get the replaced texture to show up. The original texture is at Squad/Parts/Command/mk1LanderCan/ksp_s_LanderCan_normal.dds, the new one at MacLuky_Dev/LanderCanMk12/ksp_s_landerCan_normal.dss

What am I doing wrong? (KSP 1.2.2 MM 2.7.5 and KSP 1.3 MM 2.8.1 tested. Puzzled

Link to comment
Share on other sites

Ah, I had mistyped the name of the texture I was trying to replace:

        texture = ksp_s_landerCan_diff, MacLuky_Dev/LanderCanMk12/ksp_s_landerCan_diff

 but this leads to a new can of worms:

[LOG 12:15:15.075] PartLoader: Compiling Part 'Squad/Parts/Command/mk1LanderCan/mk1LanderCan/MacLuky.LanderCanMk12'
[ERR 12:15:15.078] PartLoader: Encountered exception during compilation. System.NullReferenceException: Object reference not set to an instance of an object
  at PartLoader.ReplaceTextures (UnityEngine.GameObject model, System.Collections.Generic.List`1 textureNames, System.Collections.Generic.List`1 newTextures) [0x00000] in <filename unknown>:0 
  at PartLoader.CompileModel (.UrlConfig cfg, .ConfigNode partCfg, Single scaleFactor, .AvailablePart partInfo) [0x00000] in <filename unknown>:0 
  at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 
  at PartLoader+<CompileParts>c__Iterator62.MoveNext () [0x00000] in <filename unknown>:0 

[ERR 12:15:15.078] PartCompiler: Cannot compile part

This time the files _are_ present :-)

Link to comment
Share on other sites

6 minutes ago, MacLuky said:

Hypothesis: creating and changing can't happen in the same pass. (But how to test)

Both examples below would work just fine.

@part[something]
{
	anything = 10
	@anything = 10
}
+part[something]
{
	@name = somethingelse
}

I cannot see any basic syntax mistake in your new config - but I never tried replacing a texture myself.

Link to comment
Share on other sites

How do you go about adding stuff instead of replacing

Section I want to modify is currently:

	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 = 2000;2000;2000;2000;2000;1000,1000;2000;2000;2000;2000;400;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000;2000
		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 = 3520;1400;600;1600;640;300000;4000;28480;16000;5000;8;31600;14000;64000;4000;1000;20;600;20;40;500000;30000;1000;1000
		basePartMass = 0.25
		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
	}

 

I want to ADD resources to this, however using the following replaces rather than adds resources.

@PART[C3_Kontainer_01]
{
  @MODULE[FSfuelSwitch]
  {
    @resourceNames = MetalOre;Metal;RocketParts;ScrapMetal
    @resourceAmounts = 2000;2000;2000;2000
    @initialResourceAmounts = 0;0;0;0  // Always use 0, start empty
    @tankCost = 2602;19210;3490;1258 // Total resource cost when full plus container cost
  }
}

 

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