Add farming_redo support for maidroid_core_farming. Yes!

This commit is contained in:
sys4-fr 2017-03-03 10:36:29 +01:00
parent 874dc0214f
commit 62da75d0f1
2 changed files with 65 additions and 6 deletions

View File

@ -294,9 +294,33 @@ end
-- Maidroid behaviour
if not redo and not plus and minetest.get_modpath("maidroid_core") then
minetest.registered_items["moreflowers:wild_carrot"].groups["seed"] = 1
minetest.registered_items["moreflowers:teosinte"].groups["seed"] = 1
--if not redo and not plus and minetest.get_modpath("maidroid_core") then
if minetest.get_modpath("maidroid_core") then
local wild_plants = {
"moreflowers:wild_carrot",
"moreflowers:teosinte",
}
for _, item in pairs(wild_plants) do
minetest.registered_items[item].groups["seed"] = 1
end
if redo then
local redo_plants = {
"farming:carrot",
"farming:corn",
}
for _, item in pairs(redo_plants) do
minetest.override_item(
item,
{
groups = {seed = 1, redo = 1}
})
end
end
dofile(minetest.get_modpath("morefarming").."/maidroid_core_morefarming.lua")
end
@ -312,5 +336,8 @@ if minetest.get_modpath("bonemeal") and bonemeal then
end
bonemeal:add_crop({{"morefarming:corn_", 8, "morefarming:seed_corn"}})
else
bonemeal:add_crop({{"farming:corn_", 8, "farming:corn"}})
bonemeal:add_crop({{"farming:carrot_", 8, "farming:carrot"}})
end
end

View File

@ -5,6 +5,8 @@
-- Modified file by sys4 for morefarming mod
------------------------------------------------------------
local redo = farming.mod and farming.mod == "redo"
local state = {
WALK_RANDOMLY = 0,
WALK_TO_PLANT = 1,
@ -18,12 +20,28 @@ local target_plants = {
"farming:cotton_8",
"moreflowers:wild_carrot",
"morefarming:wildcarrot_8",
"morefarming:carrot_8",
"moreflowers:teosinte",
"morefarming:teosinte_8",
"morefarming:corn_8",
}
if redo then
local redo_plants = {
"farming:carrot_8",
"farming:corn_8",
}
for _, item in pairs(redo_plants) do
table.insert(target_plants, item)
end
else
local morefarming_plants = {
"morefarming:carrot_8",
"morefarming:corn_8",
}
for _, item in pairs(morefarming_plants) do
table.insert(target_plants, item)
end
end
local _aux = maidroid_core._aux
local FIND_PATH_TIME_INTERVAL = 20
@ -255,8 +273,22 @@ plant = function(self, dtime)
under = vector.add(self.destination, {x = 0, y = -1, z = 0}),
above = self.destination,
}
farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, stack:get_name())
if redo then
local t = string.split(itemname, "seed_")
if t[2] then
local newstackname = t[1]..t[2].."_1"
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, newstackname)
elseif minetest.get_item_group(itemname, "redo") == 1 then
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname.."_1")
else
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
end
else
farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
end
stack:take_item(1)
self:set_wield_item_stack(stack)
end