Jump to content

Unofficial 0.25 modding info


CaptRobau

Recommended Posts

I took a look at some of the modding-related changes in 0.25 and thought I'd share what I found.

1. First off, here are some things mentioned in the changelog that might be of interest to modders:

* GameDatabase code tweaked to allow modders to write their own asset loaders.

* Added GameEvents.OnCrewTransferred, fired from CrewTransfer and EVAs leaving and boarding

2. Also:

* Upgraded all parts using deprecated Winglet subclass to use ModuleLiftingSurface instead.

Some of the new wing parts have the Winglet part module names, so that's a bit weird. Either its an oversight or ModuleLiftingSurface is only designed for adding lift to lifting body shapes and not wings. Anyway this how the new ModularLiftingSurface works (comments are mine):

MODULE
{
name = ModuleLiftingSurface

deflectionLiftCoeff = 0.6 //How much lift the surface generates
dragAtMaxAoA = 0.1 //The drag at maximum angle of attack (AoA is the climbing/descent angle)
dragAtMinAoA = 0.03 //The drag at minimum angle of attack
}

3. The improvements made to ModuleAnimateGeneric for the cargo bay seem to be all on the inside, so there doesn't seem to be a need to add anything to it to make it function à la the Firespitter animation that SpaceplanePlus used.

4. Departments are like the categories for strategies, symbolized by a certain Kerbal. This file is located in GameData/Squad/Strategies. This here's an example for Mortimer and the finances department (comments are mine):

STRATEGY_DEPARTMENT
{
name = Finances
desc = He's an accountant, called Mortimer. He doesn't have many friends, but he likes things to be under control and arranged in right angles. This job is pretty stressful for him. // Description of the department
color = 254 250 135 // The color in RGB space for the text of the headName and the name
avatar = Strategy_Mortimer // Maybe the background or the internal name of the animated Kerbal figure in the department picture. Not sure.
headName = Mortimer Kerman // Name of the department's head Kerbal
headImage = MORTIMER_KERMAN // Maybe the background or the internal name of the animated Kerbal figure in the department picture. Not sure.
}

5. Within departments are strategies. They are located in the same folder as the departments. These are laid out as follows (comments are mine):

STRATEGY
{
name = AppreciationCampaignCfg //Internal name

title = Appreciation Campaign //In-game display title for this strategy
desc = We could definitely improve our image by putting some effort into reminding Kerbals everywhere of just how great the Space Program is. Advertisement space isn't free, however. //Strategy description
department = Public Relations //Department that this strategy belongs to
icon = Squad/Strategies/Icons/AppreciationCampaign //Relative path to the strategies icon. File type is .png and dimensions are 50x50

groupTag = Basic,A // The first string (you can call it whatever you want) disables the other strategies after selecting two of them. So if you pick two 'Basic' strategy, the third (or more) Basic can't be used anymore (until you remove one of the enabled Basic strategies). The second string is similar, but disables the other strategies after selecting only one. So enabling one 'A' means the others can't be enabled until you disable the first one.

minLeastDuration = 60 //Not sure. Needs to be researched.
maxLeastDuration = 100 //Not sure. Needs to be researched.
minLongestDuration = 1200 //Not sure. Needs to be researched.
maxLongestDuration = 1600 //Not sure. Needs to be researched.

requiredReputationMin = -500 //Lower limit on reputation needed to enable this strategy
requiredReputationMax = 750 //Upper limit on reputation needed to enable this strategy

initialCostFundsMin = 8000.0 //Lower limit on funds needed to enable this strategy. The upper and lower limits are there because you commit between 5-100% to the strategy.
initialCostFundsMax = 160000.0 //Upper limit on funds needed to enable this strategy
initialCostReputation = 0.0 //Initial reputation cost
initialCostScience = 0.0 //Initial science cost

hasFactorSlider = True //If true it uses the slider on the right of the strategy screen. If False, it's disabled.
factorSliderDefault = 0.05 //The percentage where it starts. 0.05 means 5%.
factorSliderSteps = 20 //How many steps you can move the slider. 100/20 means 5% per step.

EFFECT
{
SEE BELOW
}
}

The effects or the stuff that happens when you choose a strategy come in two types. The first is the Currency Converter:

  EFFECT
{
name = CurrencyConverter //The CurrencyConverter takes funds, science or reputation and converts it into another of those three
input = Funds //The type of input. See section on currencies for more info
output = Reputation //The type of output. Same possibilities as with the inputs.
minShare = 0.0 //The minimum share of the input. If you have factorSliderDefault above 0, this means that the minShare starts there, so that percentages below it aren't selectable.
maxShare = 1.0 //The maximum share of the input. 1.0 is 100%.

minRate = 0.041667 //Not sure. Needs to be researched.
maxRate = 0.0520 //Not sure. Needs to be researched.

AffectReasons = ContractReward, ContractAdvance //At these points in the game the currency converter is activated

effectDescription = Income //This is put after the effects numbers, to make it a sentence instead of just numbers
}

The second is the Currency Operation:

  EFFECT
{
name = CurrencyOperation
currency = Funds //Same as above
operation = Multiply //This can do a mathematical function on an input. See section on functions for more info

effectDescription = to Launch Costs //Same as above

minValue = 1.1 //The lower percentage for the value modification
maxValue = 1.0//The upper percentage for the value modification. 1.15 translates to a 15% increase.

AffectReasons = VesselRollout //Same as above
}

The third is the ValueModifier.

  EFFECT
{
name = ValueModifier

valueId = VesselRecoveryFactor //The value that needs to be modified. See section on valueIds for more info.

effectDescription = to Vessel Recovery Factor //Same as above

minValue = 1.05 //Same as above
maxValue = 1.15 //Same as above

}

6. Values for use in strategies:

Currencies

*Funds

*Science

*Reputation

ValueIds

*VesselRecoveryFactor = How much overall money you get back from recovering a vessel. This is further influence by distance from KSC, which you can't change with this

Functions

*Multiply = Number above 1 multiply, numbers below 1 and above 0 divide

*Add = A positive number adds and a negative number subtracts

AffectReasons

*ContractReward = On accomplishing a contract

*ContractAdvance = On accepting a contract

*ScienceTransmission = On transmission of science

*VesselRecovery = On recovering a vessel

*RnDPartPurchase = On purchasing a part in a tech node that you've unlocked with science

*VesselRollout = On launching a rocket/spaceplane

I'll edit as I discover more. If you have additions, critiques, etc. please comment below.

Edited by CaptRobau
Link to comment
Share on other sites

very cool. I have't noticed the new moduleliftingsurface yet. will have to take a closer look at it.

ModuleAnimateGeneric can work with multiple animations now and can be triggered in VAB/SPH as well as EVA. settings all appears still the same.

seems like quite a lot of things have been shifted from Assembly-CSharp-firstpass to Assembly-CSharp. if a module is referencing something from firstpass it will probably break in 0.25.

Link to comment
Share on other sites

Care to elaborate what the difference is? I'm not a coder so it just sounds like mumbo jumbo to me.

I'm not a coder either. I just ran into this while checking compatibility of RPM 18.2. a few of RPM's PROP modules rely on a KSP component "SpriteText" which was in Assembly-CSharp-firstpass.dll in 24.2. In .25; "SpriteText" has been moved over to Assembly-CSharp; so mods that referenced KSP components in Assembly-CSharp-firstpass from .24.2 or earlier will not be able to find those references. There are many others, but I don't know which Mod uses them if any.

Edited by nli2work
Link to comment
Share on other sites

5)

The group tag line is used atleast partially for creating mutually exclusive strategies. I have not tested if all the tags have to match, or if there is any significance to the basic/misc wording.

Squad have used the effect CurrencyOperation (notably different from conversion) for the contracts from the operations division which I did not see noted.

6)

Divide and subtract operations are not really logical inclusions as it is only duplicating functionality (adding a negative value, multiplying by a value less than 1)

Link to comment
Share on other sites

...

seems like quite a lot of things have been shifted from Assembly-CSharp-firstpass to Assembly-CSharp. if a module is referencing something from firstpass it will probably break in 0.25.

Actually it shouldn't matters and break anything as we all reference Assembly-CSharp already, so if anything were moved here it will still be available.

Assembly-CSharp-firstpass was only needed when using the ApplicationLauncher toolbar (animated sprite management).

I think Ram0n said in a devblog that with v0.25 we don't need to reference Assembly-CSharp-firstpass anymore because they moved a lot of these functions to Assembly-CSharp.

;)

Link to comment
Share on other sites

Worked out the grouptag:

  groupTag = Basic,A // The first string (you can call it whatever you want) disables the other strategies after selecting two of them. So if you pick two 'Basic' strategy, the third (or more) Basic can't be used anymore (until you remove one of the enabled Basic strategies). The second string is similar, but disables the other strategies after selecting only one. So enabling one 'A' means the others can't be enabled until you disable the first one.

Thanks to Crzyrndm for getting me on the right road with understanding that feature.

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