summaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>2012-10-27 01:49:01 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-11-25 18:14:15 +0200
commite42eeec8f626acbaa54ae31c10ca06c868c7931c (patch)
tree61ea64416548b5ad858c6d275da90ace607fd163 /src/content_sao.cpp
parent118285e6babd511c285780b07c275d527d7da9b1 (diff)
downloadminetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.tar.gz
minetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.tar.bz2
minetest-e42eeec8f626acbaa54ae31c10ca06c868c7931c.zip
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
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index bb38fa10e..b23d287f4 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -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;