Page 1 of 1

[Mod] Geocaching [geocache]

PostPosted: Tue Dec 22, 2015 15:49
by JoshMars
Really simple mod, adds an owned geocache block.

Any player can:
  • Right click block to view log.
  • Punch to sign log.

Image

Image
Download:
http://joshmars.net/minetest/geocache.tar.gz
License:WTFPL
Dependencies: None.

Re: [Mod] Geocaching [geocache]

PostPosted: Tue Dec 22, 2015 22:41
by twoelk
hehe, a "been there, done that" block

on the Landrush server on Mt Meru there is a sign that people have added their names to upon reaching the peak. Nice to see a mod following the same idea. Could be an interesting block to have in an achievement system.

Re: [Mod] Geocaching [geocache]

PostPosted: Tue Dec 22, 2015 22:53
by rubenwardy
It would be nice to see the times, and also to sort it as most recent first.

Re: [Mod] Geocaching [geocache]

PostPosted: Wed Dec 23, 2015 02:31
by JoshMars
rubenwardy wrote:It would be nice to see the times, and also to sort it as most recent first.

Is there a way to get timestamp from minetest?

As for sorting, I guess it would make sense for it to show recent first by default.

Re: [Mod] Geocaching [geocache]

PostPosted: Wed Dec 23, 2015 02:38
by JoshMars
Most recent is now listed first by default. I will make it toggleable later.

Re: [Mod] Geocaching [geocache]

PostPosted: Wed Dec 23, 2015 20:08
by rubenwardy
You don't get it from Minetest, you get it from Lua's os.date. A real life time stamp is much more readable than a in game timestamp.

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
local date_str = os.date("%Y-%m-%d %H:%M")


will give something like "2015-12-23 20:06". That's the current time.

To show instead something like "100 Minetest Days ago", which I don't recommend, use minetest.get_gametime() or something, and store the game time with the signature, then make the strings when showing the formspec. Be warned that get_gametime() isn't reliable and is liable to being reset (eg: when env_meta.txt is corrupted, which happens a lot)

EDIT: I forgot to say, this is a cool idea and a nice mod.

Re: [Mod] Geocaching [geocache]

PostPosted: Fri Dec 25, 2015 03:34
by JoshMars
Added timestamp (thanks rubenwardy).
Example : "belinda on Dec 24 2015 10:30 PM"