Jump to content

Science and mods!


DYJ

Recommended Posts

Additions to PART {}

.22 adds two new parameters to PART, TechRequired and entryCost.

TechRequired is what research node unlocks your part.

entryCost is the cost of the part - in credits - when the node has been researched. Cost isn't actually implemented, the player has a bottomless wallet with the parts being automatically purchased upon researching a node.

New modules.

ModuleScienceExperiment

ModuleScienceExperiment is the new module for science stuff, it's fairly straight forward but references the ScienceDefs.cfg science definition file. For this to work just make sure the id matches in both .cfgs.

It automatically activates animations set up with the default ModuleAnimateGeneric module.

ModuleDataTransmitter

Antennae module. Same as ModuleScienceExperiment in regards to animations.

ModuleLandingLeg

New landing leg module, set up like so: http://i.imgur.com/kKMEbtk.png

ModuleScienceContainer

Allows the storage of science reports.

ScienceDefs.cfg

Located in GameData/Squad/Resources, works the same way as the resources definition. So you can make your own and package it with your mod just like the resources.cfg.

This file contains all flavour text and defines what can do science where, if you don't want to see spoilers don't read it.

SituationMask & biomeMask are bitmasks defining where the part can do science.

SituationMask determines in which of the following conditions science can be gathered:

SrfLanded = 1 SrfSplashed = 2, FlyingLow = 4, FlyingHigh = 8, InSpaceLow = 16, InSpaceHigh = 32

[TABLE]

[TR]

[TH][/TH]

[TH]InSpaceHigh = 32[/TH]

[TH]InSpaceLow = 16[/TH]

[TH] FlyingHigh = 8[/TH]

[TH]FlyingLow = 4[/TH]

[TH]SrfSplashed = 2[/TH]

[TH]SrfLanded = 1[/TH]

[TH]Binary[/TH]

[TH]Decimal[/TH]

[/TR]

[TR]

[TD]Option with everything selected:[/TD]

[TD]1[/TD]

[TD]1[/TD]

[TD]1[/TD]

[TD]1[/TD]

[TD]1[/TD]

[TD]1[/TD]

[TD]111111[/TD]

[TD]63[/TD]

[/TR]

[TR]

[TD]Option with only FlyingLow selected:[/TD]

[TD]0[/TD]

[TD]0[/TD]

[TD]0[/TD]

[TD]1[/TD]

[TD]0[/TD]

[TD]0[/TD]

[TD]000100[/TD]

[TD]4[/TD]

[/TR]

[/TABLE]

The number you need to input is a decimal conversion of binary yes/no selection.

So you grab the number you've gotten by filling out the options above and run it through a binary converter like this one: http://www.binaryhexconverter.com/binary-to-decimal-converter

BiomeMask works in a similar way but determines when biomes play a part in your science gathering.

Think of it as you are filling the list out again, 111111 or 63 is always. 000100 or 4 is only when flying low.

This allows your ground poking instrument to care about if you are in the desert or not while letting a deepspace radiowavesomethingorother not bother checking what it happens to be above.

Additional researchnodes.

A few extra empty nodes have been added to allow easy endgame tie-in by mods. As shown here: http://i.imgur.com/OkwRzka.png

Names are as follows:

experimentalRocketry

nanolathing

experimentalAerodynamics

aerospaceTech

experimentalElectrics

experimentalScience

automation

experimentalsMotors

If you have something that feels relevant please post it in this thread.

Edited by UbioZur
Link to comment
Share on other sites

Is there a complete list of nodes handy? And is there an easy way to add new nodes at present?

To get all the nodes, you just need to look at the name of those nodes, attached the words, and lowercase the first letter

i.e. Basic Rocketry -> basicRocketry

You can also look directly at the config file of a part that is in a node you want.

Link to comment
Share on other sites

To get all the nodes, you just need to look at the name of those nodes, attached the words, and lowercase the first letter

Well that's handy! I didn't realize that the internal names were so close to the display names.

Edit: Actually, it seems all instances of "Advanced" should be just "adv"

Edited by TomatoSoup
Link to comment
Share on other sites

So what do you have to do to actually say find out in a plugin if a node has been researched. say you want to have a If Statement... If general construction researched then this happens.

Found RDNode.state.Researched but I always get lost at this point on what to do.. Or if I am actually looking in correct place.

Link to comment
Share on other sites

RDNode only exists inside the tech tree itself. If you just want to check the state of a technology, use the static methos ub the ResearchAndDevelopment class. All static methods on that class are safe to use regardless if whether you're in a career game or sandbox.

Cheers

Link to comment
Share on other sites

RDNode only exists inside the tech tree itself. If you just want to check the state of a technology, use the static methos ub the ResearchAndDevelopment class. All static methods on that class are safe to use regardless if whether you're in a career game or sandbox.

My assumption was that checking if(ResearchAndDevelopment.GetTechnologyState(techid) == RDNode.State.Available) was the correct way to check the status of a technology but it appears this method always return true. I'd expect that behaviour in Sandbox mode but certainly not in Career mode.

The only solution I've found is to read the nodes out of the persistence file.

Link to comment
Share on other sites

Most of the node names match what you'd think, but not all. I created this list with all the science titles, their node names and the associated parts:

https://dl.dropboxusercontent.com/u/22972712/ksp%20forum/tree_trimmed.txt

also: full detail tree.cfg from a treedit export

Names that are inconsistent:

advUnmanned = Advanced Unmanned Tech

metaMaterials = Meta-Materials

aerodynamicSystems = Aerodynamics

advancedMotors = Advanced Motors

all other instances of advanced are abbreviated to adv like so:

advRocketry = Advanced Rocketry

Link to comment
Share on other sites

ResearchAndDevelopment.GetTechnologyState(techid) == RDNode.State.Available

You don't need to compare that with the state of the node, just check it against the enum itself:

bool techIsUnlocked = ResearchAndDevelopment.GetTechnologyState("someTech") == RDTech.State.Available;

Cheers

Link to comment
Share on other sites

You don't need to compare that with the state of the node, just check it against the enum itself:

bool techIsUnlocked = ResearchAndDevelopment.GetTechnologyState("someTech") == RDTech.State.Available;

Sorry that was what I meant, just a typo in my original post. In every case I have found so far, career mode, sandbox mode, tech researched, tech unresearched, it always returns true. Likewise using the ResearchAndDevelopment.ResearchTechAvailable also appears to return true incorrectly some of the time, though I've tested this second case much less rigorously than the first.

Link to comment
Share on other sites

If I have some parts from some favorite addons that I'd like to add into career mode - how do I do that?

I've tried adding

TechRequired = fuelSystems

entryCost = 5

but... that didn't do anything.

I take it that I need to add something more? or can't stuff be added retroactively - can I only add stuff via sneaking it onto un-discovered parts of the tech tree?

Link to comment
Share on other sites

You can add things to previously unlocked tech nodes, but you have to go the the R&D building, click the node, and then click the new parts individually in the small window in the topright corner. Not entirely sure why this is, but that way works.

Link to comment
Share on other sites

Presumably so that at some point in the future (when currency is also a requirement), you can scan back through nodes you've unlocked with Science but didn't have the currency to purchase and pick up items you couldn't afford previously.

Link to comment
Share on other sites

I modified the parts of Kerbal Engineer as follow in the part.cfg

TechRequired = basicRocketry

entryCost = 1600

Then I went in the lab and i saw the 3 components of Kerbal engineer in my first tech node.

I clicked on each and I was ask if i wanted to research.

I clicked "Yes", then I went to the VAB and i was able to use them on my ship.

Looks easy but I do not know if tit works for each mode.

Link to comment
Share on other sites

Is there any way to use Science as a resource?

I am trying to develop a part that functions essentially like an RTG/Solar panel, but for science.

The problem i am coming across is that i don't want this to function like an "experiment" pod, but rather generate science like a resource constantly without needing clicking. I was hoping it was just a resource that could be generated, but i'm a little stumped.

Link to comment
Share on other sites

Having a minor issue with adding a part to the tree. Specifically, the dipole antannae found in the Remote Tech mod. I added the TechRequired = flightControl and entryCost = 1600 to the part file, and nothing. I copied and pasted those two lines from the probe core from the stock Squad parts, with the same results.

I have successfully added other parts, but it seems that this one doesn't want to go along with me. Anyone else having the same issue, or similar ones? Any advice for this part?

Thank you much!

Edit: I tried adding the dipole antenna on a stock install (with, of course, RT installed) and it installed fine, I am working on adding the rest of them in now.

Edited by kalor
Link to comment
Share on other sites

I'm trying to make several progressive data storage units intended for use on probes or for generally storing SCIENCE! until return to Kerbin. As far as I know, it's only possible to store EVA and Crew reports on command pods, but other experiments you're basically forced to keep the data "on" the experiment equipment itself, rendering it unusable for anything else.

Anyways, can anyone give me a progressive list of available storage with the advancement in command pods so I know how to balance the data drives?

Edited by BananaDealer
Link to comment
Share on other sites

I'm trying to make several progressive data storage units intended for use on probes or for generally storing SCIENCE! until return to Kerbin. As far as I know, it's only possible to store EVA and Crew reports on command pods, but other experiments you're basically forced to keep the data "on" the experiment equipment itself, rendering it unusable for anything else.

Anyways, can anyone give me a progressive list of available storage with the advancement in command pods so I know how to balance the data drives?

You can make something that implements IScienceDataContainer, then loop over all of the other parts in your vessel with IScienceDataContainer, with vessel.FindPartModulesImplementing<IScienceDataContainer>(); Then loop over them calling their GetData() method, to return a ScienceData array, storing this in an array in your part, then calling DumpData to remove it from the original part.

Link to comment
Share on other sites

You can make something that implements IScienceDataContainer, then loop over all of the other parts in your vessel with IScienceDataContainer, with vessel.FindPartModulesImplementing<IScienceDataContainer>(); Then loop over them calling their GetData() method, to return a ScienceData array, storing this in an array in your part, then calling DumpData to remove it from the original part.

This doesn't seem like it would allow for a "storage capacity" feature, instead letting an unlimited amount of data being stored until transmission...

I'm looking to make the data drives progressive, each having more capacity than the previous model. Capacity would be represented by a total value of Mits. For instance, the Basic Data Drive will have a total capacity of 20 Mits, allowing for storage of either one big 20-Mit experiment or 4 smaller, 5-Mit ones. The drives would also function in the same manner as EVA Report storage, where only one experiment of the same kind can be stored per environment.

Link to comment
Share on other sites

Then you simply add up the amount of data you've already stored and then stop adding more data when you reach the limit.

Oddly enough I'm actually also working on a science pack and was planning to add science drives as well, so I'll share my code for it when I'm done.

Edited by tobyb121
Link to comment
Share on other sites

Then you simply add up the amount of data you've already stored and then stop adding more data when you reach the limit.

Oddly enough I'm actually also working on a science pack and was planning to add science drives as well.

Well, Cabana Corp. is always looking for new um... "employees"... yes...

You're welcome to join the team! So long as you don't give the monkeys peanuts... Bad things tend to happen...

Link to comment
Share on other sites

Additional researchnodes.

A few extra empty nodes have been added to allow easy endgame tie-in by mods. As shown here: http://i.imgur.com/OkwRzka.png

Names are as follows:

experimentalRocketry

nanolathing

experimentalAerodynamics

aerospaceTech

experimentalElectrics

experimentalScience

automation

experimentalsMotors

Just to save other people some time, "experimentalsMotors" is misspelled. It's actually "experimentalMotors".

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