Fix crash and wielded items count with maidroid core farming
This commit is contained in:
parent
c02d042b0b
commit
f25fd368a1
@ -335,28 +335,28 @@ plant = function(self, dtime)
|
||||
under = vector.add(self.destination, {x = 0, y = -1, z = 0}),
|
||||
above = self.destination,
|
||||
}
|
||||
if redo or plus then
|
||||
|
||||
if redo or plus 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)
|
||||
itemname = t[1]..t[2].."_1"
|
||||
elseif minetest.get_item_group(itemname, "redo") == 1 then
|
||||
if seed_plants[itemname] then
|
||||
itemname = seed_plants[itemname]
|
||||
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
|
||||
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing,
|
||||
string.split(itemname, "_seed")[1].."_1")
|
||||
else
|
||||
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
|
||||
itemname = 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
|
||||
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
|
||||
|
||||
stack:take_item(1)
|
||||
if plus then stack:take_item(1) end
|
||||
self:set_wield_item_stack(stack)
|
||||
end
|
||||
to_walk_randomly(self)
|
||||
|
Loading…
Reference in New Issue
Block a user