aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-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)