aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-28 17:34:07 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-28 17:34:07 +0200
commit7937813c98255736c6847fe2d1302e0c6b309b04 (patch)
tree584c26ef63d273473c44fae577faa07bfb3b4e36 /data
parentad4040d982ad0a52a27df262351fd747b5408265 (diff)
downloadminetest-7937813c98255736c6847fe2d1302e0c6b309b04.tar.gz
minetest-7937813c98255736c6847fe2d1302e0c6b309b04.tar.bz2
minetest-7937813c98255736c6847fe2d1302e0c6b309b04.zip
Add get_look_dir(), get_look_pitch() and get_look_yaw() for players
Diffstat (limited to 'data')
-rw-r--r--data/mods/default/init.lua7
-rw-r--r--data/mods/experimental/init.lua15
2 files changed, 20 insertions, 2 deletions
diff --git a/data/mods/default/init.lua b/data/mods/default/init.lua
index 95d9c19ff..1edbd3cbb 100644
--- a/data/mods/default/init.lua
+++ b/data/mods/default/init.lua
@@ -188,6 +188,8 @@
-- ^ time_from_last_punch = time since last punch action of the puncher
-- - right_click(clicker); clicker = an another ObjectRef
-- - get_wield_digging_properties() -> digging property table
+-- - damage_wielded_item(num) (item damage/wear range is 0-65535)
+-- - add_to_inventory(itemstring): add an item to object inventory
-- - add_to_inventory_later(itemstring): like above, but after callback returns (only allowed for craftitem callbacks)
-- - get_hp(): returns number of hitpoints (2 * number of hearts)
-- - set_hp(hp): set number of hitpoints (2 * number of hearts)
@@ -202,8 +204,9 @@
-- - get_player_name(): will return nil if is not a player
-- - inventory_set_list(name, {item1, item2, ...})
-- - inventory_get_list(name) -> {item1, item2, ...}
--- - damage_wielded_item(num) (item damage/wear range is 0-65535)
--- - add_to_inventory(itemstring): add an item to object inventory
+-- - get_look_dir(): get camera direction as a unit vector
+-- - get_look_pitch(): pitch in radians
+-- - get_look_yaw(): yaw in radians (wraps around pretty randomly as of now)
--
-- Registered entities:
-- - Functions receive a "luaentity" as self:
diff --git a/data/mods/experimental/init.lua b/data/mods/experimental/init.lua
index d180d4778..52a729a4a 100644
--- a/data/mods/experimental/init.lua
+++ b/data/mods/experimental/init.lua
@@ -2,6 +2,21 @@
-- Experimental things
--
+-- For testing random stuff
+
+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()))
+ --]]
+end
+minetest.register_globalstep(on_step)
+
-- An example furnace-thing implemented in Lua
minetest.register_node("experimental:luafurnace", {