[Mod]mymonths[mymonths]

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Mar 09, 2016 02:20

I could add it to the holidays script. Then people will know spring summer fall and winter.

I also need to darken skies when it is raining or snowing.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mod]mymonths[mymonths]

by MineYoshi » Wed Mar 09, 2016 02:39

well, i am attent when you make the equinox, anyways, i think is better do the darken skies first!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Mar 09, 2016 02:45

I will add equinox and solstice but I will call it spring, summer, autumn and winter. That is what most know it as.
Because the mod changes the time speed it already has longer nights in winter and longer days in summer. I will add darker skies during weather events.

Thanks for the suggestion.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: [Mod]mymonths[mymonths]

by MineYoshi » Wed Mar 09, 2016 02:56

Ok :D
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod]mymonths[mymonths]

by Sokomine » Wed Mar 16, 2016 04:37

Finally! Seasons again. There was 4seasons on the King Arthurs Land server for quite a while, and that did provide some intresting gameplay. I'm glad that a new mod has been created (and seems to be developed further :-)) which adds more variety to nature over time. The screenshots look very promising.
A list of my mods can be found here.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Mar 16, 2016 05:00

Sokomine wrote:Finally! Seasons again. There was 4seasons on the King Arthurs Land server for quite a while, and that did provide some intresting gameplay. I'm glad that a new mod has been created (and seems to be developed further :-)) which adds more variety to nature over time. The screenshots look very promising.

Thanks Sokomine. Nathan and I are working on it. Tenplus1 and OldCoder has helped too.

It is at a point now that it works well. The weather will slow things down a bit but if you turn the weather off there are no issues as far as I know. We are looking at optimising the code right now. When that is done I want to add more to the mod. I am wanting to add farming to the code so you can only grow crops in certain months. I have a few other ideas as well.

Other mods can use this mode as a dependency. You can use these
mymonths.day_counter - 1 - 14
mymonths.month_counter 1 - 12
mymonths.weather - rain, storm, snow, snowstorm, sandstorm, hail, clear

Maybe other mods will support this one. Would be nice to see so we can have really good seasons in minetest
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod]mymonths[mymonths]

by Sokomine » Wed Mar 16, 2016 05:03

I'm not sure about the actual change to the length of the day. Most of us tend to prefer day for building. One server had shorter nights and longer days - which turned out to be very convenient. But from a survival point of view it might work out well. The seasonal growth of crops might also be a good game element, turning survival into a challenge.

The seasonal changes alone are nice already.
A list of my mods can be found here.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Mar 16, 2016 05:09

We would have a setting to turn on or off most of the features. I might consider a setting for length of day changing.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Mon Apr 11, 2016 12:47

Update - if you are running the latest dev version of minetest then this update uses an lbm to update the mapblocks to the right time of year. Now when you go exploring the leaves will be the right color for the right time of year.

https://github.com/minetest-mods/mymonths
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: [Mod]mymonths[mymonths]

by burli » Tue May 31, 2016 11:42

The rain in thin mod is a little bit odd. If I walk sometimes the rain doesn't follow me, if I walk downhill, also, and if I stand under a node the rain stopps. If you stand at a cliff and look down it also looks weired. And puddles don't work

Sandstorm is sometimes also weired. If you walk hills up or down the storm is below/above you
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod]mymonths[mymonths]

by luewind » Tue Aug 09, 2016 15:44

I have been playing around with this mod a bit and rather enjoy the seasons and the weather. I was building in a snow region and noticed that even with snow accumulation turned on it was never growing on the snow already in the region. So I looked into it and saw that the default version of snow in minetest was treated differently then snow in Mymonths.

I messed around a bit with the abms.lua file and changed it to include the default snow and snow blocks. I also added a function that checks the adjacent snow nodes heights before turning a snow_cover_5 node into a snow block and if the height diffs are too high it tried to increase the adjacent nodes height. It works like snow drifting IRL and lets snow "drift" and build up under trees.

Here is a link to the fork I made on github to play around with: https://github.com/luewind/mymonths/blo ... r/abms.lua
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Tue Aug 09, 2016 19:41

luewind wrote:I have been playing around with this mod a bit and rather enjoy the seasons and the weather. I was building in a snow region and noticed that even with snow accumulation turned on it was never growing on the snow already in the region. So I looked into it and saw that the default version of snow in minetest was treated differently then snow in Mymonths.

I messed around a bit with the abms.lua file and changed it to include the default snow and snow blocks. I also added a function that checks the adjacent snow nodes heights before turning a snow_cover_5 node into a snow block and if the height diffs are too high it tried to increase the adjacent nodes height. It works like snow drifting IRL and lets snow "drift" and build up under trees.

Here is a link to the fork I made on github to play around with: https://github.com/luewind/mymonths/blo ... r/abms.lua

I have been meaning to do that. I never took the time to get it done.
Would you please submit a pull request?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod]mymonths[mymonths]

by luewind » Wed Aug 10, 2016 14:20

I submitted the pull request.

I'm still working on making the melting behavior not melt the snow/ice biomes. If minetest had biome support it would be a lot easier but I'm relying on snow biomes having ice blocks in them. This doesn't prevent taiga (snow forests) from melting and it makes it a lot harder if in the future having water freeze during winter is added (may then cause snow near rivers and oceans to never melt).
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Aug 10, 2016 14:41

luewind wrote:I submitted the pull request.

I'm still working on making the melting behavior not melt the snow/ice biomes. If minetest had biome support it would be a lot easier but I'm relying on snow biomes having ice blocks in them. This doesn't prevent taiga (snow forests) from melting and it makes it a lot harder if in the future having water freeze during winter is added (may then cause snow near rivers and oceans to never melt).

I approve of your PR. I would like Nathan to look and approve before merging.

As for biome support, I wish! That would make life much better. What if you do not change snow_cover_5 to default:snowblock. Instead create a new node the same as default:snowblock. Then you can use default:snowblock for a biome check?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod]mymonths[mymonths]

by luewind » Wed Aug 10, 2016 15:42

Here is a crazy idea: use minetest.find_nodes_in_area to get a list of snow and ice blocks near by in a cube of size 5 or 7 and make the melt rate proportionally probable to the number of positions that function returns. This way Ice biomes will hardly melt and with a little tweaking taigas will be able to have a slight freeze-thaw cycle. Even the month number could help. It could be something like prob=100(1-blockNum/maxBlocks) + month# , assume we exclude month number for November through March. Don't know if this would make it too complex.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod]mymonths[mymonths]

by Don » Wed Aug 10, 2016 15:53

I like the idea. The only thing I am concerned with is minetest.f ind_nodes_in_area. This might be an issue with speed if called too much.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod]mymonths[mymonths]

by luewind » Thu Aug 11, 2016 17:49

I wrote up a quick chat command to let me run around and get the probability of the spot your standing on melting and tweaked it till I thought it looked reasonable. ice plains and icebergs are a 0.04-0% chance of melting, taiga forests are a ~2-3% chance of melting, and normal plains have a ~4-5% chance of melting (using the test world I made and had snow storms going for ~2 hours IRL). I would like to skew these number a bit more (maybe add another biased list count for pine logs?) but I didn't want to make it too complex or have it find_nodes_in_area scan too big of an area.

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
core.register_chatcommand("get_melt_prob", {
   params = "", description = "returns the probability of a node melting at the players possition",
   func = function(name, param)
      local pos = minetest.get_player_by_name(name):getpos()
      local list1 = minetest.find_nodes_in_area({x=pos.x-3,y=pos.y-2,z=pos.z-3},{x=pos.x+3,y=pos.y,z=pos.z+3},{"default:ice", "default:snowblock"})
      local list2 = minetest.find_nodes_in_area({x=pos.x-3,y=pos.y-2,z=pos.z-3},{x=pos.x+3,y=pos.y,z=pos.z+3},{"mymonths:snow_cover_5","mymonths:snow_cover_4",
            "mymonths:snow_cover_3","mymonths:snow_cover_2","mymonths:snow_cover_1"})
      -- list1 is snow blocks and ice, list 2 is snow cover nodes
      local count = 2 * table.getn(list1) + table.getn(list2)
      local prob = 1 - count/147
      prob = math.max(tonumber(string.format("%.2f", prob * 10)), 0)
      minetest.chat_send_player(name, "probability od melthing here is: " .. prob .. "%")
      return
   end
})


I was also thinking about adding Ice freezing and thawing but didn't now if that's too much or too out of scope.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Mod]mymonths[mymonths]

by Sokomine » Mon Aug 22, 2016 23:21

It might be a great game for singleplayer. It doesn't really work out in multiplayer. Getting food is tricky as the seasons follow the servers uptime and not the players online time. Thus, seasons for growing and harvesting may easily be missed. Winter leaves do not give saplings. The test server is extremly laggy. No sheep has yet been sighted. Perhaps they only spawn on unmodified dirt_with_grass.

As to the test server: The seasonal leaves are beautiful. A snowstorm can be very impressive. Rain feels really rainy. Weather and seasons do work well. Thunderstorms create fires here and there. The landscape changing only on approach might not be avoidable, but it sometimes looks a bit odd if you see summer trees in winter just some couple of meters away.

It seems to be a very entertaining mod for singleplayer. Could make survival better.
A list of my mods can be found here.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod]mymonths[mymonths]

by Nathan.S » Tue Aug 23, 2016 00:54

Currently plants don't care about the month when it comes to growing, though I do plan on trying to implement that. It would make farming on a server trickier, if a player didn't long on very often, but there is always hunting that can be done, or trading.

We didn't make any changes to any mobs, so sheep will only spawn on the original nodes they are set to spawn on. One would have to change the code for the sheep to make them spawn on any of the nodes that this mod adds.

The LBMs should take care of much of the differences in the flora, though yes you'll probably see it for a second or two before it changes, though if you're moving slowly doing other things as you go along you might not ever notice it.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod]mymonths[mymonths]

by luewind » Mon Sep 05, 2016 21:07

In the last merge I put forward if snow accumulation is turned on then plant nodes can be removed if snow falls on them, so outdoor farms will not work in the winter months. Building a "green house" (having glass blocks above the plants) is a solution to growing plants during the winter.

I put in a merge request with some changes to prevent snow and rain from getting through transparent nodes like glass. I realized this issue when I was playing and snow was building up inside my green house and destroying all my crops. It also annoyed me when rain particles were showing when I was inside my green house so I fixed this as well, luckily the fix was the same for both.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod]mymonths[mymonths]

by Nathan.S » Thu Sep 08, 2016 14:53

I've merged the pull request, so rain and snow won't fall through glass or other transparent nodes.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

snoopy
Member
 
Posts: 34
Joined: Thu Oct 20, 2016 16:49

no grass after winter - mymonths

by snoopy » Thu Oct 20, 2016 17:59

First place I want to thank you for this module and the creative functionality. My kids and me like the weather changes and the seasons effects very much. The water puddles are a great idea.

However, there seem to be some flaws with the current module as of 2016-09-08 running on a local 0.4.14 dedicated server. I copied your module from minetest-mods project.

Main issue is our world gets no grass and no flowers after winter and snow flattened the surface. Dirt remains dirt and does not change to dirt with grass. Thus I took a brief look into some of your code and would like to hint at IMHO false syntax and flawed semantics. I would hope this may help to solve the apparent issues.

(1) In file flowers.lua the code always returns and does not reach the code intended for March and April, I presume.

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_abm({
   nodenames = {'group:soil'},
   interval = 240,
   chance = 100,

   action = function (pos)

      -- return if not march or april
      if mymonths.month_counter ~=  3
      or mymonths.month_counter ~=  4 then
         return
      end


Unfortunately, the condition (mc ~= 3 OR mc ~= 4) is always true.

The correct condition should be (mc ~= 3 AND mc ~= 4) and one may refer to https://en.wikipedia.org/wiki/De_Morgan%27s_laws.

So the relevant code fragment should be corrected to:
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
-- return if not March or April
      if mymonths.month_counter ~= 3
      and mymonths.month_counter ~= 4 then
         return
      end


This would give a chance to grow flowers in March and April.

(2) In file grass.lua the code has a wrong syntax ref to http://dev.minetest.net/minetest.register_abm.

Please change nodename to nodenames for consistency with the API syntax definition.

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_abm({
   nodename = {'mymonths:fall_grass'},
   interval = 60,
   chance = 40,
   action = function (pos, node, active_object_count, active_object_count_wider)
      if mymonths.month_counter == 4 then
         minetest.set_node(pos, {name = 'default:dirt_with_grass'})
   end
end
})


BTW does the concept of Lua allow any syntax checks to avoid such hassling typos remaining undetected?

(3) Furthermore, unloading the module results in a world heavily polluted with unknown leaves and dirt elements (as would happen with other modules too). Would there be any chance to get some repair function with the mymonths module which would return to default nodes in combination with an appropriate settings.txt setup? The idea would be to not unload the module but to deactivating the loaded module with a settings flag accordingly.
Enjoying Minetest by Neoascetic's and Morn76's builds on Mac OS X 10.11.6 clients with local server and several modifications.
 

User avatar
TheReaperKing
Member
 
Posts: 493
Joined: Sun Nov 22, 2015 21:36

Re: [Mod]mymonths[mymonths]

by TheReaperKing » Thu Oct 20, 2016 23:26

My students and I have been loving this mod! They go crazy especially when it snows, maybe being in Florida is a part of that.

We did have some ideas to suggest, hopefully I remember them all:

1) In the spring time, what if the flowers bloom/sprout too? Maybe even the grass and vegetation would come to life more as well.
2) Perhaps the rainfall could work with the crops mod. The rain could potentially water or even over water the crops.
viewtopic.php?f=11&t=11795
3) I'm not sure if it is possible but maybe in the monsoon seasons there could possibly be floods.

Thanks for your great work on this mod! Right now the leaves are growing again in the trees and it looks so awesome! Take care.
-Mike
PS Just a quick note I believe it was August that was spelled incorrectly.

EDIT with the flowers and grass I just realized I should have looked more closely at the post about mine xD Thanks for that!
Last edited by TheReaperKing on Sun Oct 23, 2016 16:33, edited 1 time in total.
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com

Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com

Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: [Mod]mymonths[mymonths]

by orwell » Sun Oct 23, 2016 14:01

We now have attached particle spawners!
Is someone working on the weather reimplementation? Would make the weather particles far less laggy!
I didn't test this yet, but it looks good.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

snoopy
Member
 
Posts: 34
Joined: Thu Oct 20, 2016 16:49

Re: no grass after winter - mymonths

by snoopy » Sun Oct 23, 2016 16:03

I agree with Sokomine's post and his observations. Anyway Sokomine seems to be a pro and I am just a newbie here.
Sokomine wrote:It seems to be a very entertaining mod for singleplayer. Could make survival better.

IMHO this mod appears to be work in progress would need an improved integration for multi-player and a more consistent concept of world interaction.

Issues/Observations:
  1. After applying the proposed change (1) to the code for flowers.lua the flowers grow. However the flowers grow in caves too and there seems to be no check for light conditions.
  2. The proposed minor change (2) to the code for grass.lua is a solution to regrow dirt_with_grass and getting fall_grass instead of dirt. However, there seems to be a lack of default:grass_1 and higher grass. The fall_grass should look brown (50%) apparently but does not.
  3. The falling rain makes mobs/monsters ascending into the sky like space rockets. They may not return and may either starve in unknown heights or get killed after high fall.
  4. Look and behavior on default trees including falling apples are quite reasonable and the sticks are good for survival too.
Proposals:
  1. Area around avatar: Snow should melt immediatedly i.e. be deleted when months are beyond April and before the snowing months.
  2. Area around avatar: The trees should show summer leaves immediately and grow apples when months are beyond April and before the late summer.
  3. Water could show ice in winter months.
  4. Falling rain and other weather should give no sounds in deep (-100 ?) caves.
  5. Again, a repair function as mentioned before as (3) would be great.
Thanks for your efforts and looking forward to your very creative work.
Enjoying Minetest by Neoascetic's and Morn76's builds on Mac OS X 10.11.6 clients with local server and several modifications.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod]mymonths[mymonths]

by Nathan.S » Mon Oct 24, 2016 01:58

Snoopy, I've fixed the conditional error you pointed out, good catch, also changed the fall_dirt registration to make it work with the new grass spread function from the default mod. It was recently changed, and may have broken the spreading of the grass in game. I tested and it seemed to work fine.

The fall grass is only the dirt_with_grass nodes, the actual grass plants aren't effected with a fall version at all, though that could be a good idea, something to look into in the morning.

I'll look into keeping the flowers from growing in caves, should be able to just do a light check, though that will make the function slightly more computationally expensive.

Feel free to make my pull requests on the git repo, we can always use more good coders. :)
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
TheReaperKing
Member
 
Posts: 493
Joined: Sun Nov 22, 2015 21:36

Re: [Mod]mymonths[mymonths]

by TheReaperKing » Mon Oct 24, 2016 02:04

Thank you Nathan!!
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com

Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com

Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod]mymonths[mymonths]

by Nathan.S » Mon Oct 24, 2016 02:16

I need to also look into how to get plants from other mods to grow in the spring time too, not the crop style, but other flowers, grasses, etc. I imagine I could use some sort of table, and if a mod is loaded, add its plants to that table and randomly select from that table to grow in the game.

Modifying crops so they only grow during the right time of the year is already on our list of planned things, just not sure when we'll get to it. LOL
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

snoopy
Member
 
Posts: 34
Joined: Thu Oct 20, 2016 16:49

Re: [Mod]mymonths[mymonths]

by snoopy » Fri Oct 28, 2016 23:21

Thanks a lot for the kind words and the quick update to your mod.

Now learning Lua and making myself more familiar with minetest modding I wonder if you would be so kind to look into the performance of my following proposal. I would appreciate any advice and discussion.

In file leaves.lua you invent some procedures to nicely make the autumn come into the world. Momentarily I concentrate on the leaves getting colours.

This is your part of code:
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
-- leaves changing in September and October.
minetest.register_abm({
   nodenames = {'group:leaves'},
   interval = 60,
   chance = 40,
   action = function (pos, node, active_object_count, active_object_count_wider)

      if mymonths.month_counter == 9
      or mymonths.month_counter == 10 then

         if node.name == 'default:leaves' then

            minetest.set_node(pos, {name = 'mymonths:leaves_pale_green'})

         elseif node.name == 'mymonths:leaves_pale_green' then

            minetest.set_node(pos, {name = 'mymonths:leaves_orange'})

         elseif node.name == 'mymonths:leaves_orange' then

            minetest.set_node(pos, {name = 'mymonths:leaves_red'})

         elseif node.name == 'mymonths:leaves_red' then

            minetest.set_node(pos, {name = 'mymonths:sticks_default'})

         elseif node.name == 'default:aspen_leaves' then

            minetest.set_node(pos, {name = 'mymonths:leaves_yellow_aspen'})

         elseif node.name == 'mymonths:leaves_yellow_aspen' then

            minetest.set_node(pos, {name = 'mymonths:leaves_orange_aspen'})

         elseif node.name == 'mymonths:leaves_orange_aspen' then

            minetest.set_node(pos, {name = 'mymonths:leaves_red_aspen'})
         end
      end
   end
})


IMHO the a.m. code in registering the abm gives all the leave nodes i.e. 'group:leaves' in the world the job to process the case chain during months Sep and Oct. So many leaves which never get coloured (e.g. jungle tree leaves) get this abm activated at 1:40 ratio i.e. 2,5% chance and go through the complete chain just for leaving without any true action to the world.

EDIT: chance = 40 is a ratio at 1:40 i.e. 2,5% (or 2,5 per hundred) chance and not 40% as I wrote first.

I took the liberty to invent an alternative. The code is working and should show the same results in the world by activating only such leaves which have a chance to get coloured. However this registers seven abms instead of one.

This is my proposal for an alternative to your a.m. part of code:
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
-- leaves changing in September and October.
local newleaves_table = {
   {old = "default:leaves", new = "mymonths:leaves_pale_green"},
   {old = "mymonths:leaves_pale_green", new = "mymonths:leaves_orange"},
   {old = "mymonths:leaves_orange", new = "mymonths:leaves_red"},
   {old = "mymonths:leaves_red", new = "mymonths:sticks_default"},
   {old = "default:aspen_leaves", new = "mymonths:leaves_yellow_aspen"},
   {old = "mymonths:leaves_yellow_aspen", new = "mymonths:leaves_orange_aspen"},
   {old = "mymonths:leaves_orange_aspen", new = "mymonths:leaves_red_aspen"}
}

for i in pairs(newleaves_table) do
   minetest.register_abm({
      nodenames = {newleaves_table[i].old},
      interval = 60,
      chance = 40,
      action = function (pos)
      
         if mymonths.month_counter == 9
         or mymonths.month_counter == 10 then
            minetest.set_node(pos, {name = newleaves_table[i].new})
         end
         
      end
   })
end


I would be interested in comparing with your original the pros and cons of the newly designed code as well as the performance aspects in the minetest world but did not make the effort to investigate the documentation on minetest performance if there is any available.

NB
I already have made a new experimental mod named myrepairs which is aimed at a module to repair some remains of former active but now deactivated modules. This mod either camouflages unknown nodes by application of minetest.register_alias or thoroughly repairs i.e. changes unknown nodes into applicably known nodes with minetest.set_node alternatively.

Furthermore, I cloned the mymonths repository from minetest-mods after I have installed Git via MacPorts on Mac OS X with sudo port install git +svn +doc +gitweb and may approach you with further results on the mymonths mod via Git in the future.
Enjoying Minetest by Neoascetic's and Morn76's builds on Mac OS X 10.11.6 clients with local server and several modifications.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [Mod]mymonths[mymonths]

by Nathan.S » Mon Oct 31, 2016 02:26

This is going to sound horrible, but I've never been too worried about the overhead on any of my mods, mainly because my desktop is a beast, that said. I do agree with you, that using group:leaves does probably create a higher load than using individual ABMs for the different leave types. From a theoretic standpoint a single ABM running on all the leaves is probably heavier than seven ABMs running on specific leaves, but I don't know how much overhead there is between the ABM call and when the leave stops any thing from happening because it isn't one of the defined types. I would be interested to see what the actually performance differences would be between my code and your code.

I know there is some way to profile mods, and see what kind of processing power they use, and time spent, but with not every being too worried about that, I've never looked into it.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

PreviousNext

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 59 guests

cron