Page 1 of 1

[Mod] Walkover [Mod]

PostPosted: Mon Dec 05, 2016 23:18
by lordfingle
WalkOver

Some mod developers have shown an interest in having an on_walk_over event. This is useful for pressure-plates and the like.

See this issue - https://github.com/minetest/minetest/issues/247

I have implemented a server_side version in lua using globalstep which people might find useful. Of course this would better implemented via a client-based "on walk over", but it is sufficient for my needs now.

Example Usage

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
   minetest.register_node("somemod:someblock", {

       description = key,
       tiles = {"somemod_someblock.png"},
           groups = {cracky=1},
             on_walk_over = function(pos, node, player)
           
                    minetest.chat_send_player(player, "Hey! Watch it!")
             end
})

Depends: default

Code license: Apache 2.0

Github: https://github.com/eidy/walkover
Download: https://github.com/eidy/walkover/archive/master.zip

Re: [Mod] Walkover [Mod]

PostPosted: Tue Dec 06, 2016 02:48
by paramat

Re: [Mod] Walkover [Mod]

PostPosted: Tue Dec 06, 2016 12:12
by Wuzzy
Thank you for posting this!
I have added the mod to the dev wiki:
http://dev.minetest.net/Mod_interoperability

Re: [Mod] Walkover [Mod]

PostPosted: Tue Dec 06, 2016 15:15
by DS-minetest
maybe this would be useful for all sorts of entities, not only players

Re: [Mod] Walkover [Mod]

PostPosted: Thu Jan 12, 2017 22:13
by Wuzzy
Okay, I am currently trying out this mod. It more or less works, but not too well. I have experimented with it for MineClone 2.
I have added a redstone ore node which glows in the dark when you walk over it.
This is an early test run:

Image

Here, I walked over all the redstone ores. But only some blocks actually glow. But all blocks should glow since I walked over all of them.

I walked over at normal speed on the left side and at sneak speed on the right side.
So even at sneak speed the mod seems to “miss” the walkover event. :-(

I will probably also take a look at paramat's trails mod.

Some other notes:
- Remove depends.txt, your mod does not depend on anything.
- Rename the function to “_on_walk_over”. The naming conventions in lua_api.txt suggest that all custom fields in item definitions should begin with “_”