mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Framework for the attachment system, new object property which allows changing the color and alpha of mesh materials
New object property which allows changing the color and alpha of mesh materials. Due to the current lighting systems it doesn't work yet, but the full implementation is there Framework for the attachment system, with no actual functionality yet Send bone and player object to the setAttachment function in content_sao.cpp, but we need a way to translate it there and send it to the client I will also want position and rotation offsets to be possible to apply to attachments Network object ID from server to client. This will be used to identify the parent client-side and know what to attach to
This commit is contained in:
parent
118285e6ba
commit
e42eeec8f6
11 changed files with 181 additions and 4 deletions
|
@ -504,6 +504,7 @@ std::string LuaEntitySAO::getClientInitializationData()
|
|||
std::ostringstream os(std::ios::binary);
|
||||
writeU8(os, 0); // version
|
||||
os<<serializeString(""); // name
|
||||
writeS16(os, getId()); //id
|
||||
writeU8(os, 0); // is_player
|
||||
writeV3F1000(os, m_base_position);
|
||||
writeF1000(os, m_yaw);
|
||||
|
@ -660,6 +661,19 @@ void LuaEntitySAO::setBonePosRot(std::string bone, v3f position, v3f rotation)
|
|||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
// Part of the attachment structure, not used yet!
|
||||
void LuaEntitySAO::setAttachment(ServerActiveObject *parent, std::string bone, v3f position, v3f rotation)
|
||||
{
|
||||
// Parent should be translated from a ServerActiveObject into something
|
||||
// the client will recognize (as a ClientActiveObject) then sent in
|
||||
// gob_cmd_set_attachment that way.
|
||||
|
||||
std::string str = gob_cmd_set_attachment(); // <- parameters here
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), true, str);
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
ObjectProperties* LuaEntitySAO::accessObjectProperties()
|
||||
{
|
||||
return &m_prop;
|
||||
|
@ -804,6 +818,8 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
|||
m_prop.textures.clear();
|
||||
m_prop.textures.push_back("player.png");
|
||||
m_prop.textures.push_back("player_back.png");
|
||||
m_prop.colors.clear();
|
||||
m_prop.colors.push_back(video::SColor(255, 255, 255, 255));
|
||||
m_prop.spritediv = v2s16(1,1);
|
||||
// end of default appearance
|
||||
m_prop.is_visible = (getHP() != 0); // TODO: Use a death animation instead for mesh players
|
||||
|
@ -860,6 +876,7 @@ std::string PlayerSAO::getClientInitializationData()
|
|||
writeU8(os, 0); // version
|
||||
os<<serializeString(m_player->getName()); // name
|
||||
writeU8(os, 1); // is_player
|
||||
writeS16(os, getId()); //id
|
||||
writeV3F1000(os, m_player->getPosition() + v3f(0,BS*1,0));
|
||||
writeF1000(os, m_player->getYaw());
|
||||
writeS16(os, getHP());
|
||||
|
@ -1109,6 +1126,15 @@ void PlayerSAO::setBonePosRot(std::string bone, v3f position, v3f rotation)
|
|||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
// Part of the attachment structure, not used yet!
|
||||
void PlayerSAO::setAttachment(ServerActiveObject *parent, std::string bone, v3f position, v3f rotation)
|
||||
{
|
||||
std::string str = gob_cmd_set_attachment(); // <- parameters here
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), true, str);
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
|
||||
ObjectProperties* PlayerSAO::accessObjectProperties()
|
||||
{
|
||||
return &m_prop;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue