[Mod] Walkover [Mod]

Post Reply
User avatar
lordfingle
Member
Posts: 65
Joined: Sat Apr 04, 2015 09:21
GitHub: eidy
IRC: lordfingle
In-game: lordfingle
Location: Australia
Contact:

[Mod] Walkover [Mod]

by lordfingle » Post

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

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
Last edited by lordfingle on Wed Dec 07, 2016 05:39, edited 1 time in total.
----------------------------------------------------------------------------------------------
Team Lead on "eidy- Love learning"
I like reading, walks on the beach and building edutech experiences in lua (Find out more in this post)
"Coming together is a beginning; keeping together is progress; working together is success." - Henry Ford

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Walkover [Mod]

by paramat » Post

This code may be of use viewtopic.php?f=11&t=6773

User avatar
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Walkover [Mod]

by Wuzzy » Post

Thank you for posting this!
I have added the mod to the dev wiki:
http://dev.minetest.net/Mod_interoperability

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Walkover [Mod]

by Desour » Post

maybe this would be useful for all sorts of entities, not only players
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Walkover [Mod]

by Wuzzy » Post

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 “_”

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests