1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Properly read the mesh from LUA.

Players can now be set to meshes using the following test script:

function switch_player_visual()
		prop = {
			mesh="player.obj",
			texture="player.png",
			visual="mesh",
		}
	for _, obj in pairs(minetest.get_connected_players()) do
		obj:set_properties(prop)
	end
	minetest.after(1.0, switch_player_visual)
end
minetest.after(1.0, switch_player_visual)
This commit is contained in:
MirceaKitsune 2012-10-23 20:03:06 +03:00 committed by Perttu Ahola
parent ac97a7f70e
commit 0a020dbcc8
4 changed files with 25 additions and 11 deletions

View file

@ -783,14 +783,14 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
m_prop.weight = 75;
m_prop.collisionbox = core::aabbox3d<f32>(-1/3.,-1.0,-1/3., 1/3.,1.0,1/3.);
// start of default appearance, this should be overwritten by LUA
m_prop.visual = "upright-sprite";
m_prop.visual = "upright_sprite";
m_prop.visual_size = v2f(1, 2);
m_prop.textures.clear();
m_prop.textures.push_back("player.png");
m_prop.textures.push_back("player_back.png");
m_prop.spritediv = v2s16(1,1);
// end of default appearance
m_prop.is_visible = (getHP() != 0);
m_prop.is_visible = (getHP() != 0); // TODO: Use a death animation instead for mesh players
m_prop.makes_footstep_sound = true;
}
@ -1138,7 +1138,6 @@ void PlayerSAO::disconnected()
}
}
std::string PlayerSAO::getPropertyPacket()
{
m_prop.is_visible = (getHP() != 0);