Add get and set functions for the nametag color
[oweals/minetest.git] / src / genericobject.cpp
index f7b272b00d283a85abf7438649fc8e77527bcee2..1f4f59e92b4ad17b1843752fef03c9a80223c362 100644 (file)
@@ -117,6 +117,22 @@ std::string gob_cmd_update_armor_groups(const ItemGroupList &armor_groups)
        return os.str();
 }
 
+std::string gob_cmd_update_physics_override(float physics_override_speed, float physics_override_jump,
+               float physics_override_gravity, bool sneak, bool sneak_glitch)
+{
+       std::ostringstream os(std::ios::binary);
+       // command 
+       writeU8(os, GENERIC_CMD_SET_PHYSICS_OVERRIDE);
+       // parameters
+       writeF1000(os, physics_override_speed);
+       writeF1000(os, physics_override_jump);
+       writeF1000(os, physics_override_gravity);
+       // these are sent inverted so we get true when the server sends nothing
+       writeU8(os, !sneak);
+       writeU8(os, !sneak_glitch);
+       return os.str();
+}
+
 std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend)
 {
        std::ostringstream os(std::ios::binary);
@@ -154,3 +170,12 @@ std::string gob_cmd_update_attachment(int parent_id, std::string bone, v3f posit
        return os.str();
 }
 
+std::string gob_cmd_set_nametag_color(video::SColor color)
+{
+       std::ostringstream os(std::ios::binary);
+       // command
+       writeU8(os, GENERIC_CMD_SET_NAMETAG_COLOR);
+       // parameters
+       writeARGB8(os, color);
+       return os.str();
+}