Skip to content

Commit 91fe2a3

Browse files
committed
Implement footprints
1 parent 45b4dd7 commit 91fe2a3

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

mods/default/init.lua

+18-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ default.get_translator = S
3636
-- come up with some sane item groups to use
3737
-- generate failed dungeons in water (like an U)
3838
-- do stone deserts appear naturally?
39-
-- 'footprints'
4039
-- sound ideas: furnace, eating
4140
-- falling sand/gravel
4241
-- investigate long vertical shafts (mgv6 fail?)
@@ -250,6 +249,24 @@ minetest.register_lbm({
250249
end,
251250
})
252251

252+
minetest.register_globalstep(function()
253+
if not minetest.settings:get_bool("footprints") then
254+
return
255+
end
256+
for _, player in ipairs(minetest.get_connected_players()) do
257+
local bottompos = vector.round(vector.offset(player:get_pos(), 0, -1/4, 0))
258+
local n = minetest.get_node(bottompos)
259+
if n.name == "default:dirt_with_grass" then
260+
-- A long argument could be had whether you are allowed to trample
261+
-- over someone else's protected lawn. Let's just say no.
262+
if not minetest.is_protected(bottompos, player:get_player_name()) then
263+
n.name = "default:dirt_with_grass_footsteps"
264+
minetest.swap_node(bottompos, n)
265+
end
266+
end
267+
end
268+
end)
269+
253270
minetest.register_on_newplayer(function(player)
254271
if not minetest.settings:get_bool("give_initial_stuff") then
255272
return

0 commit comments

Comments
 (0)