[Mod] Walkover [Mod]

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

[Mod] Walkover [Mod]

by lordfingle » Mon Dec 05, 2016 23:18

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
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
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: [Mod] Walkover [Mod]

by paramat » Tue Dec 06, 2016 02:48

 

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

Re: [Mod] Walkover [Mod]

by Wuzzy » Tue Dec 06, 2016 12:12

Thank you for posting this!
I have added the mod to the dev wiki:
http://dev.minetest.net/Mod_interoperability
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: [Mod] Walkover [Mod]

by DS-minetest » Tue Dec 06, 2016 15:15

maybe this would be useful for all sorts of entities, not only players
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

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

Re: [Mod] Walkover [Mod]

by Wuzzy » Thu Jan 12, 2017 22:13

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 “_”
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 


Return to WIP Mods

Who is online

Users browsing this forum: Bing [Bot] and 14 guests

cron