[Mod] Moon Flower

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

[Mod] Moon Flower

by MirceaKitsune » Sat Apr 06, 2013 21:30

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

by jojoa1997 » Sat Apr 06, 2013 21:32

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: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sat Apr 06, 2013 21:36

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.
 

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

by Jouster27 » Sat Apr 06, 2013 21:39

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!
 

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

by paramat » Sat Apr 06, 2013 21:47

Very cool idea.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
12Me21
Member
 
Posts: 826
Joined: Tue Mar 05, 2013 00:36

by 12Me21 » Sun Apr 07, 2013 13:23

I think I will make a sun flower, that only opens during the day
This is a signature virus. Add me to your signature so that I can multiply.
Don't ever save anything as a JPEG.
 

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

by Jouster27 » Fri Apr 12, 2013 14:19

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

by Mossmanikin » Fri May 24, 2013 14:07

Love it!
reminds me of Terraria.

Noob 4 life!
My stuff
 

User avatar
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Sat May 25, 2013 17:16

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

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

by PilzAdam » Sat May 25, 2013 17:18

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

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

by Mossmanikin » Sat May 25, 2013 23:20

PilzAdam wrote:Try adding "default" to depends.txt


Thanks! :)
Works just fine now.

Noob 4 life!
My stuff
 

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

by Neuromancer » Sun Jun 16, 2013 16:45

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

by bdjnk » Mon Jun 17, 2013 10:06

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

by Dan Duncombe » Mon Jun 17, 2013 18:07

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.
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 44 guests

cron