0
0
Fork 0

Adjust item flowing speed

This commit is contained in:
Wuzzy 2017-01-12 01:30:21 +01:00
parent 580432b328
commit b2af0f6eef
1 changed files with 6 additions and 4 deletions

View File

@ -135,18 +135,20 @@ minetest.register_entity(":__builtin:item", {
local vec = get_flowing_dir(self) local vec = get_flowing_dir(self)
if vec then if vec then
local v = self.object:getvelocity() local v = self.object:getvelocity()
-- Minecraft Wiki: Flowing speed is "about 1.39 meters per second"
local f = 1.39
if vec and vec.x-p.x > 0 then if vec and vec.x-p.x > 0 then
self.object:setacceleration({x = 0, y = 0, z = 0}) self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:setvelocity({x = 1, y = -0.22, z = 0}) self.object:setvelocity({x = f, y = -0.22, z = 0})
elseif vec and vec.x-p.x < 0 then elseif vec and vec.x-p.x < 0 then
self.object:setacceleration({x = 0, y = 0, z = 0}) self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:setvelocity({x = -1, y = -0.22, z = 0}) self.object:setvelocity({x = -f, y = -0.22, z = 0})
elseif vec and vec.z-p.z > 0 then elseif vec and vec.z-p.z > 0 then
self.object:setacceleration({x = 0, y = 0, z = 0}) self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:setvelocity({x = 0, y = -0.22, z = 1}) self.object:setvelocity({x = 0, y = -0.22, z = f})
elseif vec and vec.z-p.z < 0 then elseif vec and vec.z-p.z < 0 then
self.object:setacceleration({x = 0, y = 0, z = 0}) self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:setvelocity({x = 0, y = -0.22, z = -1}) self.object:setvelocity({x = 0, y = -0.22, z = -f})
end end
self.object:setacceleration({x = 0, y = -10, z = 0}) self.object:setacceleration({x = 0, y = -10, z = 0})