diff options
author | Hume2 <teratux.mail@gmail.com> | 2018-09-07 18:29:59 +0200 |
---|---|---|
committer | Hume2 <teratux.mail@gmail.com> | 2018-09-07 18:36:20 +0200 |
commit | cce6dac74f1736bd1f1d830192632e8bbd616c62 (patch) | |
tree | bb5dc5a7f43a1d06f071b30a1fd3485ac3e2b24c | |
parent | 95403b81b087d9666a4d914ba889f8c04af6ef56 (diff) |
Slow down on bike-unfriendly blocks like dirt and sand
-rw-r--r-- | init.lua | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -8,6 +8,12 @@ local function is_water(pos) end +local function is_bike_friendly(pos) + local nn = minetest.get_node(pos).name + return minetest.get_item_group(nn, "crumbly") == 0 or minetest.get_item_group(nn, "bike_friendly") ~= 0 +end + + local function get_sign(i) if i == 0 then return 0 @@ -197,6 +203,9 @@ function bike.on_step(self, dtime) if is_water(p) then self.v = self.v / 1.3 end + if not is_bike_friendly({x=p.x, y=p.y-0.355, z=p.z}) then + self.v = self.v / 1.05 + end local new_velo new_velo = get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y) |