From 3241ad3ae8da687262db32776a1da2ef7403b3e9 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 30 Mar 2012 13:26:40 +0300 Subject: ObjectRef:set_armor_groups() and ObjectRef:set_properties() - works on players too! --- games/minimal/mods/experimental/init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'games/minimal') diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 5dab41354..f1b8ec44a 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -6,6 +6,22 @@ experimental = {} +experimental.player_visual_index = 0 +function switch_player_visual() + for _, obj in pairs(minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 1000000)) do + if obj:get_player_name() then + if experimental.player_visual_index == 0 then + obj:set_properties({visual="upright_sprite"}) + else + obj:set_properties({visual="cube"}) + end + end + end + experimental.player_visual_index = (experimental.player_visual_index + 1) % 2 + minetest.after(1.0, switch_player_visual) +end +minetest.after(1.0, switch_player_visual) + --[[ stepsound = -1 function test_sound() -- cgit v1.2.3