Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Creating/Defining a new Resource.

  1. #1
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215

    Question Creating/Defining a new Resource.

    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

  2. #2
    Make a new .cfg file in the /Resources directory. Use the ResourcesGeneric.cfg (the stock resources) as a guide to how they work.
    I am for the stars, but sometimes I hit Kerbin.

  3. #3
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215
    Quote Originally Posted by Katalliaan View Post
    Make a new .cfg file in the /Resources directory. Use the ResourcesGeneric.cfg (the stock resources) as a guide to how they work.
    Thank you.

  4. #4
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215
    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?

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

  6. #6
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215
    Quote Originally Posted by EndlessWaves View Post
    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?

  7. #7
    Global Moderator Supernovy's Avatar
    Join Date
    Jun 2012
    Location
    Jun 2012
    Posts
    1,263
    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.
    There would about think orbit really should could still right.

  8. #8
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215
    Right, I'm quite happy with the culmination of help from everyone so far and have come up with this.

    Code:
    // 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 ---
    Last edited by udk_lethal_d0se; 8th May 2013 at 20:30.

  9. #9
    Spacecraft Engineer udk_lethal_d0se's Avatar
    Join Date
    Apr 2013
    Location
    Suffolk, United Kingdom
    Posts
    215
    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:



    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.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •