[Mod] Farming Redo [1.45] [farming]

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Update

by TenPlus1 » Post

- Added some nil checks when placing seed items on nodes with on_rightclick active

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Farming Redo [1.42] [farming]

by ThorfinnS » Post

Oh, cool.

Looking forward to seeing if nil checks gets rid of the occasional weirdnesses interacting with lib_ecology. One just had to learn which plants not to plant or you would get warning messages popping up all the time. Strawberries for sure. Couple others, too, but I don't recall which.

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Farming Redo [1.42] [farming]

by ThorfinnS » Post

Trying to figure out whether you had a detectable pattern in mind when assigning groups.

For example, the thing you plant with corn is in group food_corn, beets is food_beetroot, but the juicer is food_juicer. So looks like I can't just strip off anything with group food_* and get plantable things.

Clyde did his cucina_vegana by having anything plantable be seed=1. An improvement, but not quite as useful as it might be. For example, setting seed=2 might mean you plant one of the crop, while seed=1 means it has a seed distinct from the crop.

Makes it easier to adapt things to farming_nextgen, as well as things like the threshing floor and handmill from cottages.

Question is whether that's capability you are interested in including, or if it's something that should be a stand-alone mod. It wouldn't be that hard to do an on-load parsing of registration data, then add the group seed=2 (or whatever), but maybe coming up with some suggested standard across mods, and people either embrace that voluntary standard or not, at penalty of not integrating well with other mods.

What I'm asking, then, is whether there's some standard that would work better with your long-term vision, and also whether you want to add that (PR or on your own) or simply do it through a stand-alone mod.

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.42] [farming]

by TenPlus1 » Post

The food_* groups were for easy recipes so that the same group name could be used for different items and still make the recipe :) the farming redo mod however has a global table called farming.registered_plants that holds any information on a crop/seed/growth/light you might need though.

https://notabug.org/TenPlus1/farming/sr ... pi.txt#L12

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Farming Redo [1.42] [farming]

by ThorfinnS » Post

Right. That was in my post, but it got too long, and that's part of what ended up on the cutting room floor.

The situation is that one student is writing a generalized backpack mod, where there is an easier to craft backpack limited to specific types of items. So there's a cheap seed packet you can make early, way before you have wool, because between cucina vegana and farming redo all the inventory space is filled before you find a place to build. All spaces are filled with stuff you wouldn't or couldn't collect but for the existence of those mods. Why bother with leaves if there's no mod that uses them, for instance. Just toss 'em out. Who needs to hold onto dirt if you have no farming mods?

Hardcoding it is easy, though a bit slow. Iterating through the register_plants table for each and every item as you are trying to move into the container is much, much slower than just checking that it's in an appropriate group. Allowing all items named farming:* works, and is sufficiently fast, but allows pots, pans, cutting boards, juicers, bean poles, etc., plus all the finished products, which kind of defeats the purpose of having an early, cheap bag specifically for seeds.

So the plan is to iterate through the table once at load time, adding groups to items as appropriate. I was just interested in knowing if there was anything on the back burner such that if you decided to add groups for seeds and such, like Clyde did, this would overwrite your group assignments and cause problems. We would code for that now, rather than worry about it being a future compatibility and maintenance issue.

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Updated to version 1.43

by TenPlus1 » Post

- Scythe works on use instead of right-click.
- Added {seed=2} group to plantable food items.

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Farming Redo [1.42] [farming]

by ThorfinnS » Post

Awesome.

I'll grab it before he shows up to the computer lab this afternoon.

Thanks!

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Farming Redo [1.42] [farming]

by ThorfinnS » Post

For some reason, I cannot make a fork from notabug onto github. Pretty sure I've done it before. Or maybe I cloned it locally then pushed it to a newly created github. Have to look into it some day when I have a better connection. Upshot is I can't do a PR.

Anyway, ran into an issue with earthbuild where changing the modlist would make either this or earthbuild load last, and consequently overwrite the others' drops. Rewrote grass.lua and earthbuild's farming.lua to use your function to add drops to an existing node.

And for whatever reason I can't attach the grass.lua. What's the typical workaround? Delete the extension, use a different extension, zip?

Code: Select all

minetest.log(minetest.get_current_modname())

local function add_drop(nodename, drop_table)

	-- does node exist?
	if not minetest.registered_nodes[nodename] then return end

	-- get existing drops
	local drops = minetest.registered_nodes[nodename].drop

	-- if single item string then apend to end of new drop_table
	if type(drops) == "string" then print ("== string")

		table.insert(drop_table.items, {items = {drops}})
	elseif type(drops) == "table" then print ("== table")

		-- apend existing drops to new drop_table
		for _, item in ipairs(drops.items) do
			table.insert(drop_table.items, item)
		end

		-- use new max_items or default to current
		drop_table.max_items = drop_table.max_items or drops.max_items
	end

	-- override node with new drops
	minetest.override_item(nodename, {drop = drop_table})
end


for i = 4, 5 do

	-- Override default grass and have it drop Wheat Seeds
	if not minetest.registered_nodes["default:grass_" .. i].drop.items then
		add_drop("default:grass_" .. i, {
			max_items = 1,
			items = {{items = {"farming:seed_wheat"}, rarity = 5}}
		})
	end

-- add farming redo crop
	add_drop("default:grass_" .. i, {
		items = {
			{items = {"farming:seed_oat"}, rarity = 5}
		}})
	-- minetest.log("default:grass_"..i)
	-- minetest.log(dump(minetest.registered_nodes["default:grass_"..i].drop))


	-- Override default dry grass and have it drop Barley Seeds
	if not minetest.registered_nodes["default:dry_grass_" .. i].drop.items then
		add_drop("default:dry_grass_" .. i, {
			max_items = 1,
			items = {{items = {"farming:seed_barley"}, rarity = 5}}
		})
	end

-- add farming redo crop
	add_drop("default:dry_grass_" .. i, {
		items = {
			{items = {"farming:seed_rye"}, rarity = 5},
		}
	})
	-- minetest.log("default:dry_grass_"..i)
	-- minetest.log(dump(minetest.registered_nodes["default:dry_grass_"..i].drop))

end


-- Override default Jungle Grass and have it drop Cotton Seeds
if minetest.registered_nodes["default:junglegrass"].drop == nil then
	add_drop("default:junglegrass", {
	max_items = 1,
	items = {
		{items = {"farming:seed_cotton"}, rarity = 8},
		{items = {"default:junglegrass"}}
	}
})
end

-- add farming redo crop
add_drop("default:junglegrass", {
	items = {
		{items = {"farming:seed_rice"}, rarity = 8},
	}
})
	-- minetest.log("default:junglegrass")
	-- minetest.log(dump(minetest.registered_nodes["default:junglegrass"].drop))

Emerald
Member
Posts: 12
Joined: Sat Feb 02, 2019 02:41
IRC: Emerald2
In-game: Emerald2

Re: [Mod] Farming Redo [1.42] [farming]

by Emerald » Post

Most of the savannah is now default:dry_dirt_with_dry_grass. Will there be an update so that coffee and pineapple spawns on those too?

Segmented Worm
Member
Posts: 21
Joined: Mon Oct 07, 2019 23:12

Re: [Mod] Farming Redo [1.42] [farming]

by Segmented Worm » Post

After replanting rice several times, it has stopped growing.

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Farming Redo [1.42] [farming]

by TenPlus1 » Post

@Emerald - I've added initial compatibility for new dry dirt nodes so that the pineapple and coffee grow on those nodes, also so that they can be hoe'd into normal soil.

Segmented Worm
Member
Posts: 21
Joined: Mon Oct 07, 2019 23:12

Re: [Mod] Farming Redo [1.42] [farming]

by Segmented Worm » Post

Segmented Worm wrote:After replanting rice several times, it has stopped growing.
Never mind, I thought they would grow from torches :-|

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Updated to version 1.44

by TenPlus1 » Post

- Mithril Scythe now works using right-click instead of left to harvest crops.
- Seed group added to plantable items {seed=1} for seeds, {seed=2} for food items.
- Added 'farming_stage_length' setting to adjust speed of crop growth (detault: 160 secs).

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Updated to version 1.45

by TenPlus1 » Post

- Hoes and Soil more inline with default wet/dry/base option
- Added dry_dirt soil it 5.x detected
- Translations updated, French added

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Update:

by TenPlus1 » Post

- Added Mint and Mint Tea (thanks Darkstalker for textures)

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests