aboutsummaryrefslogtreecommitdiff
path: root/data/mods
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-28 18:18:08 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-28 18:18:08 +0200
commit1c15f53318d49ccd148ec42b0a4345c4a8cd06bf (patch)
tree008ffa85e6b118dbe0a16da2f52e72e2e7b41cdf /data/mods
parent7937813c98255736c6847fe2d1302e0c6b309b04 (diff)
downloadminetest-1c15f53318d49ccd148ec42b0a4345c4a8cd06bf.tar.gz
minetest-1c15f53318d49ccd148ec42b0a4345c4a8cd06bf.tar.bz2
minetest-1c15f53318d49ccd148ec42b0a4345c4a8cd06bf.zip
Add EnvRef:get_objects_inside_radius(pos, radius)
Diffstat (limited to 'data/mods')
-rw-r--r--data/mods/default/init.lua1
-rw-r--r--data/mods/experimental/init.lua18
2 files changed, 13 insertions, 6 deletions
diff --git a/data/mods/default/init.lua b/data/mods/default/init.lua
index 1edbd3cbb..2ba42e0f4 100644
--- a/data/mods/default/init.lua
+++ b/data/mods/default/init.lua
@@ -155,6 +155,7 @@
-- - add_firefly(pos)
-- - get_meta(pos) -- Get a NodeMetaRef at that position
-- - get_player_by_name(name) -- Get an ObjectRef to a player
+-- - get_objects_inside_radius(pos, radius)
--
-- NodeMetaRef
-- - get_type()
diff --git a/data/mods/experimental/init.lua b/data/mods/experimental/init.lua
index 52a729a4a..dd0d60f4e 100644
--- a/data/mods/experimental/init.lua
+++ b/data/mods/experimental/init.lua
@@ -7,12 +7,18 @@
function on_step(dtime)
-- print("experimental on_step")
--[[
- print("celeron55 dir: "..dump(
- minetest.env:get_player_by_name("celeron55"):get_look_dir()))
- print("celeron55 pitch: "..dump(
- minetest.env:get_player_by_name("celeron55"):get_look_pitch()))
- print("celeron55 yaw: "..dump(
- minetest.env:get_player_by_name("celeron55"):get_look_yaw()))
+ objs = minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 10)
+ for k, obj in pairs(objs) do
+ name = obj:get_player_name()
+ if name then
+ print(name.." at "..dump(obj:getpos()))
+ print(name.." dir: "..dump(obj:get_look_dir()))
+ print(name.." pitch: "..dump(obj:get_look_pitch()))
+ print(name.." yaw: "..dump(obj:get_look_yaw()))
+ else
+ print("Some object at "..dump(obj:getpos()))
+ end
+ end
--]]
end
minetest.register_globalstep(on_step)