diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-12 10:39:44 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:39 +0200 |
commit | dcedfdacd1ba77591cdc0aa2b8c123c6a5ef2f5d (patch) | |
tree | b52f1ec55269db3c0691e0292de4d1bb64f41389 /data | |
parent | ea8d6d7abd86b33169b8c2b80cd382d82ba84b8b (diff) | |
download | minetest-dcedfdacd1ba77591cdc0aa2b8c123c6a5ef2f5d.tar.gz minetest-dcedfdacd1ba77591cdc0aa2b8c123c6a5ef2f5d.tar.bz2 minetest-dcedfdacd1ba77591cdc0aa2b8c123c6a5ef2f5d.zip |
Scripting WIP
Diffstat (limited to 'data')
-rw-r--r-- | data/scripts/default.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/data/scripts/default.lua b/data/scripts/default.lua index ebd4e5ab6..baf541f46 100644 --- a/data/scripts/default.lua +++ b/data/scripts/default.lua @@ -125,6 +125,10 @@ function dump(o, dumped) return tostring(o) elseif type(o) == "function" then return "<function>" + elseif type(o) == "userdata" then + return "<userdata>" + elseif type(o) == "nil" then + return "nil" else error("cannot dump a " .. type(o)) return nil @@ -139,7 +143,7 @@ local TNT = { -- Maybe handle gravity and collision this way? dunno physical = true, weight = 5, - boundingbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, + collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, visual = "cube", textures = {"tnt_top.png","tnt_bottom.png","tnt_side.png","tnt_side.png","tnt_side.png","tnt_side.png"}, -- Initial value for our timer @@ -161,10 +165,13 @@ end -- Called when object is right-clicked function TNT:on_rightclick(clicker) print("TNT:on_rightclick()") + print("self: "..dump(self)) + print("getmetatable(self): "..dump(getmetatable(self))) + print("getmetatable(getmetatable(self)): "..dump(getmetatable(getmetatable(self)))) pos = self.object:getpos() print("TNT:on_rightclick(): object position: "..dump(pos)) pos = {x=pos.x+0.5+1, y=pos.y+0.5, z=pos.z+0.5} - minetest.env:add_node(pos, 0) + --minetest.env:add_node(pos, 0) end print("TNT dump: "..dump(TNT)) |