Compare commits

...

5 Commits

2 changed files with 33 additions and 45 deletions

View File

@ -236,6 +236,7 @@ if not redo then
recipe = { recipe = {
{ "vessels:glass_bottle", "vessels:glass_bottle", "morefarming:corn"}, { "vessels:glass_bottle", "vessels:glass_bottle", "morefarming:corn"},
{ "morefarming:corn", "morefarming:corn", "morefarming:corn"}, { "morefarming:corn", "morefarming:corn", "morefarming:corn"},
{ "morefarming:corn", "morefarming:corn", "morefarming:corn"},
} }
}) })
@ -245,6 +246,7 @@ if not redo then
recipe = { recipe = {
{ "vessels:glass_bottle", "morefarming:teosinte", "morefarming:teosinte"}, { "vessels:glass_bottle", "morefarming:teosinte", "morefarming:teosinte"},
{ "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"}, { "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"},
{ "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"},
} }
}) })
@ -274,29 +276,13 @@ if redo then
if minetest.get_modpath("vessels") then if minetest.get_modpath("vessels") then
-- Bottle of Ethanol -- Bottle of Ethanol
minetest.clear_craft(
{
recipe = {
{"vessels:glass_bottle", "farming:corn", "farming:corn"},
{"farming:corn", "farming:corn", "farming:corn"},
}
})
minetest.register_craft(
{
output = "farming:bottle_ethanol 2",
recipe = {
{ "vessels:glass_bottle", "vessels:glass_bottle", "farming:corn"},
{ "farming:corn", "farming:corn", "farming:corn"},
}
})
minetest.register_craft( minetest.register_craft(
{ {
output = "farming:bottle_ethanol", output = "farming:bottle_ethanol",
recipe = { recipe = {
{ "vessels:glass_bottle", "morefarming:teosinte", "morefarming:teosinte"}, { "vessels:glass_bottle", "morefarming:teosinte", "morefarming:teosinte"},
{ "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"}, { "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"},
{ "morefarming:teosinte", "morefarming:teosinte", "morefarming:teosinte"},
} }
}) })
end end

View File

@ -44,6 +44,7 @@ if redo then
{"farming:barley_7", nil}, {"farming:barley_7", nil},
{"farming:oat_8", nil}, {"farming:oat_8", nil},
{"farming:rice_8", nil}, {"farming:rice_8", nil},
{"farming:rye_8", nil},
{"farming:blueberry_4", "farming:blueberries", "farming:blueberry"}, {"farming:blueberry_4", "farming:blueberries", "farming:blueberry"},
{"farming:carrot_8", nil}, {"farming:carrot_8", nil},
{"farming:coffee_5", "farming:coffee_beans", "farming:coffee"}, {"farming:coffee_5", "farming:coffee_beans", "farming:coffee"},
@ -63,6 +64,7 @@ if redo then
{"farming:pea_5", "farming:pea_pod", "farming:pea"}, {"farming:pea_5", "farming:pea_pod", "farming:pea"},
{"farming:pepper_5", "farming:peppercorn", "farming:pepper"}, {"farming:pepper_5", "farming:peppercorn", "farming:pepper"},
{"farming:pineapple_8", "farming:pineapple_top", "farming:pineapple"}, {"farming:pineapple_8", "farming:pineapple_top", "farming:pineapple"},
{"farming:mint_4", nil},
} }
for _, item in pairs(redo_plants) do for _, item in pairs(redo_plants) do
table.insert(target_plants, item[1]) table.insert(target_plants, item[1])
@ -132,8 +134,8 @@ local walk_randomly, walk_to_plant_and_mow_common, plant, mow
local to_walk_randomly, to_walk_to_plant, to_walk_to_mow, to_plant, to_mow local to_walk_randomly, to_walk_to_plant, to_walk_to_mow, to_plant, to_mow
local function on_start(self) local function on_start(self)
self.object:setacceleration{x = 0, y = -10, z = 0} self.object:set_acceleration{x = 0, y = -10, z = 0}
self.object:setvelocity{x = 0, y = 0, z = 0} self.object:set_velocity{x = 0, y = 0, z = 0}
self.state = state.WALK_RANDOMLY self.state = state.WALK_RANDOMLY
self.time_counters = {} self.time_counters = {}
self.path = nil self.path = nil
@ -141,7 +143,7 @@ local function on_start(self)
end end
local function on_stop(self) local function on_stop(self)
self.object:setvelocity{x = 0, y = 0, z = 0} self.object:set_velocity{x = 0, y = 0, z = 0}
self.state = nil self.state = nil
self.time_counters = nil self.time_counters = nil
self.path = nil self.path = nil
@ -149,7 +151,7 @@ local function on_stop(self)
end end
local function is_near(self, pos, distance) local function is_near(self, pos, distance)
local p = self.object:getpos() local p = self.object:get_pos()
-- p.y = p.y + 0.5 -- p.y = p.y + 0.5
return vector.distance(p, pos) < distance return vector.distance(p, pos) < distance
end end
@ -164,9 +166,9 @@ walk_randomly = function(self, dtime)
local wield_stack = self:get_wield_item_stack() local wield_stack = self:get_wield_item_stack()
if minetest.get_item_group(wield_stack:get_name(), "seed") > 0 if minetest.get_item_group(wield_stack:get_name(), "seed") > 0
or self:has_item_in_main(function(itemname) return (minetest.get_item_group(itemname, "seed") > 0) end) then or self:has_item_in_main(function(itemname) return (minetest.get_item_group(itemname, "seed") > 0) end) then
local destination = _aux.search_surrounding(self.object:getpos(), is_plantable_place, searching_range) local destination = _aux.search_surrounding(self.object:get_pos(), is_plantable_place, searching_range)
if destination ~= nil then if destination ~= nil then
local path = minetest.find_path(self.object:getpos(), destination, 10, 1, 1, "A*") local path = minetest.find_path(self.object:get_pos(), destination, 10, 1, 1, "A*")
if path ~= nil then -- to walk to plant state. if path ~= nil then -- to walk to plant state.
to_walk_to_plant(self, path, destination) to_walk_to_plant(self, path, destination)
@ -175,9 +177,9 @@ walk_randomly = function(self, dtime)
end end
end end
-- if couldn't find path to plant, try to mow. -- if couldn't find path to plant, try to mow.
local destination = _aux.search_surrounding(self.object:getpos(), is_mowable_place, searching_range) local destination = _aux.search_surrounding(self.object:get_pos(), is_mowable_place, searching_range)
if destination ~= nil then if destination ~= nil then
local path = minetest.find_path(self.object:getpos(), destination, 10, 1, 1, "A*") local path = minetest.find_path(self.object:get_pos(), destination, 10, 1, 1, "A*")
if path ~= nil then -- to walk to mow state. if path ~= nil then -- to walk to mow state.
to_walk_to_mow(self, path, destination) to_walk_to_mow(self, path, destination)
return return
@ -195,7 +197,7 @@ walk_randomly = function(self, dtime)
self.time_counters[1] = self.time_counters[1] + 1 self.time_counters[1] = self.time_counters[1] + 1
self.time_counters[2] = self.time_counters[2] + 1 self.time_counters[2] = self.time_counters[2] + 1
local velocity = self.object:getvelocity() local velocity = self.object:get_velocity()
if velocity.y == 0 then if velocity.y == 0 then
local front_node = self:get_front_node() local front_node = self:get_front_node()
@ -205,7 +207,7 @@ walk_randomly = function(self, dtime)
-- elseif front_node.name ~= "air" and minetest.registered_nodes[front_node.name] ~= nil -- elseif front_node.name ~= "air" and minetest.registered_nodes[front_node.name] ~= nil
-- and minetest.registered_nodes[front_node.name].walkable then -- and minetest.registered_nodes[front_node.name].walkable then
-- self.object:setvelocity{x = velocity.x, y = 6, z = velocity.z} -- self.object:set_velocity{x = velocity.x, y = 6, z = velocity.z}
end end
end end
return return
@ -246,9 +248,9 @@ to_plant = function(self)
or self:move_main_to_wield(function(itemname) return (minetest.get_item_group(itemname, "seed") > 0) end) then or self:move_main_to_wield(function(itemname) return (minetest.get_item_group(itemname, "seed") > 0) end) then
self.state = state.PLANT self.state = state.PLANT
self.time_counters[1] = 0 self.time_counters[1] = 0
self.object:setvelocity{x = 0, y = 0, z = 0} self.object:set_velocity{x = 0, y = 0, z = 0}
self:set_animation(maidroid.animation_frames.MINE) self:set_animation(maidroid.animation_frames.MINE)
self:set_yaw_by_direction(vector.subtract(self.destination, self.object:getpos())) self:set_yaw_by_direction(vector.subtract(self.destination, self.object:get_pos()))
return return
else else
to_walk_randomly(self) to_walk_randomly(self)
@ -259,9 +261,9 @@ end
to_mow = function(self) to_mow = function(self)
self.state = state.MOW self.state = state.MOW
self.time_counters[1] = 0 self.time_counters[1] = 0
self.object:setvelocity{x = 0, y = 0, z = 0} self.object:set_velocity{x = 0, y = 0, z = 0}
self:set_animation(maidroid.animation_frames.MINE) self:set_animation(maidroid.animation_frames.MINE)
self:set_yaw_by_direction(vector.subtract(self.destination, self.object:getpos())) self:set_yaw_by_direction(vector.subtract(self.destination, self.object:get_pos()))
end end
walk_to_plant_and_mow_common = function(self, dtime) walk_to_plant_and_mow_common = function(self, dtime)
@ -285,7 +287,7 @@ walk_to_plant_and_mow_common = function(self, dtime)
if self.time_counters[1] >= FIND_PATH_TIME_INTERVAL then if self.time_counters[1] >= FIND_PATH_TIME_INTERVAL then
self.time_counters[1] = 0 self.time_counters[1] = 0
local path = minetest.find_path(self.object:getpos(), self.destination, 10, 1, 1, "A*") local path = minetest.find_path(self.object:get_pos(), self.destination, 10, 1, 1, "A*")
if path == nil then if path == nil then
to_walk_randomly(self) to_walk_randomly(self)
return return
@ -311,13 +313,13 @@ walk_to_plant_and_mow_common = function(self, dtime)
-- else -- else
-- -- if maidroid is stopped by obstacles, the maidroid must jump. -- -- if maidroid is stopped by obstacles, the maidroid must jump.
-- local velocity = self.object:getvelocity() -- local velocity = self.object:get_velocity()
-- if velocity.y == 0 then -- if velocity.y == 0 then
-- local front_node = self:get_front_node() -- local front_node = self:get_front_node()
-- if front_node.name ~= "air" and minetest.registered_nodes[front_node.name] ~= nil -- if front_node.name ~= "air" and minetest.registered_nodes[front_node.name] ~= nil
-- and minetest.registered_nodes[front_node.name].walkable -- and minetest.registered_nodes[front_node.name].walkable
-- and not (minetest.get_item_group(front_node.name, "fence") > 0) then -- and not (minetest.get_item_group(front_node.name, "fence") > 0) then
-- self.object:setvelocity{x = velocity.x, y = 6, z = velocity.z} -- self.object:set_velocity{x = velocity.x, y = 6, z = velocity.z}
-- end -- end
-- end -- end
end end
@ -335,27 +337,27 @@ plant = function(self, dtime)
above = self.destination, above = self.destination,
} }
if redo or plus then if redo or plus then
local t = string.split(itemname, "seed_") local t = string.split(itemname, "seed_")
if t[2] then if t[2] then
local newstackname = t[1]..t[2].."_1" itemname = 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 elseif minetest.get_item_group(itemname, "redo") == 1 then
if seed_plants[itemname] then if seed_plants[itemname] then
itemname = seed_plants[itemname] itemname = seed_plants[itemname]
end end
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname.."_1") itemname = itemname.."_1"
elseif minetest.get_item_group(itemname, "plus") == 1 then elseif minetest.get_item_group(itemname, "plus") == 1 then
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname = string.split(itemname, "_seed")[1].."_1"
string.split(itemname, "_seed")[1].."_1") end
end
if not stack or not itemname or not minetest.registered_nodes[itemname] then
to_walk_randomly(self)
return
else else
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname) stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
end end
else
farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
end
stack:take_item(1) if plus then stack:take_item(1) end
self:set_wield_item_stack(stack) self:set_wield_item_stack(stack)
end end
to_walk_randomly(self) to_walk_randomly(self)