Performance improvement: Use std::list instead of std::vector for request_media,...
[oweals/minetest.git] / src / genericobject.cpp
index f7b272b00d283a85abf7438649fc8e77527bcee2..9a1b9d8d0dc657b109220b3d2a2d5877cce5277d 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);