1 -- Minetest 0.4 mod: player
2 -- See README.txt for licensing and other information.
4 -- The API documentation in here was moved into doc/lua_api.txt
6 -- Set mesh for all players
7 function switch_player_visual()
10 textures = {"player.png", },
11 colors = {{255, 255, 255, 255}, },
13 visual_size = {x=1, y=1},
16 for _, obj in pairs(minetest.get_connected_players()) do
17 obj:set_properties(prop)
18 obj:set_animation({x=1, y=50}, 35, 0)
19 --obj:set_bone_position("", {x=0,y=0,z=0}, {x=0,y=0,z=0})
22 minetest.after(1.0, switch_player_visual)
24 minetest.after(1.0, switch_player_visual)
26 -- Test case for attachments: An object is spawned and attached to the player with the specified name (use your own playername there) 10 seconds after the server starts
28 collisionbox = { 0, 0, 0, 0, 0, 0 },
32 minetest.register_entity("default:test2", test2)
34 function attachments()
37 textures = {"player.png", },
38 colors = {{255, 255, 255, 255}, },
40 visual_size = {x=1, y=1},
43 local pos={x=0,y=0,z=0}
44 local newobject=minetest.env:add_entity(pos, "default:test2")
45 newobject:set_properties(prop)
46 newobject:set_animation({x=1, y=50}, 35, 0)
47 print ("Spawned test object")
49 for _, obj in pairs(minetest.get_connected_players()) do
50 if(obj:get_player_name() == "some_nick") then
51 newobject:set_attach(obj, "Bone.001", {x=0,y=3,z=0}, {x=0,y=45,z=0})
52 print ("Attached test object to "..obj:get_player_name())
56 minetest.after(5.0, function() detachments(newobject) end)
59 minetest.after(10.0, attachments)
61 -- Definitions made by this mod that other mods can use too
65 dofile(minetest.get_modpath("default").."/mapgen.lua")
66 dofile(minetest.get_modpath("default").."/leafdecay.lua")