mirror of
https://github.com/tacigar/maidroid.git
synced 2025-07-20 16:10:24 +02:00
Compare commits
4 Commits
master
...
f83705bb6c
Author | SHA1 | Date | |
---|---|---|---|
f83705bb6c | |||
2f63c8aa42 | |||
ea7c3eb27b | |||
46eddc266b |
@ -11,3 +11,5 @@ maidroid.modpath = minetest.get_modpath(maidroid.modname)
|
||||
dofile(maidroid.modpath .. "/api.lua")
|
||||
dofile(maidroid.modpath .. "/register.lua")
|
||||
dofile(maidroid.modpath .. "/crafting.lua")
|
||||
|
||||
minetest.log("action", "[maidroid] loaded.")
|
||||
|
@ -16,3 +16,5 @@ dofile(maidroid_core.modpath .. "/cores/torcher.lua")
|
||||
if minetest.global_exists("pdisc") then
|
||||
dofile(maidroid_core.modpath .. "/cores/ocr.lua")
|
||||
end
|
||||
|
||||
minetest.log("action", "[maidroid_core] loaded.")
|
||||
|
@ -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))
|
||||
|
||||
|
@ -14,3 +14,5 @@ dofile(maidroid_tool.modpath .. "/egg_writer.lua")
|
||||
dofile(maidroid_tool.modpath .. "/crafting.lua")
|
||||
dofile(maidroid_tool.modpath .. "/nametag.lua")
|
||||
dofile(maidroid_tool.modpath .. "/capture_rod.lua")
|
||||
|
||||
minetest.log("action", "[maidroid_tool] loaded.")
|
||||
|
Reference in New Issue
Block a user