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}),
|
under = vector.add(self.destination, {x = 0, y = -1, z = 0}),
|
||||||
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")
|
|
||||||
else
|
|
||||||
stack = farming.place_seed(stack, minetest.get_player_by_name(self.owner_name), pointed_thing, itemname)
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not stack or not itemname or not minetest.registered_nodes[itemname] then
|
||||||
|
to_walk_randomly(self)
|
||||||
|
return
|
||||||
else
|
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
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user