Jump to content

[1.3.1] NoFuel - v0.7 - 17-01-18


selfish_meme

Recommended Posts

IzgjNdQ.png

A small MM script that by default defuels all parts.

The idea behind it that you must build refueling infrastructure to fuel any launched craft. So your Space Program will need mining, refining, transportation and refueling infrastructure to work.

Release v0.7! The - it should probably have been in a folder from start release

Download

Licence

Thanks to @artwhaley for the help with the script

Visit my dev thread for my other mods

Edited by selfish_meme
Link to comment
Share on other sites

About using Mac and linux:

I do, too.  It works perfectly fine.  Just make sure to get Monodevelop and Unity.  I highly recommend using Xamerin Studio instead of mlnodevelop for KSP stuff, as it has a much better UI and is a little more versatile.  There are some really good resources in the add on development sub-forum, which I'm sure you know.

Link to comment
Share on other sites

I could modify parts using MM and maybe disable crossfeed on launch clamps. Would this be enough? It wouldn't affect mod parts.

I am already going through every part on a re-org of Kerbpaint so the MM script route would be quite easy. 

Edited by selfish_meme
Link to comment
Share on other sites

It should be able to work with mods as well...  other than real fuels, of course...

I haven't tested it, but if this isn't exactly what you want, it's close, I think:

@PART[*]:HAS[@RESOURCE[LiquidFuel]]
{
  
    @RESOURCE[LiquidFuel] {
        @amount = 0
    }
    @RESOURCE[Oxidizer] {
        @amount = 0
    }
}
Link to comment
Share on other sites

10 minutes ago, artwhaley said:

It should be able to work with mods as well...  other than real fuels, of course...

I haven't tested it, but if this isn't exactly what you want, it's close, I think:


@PART[*]:HAS[@RESOURCE[LiquidFuel]]
{
  
    @RESOURCE[LiquidFuel] {
        @amount = 0
    }
    @RESOURCE[Oxidizer] {
        @amount = 0
    }
}

Thank you very much, I can add monoprop to that script, unfortunately no way to make Solid Fuel in stock, but with this and a contract pack I think it could be on it's way

Link to comment
Share on other sites

Especially if you're adding monoprop, it's probably best to split it into 3 steps to make sure you catch everything...

 

@PART[*]:HAS[@RESOURCE[LiquidFuel]]
{
  
    @RESOURCE[LiquidFuel] {
        @amount = 0
    }
}
@PART[*]:HAS[@RESOURCE[Oxidizer]]
{
  
    @RESOURCE[Oxidizer] {
        @amount = 0
    }
}
@PART[*]:HAS[@RESOURCE[MonoPropellant]]
{
  
    @RESOURCE[MonoPropellant] {
        @amount = 0
    }
}

 

Link to comment
Share on other sites

Well thank you very much @artwhaley I have modified the script above to add XenonGas as well and put it up on Github. I was just going to choose an open source you can do whatever the hell you like with it licence. Anyway it's here if you want it, now on to CKAN.

https://github.com/leocadle/nofuel/releases

Link to comment
Share on other sites

So the MM script is up and I have started the CKAN integration (run into a bug straight away, it might be OSX and Mono we will see) but I don't think it is the end solution What I want to provide is a mod that does not interfere with your ship building, dV and CoM won't work properly without fuel in the tanks, so it is back to the mod based route. But I can start the Contracts part of it independently.

Link to comment
Share on other sites

That's a good point I hadn't thought of - the COM shifts.  So, it sounds like you do need a plugin.   

A suggestion, though... I'm not a person who'd necessarily use this mod, so maybe talk to people who've expressed interest in it from a gameplay standpoint before taking my opinion too seriously...  but....  I might build your plugin as a partmodule, then use a MM script to add your partmodule to every commandpod and probecore.  This way, any controllable vessel spawns empty of fuel, but if you wanted to...  you could spawn an uncontrolled fuel tank on the pad for your tanker or other support vessels to refill from in a pinch?  It still makes you deal with fueling your rockets while allowing an option to get fuel into the game if necessary for some reason?  And it's easy to make a partmodule check to see if a vessel's situation is prelaunch, if so, drain the tank, then make a note in the .sfs file that we've already robbed this vessel, so we don't need to ever do it again.

Link to comment
Share on other sites

2 hours ago, artwhaley said:

That's a good point I hadn't thought of - the COM shifts.  So, it sounds like you do need a plugin.   

A suggestion, though... I'm not a person who'd necessarily use this mod, so maybe talk to people who've expressed interest in it from a gameplay standpoint before taking my opinion too seriously...  but....  I might build your plugin as a partmodule, then use a MM script to add your partmodule to every commandpod and probecore.  This way, any controllable vessel spawns empty of fuel, but if you wanted to...  you could spawn an uncontrolled fuel tank on the pad for your tanker or other support vessels to refill from in a pinch?  It still makes you deal with fueling your rockets while allowing an option to get fuel into the game if necessary for some reason?  And it's easy to make a partmodule check to see if a vessel's situation is prelaunch, if so, drain the tank, then make a note in the .sfs file that we've already robbed this vessel, so we don't need to ever do it again.

Thats sounds like another way forward, I will check out the part module situation. The point is for the player to build things like a fuel truck and storage tanks, so I wouldn't try and spawn any free fuel around.

Link to comment
Share on other sites

Interesting idea, personally I was looking for a mod that can add options of building/upgrading different fuel tanks at KSC site so you can build and fuel bigger and bigger rockets along with upgrades (storage tanks' refilling time and max capacity increases with their tech level).

Link to comment
Share on other sites

25 minutes ago, riocrokite said:

Interesting idea, personally I was looking for a mod that can add options of building/upgrading different fuel tanks at KSC site so you can build and fuel bigger and bigger rockets along with upgrades (storage tanks' refilling time and max capacity increases with their tech level).

It sounds great and I would love to be able to do it one day.

Link to comment
Share on other sites

On 20 January 2016 at 1:59 PM, CliftonM said:

About using Mac and linux:

I do, too.  It works perfectly fine.  Just make sure to get Monodevelop and Unity.  I highly recommend using Xamerin Studio instead of mlnodevelop for KSP stuff, as it has a much better UI and is a little more versatile.  There are some really good resources in the add on development sub-forum, which I'm sure you know.

Thanks for that, I got a development environment running on my mac with Monodevelop, now to actually write something other than Hello World

Link to comment
Share on other sites

Doing this as a plugin would be really simple. Kerbal Construction Time used to do exactly this in the early days (then would refill them after the required time had passed).

 

I'm not at my home computer, so I can't get exact names for functions, but here's a few pointers on where to look:

0. Make sure you are "using KSP;" and probably also "using UnityEngine;". You'll have to reference the UnityEngine.dll and Assembly-CSharp.dll from the KSPFolder/Managed/ folder (might be slightly different on mac/linux)

1. You'll want to add a listener to the OnVesselRollout event. Create a function that takes a Vessel as the only parameter (ie: public void MyFunction(Vessel launchedVessel)) and add it to that event with GameEvents.OnVesselRollout.Add(MyFunction);

2. In that function you'll want to cycle through all the parts and set the fuel to zero. Looping through all the parts is as easy as "foreach (Part p in launchedVessel.parts) { }". To drain the resources you'll have to find them on the Part. I don't recall the exact structure off the top of my head. You'll have to loop through those too to find only the ones you want to drain and set their amounts to zero.

3. You might want to track which resources you drain and how much. Fuel costs funds (not many, but some) so you might consider calculating the cost of the resources you drain and giving that back to the player (look into the Funding class. Either utilize the Funding.Instance or use the static functions if there are appropriate ones)

 

If you need help, don't hesitate to PM me or tag me in a comment (using the @ symbol or by quoting me). Once I get home I could write this up in a few minutes, but this is also a great learning opportunity for a potential new modder ;)

Link to comment
Share on other sites

23 minutes ago, magico13 said:

Doing this as a plugin would be really simple. Kerbal Construction Time used to do exactly this in the early days (then would refill them after the required time had passed).

 

I'm not at my home computer, so I can't get exact names for functions, but here's a few pointers on where to look:

0. Make sure you are "using KSP;" and probably also "using UnityEngine;". You'll have to reference the UnityEngine.dll and Assembly-CSharp.dll from the KSPFolder/Managed/ folder (might be slightly different on mac/linux)

1. You'll want to add a listener to the OnVesselRollout event. Create a function that takes a Vessel as the only parameter (ie: public void MyFunction(Vessel launchedVessel)) and add it to that event with GameEvents.OnVesselRollout.Add(MyFunction);

2. In that function you'll want to cycle through all the parts and set the fuel to zero. Looping through all the parts is as easy as "foreach (Part p in launchedVessel.parts) { }". To drain the resources you'll have to find them on the Part. I don't recall the exact structure off the top of my head. You'll have to loop through those too to find only the ones you want to drain and set their amounts to zero.

3. You might want to track which resources you drain and how much. Fuel costs funds (not many, but some) so you might consider calculating the cost of the resources you drain and giving that back to the player (look into the Funding class. Either utilize the Funding.Instance or use the static functions if there are appropriate ones)

 

If you need help, don't hesitate to PM me or tag me in a comment (using the @ symbol or by quoting me). Once I get home I could write this up in a few minutes, but this is also a great learning opportunity for a potential new modder ;)

Wow thanks very much for this, I am indeed looking at it as an opportunity to get into modding and back into programming.

Link to comment
Share on other sites

Maybe you could try to change FASA's Launch Clamp module so they mine fuel from the LaunchPad. That would be nice. You might change it to a generator that turns Ore into LF/O, Xenon, and Monoprop. For Solid Fuel, it's best to let that go since it's so cheap and usually loaded before rollout.

Edited by legoclone09
Link to comment
Share on other sites

  • 1 year later...
43 minutes ago, selfish_meme said:

Can I get this thread moved to the Add-ons-Add-on Releases thread please

I'm away from my PC for much of the day but does this MM config basically just make all fuel = 0 in every part or remove it on launch?

Nice idea to make construction take time without KCT.

Peace. 

Link to comment
Share on other sites

25 minutes ago, theJesuit said:

I'm away from my PC for much of the day but does this MM config basically just make all fuel = 0 in every part or remove it on launch?

Nice idea to make construction take time without KCT.

Peace. 

It actually removes it by default, this is not ideal, one day I want to do it via a proper mod so you can build your rocket with correct CoM and then it is defueled before launch.

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