Fix attachment test script and unregistered entities. Thanks jin_xi for this
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 3 Nov 2012 11:17:13 +0000 (13:17 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 25 Nov 2012 19:02:00 +0000 (21:02 +0200)
mods/default/player.lua

index 51c1d4106e782bc2a300939e0e8eb7fd9c372d8d..44b73c6793e0d58620203c5efada09efc272cdba 100644 (file)
@@ -24,7 +24,6 @@ end
 minetest.after(1.0, switch_player_visual)
 
 -- 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
-
 test2 = {
   collisionbox = { 0, 0, 0, 0, 0, 0 },
   visual = "cube"
@@ -32,11 +31,6 @@ test2 = {
 
 minetest.register_entity("default:test2", test2)
 
-function detachments(newobject)
-       newobject:set_detach()
-       print ("Detached test object")
-end
-
 function attachments()
        prop = {
                mesh = "player.x",
@@ -47,13 +41,13 @@ function attachments()
        }
 
        local pos={x=0,y=0,z=0}
-       local newobject=minetest.env:add_entity(pos, "test:test2")
+       local newobject=minetest.env:add_entity(pos, "default:test2")
        newobject:set_properties(prop)
        newobject:set_animation({x=1, y=50}, 35, 0)
        print ("Spawned test object")
 
        for _, obj in pairs(minetest.get_connected_players()) do
-               if(obj:get_player_name() == "MirceaKitsune") then
+               if(obj:get_player_name() == "some_nick") then
                        newobject:set_attach(obj, "Bone.001", {x=0,y=3,z=0}, {x=0,y=45,z=0})
                        print ("Attached test object to "..obj:get_player_name())
                end
@@ -61,24 +55,8 @@ function attachments()
 
        minetest.after(5.0, function() detachments(newobject) end)
 end
-minetest.after(15.0, attachments)]]
-
--- Test case for player to player attachments
-
-function attachments_player()
-       for _, obj in pairs(minetest.get_connected_players()) do
-               if(obj:get_player_name() == "MirceaKitsune") then
-                       for _, obj2 in pairs(minetest.get_connected_players()) do
-                               if(obj2:get_player_name() == "MirceaKitsune1") then
-                                       obj2:set_attach(obj, "Bone.001", {x=0,y=6,z=0}, {x=0,y=45,z=0})
-                                       print ("Attached player "..obj2:get_player_name().." to player "..obj:get_player_name())
-                               end
-                       end
-               end
-       end
-end
 
-minetest.after(10.0, attachments_player)
+minetest.after(10.0, attachments)
 
 -- Definitions made by this mod that other mods can use too
 default = {}