mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Complete the attachment framework.
The child ID can now be checked against the parent ID in content_cao.cpp so the parent can be detected. Actual attachment code to come Divide attachment system between server attachments and client attachments, neither coded right now. As explained in the code comment: // Attachments need to be handled on both the server and client. // If we attach only on the server, models (which are client-side) // can't be read so we don't know the origin and orientation of bones. // If we attach only on the client, the real position of attachments is // not updated and you can't click them for example.
This commit is contained in:
parent
e42eeec8f6
commit
948b5a8be7
6 changed files with 270 additions and 152 deletions
|
@ -104,17 +104,6 @@ std::string gob_cmd_set_animations(v2f frames, float frame_speed, float frame_bl
|
|||
return os.str();
|
||||
}
|
||||
|
||||
// Part of the attachment structure, not used yet!
|
||||
std::string gob_cmd_set_attachment() // <- parameters here
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
writeU8(os, GENERIC_CMD_SET_ATTACHMENT);
|
||||
// parameters
|
||||
// Parameters go here
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_set_bone_posrot(std::string bone, v3f position, v3f rotation)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
|
@ -127,6 +116,19 @@ std::string gob_cmd_set_bone_posrot(std::string bone, v3f position, v3f rotation
|
|||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_set_attachment(int parent_id, std::string bone, v3f position, v3f rotation)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
writeU8(os, GENERIC_CMD_SET_ATTACHMENT);
|
||||
// parameters
|
||||
writeS16(os, parent_id);
|
||||
os<<serializeString(bone);
|
||||
writeV3F1000(os, position);
|
||||
writeV3F1000(os, rotation);
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_punched(s16 damage, s16 result_hp)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue