Campfire Fuel Problems
1 1

12 posts in this topic

Recommended Posts

I was trying to add new fuels to the campfire as well as stop some items from being able to burn since they use literature as their item category. How do I get this to work?

 

Here is my code ...

require "Camping/camping_fuel";   -- Add Fuel for Campfire   table.insert(campingFuelType, Hydrocraft.HCWoodblock,1.0);   table.insert(campingFuelType, Hydrocraft.HCGrass,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCBark,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCBirchbark,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCPinecone,10.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCFircone,10.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCHickoryleaves,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCOakleaves,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCPinebough,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCFirbough,5.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCCoal,30.0/60.0);   table.insert(campingFuelType, Hydrocraft.HCCharcoal,1.0);      -- Cannot Fuel Campfire   table.insert(campingFuelType, Hydrocraft.HCHarmonica,-1.0);   table.insert(campingFuelType, Hydrocraft.HCRubberball,-1.0);   table.insert(campingFuelType, Hydrocraft.HCBowlingball,-1.0);   table.insert(campingFuelType, Hydrocraft.HCBasketball,-1.0);   table.insert(campingFuelType, Hydrocraft.HCSoccerball,-1.0);   table.insert(campingFuelType, Hydrocraft.HCToybear,-1.0);   table.insert(campingFuelType, Hydrocraft.HCYoyo,-1.0);   table.insert(campingFuelType, Hydrocraft.HCDice,-1.0);      -- Add Starter for Campfire   table.insert(campingLightFireType, Hydrocraft.HCDeerpoop,10.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCGrass,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCBark,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCBirchbark,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCHickoryleaves,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCOakleaves,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCPinebough,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCFirbough,5.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCCoal,30.0/60.0);   table.insert(campingLightFireType, Hydrocraft.HCCharcoal,1.0);      -- Cannot Start Campfires   table.insert(campingLightFireType, Hydrocraft.HCHarmonica,-1.0);   table.insert(campingLightFireType, Hydrocraft.HCRubberball,-1.0);   table.insert(campingLightFireType, Hydrocraft.HCBowlingball,-1.0);   table.insert(campingLightFireType, Hydrocraft.HCBasketball,-1.0);   table.insert(campingLightFireType, Hydrocraft.HCSoccerball,-1.0);       table.insert(campingLightFireType, Hydrocraft.HCToybear,-1.0);       table.insert(campingLightFireType, Hydrocraft.HCYoyo,-1.0);       table.insert(campingLightFireType, Hydrocraft.HCDice,-1.0);    

Share this post


Link to post
Share on other sites

The require() function is broken at the moment.  The devs have marked it as fixed and committed for build 31 so more than likely you will need to wait until then before it will work properly in the \mods folder.  You can still test it though by placing the file in the games core \media\lua\server\Camping folder.

Share this post


Link to post
Share on other sites

Really? Because I use () for item distribution and scavenging code and it seems to work fine.

 

According to RoboMat, testing that I have done and the devs here: http://theindiestone.com/forums/index.php/tracker/issue-796-lua-require-broken/ the function does not work correctly from the \mods folder.

 

Maybe you are misunderstanding what I am referring to.  In your code above, the line

require "Camping/camping_fuel";

is where the problem lies.  As I said though, if you copy your file to the base games \media\lua\server\Camping folder it should start working, barring any other errors in your code.  You can also copy all of the files from the base games Camping folder to your mods Camping folder to test it.

Share this post


Link to post
Share on other sites

I have been able to use "require" just fine with inserting items to be found in containers in the SuburbsDistributions code.  One issue I found is that my code only worked properly if the directory path in the mod matched where the SuburbsDistributions was in the code.  To change the fules, make sure your code is in a LUA file in:

 

[MODNAME]\media\lua\server\Camping\

 

 

However, I believe there is a problem with your calls to table.insert(). 

--Default LUA definitiontable.insert (myTable , [position,] value)--Sample line from your code. table.insert(campingFuelType, Hydrocraft.HCWoodblock,1.0);

As far as I can tell, table.insert() is specifically for inserting values into a table that uses a numerical index.  (Meaning a table where the keys are something like 1, 2, 3, 4, 5, or perhaps 53, 54, 55.)  Since the tables in camping_fuel.lua use string keys, table.insert() isn't what you want.

 

In working with distribution of items in containers, I wanted to adjust the number of rolls for a particular container.  I was able to simply set the "key = value" like any normal table.

 

This is how I would suggest you try your code:

require "Camping/camping_fuel";   -- Add Fuel for Campfire   campingFuelType["Hydrocraft.HCWoodblock"] = 1.0;   campingFuelType["Hydrocraft.HCGrass"] = 5.0/60.0;

Share this post


Link to post
Share on other sites

@EasyPickins

 

It works great for adding fuel items but how can I make it stop fuel items like how Shoes have a -1 next to their value?

 

I tried having ...

campingFuelType.HCYoyo = -1.0campingFuelType["HCYoyo"] = -1.0

Since I have a Yoyo item that is actually a Literature item, so you can "play" with it. However since all Literature are flammable I tried to put the -1.0 value for it so it would not be a burnable item.

 

In addition why is there a numerical sign next to both lines? What would happen if you put like ...

campingFuelType.HCWoodblock = 1.0campingFuelType["HCWoodblock"] = 2.0

Thanks in advance!

Share this post


Link to post
Share on other sites

Putting -1 as the fuel amount only works with campingLightFireType, not campingFuelType.

This means you can stop specific items being used to start a fire but cannot stop it being used as fuel.

I suppose I should change it so -1 works with campingFuelType as well.

Share this post


Link to post
Share on other sites

@EasyPickins

 

It works great for adding fuel items but how can I make it stop fuel items like how Shoes have a -1 next to their value?

 

I tried having ...

campingFuelType.HCYoyo = -1.0campingFuelType["HCYoyo"] = -1.0

Since I have a Yoyo item that is actually a Literature item, so you can "play" with it. However since all Literature are flammable I tried to put the -1.0 value for it so it would not be a burnable item.

 

In addition why is there a numerical sign next to both lines? What would happen if you put like ...

campingFuelType.HCWoodblock = 1.0campingFuelType["HCWoodblock"] = 2.0

Thanks in advance!

So, the code should be written like the following?

 

require "Camping/camping_fuel";

   -- Add Fuel for Campfire

   table.insert(campingFuelType.HCYoyo = 1.0);

   table.insert(campingFuelType["HCYoyo"] = -1.0);

 

---------------------------------------------------------------------------

or something else?

Share this post


Link to post
Share on other sites
Posted (edited)

     campingFuelType.Mattress = 10.0/30
 campingFuelType["Mattress"] = 10.0/30

 

Help me to understand...
What do these two numbers mean? Before slash and after ...

 

Why in the game, the mattress does not appear as fuel? Need to add a Base through the dot at the beginning of the name?

 

Also, some items do not appear for burning, although I put them in the table.
For example:

 

    campingFuelType.Doll = 1.0/10
        campingFuelType["Doll"] = 1.0/10   

 

Some items are added and burn ... everything is fine ... for example

  

     campingFuelType.HCBriefs2 = 1.0/7
    campingFuelType["HCBriefs2"] = 1.0/7   

 

What's my mistake?
 
Understood by experience ...
Edited by Nebula

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1