Jump to content

Creating/Defining a new Resource.


Recommended Posts

Hey All,

I've searched, but couldn't find the information I was looking for. To start, I know how to start by creating a simple plugin/module.

I would like to know how I would go about creating and defining a new resource, ie Food.

Thanks in advance for your help, I do apologize for creating a new thread if there's a thread for this already.

- udk_lethal_d0se

Link to comment
Share on other sites

Alrighty,

I have defined my Resources, Created Parts for these Resources (storage containers) and Created a Command Pod that will utilize said Resources.

Now for the next question, how does one go about creating a new CommandPod Module to utilize/drain my proposed resources?

Link to comment
Share on other sites

That depends on which conditions it should drain under, you may be able to use an existing module like ModuleGenerator or you may need a custom plugin.

The conditions at which the Resources Drain are dependent on the amount of Crew occupying the part over a period of time.

I'll elaborate on my modification a little more, my resources are as follows:

- Oxygen

- Karbun

- Food

- Water

- Waste

[i am aware of the Life Support Mods, but there's no harm in making one for personal use].

I have used the ModuleGenerator as suggested to create/deplete my Resources over time. What I would like to do is have ship control drop once a condition is met, much like when you run out of Electricity.

The conditions are as follows:

- Kerbal intake per day: 1kg Oxygen, 0.5kg Food, 3.5k Water.

- Kerbal output per day: 1kg Karbun, 4kg Waste.

For the sake of argument, and the simplest way to kill a Kerbal; once Oxygen is depleted, ship control is lost and your Kerbals are dead.

I'm presuming, for the most part, the State of my Kerbals and Control of the ship will come from a custom plugin?

Link to comment
Share on other sites

From one of the probe core .cfgs:

MODULE

{

name = ModuleCommand

minimumCrew = 0

RESOURCE

{

name = ElectricCharge

rate = 0.02777778

}

}

If you do something like this, but with oxygen or something, the vessel should become uncontrollable when it runs out. Drawbacks are that it'll drain whether you have kerbals in there or not, so using a plugin is probably a better idea.

Link to comment
Share on other sites

Right, I'm quite happy with the culmination of help from everyone so far and have come up with this.

// KSP: Custom Configuration File.
// -------------------------------
// Vitae by udk_lethal_d0se.

// --- General Parameters ---
name = VITAE_Command_Pod
module = CommandPod
author = udk_lethal_d0se

// --- Asset Parameters ---
mesh = model.mu
scale = 1
rescaleFactor = 1

// --- Node Definitions ---
node_stack_bottom = 0.0, -0.47924, 0.0, 0.0, 1.0, 0.0, 2
node_stack_top = 0.0, 1.19319, 0.0, 0.0, 1.0, 0.0, 1

// --- Editor Parameters ---
cost = 2500
category = Pods
subcategory = 0
title = VITAE Command Pod
manufacturer = udk_lethal_d0se
description = N/A.

// --- Attachment Parameters ---
// Rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,0,1,1,0

// --- Standard Parameters ---
mass = 4
dragModelType = default
maximum_drag = 0.20
minimum_drag = 0.15
angularDrag = 2
crashTolerance = 45
maxTemp = 3500
vesselType = Ship

// --- Pod/RCS Parameters ---
rotPower = 20
linPower = 20
Kp = 1.0
Kd = 1.0

// --- Internal Setup ---
CrewCapacity = 3

INTERNAL
{
name = PodCockpit
}

MODULE
{
name = ModuleCommand
minimumCrew = 1

RESOURCE
{
name = ElectricCharge
rate = 0.025
}

RESOURCE
{
name = V_Oxygen
rate = 0.000114
}

RESOURCE
{
name = V_Food
rate = 0.000057
}

RESOURCE
{
name = V_Water
rate = 0.000399
}
}

MODULE
{
name = ModuleGenerator

OUTPUT_RESOURCE
{
name = V_Karbun
rate = 0.000114
}

OUTPUT_RESOURCE
{
name = V_Waste
rate = 0.000456
}

isAlwaysActive = true
}

RESOURCE
{
name = ElectricCharge
amount = 100.0
maxAmount = 100.0
}

RESOURCE
{
name = V_Oxygen
amount = 3.0
maxAmount = 3.0
}

RESOURCE
{
name = V_Karbun
amount = 0.0
maxAmount = 3.0
}

RESOURCE
{
name = V_Food
amount = 1.5
maxAmount = 1.5
}

RESOURCE
{
name = V_Water
amount = 10.5
maxAmount = 10.5
}

RESOURCE
{
name = V_Waste
amount = 0.0
maxAmount = 12.0
}

// --- End of File ---

Edited by udk_lethal_d0se
Link to comment
Share on other sites

This now works as intended, ship control is lost when the following conditions are met.

- Power Deprivation

- Oxygen Deprivation

- Food Deprivation

- Water Deprivation

All of the intended values work wonderfully too, the Command Pod (config in previous post) gives the 3 Kerbal Crew enough supplies for a 6 hour mission, or one Solar Day on Kerbin.

Screenshot:

VjIS5pl.jpg

Thanks for the help everyone. I'll probably open a new thread if I choose to expand on this with Hydroponics, Waste Disposal, Orbital Resupply, etc.

Link to comment
Share on other sites

One thing to note is that the way you have things set up now, those resources will deplete whether there are Kerbals inside the pod or not. If you want the resources to only deplete when the pod is occupied, you will need an external plugin similar to IonCross Life Support. I'd suggest you try and contact the author and see if he might be able to help you towards that end.

Link to comment
Share on other sites

One thing to note is that the way you have things set up now, those resources will deplete whether there are Kerbals inside the pod or not. If you want the resources to only deplete when the pod is occupied, you will need an external plugin similar to IonCross Life Support. I'd suggest you try and contact the author and see if he might be able to help you towards that end.

Yeah, this was noted earlier. Thanks for the suggestion, I'm trying to see how much I can do via part config before I delve into Plugin creation.

Link to comment
Share on other sites

Nice idea with the resources. If you would like to create a plugin where the amount the will be consumed is calculated by kerbal (the more kerbals the higher the consumption) I would help you if you need help.

But just as little note currently I am studying so I may not have time all day long. I am firmiliar with programming C/C++ and Java and already looked into programming Modules for KSP. Learning C# is not that difficult for me.

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...
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...