Let item entity ground friction change when on slippery floors

This commit is contained in:
wallabra 2022-02-09 03:26:05 -03:00
parent 44f327b60b
commit 11a661f427
Signed by untrusted user: Gustavo6046
GPG Key ID: 5182FABAA5E139B3
1 changed files with 7 additions and 1 deletions

View File

@ -30,6 +30,7 @@ item_drop_settings.age = 1.0 --how old a dropped item (_insta_
item_drop_settings.fluid_flow_rate = 1.39 --the speed of a flowing fluid, used when computing push and drag forces of water on items; default is tuned to Minecraft
item_drop_settings.fluid_drag = 1.8 --how much drag water has on items (how quickly an item's motion will settle onto the water's flow speed)
item_drop_settings.ground_drag = 2.5 --how much friction with the ground slows items sliding on it
item_drop_settings.slippery_drag_factor = 0.4 --scales item friction with the ground on slippery floors (e.g. ice)
item_drop_settings.radius_magnet = 2.0 --radius of item magnet. MUST BE LARGER THAN radius_collect!
item_drop_settings.xp_radius_magnet = 7.25 --radius of xp magnet. MUST BE LARGER THAN radius_collect!
item_drop_settings.radius_collect = 0.2 --radius of collection
@ -845,9 +846,14 @@ minetest.register_entity(":__builtin:item", {
end
local ground_drag = item_drop_settings.ground_drag
if minetest.registered_nodes[nn].slippery then
ground_drag = ground_drag * item_drop_settings.slippery_drag_factor
end
local newvel = {
x = oldvel.x - oldvel.x * ground_drag * dtime,
y = oldvel.y,
y = 0,
z = oldvel.z - oldvel.z * ground_drag * dtime
}
self.object:set_velocity(newvel)