Jump to content

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


nightingale

Recommended Posts

1 hour ago, Jim DiGriz said:

unfortunately:

88hzQ0K.png

EDIT:  KSP.log:  https://gist.githubusercontent.com/anonymous/31dc8c0425c12c6216b3147f1d95e49d/raw/1bf7f82ec70c2cc8894d44016b7cdd6b2a325309/KSP.log

Also if it helps, I'm not remotely where I'd be flying by Venus, and I'm doing Moon impactor contracts, so that was definitely not an accepted contract.  I think I remember seeing it in my available list though.

There's around a hundred errors before that about stuff failing to load (it looks to me like Kopernicus/RSS isn't working in 1.1.3).  So I'd wait until RP-0 and all its dependencies are working on this one as it seems the other errors are the direct cause of this.

Link to comment
Share on other sites

Not sure if this is related to the 1.1.3 update, but while looking at the logs for other issues, found these. And yes, I have RealSolarSystem installed.

[EXC 21:44:09.059] ArgumentException: 'Mercury' is not a valid CelestialBody.
    ContractConfigurator.ConfigNodeUtil.ParseCelestialBodyValue (System.String celestialName)
    ContractConfigurator.ConfigNodeUtil.ParseSingleValue[CelestialBody] (System.String key, System.String stringValue, Boolean allowExpression)
    ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, Boolean allowExpression)
    ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, .CelestialBody defaultValue)
    ContractConfigurator.RemoteTech.HasAntennaParameter.OnParameterLoad (.ConfigNode node)
    ContractConfigurator.Parameters.ContractConfiguratorParameter.OnLoad (.ConfigNode node)
    UnityEngine.Debug:LogException(Exception)
    ContractConfigurator.LoggingUtil:LogException(Exception)
    ContractConfigurator.Parameters.ContractConfiguratorParameter:OnLoad(ConfigNode)
    Contracts.ContractParameter:Load(ConfigNode)
    Contracts.ContractParameter:Load(ConfigNode)
    Contracts.Contract:Load(Contract, ConfigNode)
    Contracts.ContractSystem:LoadContract(ConfigNode)
    Contracts.<OnLoadRoutine>c__Iterator80:MoveNext()
[EXC 21:44:09.065] ArgumentException: 'Venus' is not a valid CelestialBody.
    ContractConfigurator.ConfigNodeUtil.ParseCelestialBodyValue (System.String celestialName)
    ContractConfigurator.ConfigNodeUtil.ParseSingleValue[CelestialBody] (System.String key, System.String stringValue, Boolean allowExpression)
    ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, Boolean allowExpression)
    ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, .CelestialBody defaultValue)
    ContractConfigurator.RemoteTech.HasAntennaParameter.OnParameterLoad (.ConfigNode node)
    ContractConfigurator.Parameters.ContractConfiguratorParameter.OnLoad (.ConfigNode node)
    UnityEngine.Debug:LogException(Exception)
    ContractConfigurator.LoggingUtil:LogException(Exception)
    ContractConfigurator.Parameters.ContractConfiguratorParameter:OnLoad(ConfigNode)
    Contracts.ContractParameter:Load(ConfigNode)
    Contracts.ContractParameter:Load(ConfigNode)
    Contracts.Contract:Load(Contract, ConfigNode)
    Contracts.ContractSystem:LoadContract(ConfigNode)
    Contracts.<OnLoadRoutine>c__Iterator80:MoveNext()

And several more, one for each body.

Link to comment
Share on other sites

New release with KSP 1.1.3 compatibility.  Download here.

Contract Configurator 1.13.0

  • KSP 1.1.3 compatibility.
  • Integrated Wider Contracts App into Contract Configurator.
  • Fixed isuse with SpawnVessels spawning vessels with incorrect rotation (thanks severedsolo).
  • Prevent Rendenzvous parameter from triggering when a vessel performs a rendezvous with itself (thanks danielguo).
  • Fixed NRE on contract accept when using SpawnVessel's craftPart method of spawning.
  • Fixed PartModuleUnlocked and PartUnlocked requirements to check for part purchase and not just tech unlock (thanks inigma).
  • Always set the CollectScience targetBody to the one from the biome if a biome is used (thanks severedsolo & enceos).
  • Fixed exception in RecoverKerbal (thanks palleon).
  • Fixed incorrect handling of waypoints with negative altitude on non-ocean worlds in VisitWaypoint (thanks Galenmacil).
  • Removed extra ConfiguredContract entries from settings menu (thanks Deimos Rast).
Link to comment
Share on other sites

Thanks a lot for updating already!

A couple of questions for you...I know that you can create a new line in the text areas by using \n but are there other ways to add underline, or bold?

Second question...I have a contract that I created that generates a tourist. He is actually a Chimpanzee that is used as a test subject for the Mercury-Redstone. I have the contract set up so that MaxCrew = 0 and that having teh tourist on board is mandatory. The Uncrewed portion of the contract cannot be completed when I add the tourist in. Is this an issue in the way I am trying to implement?

Thanks!

Link to comment
Share on other sites

48 minutes ago, pap1723 said:

A couple of questions for you...I know that you can create a new line in the text areas by using \n but are there other ways to add underline, or bold?

Under the hood, most of the places that text is displayed uses a unity Rich Text field, so you can theoretically use anything that Unity allows (docs here).  I'm not 100% sure if this holds for the contracts app though, and even if it does it may break @DMagic's Contracts Window+, so test it out thoroughly (and let me know if it works or not).

50 minutes ago, pap1723 said:

Second question...I have a contract that I created that generates a tourist. He is actually a Chimpanzee that is used as a test subject for the Mercury-Redstone. I have the contract set up so that MaxCrew = 0 and that having teh tourist on board is mandatory. The Uncrewed portion of the contract cannot be completed when I add the tourist in. Is this an issue in the way I am trying to implement?

Right now, HasCrew counts tourists, but I can see an argument for excluding tourists from the count.  But since that's changing the existing behaviour, I'd first want to see if that breaks anything for @inigma, @severedsolo or @NathanKell.

Link to comment
Share on other sites

Thank You! I will let you know about the Rich Text markup.

Another question...when using PartValidation, can I use partModule = Antenna ? I am trying to limit the amount of coding I need to do, but I ran into an issue where I was running RemoteTech and it would not recognize partModule = ModuleDataTransmitter as it changes the name. This is the code that is in the stock Squad Contracts that I was wondering if it is useable to make it easier coding...

MODULE_DEFINITIONS // Modules that contracts consider for certain things
	{
		Antenna = ModuleDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleLimitedDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleRTDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleRTAntenna // Part module considered to be an antenna by career
		Dock = ModuleDockingNode // Part module considered to be a docking port by career
		Grapple = ModuleGrappleNode // Part module considered to be a claw grappler by career
		Power = ModuleGenerator // Part module considered to be a power generator by career
		Power = ModuleDeployableSolarPanel // Part module considered to be a power generator by career
		Power = FNGenerator // Part module considered to be a power generator by career
		Power = FNAntimatterReactor // Part module considered to be a power generator by career
		Power = FNNuclearReactor // Part module considered to be a power generator by career
		Power = FNFusionReactor // Part module considered to be a power generator by career
		Power = KolonyConverter // Part module considered to be a power generator by career
		Power = FissionGenerator // Part module considered to be a power generator by career
		Power = ModuleCurvedSolarPanel // Part module considered to be a power generator by career
	}

 

Link to comment
Share on other sites

24 minutes ago, pap1723 said:

Thank You! I will let you know about the Rich Text markup.

Another question...when using PartValidation, can I use partModule = Antenna ? I am trying to limit the amount of coding I need to do, but I ran into an issue where I was running RemoteTech and it would not recognize partModule = ModuleDataTransmitter as it changes the name. This is the code that is in the stock Squad Contracts that I was wondering if it is useable to make it easier coding...


MODULE_DEFINITIONS // Modules that contracts consider for certain things
	{
		Antenna = ModuleDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleLimitedDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleRTDataTransmitter // Part module considered to be an antenna by career
		Antenna = ModuleRTAntenna // Part module considered to be an antenna by career
		Dock = ModuleDockingNode // Part module considered to be a docking port by career
		Grapple = ModuleGrappleNode // Part module considered to be a claw grappler by career
		Power = ModuleGenerator // Part module considered to be a power generator by career
		Power = ModuleDeployableSolarPanel // Part module considered to be a power generator by career
		Power = FNGenerator // Part module considered to be a power generator by career
		Power = FNAntimatterReactor // Part module considered to be a power generator by career
		Power = FNNuclearReactor // Part module considered to be a power generator by career
		Power = FNFusionReactor // Part module considered to be a power generator by career
		Power = KolonyConverter // Part module considered to be a power generator by career
		Power = FissionGenerator // Part module considered to be a power generator by career
		Power = ModuleCurvedSolarPanel // Part module considered to be a power generator by career
	}

 

There's a number of places that you can use partModuleType instead of partModule, where partModuleType uses the above values (Antenna, Dock, Grapple, Power).  It also has Wheel for backwards compatibility (it got removed from stock in 1.1.0 or so).

Link to comment
Share on other sites

4 hours ago, nightingale said:

Under the hood, most of the places that text is displayed uses a unity Rich Text field, so you can theoretically use anything that Unity allows (docs here).  I'm not 100% sure if this holds for the contracts app though, and even if it does it may break @DMagic's Contracts Window+, so test it out thoroughly (and let me know if it works or not).

Right now, HasCrew counts tourists, but I can see an argument for excluding tourists from the count.  But since that's changing the existing behaviour, I'd first want to see if that breaks anything for @inigma, @severedsolo or @NathanKell.

It would break the vast majority of GAP. I recommend an optional fuction in HasCrew called IncludeTourists = True by default.

Link to comment
Share on other sites

5 hours ago, nightingale said:

Right now, HasCrew counts tourists, but I can see an argument for excluding tourists from the count.  But since that's changing the existing behaviour, I'd first want to see if that breaks anything for @inigma, @severedsolo or @NathanKell.

I'd rather it didn't count tourists to be honest. I'm sure I reported this as a bug a long time ago.

Link to comment
Share on other sites

Contract Configurator asked me to give you the following message:

Exception occured while loading contract 'BasesandStations.StationCore':
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: 'Earth' is not a valid CelestialBody.
  at ContractConfigurator.ConfigNodeUtil.ParseCelestialBodyValue (System.String celestialName) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[CelestialBody] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.ConfiguredContract.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0 

Link to comment
Share on other sites

2 minutes ago, MaxPeck said:

Contract Configurator asked me to give you the following message:

Exception occured while loading contract 'BasesandStations.StationCore':
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: 'Earth' is not a valid CelestialBody.
  at ContractConfigurator.ConfigNodeUtil.ParseCelestialBodyValue (System.String celestialName) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[CelestialBody] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at ContractConfigurator.ConfiguredContract.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0 

Sounds like you're trying to use RSS/Kopernicus on 1.1.3, which AFAIK is not ready yet.

Link to comment
Share on other sites

Just now, nightingale said:

Sounds like you're trying to use RSS/Kopernicus on 1.1.3, which AFAIK is not ready yet.

It is. Kopernicus just updated and Nathan has an RSS update on his Github that he hasn't pushed out yet.  I figured out that I screwed something up troubleshooting something else and turned Kopernicus off by accident.

Link to comment
Share on other sites

6 hours ago, nightingale said:

There's a number of places that you can use partModuleType instead of partModule, where partModuleType uses the above values (Antenna, Dock, Grapple, Power).  It also has Wheel for backwards compatibility (it got removed from stock in 1.1.0 or so).

So I took your advice and it works! But there is a slight issue. in the Contract Debug screen it is showing as the following error:

[WARNING] ContractConfigurator.PartValidationFActory: CONTRACT_TYPE 'Sputnik-1'; PARAMETER 'HasAntenna' of type 'PartValidation' unexpected attribute 'partModuleType' found, ignored.

The strange thing is that the requirement is not ignored and it is correctly attributed when there is an Antenna on the craft. Here is the contract:

CONTRACT_TYPE
{
    name = Sputnik-1
    group = EarlyMissions
    title = Sputnik 1
    notes = Launch the first artificial satellite of HomeWorld()
    synopsis = Launch Sputnik 1 into orbit of HomeWorld()
    description = The Sputnik 1 spacecraft was the first artificial satellite successfully placed in orbit around the Earth and was launched from Baikonur Cosmodrome at Tyuratam in Kazakhstan, then part of the former Soviet Union. The Russian word "Sputnik" means "companion" ("satellite" in the astronomical sense).\n\n<b><color=white>Objectives:</color></b>\n\n1. Design an unmanned rocket with an antenna \n2. Launch the Rocket \n3. Reach Orbit \n\n Significance:\n Sputnik 1 was the first artificial satellite orbiting Earth. \n\n Historical Launch Date: October 4, 1957
		
    completedMessage = Success! Sputnik 1 is one of the most significant events of the Space Race between the USA and USSR. This monumental achievement was proof of how far ahead the USSR were at this point in history.
    prestige = Trivial
    minExpiry = 1
    maxExpiry = 30
    agent = USSR
    deadline = 70
    maxCompletions = 1
    cancellable = false
    declinable = false
    targetBody = HomeWorld()
    rewardScience = 5
    rewardReputation = 5
    rewardFunds = 15000
    failureReputation = 10
    failureFunds = 30000
    advanceFunds = 20000
	
	weight = 999

PARAMETER
{
	name = Sputnik1
	type = VesselParameterGroup
	title = Launch the Sputnik 1 probe into orbit.
	define = Sputnik 1

	PARAMETER 
	{
		name = Crewmembers
		type = HasCrew
		minCrew = 0
		maxCrew = 0
		title = Unmanned
	}
	PARAMETER
	{
		name = HasAntenna
		type = PartValidation
		partModuleType = Antenna
		minCount = 1
		title = Craft has a transmission device
	}

	PARAMETER
	{
		name = Orbit
		type = Orbit
		targetBody = HomeWorld()
		minAltitude = @targetBody.AtmosphereAltitude()
		disableOnStateChange = true
	}

}
REQUIREMENT
{
    name = CompleteContract
    type = CompleteContract
    contractType = V-2
    minCount = 1
    maxCount = 1
    cooldownDuration = 0d
}
}

 

Link to comment
Share on other sites

3 hours ago, pap1723 said:

So I took your advice and it works!

Check again - the doco and warning are correct - partModuleType is not supported in the PartValidation parameter.  Raise an enhancement and I'll add support for it.

Link to comment
Share on other sites

4 hours ago, Maxsimal said:

So do we need to update to 1.1.3 now, along with getting whatever the new RSS version will be, to get contracts working again?

No, you need to use the versions of mods built for 1.1.2 if you want to remain on that version.  If you're ready to go to 1.1.3, then you need the latest versions of whatever mods you're running.

Link to comment
Share on other sites

alright, I'm up to date, still getting lots of errors on contracts playing RP0.  Guess I'll wait for a fix on the RP0 side, and be a bit more careful about updates.

Edited by Maxsimal
Link to comment
Share on other sites

So, the Rich Text markup works great! So far I have used BOLD <b> Italics <i> and changed the color <color>.

Another question...I am creating the pack that can be used for Stock or RSS and its derivatives. I have been fine using parameters like the following so far...

HomeWorld() = Earth / Kerbin
HomeWorld().Children().First() = Mun / Moon
HomeWorld().Parent().Children().ElementAt(0) = Moho / Mercury
HomeWorld().Parent().Children().ElementAt(1) = Eve / Venus
HomeWorld().Parent().Children().ElementAt(3) = Duna / Mars

This is where I run into problems though, and there might not be a way around it. I want the next mission to be to either Jupiter or Jool. In RSS it would be ElementAt(4), but the same string would return Dres in stock. Is there some logic I can use to choose Jupiter OR Jool as the target of the mission?

Thanks!

Link to comment
Share on other sites

13 minutes ago, Maxsimal said:

alright, I'm up to date, still getting lots of errors on contracts playing RP0.  Guess I'll wait for a fix on the RP0 side, and be a bit more careful about updates.

AFAIK RP-0 is updated for 1.1.3 - so if there's errors you should report them there (although it's always possible you've uncovered a Contract Configurator bug, too).

Link to comment
Share on other sites

12 minutes ago, pap1723 said:

So, the Rich Text markup works great! So far I have used BOLD <b> Italics <i> and changed the color <color>.

Another question...I am creating the pack that can be used for Stock or RSS and its derivatives. I have been fine using parameters like the following so far...


HomeWorld() = Earth / Kerbin
HomeWorld().Children().First() = Mun / Moon
HomeWorld().Parent().Children().ElementAt(0) = Moho / Mercury
HomeWorld().Parent().Children().ElementAt(1) = Eve / Venus
HomeWorld().Parent().Children().ElementAt(3) = Duna / Mars

This is where I run into problems though, and there might not be a way around it. I want the next mission to be to either Jupiter or Jool. In RSS it would be ElementAt(4), but the same string would return Dres in stock. Is there some logic I can use to choose Jupiter OR Jool as the target of the mission?

Thanks!

Have a look at the RemoteTech and Field Research contract packs, they have a lot of carefully tweaked expressions for Celestial Body selection (including handling for stuff like New Horizons where Kerbin is a moon of a gas giant.

In short, rather than trying to base everything off the homeworld and order of bodies, you should use something like this (example is to get a random gas giant):

AllBodies().Where(cb => cb.IsPlanet() && !cb.HasSurface()).Random()

Also, various planet packs can change so much, so I'd avoid the following assumptions:

  1. The HomeWorld is called Kerbin
  2. There is a planet called Kerbin (or Duna, or...)
  3. The HomeWorld is a planet
  4. There is only one gas giant
  5. There are gas giants
  6. All bodies orbit the Sun
  7. The HomeWorld has two moons (or one moon or any moons)

I'm sure there's plenty more (and I'm sure I've violated some of the above). The point is that with Kopernicus in the mix, anything is possible, and if something that breaks your contracts doesn't exist today, it probably will exist some day.

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