I have the question, i mean i have a mob, how i teleport it with a command?
Do i need a mod, or a modification in the Engine?
MineYoshi wrote:I have the question, i mean i have a mob, how i teleport it with a command?
Do i need a mod, or a modification in the Engine?
minetest.register_abm({
nodenames = {"default:portal"},
interval = 1,
chance = 2,
action = function(pos, node)
minetest.add_particlespawner(
32, --amount
4, --time
{x = pos.x - 0.25, y = pos.y - 0.25, z = pos.z - 0.25}, --minpos
{x = pos.x + 0.25, y = pos.y + 0.25, z = pos.z + 0.25}, --maxpos
{x = -0.8, y = -0.8, z = -0.8}, --minvel
{x = 0.8, y = 0.8, z = 0.8}, --maxvel
{x = 0, y = 0, z = 0}, --minacc
{x = 0, y = 0, z = 0}, --maxacc
0.5, --minexptime
1, --maxexptime
1, --minsize
2, --maxsize
false, --collisiondetection
"default_particle.png^[colorize:#FF0000:150" --texture
)
--for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
for _,obj in ipairs(minetest.get_objects_inside_radius(pos,1)) do --maikerumine added for objects to travel
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
--if obj:is_player() then
if obj:is_player() or lua_entity then
local meta = minetest.get_meta(pos)
local target = minetest.string_to_pos(meta:get_string("target"))
if target then
-- force emerge of target area
minetest.get_voxel_manip():read_from_map(target, target)
if not minetest.get_node_or_nil(target) then
minetest.emerge_area(
vector.subtract(target, 4), vector.add(target, 4))
end
-- teleport the player
minetest.after(3, function(obj, pos, target)
local objpos = obj:getpos() if objpos == nil then return end --maikerumine added for objects to travel
objpos.y = objpos.y + 0.1 -- Fix some glitches at -8000
if minetest.get_node(objpos).name ~= "default:portal" then
return
end
obj:setpos(target)
minetest.sound_play("tng_transporter1", {pos=target,gain=0.5,max_hear_distance = 8,}) --maikerumine added sound when travel
local function check_and_build_portal(pos, target)
local n = minetest.get_node_or_nil(target)
if n and n.name ~= "default:portal" then
build_portal(target, pos)
minetest.after(2, check_and_build_portal, pos, target) --was 2
minetest.after(4, check_and_build_portal, pos, target)
elseif not n then
minetest.after(1, check_and_build_portal, pos, target)
end
end
minetest.after(1, check_and_build_portal, pos, target) --was 1
end, obj, pos, target)
end
end
end
end,
})
local lua_entity = obj:get_luaentity() --maikerumine added for objects to travel
--if obj:is_player() then
if obj:is_player() or lua_entity then
Users browsing this forum: No registered users and 7 guests