[MOD]Knotholes and nature[0.2][knothole]

Post Reply
Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

[MOD]Knotholes and nature[0.2][knothole]

by Xevmescrige » Post

This is a simple mod that adds knotholes in trees that you can store up to 2 stacks of items inside of them. They generate in forests near water.

Features
Trees near other trees and water have a chance of rotting into knotholes
You can store some items inside of knotholes
Knotholes have a chance of "healing" and becoming an ordinary tree again
Craft knotholes into 3 wooden planks
Birdnests that generate in trees, they look nice :3
Birdies :D They don't spawn naturally, and I haven't implemented the hatchery yet (Made using RHR's WTFPL ccmobs code)

To Do List
Add a chisel-type tool so you can dig out knotholes
Maybe add a function for one of the slots to be randomly filled with apples/saplings/rare chance for iron
Compatibility for other mods and jungletrees.
Balance and more bugtesting
Add new node- wooden plank with knothole (Only good for sticks, and even then they wouldn't produce as many sticks as normal wood)
Fungus that grows in knotholes?
Add a "nest with egg" node that gives you an empty nest and a few eggs when broken.
Incubator and coups for birds
Adjust ABM so that only one nest spawns per 10~30 blocks
Add a config file to change the nest spawn range

License
Gnu LGPL 2.1

Dependencies
Default

Download
https://github.com/Xevmescrige/knothole
Spoiler
Image
Knothole
Image
Nest
Image
Birds <3
Last edited by Xevmescrige on Thu Nov 06, 2014 21:30, edited 18 times in total.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [MOD]Knotholes[0.1][knothole]

by Nathan.S » Post

I like the sound of this. Could you maybe make a super random appearance of more valuable items, say gold, mese, or diamond?
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

Re: [MOD]Knotholes[0.1][knothole]

by Topywo » Post

I've learned a bit about formspecs by trial and error, but this might help you out:

default.chest_formspec =
-- "size[1,2]"..
"size[8,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;main;3.5,0.3;1,2;]"..
-- "list[current_player;main;-3.5,2.85;8,1;]"..
-- "list[current_player;main;-3.5,4.08;8,3;8]"..

"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
-- default.get_hotbar_bg(-3.5,4.85)
default.get_hotbar_bg(0,4.85)


- default.chest_formspec --> this defines the total space in which you are going to work, so 1,2 is a bit small, because you also want to show your own inventory.

- list[current_player;main] and default.get_hotbar_bg --> -3.5 means you're moving almost half of your inventory outside the form, making it 'invisible'.
- 2.85 --> 4.85 and 4.08 --> 6.08 is just a cosmetic change, to lower the inventory slots (and line the first row into the hotbar space).


** One important thing to remember:
Whenever you change formspec things, save the changes and restart a game to try them out, the old chests/knothole/formspecs don't change. You need to place a new knothole to see the differences! (advantage is that it's easier to compare your new and old choice.


**ABM's: The papyrus ABM in default:functions.lua is a good choice.

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes[0.1][knothole]

by Xevmescrige » Post

Alright, thanks. I have noticed the issue with having to place new knotholes, I ended up with a world with a wall of around 30 knotholes. The part where I changed the 4.85 to a 2.85 is where I made them a bit higher, but that could have been an issue with my screen's resolution, because they looked fine to me. It's easier for me to learn if I poke through code (Such as the papyrus code) rather than looking at the api, because I have a general idea of what it does.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [MOD]Knotholes[0.1][knothole]

by Don » Post

This is an awesome idea. I use nodebox editor to make node boxes. It is an awesome program.
If you want the knot to stick out you need to edit the nodebox code. Any number less than -0.5 and more than 0.5 will stick out past the block size.
Example. if you create a node box and and save it as lua. Then add another line with a nodebox like this,
-0.1,-0.1,-0.5,0.1,0.1,-0.7
this makes a nobebox that will stick out 0.2 past the edge of the box.
Hope that helps

Edit - To have random items the surprise block code might be a help.
viewtopic.php?f=9&t=9452
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [MOD]Knotholes[0.1][knothole]

by Sokomine » Post

A very nice idea! Hope this will get integrated into plantlife.

Birds and squirrels could find a home in these holes. Squirrels could run the trunk up and down, and birds just be randomly placed. Players could build a bird house and hang it on a tree. Birds may have hidden eggs, nuts, keys and gold ingots inside. Or just some sticks for their nest :-)

It would also be intresting to integrate this into the tree-growing code itshelf - so that a new tree grows complete with knotholes. There are also jungletrees and worlds where trees are made round.

Hope you'll continue develop this mod!
A list of my mods can be found here.

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes[0.1][knothole]

by Xevmescrige » Post

Don wrote:This is an awesome idea. I use nodebox editor to make node boxes. It is an awesome program.
If you want the knot to stick out you need to edit the nodebox code. Any number less than -0.5 and more than 0.5 will stick out past the block size.
Example. if you create a node box and and save it as lua. Then add another line with a nodebox like this,
-0.1,-0.1,-0.5,0.1,0.1,-0.7
this makes a nobebox that will stick out 0.2 past the edge of the box.
Hope that helps

Edit - To have random items the surprise block code might be a help.
viewtopic.php?f=9&t=9452
Thanks, but the surprise block code won't help me, as I don't wish to dig up the block. If you look at farming's code, you can also get the random drop (In that case seeds instead of a reward). Thanks for the help, though. Yes, I have found the nodebox tool, I just didn't really like using it much because it's a bit confusing. It's really useful once you figure it out though :)

@Sokomine: Thanks! I'll keep the animals in mind ;)

EDIT: Urgh, whenever I finish something on the to do list, I end up adding more... This could take a while.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes[0.2][knothole]

by Xevmescrige » Post

As for the update with birds: Because they are set not to spawn unless a player incubates some eggs, birds are entirely optional and won't lag your world if you don't want them. This way you won't need to edit config files.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

User avatar
Linuxdirk
Member
Posts: 3218
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [MOD]Knotholes[0.2][knothole]

by Linuxdirk » Post

Dem cute blocky birds :D

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes[0.2][knothole]

by Xevmescrige » Post

I plan on working on the incubator now, but I'm not quite sure how that'll work. Could having a look at the furnace code or maybe even technic's code help?
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [MOD]Knotholes and nature[0.2][knothole]

by Sokomine » Post

Xevmescrige wrote: I plan on working on the incubator now, but I'm not quite sure how that'll work. Could having a look at the furnace code or maybe even technic's code help?
Do you know already how you want the incubator to work? Using it like a furnace might be a bit odd - or rather - hot - for the poor eggs :-) Using technic would limit the bird breeding to those worlds that have technic installed.
If your incubator doesn't consume fuel or energy, it'll be easier to write as well.
A list of my mods can be found here.

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes and nature[0.2][knothole]

by Xevmescrige » Post

Sokomine wrote:
Xevmescrige wrote: I plan on working on the incubator now, but I'm not quite sure how that'll work. Could having a look at the furnace code or maybe even technic's code help?
Do you know already how you want the incubator to work? Using it like a furnace might be a bit odd - or rather - hot - for the poor eggs :-) Using technic would limit the bird breeding to those worlds that have technic installed.
If your incubator doesn't consume fuel or energy, it'll be easier to write as well.
I plan on having three slots for the items to be consumed, one for coal (Energy), Water buckets (Cooling), and wheat or straw block (For bedding). The incubator could burn the coal to turn on the light (Mese crystal and/or iron in the recipe) and the water would cool the machinery. The straw would keep the birds warm :) Is it possible to make it so that if you forget the water, the eggs perish? (Elseif maybe?) It wouldn't necessarily be cooked, but it would spoil the eggs. I could also just make it so that it only consumes straw, not coal or water, so I'll try that first and then add the other two later.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [MOD]Knotholes and nature[0.2][knothole]

by Sokomine » Post

Xevmescrige wrote: The incubator could burn the coal to turn on the light (Mese crystal and/or iron in the recipe) and the water would cool the machinery.
If you want it to be a process, it might be more work. First, you'd have to have a second node for "incubator active" (also light emitting). swap_node might help here. Then, after the process is finished (i.e. by using an abm), you can remove the items from the input slots and add the entity. Furnaces are a bit more complicated as they burn their fuel over time. You might lock the inventory slots of the incubator once it's active (i.e. disallow taking something out of the slots - or just remove the slots and show something fitting).
A list of my mods can be found here.

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [MOD]Knotholes and nature[0.2][knothole]

by Nathan.S » Post

The bird nests are going a little crazy in my world.
Image

You might want to check into limiting how close they can spawn, or a max per tree, though I don't know how the tree gen code works.
Attachments
nests.png
nests.png (1.13 MiB) Viewed 1116 times
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes and nature[0.2][knothole]

by Xevmescrige » Post

Is this the most recent version? If so, I may have made a little typo, but if not, update. Sorry about that >.> EDIT: Just checked the code, it's set so that one nest spawns every 10 or so blocks. I had that issue too. Now, only trees near water become knothole-trees. I had accidentally uploaded my test version (The one where I set intervals lower so I can see if they work) to github instead of the official version.
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

Xevmescrige
Member
Posts: 11
Joined: Sat Nov 01, 2014 13:35
In-game: Xevmescrige

Re: [MOD]Knotholes and nature[0.2][knothole]

by Xevmescrige » Post

Sokomine wrote:
Xevmescrige wrote: The incubator could burn the coal to turn on the light (Mese crystal and/or iron in the recipe) and the water would cool the machinery.
If you want it to be a process, it might be more work. First, you'd have to have a second node for "incubator active" (also light emitting). swap_node might help here. Then, after the process is finished (i.e. by using an abm), you can remove the items from the input slots and add the entity. Furnaces are a bit more complicated as they burn their fuel over time. You might lock the inventory slots of the incubator once it's active (i.e. disallow taking something out of the slots - or just remove the slots and show something fitting).
Hehe... I'll just do something similar to a furnace that uses wheat/straw as "fuel" because I don't know how to do that, and because that would ruin the aim of "natural". Thanks for the feedback, though :)
I like cryptocurrencies and I can make some decent textures if anyone wants any.
My Deviantart: http://experimentalcatalyst.deviantart.com/
Knotholes! viewtopic.php?f=9&t=10531

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [MOD]Knotholes and nature[0.2][knothole]

by Nathan.S » Post

Xevmescrige wrote:Is this the most recent version? If so, I may have made a little typo, but if not, update. Sorry about that >.> EDIT: Just checked the code, it's set so that one nest spawns every 10 or so blocks. I had that issue too. Now, only trees near water become knothole-trees. I had accidentally uploaded my test version (The one where I set intervals lower so I can see if they work) to github instead of the official version.

Just tried to git pull and it said it's up to date.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests