Angel-125

[1.8.x] Snacks! - Friendly, Simplified Life Support

Recommended Posts

4 hours ago, linuxgurugamer said:

@Angel-125

I'm working on updating Dang It!, and a tester is having a problem with Snacks.

So, before I start digging, I saw that on SpaceDock, the version seems to be for 1.2 (unless you just forgot to update Spacedock), and the last version was released on 11/2

So, do you have a 1.2.1 version available?

Almost, I'm testing some fixes.

Share this post


Link to post
Share on other sites
1 hour ago, Angel-125 said:

Almost, I'm testing some fixes.

OK.

If you can, please ping me when you get it released.

Thanks

Share this post


Link to post
Share on other sites
3 hours ago, linuxgurugamer said:

OK.

If you can, please ping me when you get it released.

Thanks

Done, get Snacks 1.5.6 here.

- Fixed NRE's that happen in the editor (VAB/SPH)
- Snacking frequency is correctly calculated now.
- Updated to KSP 1.2.1
- Added recyclers to the Mk3 shuttle cockpit and the Mk2 crew cabin.

Share this post


Link to post
Share on other sites

love the update on the new recyclers!!

Mind I ask, is it ok if I create another additional cfg file named "additionalRecyclers.cfg" in the ./Snacks/ModuleManagerPatches/ModSupport folder, so that it applies additional recycler abilities on modded and/or other parts i wish to have that feature?

i.e. utilityCabin/PPD-24 Itinerant Service Container from NearFutureSpacecraft would have the line

@PART[utilityCabin]:NEEDS[NearFutureSpacecraft]

instead of (or add "utilityCabin" to)

@PART[crewCabin,mk3Cockpit_Shuttle,mk2CrewCabin]

but the section below copy/pasted from the last segment of the "MM_Stock.cfg"

 

additional thinking:
 

Spoiler

I have created a folder called  ./Snacks/ModuleManagerPatches/ModSupport, added a config there called "NearFutureSpacecraft.cfg" (or w/e mod is wishing to get supported, IF planned or else)

this way i might get that sorted if thats not just this one part of this mod or different mods.

My question still remains and I'm yet convinced those recycler abilities should just be added on mod parts that are eligable for that feature .. or better said, that have the capability :wink:

ty in advance

Edited by LatiMacciato

Share this post


Link to post
Share on other sites
41 minutes ago, LatiMacciato said:

love the update on the new recyclers!!

Mind I ask, is it ok if I create another additional cfg file named "additionalRecyclers.cfg" in the ./ModuleManagerPatches folder, so that it applies additional recycler abilities on modded and/or other parts i wish to have that feature?

i.e. utilityCabin/PPD-24 Itinerant Service Container from NearFutureSpacecraft would have the line


@PART[utilityCabin]:NEEDS[NearFutureSpacecraft]

instead of (or add "utilityCabin" to)


@PART[crewCabin,mk3Cockpit_Shuttle,mk2CrewCabin]

ty in advance

Absolutely! Knock yourself out. :) Snacks is designed to be moddable, so by all means, make extra patches. :)

Share this post


Link to post
Share on other sites

I have added utilityCabin and the 2 greenhouses from KBPS so far (1 module, 1 container)

NearFutureSpacecraft.cfg: (400 snacks/100 soil, 10 ec)

Spoiler

@PART[utilityCabin]:NEEDS[NearFutureSpacecraft]
{
	//This is calibrated for 4 kerbals at 100% efficiency
	//when they consume 1 snack per meal and 1 meal per day. For your custom recycler,
	//Take into account the number of kerbals it should support along with the meals and snacks.
	//In game, the player can adjust the efficiency of the recycler from 10% to 100%.
	MODULE
	{
		name = SoilRecycler
		ConverterName = Soil Recycler
		StartActionName = Start Soil Recycler
		StopActionName = Stop Soil Recycler
		AutoShutdown = false
		GeneratesHeat = false
		UseSpecialistBonus = true
		SpecialistEfficiencyFactor = 0.2
		UseSpecializationBonus = true
		SpecialistEfficiencyFactor = 0.1
		ExperienceEffect = ScienceSkill
		EfficiencyBonus = 1.0
		RecyclerCapacity = 4
	 
		INPUT_RESOURCE
		{
			ResourceName = Soil
			Ratio = 0.0002
			FlowMode = ALL_VESSEL
  		}

		INPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 10
		}

		OUTPUT_RESOURCE
		{
			ResourceName = Snacks
			Ratio = 0.0002
			DumpExcess = false
			FlowMode = ALL_VESSEL
		}
	}

	RESOURCE
	{
		name = Soil
		amount = 0
		maxAmount = 100
	}
}

 

 

PlanetaryBaseInc.cfg (greenhouse has also 400 snacks/100 soil, same ec, but the container doesn't have any storage for snacks/soil and converts in half ratio/just 5 ec)

Spoiler

@PART[KKAOSS_Greenhouse_g]:NEEDS[PlanetaryBaseInc]
{
	//This is calibrated for 4 kerbals at 100% efficiency
	//when they consume 1 snack per meal and 1 meal per day. For your custom recycler,
	//Take into account the number of kerbals it should support along with the meals and snacks.
	//In game, the player can adjust the efficiency of the recycler from 10% to 100%.
	MODULE
	{
		name = SoilRecycler
		ConverterName = Soil Recycler
		StartActionName = Start Soil Recycler
		StopActionName = Stop Soil Recycler
		AutoShutdown = false
		GeneratesHeat = false
		UseSpecialistBonus = true
		SpecialistEfficiencyFactor = 0.2
		UseSpecializationBonus = true
		SpecialistEfficiencyFactor = 0.1
		ExperienceEffect = ScienceSkill
		EfficiencyBonus = 1.0
		RecyclerCapacity = 4
	 
		INPUT_RESOURCE
		{
			ResourceName = Soil
			Ratio = 0.0002
			FlowMode = ALL_VESSEL
  		}

		INPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 10
		}

		OUTPUT_RESOURCE
		{
			ResourceName = Snacks
			Ratio = 0.0002
			DumpExcess = false
			FlowMode = ALL_VESSEL
		}
	}

	RESOURCE
	{
		name = Soil
		amount = 0
		maxAmount = 100
	}
}

@PART[KKAOSS_LS_container_greenhouse]:NEEDS[PlanetaryBaseInc]
{
	//This is calibrated for 4 kerbals at 100% efficiency
	//when they consume 1 snack per meal and 1 meal per day. For your custom recycler,
	//Take into account the number of kerbals it should support along with the meals and snacks.
	//In game, the player can adjust the efficiency of the recycler from 10% to 100%.
	MODULE
	{
		name = SoilRecycler
		ConverterName = Soil Recycler
		StartActionName = Start Soil Recycler
		StopActionName = Stop Soil Recycler
		AutoShutdown = false
		GeneratesHeat = false
		UseSpecialistBonus = true
		SpecialistEfficiencyFactor = 0.2
		UseSpecializationBonus = true
		SpecialistEfficiencyFactor = 0.1
		ExperienceEffect = ScienceSkill
		EfficiencyBonus = 1.0
		RecyclerCapacity = 4
	 
		INPUT_RESOURCE
		{
			ResourceName = Soil
			Ratio = 0.0001
			FlowMode = ALL_VESSEL
  		}

		INPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 5
		}

		OUTPUT_RESOURCE
		{
			ResourceName = Snacks
			Ratio = 0.0001
			DumpExcess = false
			FlowMode = ALL_VESSEL
		}
	}
}

 

just saved that 2 files, wish me luck, hehe

EDIT: works flawlessly!

ty again for that feature :)

heres my XKOM.cfg: (300 snacks/75 soil, 10 ec regular rate)

Spoiler

@PART[SkyRangerFuselage]:NEEDS[XKOM]
{
	//This is calibrated for 4 kerbals at 100% efficiency
	//when they consume 1 snack per meal and 1 meal per day. For your custom recycler,
	//Take into account the number of kerbals it should support along with the meals and snacks.
	//In game, the player can adjust the efficiency of the recycler from 10% to 100%.
	MODULE
	{
		name = SoilRecycler
		ConverterName = Soil Recycler
		StartActionName = Start Soil Recycler
		StopActionName = Stop Soil Recycler
		AutoShutdown = false
		GeneratesHeat = false
		UseSpecialistBonus = true
		SpecialistEfficiencyFactor = 0.2
		UseSpecializationBonus = true
		SpecialistEfficiencyFactor = 0.1
		ExperienceEffect = ScienceSkill
		EfficiencyBonus = 1.0
		RecyclerCapacity = 4
	 
		INPUT_RESOURCE
		{
			ResourceName = Soil
			Ratio = 0.0002
			FlowMode = ALL_VESSEL
  		}

		INPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 10
		}

		OUTPUT_RESOURCE
		{
			ResourceName = Snacks
			Ratio = 0.0002
			DumpExcess = false
			FlowMode = ALL_VESSEL
		}
	}

	RESOURCE
	{
		name = Soil
		amount = 0
		maxAmount = 75
	}
}

 

EDIT2: yes i noticed the snack/soil balance on the hitchy .. its 1 soil per 4 snacks .. corrected, now its as its originally purposed :)

Edited by LatiMacciato

Share this post


Link to post
Share on other sites

@Angel-125

DangIt! uses the following code to get a list of all the resources in a part:

 leakables = new List<PartResource>();

But it doesn't seem to get the snacks which are controlled by the SnacksResourceSwitcher

Any ideas?

I just looked at the code, and I think I might know what's going on.

DangIt gets the list early, probably before Snacks! has updated the partlist

I'll have to think about this, not sure yet how to fix

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites
1 hour ago, linuxgurugamer said:

@Angel-125

DangIt! uses the following code to get a list of all the resources in a part:


 leakables = new List<PartResource>();

But it doesn't seem to get the snacks which are controlled by the SnacksResourceSwitcher

Any ideas?

I just looked at the code, and I think I might know what's going on.

DangIt gets the list early, probably before Snacks! has updated the partlist

I'll have to think about this, not sure yet how to fix

Hm. Can you get to the SnacksResourceSwitcher?

Share this post


Link to post
Share on other sites
1 hour ago, Angel-125 said:

Hm. Can you get to the SnacksResourceSwitcher?

Not without using Reflection.

But, I have some ideas, I'm going to try them this evening.  If it works, I may send you a PR on Github

Share this post


Link to post
Share on other sites
10 hours ago, linuxgurugamer said:

Not without using Reflection.

But, I have some ideas, I'm going to try them this evening.  If it works, I may send you a PR on Github

I found the problem, it was becuase the basic part didn't have any resources the way a tank did, so the MM patch for tanks wasn't working on it.

I'm adding a MM patch for any part which contains:  SnacksResourceSwitcher

Share this post


Link to post
Share on other sites

I'm having a minor issue with the latest version (1.5.6), Snack Supply check window is showing indefinite duration for all vessels. Snack and crew amount is fine. Only exception is when I'm controlling a vessel, for that it shows the right estimated time, but after exiting to KSC, goes back to indefinite. Anyone else experiencing this? Running KSP 1.2.1 64 bit.

Also, there is no Snacks button in Tracking Station, could you enable it please? I can still switch it on in KSC and switch to TS, but a separate button would be convenient.

Edited by bounty123

Share this post


Link to post
Share on other sites
6 hours ago, bounty123 said:

I'm having a minor issue with the latest version (1.5.6), Snack Supply check window is showing indefinite duration for all vessels. Snack and crew amount is fine. Only exception is when I'm controlling a vessel, for that it shows the right estimated time, but after exiting to KSC, goes back to indefinite. Anyone else experiencing this? Running KSP 1.2.1 64 bit.

Running KSP 1.2.1 64-bit and Snacks 1.5.6 in Linux, the supply window shows correct times for me at KSC.

On a related note, though, I notice that it says "indefinite" in the VAB when the craft has zero snacks aboard.  I don't know whether that's a code bug, or an intentional message using an inaccurate word.  (Strictly speaking, "indefinite" just means that the duration can't be determined, but in common usage it means "no end in sight", i.e. unlimited snacks.)

Share this post


Link to post
Share on other sites
4 hours ago, Wyzard said:

Running KSP 1.2.1 64-bit and Snacks 1.5.6 in Linux, the supply window shows correct times for me at KSC.

I investigated a bit, and it must be something save-related, because it works fine with a new save. I wonder how could I fix it.

Share this post


Link to post
Share on other sites

@Angel-125:  I like what you've done with Snacks! here, solving the 2 main issues with the original version:  lack of extra storage and lack of recyclers.  I'll give this a try.  Thanks.

Share this post


Link to post
Share on other sites
8 hours ago, bounty123 said:

I investigated a bit, and it must be something save-related, because it works fine with a new save. I wonder how could I fix it.

Not sure. One scenario I tested was dropping Snacks into an existing save, including one with active rescue contracts.

I'll look into adding a Snacks button into the Tracking Station window; depends upon whether the game supports that.

2 hours ago, Geschosskopf said:

@Angel-125:  I like what you've done with Snacks! here, solving the 2 main issues with the original version:  lack of extra storage and lack of recyclers.  I'll give this a try.  Thanks.

Glad you like the changes. :) The third issue it had, a messy code base, is also in progress. I also like that none of the penalties will brick your mission, just like losing comms won't necessarily brick your mission. And should you uninstall Snacks, doing so won't brick your save. And, I've left hooks in place so that Snacks can be modded. Say, for instance, you want the death penalty, radiation effects, and to track habitation time. These features don't really belong in the core mod but could be added as an additional plugin.

Share this post


Link to post
Share on other sites
On 11/13/2016 at 6:16 PM, Angel-125 said:

Not sure. One scenario I tested was dropping Snacks into an existing save, including one with active rescue contracts.

 

Update: calculation changes from indefinite to right amount, if I disable recyclers

Update2: I think I managed to find the bug in the code. In SnackSnapshot.cs, in case of not loaded vessels with recyclers, the  snackConsumption reduction code runs at the wrong stage, multiple times for every protopart, so snackConsumption becomes negative. If I move it outside of the "foreach (ProtoPartSnapshot pps in pv.protoPartSnapshots)" loop, the consumption value becomes correct and the same as in case of loaded vessels, which worked fine.

Edited by bounty123

Share this post


Link to post
Share on other sites
On 11/13/2016 at 11:47 AM, bounty123 said:

 

Update: calculation changes from indefinite to right amount, if I disable recyclers

Update2: I think I managed to find the bug in the code. In SnackSnapshot.cs, in case of not loaded vessels with recyclers, the  snackConsumption reduction code runs at the wrong stage, multiple times for every protopart, so snackConsumption becomes negative. If I move it outside of the "foreach (ProtoPartSnapshot pps in pv.protoPartSnapshots)" loop, the consumption value becomes correct and the same as in case of loaded vessels, which worked fine.

Awesome. Can you create a pull request?

Share this post


Link to post
Share on other sites
1 hour ago, Angel-125 said:

Awesome. Can you create a pull request?

Ok I'll try tomorrow, it's about time I figure out how to do it. Snacks already made me learn how to debug and compile a ksp addon, that's how much I like it :)

Share this post


Link to post
Share on other sites

Sent a pull request with the duration display fix. Also for some minor cosmetic changes to the Supply window if you agree, I found it a bit hard to distinguish between vessels as it was, especially when you have many vessels around the same body. Before - after screenshot.

Edited by bounty123

Share this post


Link to post
Share on other sites
On 11/17/2016 at 2:42 AM, bounty123 said:

Sent a pull request with the duration display fix. Also for some minor cosmetic changes to the Supply window if you agree, I found it a bit hard to distinguish between vessels as it was, especially when you have many vessels around the same body. Before - after screenshot.

Much appreciated, thanks. :)Here is 1.5.7 with your changes.

Share this post


Link to post
Share on other sites

@Angel-125 wanted to ask,is there a possibility to set the settings so that when Kerbals Faint,they stay in that status until you provide more Snacks?

If no, is there a possibility to add this Feature in the next release?

Share this post


Link to post
Share on other sites
55 minutes ago, dtoxic said:

@Angel-125 wanted to ask,is there a possibility to set the settings so that when Kerbals Faint,they stay in that status until you provide more Snacks?

If no, is there a possibility to add this Feature in the next release?

At present no, but you could set the faint duration to maximum. Whenever the next snack time is, they'll faint again.

Share this post


Link to post
Share on other sites
5 minutes ago, Angel-125 said:

At present no, but you could set the faint duration to maximum. Whenever the next snack time is, they'll faint again.

Ok, thx for the info

Share this post


Link to post
Share on other sites

Is anyone having the issue where the kerbal EVAs, and then immediately becomes disabled on your ladder due to lack of snacks? Maybe make it so that kerbals can go a few hours before fainting from lack of snacks?

Share this post


Link to post
Share on other sites
21 minutes ago, sardia said:

Is anyone having the issue where the kerbal EVAs, and then immediately becomes disabled on your ladder due to lack of snacks? Maybe make it so that kerbals can go a few hours before fainting from lack of snacks?

you have the settings so you can adjust that,personally i have not experienced that.

make sure you got the latest version

Share this post


Link to post
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.