mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Add Entity get_texture_mod() to Lua API
Send texture modifier to clients connecting later too
This commit is contained in:
parent
72535d3328
commit
c57b4ff9b5
7 changed files with 53 additions and 8 deletions
|
@ -257,7 +257,8 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
|||
m_last_sent_position(0,0,0),
|
||||
m_last_sent_velocity(0,0,0),
|
||||
m_last_sent_position_timer(0),
|
||||
m_last_sent_move_precision(0)
|
||||
m_last_sent_move_precision(0),
|
||||
m_current_texture_modifier("")
|
||||
{
|
||||
// Only register type if no environment supplied
|
||||
if(env == NULL){
|
||||
|
@ -511,6 +512,9 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)
|
|||
}
|
||||
}
|
||||
|
||||
msg_os << serializeLongString(gob_cmd_set_texture_mod(m_current_texture_modifier));
|
||||
message_count++;
|
||||
|
||||
writeU8(os, message_count);
|
||||
os.write(msg_os.str().c_str(), msg_os.str().size());
|
||||
}
|
||||
|
@ -687,11 +691,17 @@ v3f LuaEntitySAO::getAcceleration()
|
|||
void LuaEntitySAO::setTextureMod(const std::string &mod)
|
||||
{
|
||||
std::string str = gob_cmd_set_texture_mod(mod);
|
||||
m_current_texture_modifier = mod;
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), true, str);
|
||||
m_messages_out.push(aom);
|
||||
}
|
||||
|
||||
std::string LuaEntitySAO::getTextureMod() const
|
||||
{
|
||||
return m_current_texture_modifier;
|
||||
}
|
||||
|
||||
void LuaEntitySAO::setSprite(v2s16 p, int num_frames, float framelength,
|
||||
bool select_horiz_by_yawpitch)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue