[Mod] Moon Flower [moonflower]

Post Reply
User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

[Mod] Moon Flower [moonflower]

by MirceaKitsune » Post

Although I've made several code changes to MineTest, I never created my own mod or worked with the Lua API before. I decided to change that today, and start with putting in practice a simple idea I had in mind.

The Moon Flower is an unique flower created for Minetest. It spawns on grass and can be pretty rare to find (5 spawn attempts of 0.1 probability per chunk). Compared to simple decorative flowers, it has a special property: It opens up and casts lighting when under the influence of the moon. This is done by checking that its location is affected by sky light and the time of day is right. This was mainly its purpose, since I thought a plant that spawns naturally and emits lighting at night could be a beautiful sight.

This is also intended to become part of MineTest by default, but I'd rather it's included as part of the complete flowers mod. The texture and code are free to use, and I guess they're licensed GPL or WTFPL if that works best. Since this is my first Lua mod, I'd like to know what you think of the coding too and if my approach is generally correct (some of the code was inspired from VanessaE's old Flowers mod).

Mod available on Github

Image

Image
Last edited by MirceaKitsune on Sat Apr 06, 2013 21:31, edited 1 time in total.

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

could you have it change tyhe gravity. i know someone added that to dev
Coding;
1X coding
3X debugging
12X tweaking to be just right

User avatar
MirceaKitsune
Member
Posts: 860
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune
Location: Romania, Bucharest
Contact:

by MirceaKitsune » Post

jojoa1997 wrote:could you have it change tyhe gravity. i know someone added that to dev
I added that to dev yesterday :P But that goes beyond its purpose. I'm considering lower gravity for floatlands instead, but that's a different story.

User avatar
Jouster27
Member
Posts: 117
Joined: Fri Mar 29, 2013 14:16

by Jouster27 » Post

I really like the idea of this mod. I'm currently trying to map a world with landup, chasm and canyons (and it's literally taking all day) but as soon as I find a stopping-point, i plan to try this one out!

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

by paramat » Post

Very cool idea.
I rely on donations for basic income. PayPal viewtopic.php?f=3&t=14935 Patreon https://www.patreon.com/paramat

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

by 12Me21 » Post

I think I will make a sun flower, that only opens during the day
Shoutouts to Simpleflips

User avatar
Jouster27
Member
Posts: 117
Joined: Fri Mar 29, 2013 14:16

by Jouster27 » Post

I tried the mod. My daughters and I love the moon flowers. Thank you for making this mod.

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

Love it!
reminds me of Terraria.

Noob 4 life!
My stuff

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

Seems to work fine on stable 0.4.6.
Unfortunately it does not on the version of 0.4.6dev I've got (no other mods installed);

Code: Select all

GUIConfigureWorld: Not allowing focus change.
GUIConfigureWorld: Not allowing focus change.
18:37:20: ERROR[main]: ========== ERROR FROM LUA ===========
18:37:20: ERROR[main]: Failed to load and run script from 
18:37:20: ERROR[main]: C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:
18:37:20: ERROR[main]: ....6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:20: attempt to index global 'default' (a nil value)
18:37:20: ERROR[main]: stack traceback:
18:37:20: ERROR[main]:     ....6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:20: in main chunk
18:37:20: ERROR[main]: =======END OF ERROR FROM LUA ========
18:37:20: ERROR[main]: Server: Failed to load and run C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua
18:37:20: ERROR[main]: ModError: Failed to load and run C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua

Noob 4 life!
My stuff

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Mossmanikin wrote:Seems to work fine on stable 0.4.6.
Unfortunately it does not on the version of 0.4.6dev I've got (no other mods installed);

Code: Select all

GUIConfigureWorld: Not allowing focus change.
GUIConfigureWorld: Not allowing focus change.
18:37:20: ERROR[main]: ========== ERROR FROM LUA ===========
18:37:20: ERROR[main]: Failed to load and run script from 
18:37:20: ERROR[main]: C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:
18:37:20: ERROR[main]: ....6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:20: attempt to index global 'default' (a nil value)
18:37:20: ERROR[main]: stack traceback:
18:37:20: ERROR[main]:     ....6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua:20: in main chunk
18:37:20: ERROR[main]: =======END OF ERROR FROM LUA ========
18:37:20: ERROR[main]: Server: Failed to load and run C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua
18:37:20: ERROR[main]: ModError: Failed to load and run C:\Games\minetest-0.4.6-e57dc4e-farming-win32\bin\..\mods\moonflower\init.lua
Try adding "default" to depends.txt

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

PilzAdam wrote: Try adding "default" to depends.txt
Thanks! :)
Works just fine now.

Noob 4 life!
My stuff

User avatar
Neuromancer
Member
Posts: 795
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

Mossmanikin wrote:
PilzAdam wrote: Try adding "default" to depends.txt
Thanks! :)
Works just fine now.
I like this mod, kind of unique. Please make this windows fix part of this mod.

User avatar
bdjnk
Member
Posts: 104
Joined: Wed Mar 20, 2013 21:03
GitHub: bdjnk
Location: New York
Contact:

by bdjnk » Post

MirceaKitsune wrote:Since this is my first Lua mod, I'd like to know what you think of the coding too and if my approach is generally correct.
I don't know whether what you've done is "correct", but it is different in an interesting way from what I've done (in similar circumstances).

You use a register_abm to create a timer, as explained here. I use on_timer in register_node, as explained here and here.

I've heard tell in ancient times of the potential evils of ABMs. Which is to say, I've seen people on the forum saying you shouldn't have too many, or something like that.

Maybe someone who knows what they're talking about can jump in and explain some details.

User avatar
Dan Duncombe
Member
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Post

Adding lots of ABMs can cause a lot of lag- So they are fine to use, but if you have, say, 10 or more, lag will definitely start to occur.
Last edited by Dan Duncombe on Mon Jun 17, 2013 18:07, edited 1 time in total.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.

LordVlad
Member
Posts: 15
Joined: Wed Apr 26, 2017 02:22
In-game: LordVlad
Contact:

Re: [Mod] Moon Flower [moonflower]

by LordVlad » Post

Awesome mod... simple and original!

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests