Jump to content

[Question] Need help determining which files I will need to alter for my mod...


Furious_Monk

Recommended Posts

Hey folks,

 

Before posting my mod plan to the WIP section, I wanted to seek help from you knowledgable coders to see if there is any way I can know ahead of time what folders/files I will need to modify in order to fully accomplish what I am looking to do with my planned mod: Compostables. I think I have all the scripts under control, but what I need information about are the LUA files. It is difficult for me to determine from a given file what files it references, and what files reference it, so I cannot really create a list of all the files I will need to update. Is there any way for me to find that information?

 

In addition, I am wondering if there is a way for me to make a lua file that only contains my mod, which will append itself properly to the vanilla lua files, or if I have to make all new files for the folders to hold my specific mod. I assume the latter, just judging by how many IS files there are. Anyway, sorry, I am sure this is all basic stuff that I just don't have the background in. I am a designer, not a programmer! :)

 

I am going to try to break down the core concepts of my mod, so that someone with better knowledge of the file structure might be able to give me a list of files I will need, hopefully.

 

Concept 1: Decomposition

 

I need to find a way to hook into the "rottenness" of a food item and then, if it is in a compost bin or pile, to have that item begin a "decomposition" timer. I am hoping to make that work similarly to cooking (or perhaps burning fuel), but to have it take a much longer period of time (for example, 5 in-game days). It would be nice if I could get each "tick" of decomposition to use a portion of the foods "uses" that would normally factor into how it can be used as an ingredient in cooking.

 

Once that items decomposition timer has filled up (or run out, depending on how I do it), the item should remove itself from the world, and add a tick to a tally of how many items have been decomposed in this bin/pile. This tally can either be hidden or be shown to the player via an info panel, and if possible, I would like to assign N (nitrogen),P (phosphorous), and K (potassium) values to each kind of food. If I can get that NPK value section working, I would like to keep each tally separate, thus having a count for N, P, and K, rather than just "number of items decomposed."

 

Need 1: Bin and pile items that act as containers and some kind of modified oven or generator.

Need 2: Food items to decompose, subtracting from their "uses" and adding to a tally.

Hope: Have 3 separate tallies, one for each type of soil nutrient, and have individual nutrient values assigned to each type of decomposable food.

 

 

Concept 2: Compost Generation

 

If, during one of the decomposition ticks, the tally of decomposed items (or even the total of the N, P, and K tallies) reaches 20, the system should divide the tally total by 20 (to factor in the possibility that there might be a LOT of food decomposing at once), and then round down, causing a "compost" generation event, and leaving the remainder of the tally in place for the next generation event. If I can get the NPK tallies working, rather than just a single tally, I would like to have the percentage of N, P, and K in the 20-tally totals factor into the generation event, creating 1 of 3 different possible composts (High-Nitrogen, High-Phosphorous, or High-Potassium, respectively). If I cannot get that to work, I suppose plain old "Compost" will have to do ;)

 

I would like these items to generate inside the compost bin/pile, and remain there (contributing to container weight maximum) until a player removes it, by using an empty sandbag, plastic bag, or cloth sack (an item I am adding in this mod) on the compost bin, much like extracting water from a water source to a CanHoldWater item. In addition, if one of each kind of "High-N/P/K" compost exists in the bin, it would be neat if I could get those to auto-combine into 3 "Rich Compost" items.

 

Need: Once the tally from Concept 1 have reached a certain value, the tallies are reset to their remainder above that value, and a "compost" item is created within the bin.

Hope 1: Separate tallies are used to determine the density of nutrients in the newly created compost item, which determines which of 4 items it becomes (High N, P, K, or Rich Compost, if the tally ratios are equal). I will probably need to also have a randomizer in case two of the tallies are both higher than the other, and equal to each other.

Hope 2: The High N/P/K items can automatically combine within the bin/pile to produce 3 units of Rich Compost.

 

 

Concept 3: Compost Usage

 

I think I can handle this part, as I have something similar to this working already, but in the interest of full disclosure, I will lay it out here anyway. Perhaps someone can help me find a smarter way to do this. Compost is intended to work exactly like fertilizer, although a little less potent, but without risk of diseasing the plant. Instead, I have made it have the chance to attract flies. I have a "Composted" tally in the farming info panel, which keeps count of how much you have composted a plant, and is separate from "Fertilized."

 

One thing I would possibly like to add to this is the notion that certain types of the High-N/P/K compost work better for certain plants at different stages of plant development. So for example, with Tomatoes, you would want to begin with a rich compost (balanced), then go to High-Phosphorus to encourage flowering stage, and then add High-Potassium after the flowering stage to encourage fruit growth. I am not sure if this is worth going into the depth it would require, but I like when games can give you a slightly better understanding of reality.

 

On a side note, it would be kind of cool if while you used compost you had a chance to create a worm. Or maybe that could be done in the compost bin/pile.

 

Need: Any suggestions on how to do this most efficiently!

 

 

Concept 4: Mulch and Humus

 

And finally, I would like to make mulch-pile and mulcher items that function the same way as compost piles, but are used for twigs, branches, grasses, and vines (I want to make "remove grass" and "remove wall-vine" give you grass and vine items, and increase your foraging skill slightly). The difference here would be that Mulch produces the following benefits:

 

1. visibly alter the ground layer so you can tell what has been mulched.

2. reduce to eliminate trample damage.

3. reduce to eliminate fungal infection.

 

Humus would be something that you could apply after digging but BEFORE planting, that would make that tile into an "enhanced" planting plot (so, whatever the "has been dug" property is for a tile, I would transfer information to the thing that replaces it with a planted tile). Humus would provide the following benefits, depending on the quality of humus used:

 

1. reduce to eliminate mildew.

2. keeps plant at good to optimal water levels after it has been watered to full once.

 

Humus would be created by mixing bags of compost, mulch, and dirt or sand.

 

Needs: Hook into 'remove grass' and 'remove wall vine' actions, and understand how to make the "dug" tile pass information on to the plant that replaces it.

 

 

I realize this was a rather long post, but I thank you for reading this far! If anyone has an interest in helping me out with this, either through advice or even working on it with me, that would be great, and I would love a collaborator while I learn how to do this coding. Also, I will be working on new art for all of this, and will post a template for artists to use to make new objects and sprites once I know what I need to know in order to make one. 

Speaking of which, anyone know where I can find the art files in the Zomboid folders? :)

 

THANKS!

Link to comment
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
×
×
  • Create New...