Jump to content

Help to make an add-on to add USI Life support Supply resource to crewed parts


Chrisomega123

Recommended Posts

I'm trying to make a simple add-on that just adds the supply resource to all crewed parts. OPT spaceplane parts already has this at a certain ratio of the resource to crew capacity in the part. I changed the ratio in the OPT config files to something I felt was more balanced (by default it's very low), which worked just fine. But for some reason even directly modifying a stock part config such as:

@PART[mk2LanderCabin_v2]
{
    MODULE
    {
        name = USI_ModuleResourceWarehouse
    }
    RESOURCE
    {
        name = Supplies
        amount = 100
        maxAmount = 100
    }
}

this doesn't seem to work. Any help? Ideally I'd like to configure it simply to add 50 supplies per crew spot to all command/crewed parts. But I'm fine with manually configuring every crew part in my game.

Link to comment
Share on other sites

16 minutes ago, Chrisomega123 said:

50 supplies per crew spot to all command/crewed parts

Hi there. You want something like this. Should work just fine.

@PART:HAS[#CrewCapacity[>0]]:AFTER[USILifeSupport]
{
	%MODULE[USI_ModuleResourceWarehouse] {}
	%RESOURCE[Supplies]
	{
		%amount = 50
		@amount *= #$/CrewCapacity$
		%maxAmount = 50
		@maxAmount *= #$/CrewCapacity$
	}
}

You need to have a pass modifier to help the patch to know when exactly to be run (that's the :AFTER[ModName] bit). Your patches can be greatly simplified by targeting a key and using MM math processes on its value or if its value is true: "For every part that has crew capacity > 0, declare Supplies amounts and multiply these by the crew capacity." Finally, the % prefix means "If it exists, edit it. If it doesn't exist, create it. The value within [] there belongs to the name key"

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