Jump to content

[1.10.1+] Contract Configurator [v1.30.5] [2020-10-05]


nightingale

Recommended Posts

Ohhh yes, I approve of this mod!

Ok, so I've got an idea for a collection of training incentives contracts - you know, like an NVQ in being an astronaut... I would take the hell out of that course - and I've had a look through the wiki but I want to quickly check that I have a clue before I dive in and start fiddling with things.

If I were to use the following code, would it come up when your space program only has one crew member of the specified trait and level, and no crew members ahead or one level behind them? Say, one pilot at level four, and maybe twelve pilots at level two or lower, but none at three or five?

REQUIREMENT

{

name = All

type = All

REQUIREMENT

{

name = HasCrew

type = HasCrew

trait = Pilot

minExperience = 4

maxExperience = 4

maxCount = 1

}

REQUIREMENT

{

name = HasCrew

type = HasCrew

trait = Pilot

minExperience = 3

maxCount = 1

}

}

I'm pretty much certain it would, but I thought I'd ask before I start down a rabbit trail and find out that HasCrew actually only refers to space craft or something. Also, is it safe to leave the parameters I have out - minCount and maxExperience - or do they need to be included even though they have defaults?

Edited by Athywren
Link to comment
Share on other sites

Correct. So if you wanted "one pilot at level four, and maybe twelve pilots at level two or lower, but none at three or five", then you would do:

[COLOR=#333333]REQUIREMENT[/COLOR]
[COLOR=#333333]{[/COLOR]
[COLOR=#333333] name = HasCrew
[/COLOR][COLOR=#333333] type = HasCrew

[/COLOR][COLOR=#333333] trait = Pilot

[/COLOR][COLOR=#333333] minExperience = 4
[/COLOR][COLOR=#333333] maxExperience = 4

[/COLOR][COLOR=#333333] maxCount = 1[/COLOR]
[COLOR=#333333]}

[/COLOR][COLOR=#333333]REQUIREMENT[/COLOR]
[COLOR=#333333]{[/COLOR]
[COLOR=#333333] name = HasCrew
[/COLOR][COLOR=#333333] type = HasCrew

[/COLOR][COLOR=#333333] trait = Pilot

[/COLOR][COLOR=#333333] minExperience = 5
[/COLOR][COLOR=#333333] maxExperience = 5

[/COLOR][COLOR=#333333] maxCount = 0[/COLOR]
[COLOR=#333333]}

[/COLOR][COLOR=#333333]REQUIREMENT[/COLOR]
[COLOR=#333333]{[/COLOR]
[COLOR=#333333] name = HasCrew
[/COLOR][COLOR=#333333] type = HasCrew

[/COLOR][COLOR=#333333] trait = Pilot

[/COLOR][COLOR=#333333] minExperience = 3
[/COLOR][COLOR=#333333] maxExperience = 3

[/COLOR][COLOR=#333333] maxCount = 0[/COLOR]
[COLOR=#333333]}[/COLOR]

Although those are fairly rigid requirements. Maybe just having contracts for "none at level 5", "none at level 4+", "none at level 3+", etc. may make more sense.

Link to comment
Share on other sites

Excellent! :D

I thought it would work, but it was a hastily thrown together bit of nonsense based on very quickly skimming the wiki and making assumptions (like that a parameter with a default probably doesn't need to be defined if it's only going to be defined as its default). What I'm trying to have it look for is a single crew member at level n, and that there are no crew members of the same career path between level n-1 and 5 other than the one at n, so if minXP=3/maxXP=5/maxCount=1 works, and min&maxXP=4/maxCount=1 works, then the crew member at 4 must be the one in that range.

I can think of a much simpler way to do it, which would be to call for the highest level crew member with the required trait, then check the count between n-1 & 5 to make sure there's the skill gap. I just don't know how to do that yet. I'll have to have a proper go at the wiki in a bit. For now, though, I'm done pretending to be an adult for the day, so I'm going to take the brute force route first - see if I can make it do what I want before I figure out how to finesse it.

I'm more excited about this than is healthy...

Link to comment
Share on other sites

In that case you may want to look at an expression to "select" the Kerbal that meets your criteria. Tourism contract pack would have examples, although I may need to add methods for you to get the trait and experience level (they may already be there, can't check at the moment).

Link to comment
Share on other sites

Thanks, I'll check the Tourism pack out tomorrow, see what I can learn from it. You've written a brilliant tool here... I'm sure you know that, but, you know, it needed to be said.

What I've got in mind is a two part thing. The first is a contract that shows up if you have a single kerbonaut on any of the career paths shooting ahead of their colleagues in terms of level, and offers you a decent bit of reputation for training up a backup, for in case it turns out that sitting on top of several hundred tons of highly compressed explosive chemicals is somehow dangerous. The other is for when the astronaut complex is a little upgraded, and you've got a decent collection of crew members. It offers a little cash and reputation for training a certain percentage of your kerbonauts to different levels, so a group of 20 would have a contract for getting maybe 16 to level 2 or above, one for 8 to 3 or above, 4 to 4 etc. Basically, it's an HR mod :P (because, hey, just because they're weird little green fictional people, that doesn't mean they don't have a right to continuing education and professional development!)

I've actually got it working in a Conan The Barbarian kind of way, but it definitely needs a bit of... pruning.

Link to comment
Share on other sites

Here's what it would look like with an expression - I ended up keeping the requirements to match exactly what you're looking for:

CONTRACT_TYPE{
name = KerbalExperienceTest
title = Kerbal Pilot Experience

description = Do something with @targetKerbal!

DATA
{
type = Kerbal

// Get a Kerbal that matches our criteria
targetKerbal = AllKerbals().Where(k => k.ExperienceTrait() == Pilot && k.ExperienceLevel() == 4).Random()
}

REQUIREMENT
{
name = HasCrew
type = HasCrew

trait = Pilot

minExperience = 4
maxExperience = 4

maxCount = 1
}

REQUIREMENT
{
name = HasCrew
type = HasCrew

trait = Pilot

minExperience = 5
maxExperience = 5

maxCount = 0
}


REQUIREMENT
{
name = HasCrew
type = HasCrew

trait = Pilot

minExperience = 3
maxExperience = 3

maxCount = 0
}
}

I ran some quick tests and there were minor issues (which will be fixed in 0.7.12). So if you can wait a couple days, the above should work, or you can grab the development dll here.

Link to comment
Share on other sites

I needed to get 0.7.12 out for some fixes related to something special I'm working on.... check back in about 30 minutes for a new mini-contract pack. Download 0.7.12 now!

Contract Configurator 0.7.12

  • Fix issue when loading part names with non-standard characters (thanks tattagreis).
  • Fix issue with using custom behaviours.
  • Can now provide multiple techs, parts and part modules in PartModuleUnlocked, PartUnlocked and TechResearched requirements.
  • TechResearched requirement now supports selecting techs by specifying parts.
  • WaypointGenerator now supports a hidden attribute for waypoints.
  • Hash contract configuration details, and cancel offered contracts if the hashed values do not match. This prevents old contracts from staying on offer when a contract pack is upgraded.
  • Improved handling of invalid vessel identifiers.
  • SpawnVessel now properly supports landed vessels.
  • Support for hierarchies of contract groups.
  • Fixes for Expression requirement.
  • Minor bug fixes.

Link to comment
Share on other sites

So, immediately after updating to the new version, I am presented with the following:

Exception occured while loading contract parameter 'HasCrew5703' in contract 'unknown':
System.TypeInitializationException: An exception was thrown by the type initializer for ContractConfigurator.ExpressionParser.BaseParser ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at ContractConfigurator.ContractConfigurator+<GetAllTypes>d__1e`1[ContractConfigurator.ExpressionParser.IExpressionParserRegistrer].MoveNext () [0x00000] in <filename unknown>:0
at ContractConfigurator.ExpressionParser.BaseParser..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[Int32] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0
at ContractConfigurator.ConfigNodeUtil.ParseValue[Int32] (.ConfigNode configNode, System.String key, Boolean allowExpression) [0x00000] in <filename unknown>:0
at ContractConfigurator.ConfigNodeUtil.ParseValue[Int32] (.ConfigNode configNode, System.String key, Int32 defaultValue) [0x00000] in <filename unknown>:0
at ContractConfigurator.RemoteTech.RemoteTechProgressTracker.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioRunner.AddModule (.ConfigNode node) [0x00000] in <filename unknown>:0
at ProtoScenarioModule.Load (.ScenarioRunner host) [0x00000] in <filename unknown>:0
at ScenarioRunner+ .MoveNext () [0x00000] in <filename unknown>:0

Also, this apparently breaks Kerbal Construction Time somehow as that mod is now reporting errors which would make the game "unplayable" (it's words).

Link to comment
Share on other sites

Currently checking to see if reverting to the previous version is going to fix the issue (I have a lot of mods, so it takes a while). Has anyone ever come up with a way to quickly list all installed mods? I have 116 folders in my GameData folder and I'm not super keen on typing them all out...

Link to comment
Share on other sites

Currently checking to see if reverting to the previous version is going to fix the issue (I have a lot of mods, so it takes a while). Has anyone ever come up with a way to quickly list all installed mods? I have 116 folders in my GameData folder and I'm not super keen on typing them all out...

If you have AVC you can screenshot that list, that should cut it down considerably. Or screenshot your "installed" list on CKAN?

Link to comment
Share on other sites

Fix for the above issue is out. Download it now!

Contract Configurator 0.7.13

  • Fix exception when loading types from assemblies that have been improperly compiled (thanks SpacedInvader).

Basically what happened is I mucked up some exception handling code that protects Contract Configurator from other mod that are improperly compiled against the wrong .Net version. That code is now fixed in 0.7.13. If you can provide logs under 0.7.13, it should identify which mod is the one that is compiled wrong (and it can be reported on their thread).

Link to comment
Share on other sites

Currently checking to see if reverting to the previous version is going to fix the issue (I have a lot of mods, so it takes a while). Has anyone ever come up with a way to quickly list all installed mods? I have 116 folders in my GameData folder and I'm not super keen on typing them all out...

If you are on windows open a command prompt in your gamedata folder (or better a folder of all the downloaded mods still in archives) and type

dir /b /o:n > modlist.txt

And will output a list of contents of the folder and save it in modlist.txt.

Link to comment
Share on other sites

So it looks like it's Firespitter throwing the error which is going to be a problem since I don't think it's been updated in quite some time.

As for the contents of my GameData folder, here it is, just in case any of the rest of it is relevant:


000_Toolbar
000_USITools
AIES_Aerospace
AJE
AnimatedDecouplers
ArcanumIndustries
ART
ASET
B9_Aerospace
BackgroundProcessing-0.4.0.1.dll
blackheart
Chatterer
CIT
CMES
CoherentContracts
CommunityResourcePack
CommunityTechTree
ConnectedLivingSpace
Contract_science_modifier
ContractConfigurator
ContractPacks
ContractsWindow
CrossFeedEnabler
CrowdSourcedScience
CustomAsteroids
DDSLoader
DeadlyReentry
Diazo
DistantObject
DMagicOrbitalScience
EditorExtensions
EngineIgnitor
EnhancedNavBall
ExtraplanetaryLaunchpads
FASA
FerramAerospaceResearch
FieldExperience
FinalFrontier.dat
Firespitter
FreedomTex
ftmn_new
Fusebox
GCMonitor
JSI
KAS
KAX
KerbalConstructionTime
KerbalIspDifficultyScaler
KerbalJointReinforcement
KerbalStats
KerbalStockLauncherOverhaul
KineTechAnimation
KittopiaSpace
Klockheed_Martian_Gimbal
Kopernicus
KOSMOS
KSPAPIExt
KSP-AVC
KWRocketry
LICENSE_DDSLoader.txt
LICENSE_KittopiaTech.txt
LICENSE_Kopernicus.txt
LICENSE_KopernicusTech.txt
LICENSE_ModuleManager.txt
LICENSE_OuterPlanetsMod.txt
MagicSmokeIndustries
MechJeb2
MechJebAndEngineerForAll.cfg
modlist.txt
ModuleManager.2.5.1.dll
ModuleManager.2.5.13.dll
ModuleManager.2.5.8.dll
ModuleManager.ConfigCache
ModuleManager.ConfigSHA
ModuleRCSFX
MunarSurfaceExperimentPackage
MyMods
NASAmission
NavyFish
NearFutureConstruction
NearFutureElectrical
NearFutureProps
NearFuturePropulsion
NearFutureSolar
Nereid
NovaPunch2
OpenResourceSystem
OPM
OPT
ORSResourcePack
OuterPlanetsMod.version
PlanetShine
PreciseNode
ProceduralFairings
ProceduralParts
RCSBuildAid
RealChute
RealFuels
Regolith
RemoteTech
ResGen
RLA_Stockalike
Sane Strategies
SCANsat
ScienceAlert
SDHI
SETI
SETIgreenhouse
ShipManifest
spacetux
Squad
StageRecovery
StationScience
StockBugFixModules
TechManager
TextureReplacer
ThrottleControlledAvionics
ThunderAerospace
ToadicusTools
toolbar-settings.dat
Trajectories
TriggerTech
TweakableEverything
TweakScale
UmbraSpaceIndustries
UniversalStorage
VenStockRevamp
Virgin Kalactic
VNG
WaypointManager
WombatConversions
Yarbrough08
000_FilterExtensions

Link to comment
Share on other sites

There was an unofficial updated firespitter dll released, grab it from MKS.

I'll give that a try to see if there are any changes in loading. I already have MKS, but I'm sure I've overwritten the firespitter.dll with the most recent one from the release thread.

Link to comment
Share on other sites

New version out, a few fixes for the Tourism pack. Download it now!

Contract Configurator 0.7.14

  • Expressions now work in child nodes (for WaypointGenerator and other behaviours that support it).
  • Fix issues with fairness when generating contracts (should now give appropriate consideration to all contract packs).
  • Fix errors in Tourism contract pack introduced by 0.7.13.
  • Minor bug fixes.

Link to comment
Share on other sites

So I used hideChildren for the first time, but it seems to have missed some? It's hidden what parts I'm looking for, but still says that I'm looking for parts. Is this intentional? It looks a bit silly IMO.

I should mention, this seems to be a problem either with using "Any" or "partModule" as the Cupola + Station Docking Port parameters are just looking for one part, and not a module and they work fine.

3AKCnVg.png

Edited by severedsolo
Link to comment
Share on other sites

Hmm... I'm not 100% clear what you're trying to accomplish on this one. Could you provide your contract cfg and I'll take a look?

Also, what is it about the "default" look that you don't like? Is there some other thing I could change or make customizable to make this work for you?

Link to comment
Share on other sites

Cfg is here: https://github.com/severedsolo/KerbinSpaceStation/blob/master/Kerbin/KerbinStationCore.cfg

The thing I don't like specifically about the example above, is that my title says "have a way of generating power" - the modules are removed in the next two lines (as they should be), but it still says "parts" (twice). I would like those two "Parts" lines to also be hidden, and just my title shown instead (as it does for the "Have the Station Core Docking Port" parameter, and the "Include a cupola" parameter.

This is what it looks like with no hideChildren lines:

HWn5o6d.png

This is ALOT of information, and most of it is duplicated. For example, my title is "Have a way of generating power" - I don't then need "with module Deployable solar panel" or "with module Generator"

Or: "Have the Station Core Docking Port on board."

CC then inserts "with type: Station Core Docking Port" + "Count: At least 1" - Duplicated information.

In an ideal world, if I choose to use hideChildren - I would like everything under the "title" to be removed.

The thing is though (and I know I'm being awkward now), sometimes I LIKE those lines. Orbit for example - it's handy to have that, rather than me needing to spell it out in the title. I guess I just want the option to choose.

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