5 Commits

3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,5 @@
※ This repository has not been actively updated for a long time.
# Maidroid
<img src=http://i.imgur.com/oWjrLtK.png>

View File

@ -1,5 +1,9 @@
local rod_uses = 100
local function obj_remove(obj)
obj:remove()
end
minetest.register_tool("maidroid_tool:capture_rod", {
description = "maidroid tool : capture rod",
inventory_image = "maidroid_tool_capture_rod.png",
@ -10,6 +14,7 @@ minetest.register_tool("maidroid_tool:capture_rod", {
local obj = pointed_thing.ref
local luaentity = obj:get_luaentity()
if not luaentity then return end
if not maidroid.is_maidroid(luaentity.name) then
if luaentity.name == "__builtin:item" then
luaentity:on_punch(user)
@ -17,12 +22,17 @@ minetest.register_tool("maidroid_tool:capture_rod", {
return
end
if luaentity.is_removed then
return
end
luaentity.is_removed = true
local drop_pos = vector.add(obj:getpos(), {x = 0, y = 1, z = 0})
local maidroid_name = string.split(luaentity.name, ":")[2]
local stack = ItemStack("maidroid_tool:captured_" .. maidroid_name .. "_egg")
stack:set_metadata(luaentity:get_staticdata())
obj:remove()
minetest.after(0.1, obj_remove, obj)
minetest.add_item(drop_pos, stack)
itemstack:add_wear(65535 / (rod_uses - 1))

View File

@ -242,13 +242,13 @@ do -- register a definition of an egg entity
})
self.object:setpos(new_position)
else
local cur_position = self.object:getpos()
local cur_position = self.object:get_pos()
local new_position = {
x = cur_position.x,
y = self.center_position.y + math.sin(self.angle * math.pi / 180.0) * 0.025,
z = cur_position.z,
}
self.object:setpos(new_position)
self.object:set_pos(new_position)
end
end
@ -256,7 +256,7 @@ do -- register a definition of an egg entity
self.angle = 0
self.center_position = pos
local init_pos = vector.add(pos, {x = 0.15, y = 0, z = 0})
self.object:setpos(init_pos)
self.object:set_pos(init_pos)
end
minetest.register_entity("maidroid_tool:egg_entity", {