I am trying to make a texture pack/subgame in which I would like to modify the color of the sky. I understand that the color of the sky is part of code of the game and not a texture. I would like to know where is the code to modify the sky and how I can integrate it into my texture pack/subgame. I would also like to know whether the sun and the moon have a texture. If they do, where can I find the default textures to modify them, and if they don't, what part of the code are they in?
Thanks in advance.
How do I change the color of the sky, the moon, and the sun?
How do I change the color of the sky, the moon, and the sun?
Check out my emerald mod: viewtopic.php?f=11&t=15485
Re: How do I change the color of the sky, the moon, and the
I have found that there is a function 'player:set_sky' that allows you to change how the player see the sky. I have tried using it to change the color of the sky depending on the time of the day in the following code in my init.lua file.
minetest.after(0)
get time_of_day,
if time_of_day = 0,
player:set_sky({r=0, g=0, b=0}, plain),
end
However, when I try to launch a world with the mod that contains this code enabled, it outputs the following error:
2017-09-02 11:14:32: WARNING[Main]: BanManager: creating /home/cc10/.minetest/worlds/TestBlack&White/ipban.txt
2017-09-02 11:14:32: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
2017-09-02 11:14:32: ERROR[Main]: ModError: Failed to load and run script from /usr/share/minetest/games/black&white/mods/blackwhite/init.lua:
2017-09-02 11:14:32: ERROR[Main]: ...hare/minetest/games/black&white/mods/blackwhite/init.lua:2: '=' expected near 'time_of_day'
2017-09-02 11:14:32: ERROR[Main]: Check debug.txt for details.
What did I do wrong and how can I rewrite my code so that it does what I mentioned above?
minetest.after(0)
get time_of_day,
if time_of_day = 0,
player:set_sky({r=0, g=0, b=0}, plain),
end
However, when I try to launch a world with the mod that contains this code enabled, it outputs the following error:
2017-09-02 11:14:32: WARNING[Main]: BanManager: creating /home/cc10/.minetest/worlds/TestBlack&White/ipban.txt
2017-09-02 11:14:32: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
2017-09-02 11:14:32: ERROR[Main]: ModError: Failed to load and run script from /usr/share/minetest/games/black&white/mods/blackwhite/init.lua:
2017-09-02 11:14:32: ERROR[Main]: ...hare/minetest/games/black&white/mods/blackwhite/init.lua:2: '=' expected near 'time_of_day'
2017-09-02 11:14:32: ERROR[Main]: Check debug.txt for details.
What did I do wrong and how can I rewrite my code so that it does what I mentioned above?
Check out my emerald mod: viewtopic.php?f=11&t=15485
- srifqi
- Member
- Posts: 570
- Joined: Sat Jun 28, 2014 04:31
- GitHub: srifqi
- IRC: srifqi
- In-game: srifqi
- Location: Indonesia
Re: How do I change the color of the sky, the moon, and the
Your syntaxes are not correct. Note that Minetest uses lua as Modding API language.
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/
Re: How do I change the color of the sky, the moon, and the
I know Minetest uses lua as Modding API, but I was experimenting with code. I am no pro programmer, this is the first time I try to make something happen when the game starts. Searching around and experimenting, I managed to make this piece of code which works:srifqi wrote:Your syntaxes are not correct. Note that Minetest uses lua as Modding API language.
minetest.register_on_joinplayer(function(player)
player:set_sky(000000, "plain", {})
end)
Right now, it turns the sky black and I can still see the clouds. Is there a way to change the color of the sky depending on the time of the day? Also, how do I make the sun and moon show up in my custom sky? I can't see them anymore.
Check out my emerald mod: viewtopic.php?f=11&t=15485
Re: How do I change the color of the sky, the moon, and the
To all future replies: Although I have not succeeded in accomplishing what I was trying to do, I am satisfied with my current results (a black sky with the clouds still showing). So case closed. However, during my search for how do this I have learned that it is not easy to edit the sky while keeping the sun and the moon. And there is no accessible "default" sun and moon textures. I hope in the future both of these issues will be solved and/or added to the API so that it's easier to make a textures pack in which you edit the sky.
Check out my emerald mod: viewtopic.php?f=11&t=15485
- Wuzzy
- Member
- Posts: 4804
- Joined: Mon Sep 24, 2012 15:01
- GitHub: Wuzzy2
- IRC: Wuzzy
- In-game: Wuzzy
- Contact:
Re: How do I change the color of the sky, the moon, and the
Actually, you can change the appearance of sun and moon. It just happens that the default sun and moon are generated from code alone and not from an image.
To change sun and moon, you just have to add textures with the correct file names.
See also: https://github.com/minetest/minetest/bl ... _packs.txt
To change sun and moon, you just have to add textures with the correct file names.
See also: https://github.com/minetest/minetest/bl ... _packs.txt
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: How do I change the color of the sky, the moon, and the sun?
I got a hit on this topic when hunting for the same info and after trawlling for a bit found the relevant section in the api. I know this is an old topic but someone else might also stumble on this topic and need the info:
You want the below as I know edits to the api doc will make the direct link I've included wrong over time, do a find on the git page for the below.
https://github.com/minetest/minetest/bl ... .txt#L6599
pretty sure you need these settings inside a "minetest.register_on_joinplayer()"....other than that I'll try and post back with a working example once I have one...
You want the below as I know edits to the api doc will make the direct link I've included wrong over time, do a find on the git page for the below.
Code: Select all
set_sky(sky_parameters)
pretty sure you need these settings inside a "minetest.register_on_joinplayer()"....other than that I'll try and post back with a working example once I have one...
Who is online
Users browsing this forum: No registered users and 15 guests