Initial commit
1
mods/skybox/description.txt
Normal file
@@ -0,0 +1 @@
|
||||
Allows changing your sky to unimaginably epic scenes.
|
||||
153
mods/skybox/init.lua
Normal file
@@ -0,0 +1,153 @@
|
||||
|
||||
--[[
|
||||
|
||||
Copyright (C) 2017 - Auke Kok <sofar@foo-projects.org>
|
||||
|
||||
"skybox" is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1
|
||||
of the license, or (at your option) any later version.
|
||||
|
||||
]]--
|
||||
|
||||
--
|
||||
-- Builtin sky box textures and color/shadings, clouds
|
||||
--
|
||||
|
||||
local skies = {
|
||||
{"DarkStormy", "#1f2226", 0.5, { density = 0.5, color = "#aaaaaae0", ambient = "#000000",
|
||||
height = 64, thickness = 32, speed = {x = 6, y = -6},}},
|
||||
{"CloudyLightRays", "#5f5f5e", 0.9, { density = 0.4, color = "#efe3d5d0", ambient = "#000000",
|
||||
height = 96, thickness = 24, speed = {x = 4, y = 0},}},
|
||||
{"FullMoon", "#24292c", 0.2, { density = 0.25, color = "#ffffff80", ambient = "#404040",
|
||||
height = 140, thickness = 8, speed = {x = -2, y = 2},}},
|
||||
{"SunSet", "#72624d", 0.4, { density = 0.2, color = "#f8d8e8e0", ambient = "#000000",
|
||||
height = 120, thickness = 16, speed = {x = 0, y = -2},}},
|
||||
{"ThickCloudsWater", "#a57850", 0.8, { density = 0.35, color = "#ebe4ddfb", ambient = "#000000",
|
||||
height = 80, thickness = 32, speed = {x = 4, y = 3},}},
|
||||
{"TropicalSunnyDay", "#f1f4ee", 1.0, { density = 0.25, color = "#fffffffb", ambient = "#000000",
|
||||
height = 120, thickness = 8, speed = {x = -2, y = 0},}},
|
||||
}
|
||||
|
||||
--
|
||||
-- API
|
||||
--
|
||||
|
||||
skybox = {}
|
||||
|
||||
skybox.set = function(player, number)
|
||||
if number == 0 then
|
||||
skybox.clear(player)
|
||||
else
|
||||
local sky = skies[number]
|
||||
player:override_day_night_ratio(sky[3])
|
||||
local textures = {
|
||||
sky[1] .. "Up.jpg",
|
||||
sky[1] .. "Down.jpg",
|
||||
sky[1] .. "Front.jpg",
|
||||
sky[1] .. "Back.jpg",
|
||||
sky[1] .. "Left.jpg",
|
||||
sky[1] .. "Right.jpg",
|
||||
}
|
||||
if player.get_sky_color ~= nil then
|
||||
player:set_sky({
|
||||
base_color = sky[2],
|
||||
type = "skybox",
|
||||
textures = textures,
|
||||
clouds = true
|
||||
})
|
||||
player:set_sun({visible = false, sunrise_visible = false})
|
||||
player:set_moon({visible = false})
|
||||
player:set_stars({visible = false})
|
||||
else
|
||||
player:set_sky(sky[2], "skybox", textures, true)
|
||||
end
|
||||
player:set_clouds(sky[4])
|
||||
player:set_attribute("skybox:skybox", sky[1])
|
||||
end
|
||||
end
|
||||
|
||||
skybox.clear = function(player)
|
||||
player:override_day_night_ratio(nil)
|
||||
if player.get_sky_color ~= nil then
|
||||
player:set_sky({base_color = "white", type = "regular"})
|
||||
else
|
||||
player:set_sky("white", "regular")
|
||||
end
|
||||
player:set_clouds({
|
||||
density = 0.4,
|
||||
color = "#fff0f0e5",
|
||||
ambient = "#000000",
|
||||
height = 120,
|
||||
thickness = 16,
|
||||
speed = {x = 0, y = -2},
|
||||
})
|
||||
player:set_sun({visible = true, sunrise_visible = true})
|
||||
player:set_moon({visible = true})
|
||||
player:set_stars({visible = true})
|
||||
|
||||
player:set_attribute("skybox:skybox", "off")
|
||||
end
|
||||
|
||||
skybox.add = function(def)
|
||||
table.add(skies, def)
|
||||
end
|
||||
|
||||
skybox.get_skies = function()
|
||||
return table.copy(skies)
|
||||
end
|
||||
|
||||
--
|
||||
-- registrations and load/save code
|
||||
--
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local sky = player:get_attribute("skybox:skybox")
|
||||
if not sky or sky == "" then
|
||||
skybox.clear(player)
|
||||
else
|
||||
for k, v in ipairs(skies) do
|
||||
if sky == v[1] then
|
||||
skybox.set(player, k)
|
||||
return
|
||||
end
|
||||
end
|
||||
skybox.clear(player)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_privilege("skybox", {
|
||||
description = "Change sky box for yourself",
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("skybox", {
|
||||
params = "<skybox> or <number> or \"off\" or empty to list skyboxes",
|
||||
description = "Change your sky box set",
|
||||
privs = "skybox",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
if param == nil or param == "" then
|
||||
minetest.chat_send_player(name, "Available sky boxes:")
|
||||
for _, v in ipairs(skies) do
|
||||
minetest.chat_send_player(name, v[1])
|
||||
end
|
||||
return
|
||||
elseif tonumber(param) ~= nil and tonumber(param) >= 1 and tonumber(param) <= table.getn(skies) then
|
||||
skybox.set(player, tonumber(param))
|
||||
return
|
||||
elseif param == "off" or param == "0" then
|
||||
skybox.clear(player)
|
||||
return
|
||||
end
|
||||
for k, v in ipairs(skies) do
|
||||
if v[1] == param then
|
||||
skybox.set(player, k)
|
||||
return
|
||||
end
|
||||
end
|
||||
minetest.chat_send_player(name, "Could not find that sky box.")
|
||||
end
|
||||
})
|
||||
5
mods/skybox/mod.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
name = skybox
|
||||
description = Allows changing your sky to unimaginably epic scenes.
|
||||
release = 8628
|
||||
author = sofar
|
||||
title = Skybox
|
||||
57
mods/skybox/readme.md
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
## skybox - a player skybox mod (and API!)
|
||||
|
||||
### License of code and artwork
|
||||
|
||||
* Code:
|
||||
|
||||
Copyright (C) 2017 - Auke Kok <sofar@foo-projects.org>
|
||||
|
||||
Provides a basic API for modifying a player sky box in a coherent
|
||||
fashion.
|
||||
|
||||
* Artwork (textures):
|
||||
|
||||
SkyboxSet by Heiko Irrgang ( http://gamvas.com ) is licensed under
|
||||
the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
Based on a work at http://93i.de.
|
||||
|
||||
|
||||
### Usage
|
||||
|
||||
The `skybox` privilege allows players to change their own sky boxes.
|
||||
The command allows listing, and changing skyboxes, or turning skybox
|
||||
settings `off`.
|
||||
|
||||
### API
|
||||
|
||||
The `skybox` handle can be used to perform various actions:
|
||||
|
||||
`skybox.clear(player)`
|
||||
-- Reverts the player skybox setting to the default.
|
||||
|
||||
`skybox.set(player, number)`
|
||||
-- Sets the skybox to the `number` in the list of current skyboxes.
|
||||
|
||||
`skybox.add(skyboxdef)`
|
||||
-- Add a new skybox with skyboxdef to the list of available skyboxes.
|
||||
|
||||
`skybox.get_skies()`
|
||||
-- Get a list of availiable skyboxes
|
||||
-- Example value of `skybox.get_skies()[1]`:
|
||||
--[[
|
||||
```lua
|
||||
{"DarkStormy", "#1f2226", 0.5, { density = 0.5, color = "#aaaaaae0", ambient = "#000000",
|
||||
height = 64, thickness = 32, speed = {x = 6, y = -6},}},
|
||||
```
|
||||
]]
|
||||
|
||||
|
||||
```
|
||||
skyboxdef = {
|
||||
[1] -- Base name of texture. The 6 textures you need to
|
||||
-- provide need to start with this value, and then
|
||||
-- have "Up", "Down", "Front", "Back", "Left" and
|
||||
-- "Right", Followed by ".jpg" as the file name.
|
||||
[2] -- Sky color (colorstring)
|
||||
[3] -- Day/Night ratio value (float - [0.0, 1.0])
|
||||
BIN
mods/skybox/screenshot.png
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
mods/skybox/textures/CloudyLightRaysBack.jpg
Normal file
|
After Width: | Height: | Size: 804 KiB |
BIN
mods/skybox/textures/CloudyLightRaysDown.jpg
Normal file
|
After Width: | Height: | Size: 540 KiB |
BIN
mods/skybox/textures/CloudyLightRaysFront.jpg
Normal file
|
After Width: | Height: | Size: 671 KiB |
BIN
mods/skybox/textures/CloudyLightRaysLeft.jpg
Normal file
|
After Width: | Height: | Size: 880 KiB |
BIN
mods/skybox/textures/CloudyLightRaysRight.jpg
Normal file
|
After Width: | Height: | Size: 494 KiB |
BIN
mods/skybox/textures/CloudyLightRaysUp.jpg
Normal file
|
After Width: | Height: | Size: 519 KiB |
BIN
mods/skybox/textures/DarkStormyBack.jpg
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
mods/skybox/textures/DarkStormyDown.jpg
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
mods/skybox/textures/DarkStormyFront.jpg
Normal file
|
After Width: | Height: | Size: 173 KiB |
BIN
mods/skybox/textures/DarkStormyLeft.jpg
Normal file
|
After Width: | Height: | Size: 193 KiB |
BIN
mods/skybox/textures/DarkStormyRight.jpg
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
mods/skybox/textures/DarkStormyUp.jpg
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
mods/skybox/textures/FullMoonBack.jpg
Normal file
|
After Width: | Height: | Size: 343 KiB |
BIN
mods/skybox/textures/FullMoonDown.jpg
Normal file
|
After Width: | Height: | Size: 318 KiB |
BIN
mods/skybox/textures/FullMoonFront.jpg
Normal file
|
After Width: | Height: | Size: 328 KiB |
BIN
mods/skybox/textures/FullMoonLeft.jpg
Normal file
|
After Width: | Height: | Size: 456 KiB |
BIN
mods/skybox/textures/FullMoonRight.jpg
Normal file
|
After Width: | Height: | Size: 451 KiB |
BIN
mods/skybox/textures/FullMoonUp.jpg
Normal file
|
After Width: | Height: | Size: 260 KiB |
8
mods/skybox/textures/LICENSE.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
SkyboxSet by Heiko Irrgang ( http://gamvas.com ) is licensed under
|
||||
the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
Based on a work at http://93i.de.
|
||||
|
||||
To view a copy of this license, visit
|
||||
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to
|
||||
Creative Commons, 444 Castro Street, Suite 900, Mountain View,
|
||||
California, 94041, USA.
|
||||
16
mods/skybox/textures/README.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
You may use this textures for free in games, even commercial.
|
||||
|
||||
See LICENSE.txt for details.
|
||||
|
||||
Please also have a look on my other projects:
|
||||
|
||||
Gamvas - a HTML5 game engine for the canvas element
|
||||
|
||||
http://gamvas.com
|
||||
|
||||
Brukkon - a puzzle game using the skybox textures
|
||||
|
||||
http://93i.de/cms/products/games/brukkon
|
||||
|
||||
Kind Regards,
|
||||
Heiko Irrgang <hi@93-interactive.com>
|
||||
BIN
mods/skybox/textures/SunSetBack.jpg
Normal file
|
After Width: | Height: | Size: 218 KiB |
BIN
mods/skybox/textures/SunSetDown.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
mods/skybox/textures/SunSetFront.jpg
Normal file
|
After Width: | Height: | Size: 220 KiB |
BIN
mods/skybox/textures/SunSetLeft.jpg
Normal file
|
After Width: | Height: | Size: 366 KiB |
BIN
mods/skybox/textures/SunSetRight.jpg
Normal file
|
After Width: | Height: | Size: 222 KiB |
BIN
mods/skybox/textures/SunSetUp.jpg
Normal file
|
After Width: | Height: | Size: 288 KiB |
BIN
mods/skybox/textures/ThickCloudsWaterBack.jpg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
mods/skybox/textures/ThickCloudsWaterDown.jpg
Normal file
|
After Width: | Height: | Size: 786 KiB |
BIN
mods/skybox/textures/ThickCloudsWaterFront.jpg
Normal file
|
After Width: | Height: | Size: 1009 KiB |
BIN
mods/skybox/textures/ThickCloudsWaterLeft.jpg
Normal file
|
After Width: | Height: | Size: 1006 KiB |
BIN
mods/skybox/textures/ThickCloudsWaterRight.jpg
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
mods/skybox/textures/ThickCloudsWaterUp.jpg
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayBack.jpg
Normal file
|
After Width: | Height: | Size: 686 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayDown.jpg
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayFront.jpg
Normal file
|
After Width: | Height: | Size: 590 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayLeft.jpg
Normal file
|
After Width: | Height: | Size: 554 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayRight.jpg
Normal file
|
After Width: | Height: | Size: 586 KiB |
BIN
mods/skybox/textures/TropicalSunnyDayUp.jpg
Normal file
|
After Width: | Height: | Size: 505 KiB |