EXPERIMENTAL COMMIT - DO NOT UPDATE

master
Jordach 2018-07-26 23:04:19 +01:00
parent 0c299ad135
commit a88808e555
20 changed files with 523 additions and 268 deletions

View File

@ -15,8 +15,12 @@ minetest.register_chatcommand("weather", {
atmos.current_weather = 0 + param
local player = minetest.get_player_by_name(name)
player:set_sky("#000000", "skybox", {"core_glass.png", "core_glass.png", "core_glass.png", "core_glass.png", "core_glass.png", "core_glass.png"}, false, true)
atmos.set_skybox(player)
player:override_day_night_ratio(0)
--atmos.set_skybox(player)
return true, "Current weather updated."
end,
@ -25,163 +29,105 @@ minetest.register_chatcommand("weather", {
--
atmos.weather_type = 1
--atmos.weather_type = 1
atmos.current_weather = 3
atmos.weather_sky_colour = {}
--[[
atmos.fog_colour = {}
atmos.weather_sky_type = {}
atmos.weather_light_level = {}
atmos.weather_clouds = {}
atmos.weather_cloud_colour = {}
atmos.weather_cloud_direction = {}
atmos.weather_cloud_thicc = {}
atmos.weather_cloud_height = {}
-- sky settings, items 1-4 are here just for completeness, not functionality
atmos.weather_sky_colour[1] = "#8bb9f9"
atmos.weather_sky_colour[2] = "#8bb9f9"
atmos.weather_sky_colour[3] = "#8bb9f9"
atmos.weather_sky_colour[4] = "#8bb9f9"
atmos.weather_sky_colour[5] = "#9b9b9b"
atmos.weather_sky_colour[6] = "#000409"
atmos.weather_sky_colour[7] = "#8b8b8b"
atmos.weather_sky_colour[8] = "#000409"
atmos.weather_sky_colour[9] = "#333b46"
atmos.weather_sky_colour[10] = "#000409"
atmos.weather_sky_colour[11] = "#333b46"
atmos.weather_sky_colour[12] = "#000409"
atmos.weather_sky_colour[13] = "#8b8b8b"
atmos.weather_sky_colour[14] = "#000409"
atmos.weather_sky_colour[15] = "#000000"
atmos.weather_sky_type[1] = "regular"
atmos.weather_sky_type[2] = "regular"
atmos.weather_sky_type[3] = "regular"
atmos.weather_sky_type[4] = "regular"
atmos.weather_sky_type[5] = "plain"
atmos.weather_sky_type[6] = "plain"
atmos.weather_sky_type[7] = "plain"
atmos.weather_sky_type[8] = "plain"
atmos.weather_sky_type[9] = "plain"
atmos.weather_sky_type[10] = "plain"
atmos.weather_sky_type[11] = "plain"
atmos.weather_sky_type[12] = "plain"
atmos.weather_sky_type[13] = "plain"
atmos.weather_sky_type[14] = "plain"
atmos.weather_sky_type[15] = "plain"
atmos.weather_light_level[1] = nil
atmos.weather_light_level[2] = nil
atmos.weather_light_level[3] = nil
atmos.weather_light_level[4] = nil
atmos.weather_light_level[5] = 0.8
atmos.weather_light_level[6] = 0.175
atmos.weather_light_level[7] = 0.775
atmos.weather_light_level[8] = 0.175
atmos.weather_light_level[9] = 0.6
atmos.weather_light_level[10] = 0.175
atmos.weather_light_level[11] = 0.6
atmos.weather_light_level[12] = 0.175
atmos.weather_light_level[13] = 0.775
atmos.weather_light_level[14] = 0.175
atmos.weather_light_level[15] = 0.075
atmos.weather_light_level[1] = nil -- default skies
atmos.weather_light_level[5] = 0.8 -- cloudy
atmos.weather_light_level[8] = 0.175 -- rain, night
-- cloud settings
atmos.weather_clouds[1] = 0
atmos.weather_clouds[2] = 0.275
atmos.weather_clouds[3] = 0.4
atmos.weather_clouds[4] = 0.5
atmos.weather_clouds[5] = 0.65
atmos.weather_clouds[6] = 0.65
atmos.weather_clouds[7] = 0.65
atmos.weather_clouds[8] = 0.65
atmos.weather_clouds[9] = 0.65
atmos.weather_clouds[10] = 0.65
atmos.weather_clouds[11] = 0.65
atmos.weather_clouds[12] = 0.65
atmos.weather_clouds[13] = 0.65
atmos.weather_clouds[14] = 0.65
atmos.weather_clouds[1] = 0.275 -- light
atmos.weather_clouds[2] = 0.4 -- default
atmos.weather_clouds[3] = 0.5 -- large
atmos.weather_clouds[4] = 0.65 -- rain, snow, thunder
atmos.weather_cloud_colour[1] = "#f0f0f0e5"
atmos.weather_cloud_colour[2] = "#f0f0f055"
atmos.weather_cloud_colour[3] = "#f0f0f0e5"
atmos.weather_cloud_colour[4] = "#f0f0f0f5"
atmos.weather_cloud_colour[5] = "#9b9b9bff"
atmos.weather_cloud_colour[6] = "#797979ff"
atmos.weather_cloud_colour[7] = "#93a2b3ff"
atmos.weather_cloud_colour[8] = "#6b6b6bff"
atmos.weather_cloud_colour[9] = "#4d5968ff"
atmos.weather_cloud_colour[10] = "#6b6b6bff"
atmos.weather_cloud_colour[11] = "#4d5968ff"
atmos.weather_cloud_colour[12] = "#6b6b6bff"
atmos.weather_cloud_colour[13] = "#93a2b3ff"
atmos.weather_cloud_colour[14] = "#6b6b6bff"
atmos.weather_cloud_colour[1] = "#f0f0f0e5" -- default
atmos.weather_cloud_colour[2] = "#9b9b9bff" -- cloudy
atmos.weather_cloud_colour[3] = "#797979ff" -- cloudy, night
atmos.weather_cloud_colour[4] = "#93a2b3ff" -- rain
atmos.weather_cloud_colour[5] = "#6b6b6bff" -- rain, night
atmos.weather_cloud_thicc[1] = 0
atmos.weather_cloud_thicc[2] = 8
atmos.weather_cloud_thicc[3] = 16
atmos.weather_cloud_thicc[4] = 32
atmos.weather_cloud_thicc[5] = 32
atmos.weather_cloud_thicc[6] = 32
atmos.weather_cloud_thicc[7] = 96/2
atmos.weather_cloud_thicc[8] = 96/2
atmos.weather_cloud_thicc[9] = 64
atmos.weather_cloud_thicc[10] = 64
atmos.weather_cloud_thicc[11] = 64
atmos.weather_cloud_thicc[12] = 64
atmos.weather_cloud_thicc[13] = 96/2
atmos.weather_cloud_thicc[14] = 96/2
atmos.weather_cloud_thicc[1] = 8 -- thin
atmos.weather_cloud_thicc[2] = 16 -- default
atmos.weather_cloud_thicc[3] = 32 -- large
atmos.weather_cloud_thicc[4] = 96/2 -- rain
atmos.weather_cloud_height[1] = 120
atmos.weather_cloud_height[2] = 180
atmos.weather_cloud_height[3] = 120
atmos.weather_cloud_height[4] = 100
atmos.weather_cloud_height[5] = 110
atmos.weather_cloud_height[6] = 110
atmos.weather_cloud_height[7] = 105
atmos.weather_cloud_height[8] = 105
atmos.weather_cloud_height[9] = 130
atmos.weather_cloud_height[10] = 130
atmos.weather_cloud_height[11] = 130
atmos.weather_cloud_height[12] = 130
atmos.weather_cloud_height[13] = 115
atmos.weather_cloud_height[14] = 115
atmos.weather_cloud_height[1] = 120 -- default
atmos.weather_cloud_height[2] = 110 -- rain, snow, thunder
-- 1 = clear, no clouds /
-- 2 = clear, some clouds /
-- 3 = clear, default settings /
-- 4 = clear, almost cloudy /
-- 5 = cloudy /
-- 6 = cloudy at night
-- 7 = rainy /
-- 8 = rainy at night
-- 9 = thunderstorm /
-- 10 = thunderstorm at night
-- 11 = hailstorm /
-- 12 = hailstorm at night
-- 13 = snowing /
-- 14 = snowing at night
]]--
-- load data into atmos2 from .atm configuration files:
local atmos_clear_weather = {}
local storage = minetest.get_modpath("atmos").."/skybox/"
local val = 0
for line in io.lines(storage.."skybox_clear_gradient"..".atm") do
atmos_clear_weather[val] = minetest.deserialize(line)
val = val + 1
end
function atmos.set_skybox(player)
local skybox = atmos.get_weather_skybox()
--local skybox = atmos.get_weather_skybox()
local ctime = minetest.get_timeofday() * 100
player:set_sky(atmos.weather_sky_colour[skybox], atmos.weather_sky_type[skybox], true)
ctime = ctime - (ctime % 1)
print (ctime)
player:set_sky(atmos_clear_weather[ctime].base, "skybox", {
"atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].top,
"atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].bottom,
"(atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].base .. ")^" ..
"(atmos_sky_top.png^[multiply:" .. atmos_clear_weather[ctime].top .. ")^" ..
"(atmos_sky_bottom.png^[multiply:" .. atmos_clear_weather[ctime].bottom .. ")",
"(atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].base .. ")^" ..
"(atmos_sky_top.png^[multiply:" .. atmos_clear_weather[ctime].top .. ")^" ..
"(atmos_sky_bottom.png^[multiply:" .. atmos_clear_weather[ctime].bottom .. ")",
"(atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].base .. ")^" ..
"(atmos_sky_top.png^[multiply:" .. atmos_clear_weather[ctime].top .. ")^" ..
"(atmos_sky_bottom.png^[multiply:" .. atmos_clear_weather[ctime].bottom .. ")",
"(atmos_sky.png^[multiply:".. atmos_clear_weather[ctime].base .. ")^" ..
"(atmos_sky_top.png^[multiply:" .. atmos_clear_weather[ctime].top .. ")^" ..
"(atmos_sky_bottom.png^[multiply:" .. atmos_clear_weather[ctime].bottom .. ")"
}, true)
player:set_clouds({
density = atmos.weather_clouds[skybox],
color = atmos.weather_cloud_colour[skybox],
thickness = atmos.weather_cloud_thicc[skybox],
height = atmos.weather_cloud_height[skybox],
density = 0.4,
color = "#fff0f0e5",
thickness = 16,
height = 210,
})
player:override_day_night_ratio(atmos.weather_light_level[skybox])
player:override_day_night_ratio(atmos_clear_weather[ctime].light)
end
@ -196,18 +142,9 @@ function atmos.sync_skybox()
if player:get_pos().y <= -32 then
player:set_sky(atmos.weather_sky_colour[15], atmos.weather_sky_type[15], false)
player:set_sky("#000000", "plain", false)
player:set_clouds({
density = atmos.weather_clouds[1],
color = atmos.weather_cloud_colour[1],
thickness = atmos.weather_cloud_thicc[1],
height = atmos.weather_cloud_height[1],
})
player:override_day_night_ratio(atmos.weather_light_level[15])
player:override_day_night_ratio(0)
elseif player:get_pos().y > 10000 then
@ -232,97 +169,13 @@ end
-- 2 = some clouds (uses default dynamic skybox)
-- 3 = default (uses default dynamic skybox)
-- 4 = somewhat cloudy, not overcast enough (uses default dynamic skybox)
-- 5 = cloudy, overcast? (5 and 6)
-- 6 = raining (and snow in colder areas) (7 and 8)
-- 7 = thunderstorm (9 and 10)
-- 8 = snowing in all biomes exc. the desert (13 and 14 on the atmos.weather_type chart)
-- 9 = hailstorm (11 and 12)
-- 5 = cloudy, overcast?
-- 6 = raining (and snow in colder areas)
-- 7 = thunderstorm
-- 8 = snowing in all biomes exc. the desert
-- 9 = hailstorm
function atmos.get_weather_skybox()
-- let's get the skybox we want depending on the time and day, as well as the current weather
local ctime = minetest.get_timeofday()
if atmos.current_weather == 1 then
return 1
elseif atmos.current_weather == 2 then
return 2
elseif atmos.current_weather == 3 then
return 3
elseif atmos.current_weather == 4 then
return 4
elseif atmos.current_weather == 5 then
if ctime >= 0.22 and ctime <= 0.77 then
return 5
else
return 6
end
elseif atmos.current_weather == 6 then
if ctime >= 0.22 and ctime <= 0.77 then
return 7
else
return 8
end
elseif atmos.current_weather == 7 then
if ctime >= 0.22 and ctime <= 0.77 then
return 9
else
return 10
end
elseif atmos.current_weather == 9 then
if ctime >= 0.22 and ctime <= 0.77 then
return 11
else
return 12
end
elseif atmos.current_weather == 8 then
if ctime >= 0.22 and ctime <= 0.77 then
return 13
else
return 14
end
end
end
function atmos.weatherchange()
@ -402,8 +255,8 @@ function atmos.thunderstrike()
end
minetest.after(1, atmos.sync_skybox)
minetest.after(60+math.random(1,59)*math.random(5,15), atmos.weatherchange)
minetest.after(math.random(43, 156), atmos.thunderstrike)
--minetest.after(60+math.random(1,59)*math.random(5,15), atmos.weatherchange)
--minetest.after(math.random(43, 156), atmos.thunderstrike)
lightning.light_level = atmos.weather_light_level
@ -497,8 +350,8 @@ local function local_area_stamina()
local pposx = math.floor(pos.x)
local pposz = math.floor(pos.z)
local nobj_temp = nobj_temp or minetest.get_perlin(np_temp) -- paramats black magic
local nobj_humid = nobj_humid or minetest.get_perlin(np_humid)
local nobj_temp = minetest.get_perlin(np_temp) -- paramats black magic
local nobj_humid = minetest.get_perlin(np_humid)
local nval_temp = nobj_temp:get2d({x = pposx, y = pposz}) -- more noisy black magic
local nval_humid = nobj_humid:get2d({x = pposx, y = pposz})
@ -570,9 +423,9 @@ local function local_area_stamina()
end
-- if the local temp is less than -15 C then decrement frostbite every now and then, if the heatstroke bar is not at 100,
-- if the local temp is more than -15 C then decrement frostbite every now and then, if the heatstroke bar is not at 100,
-- then start replenishing it
-- if the local temp is more than +35 C then decrement heatstroke every now and then, if the frostbite bar is not at 100,
-- if the local temp is less than +35 C then decrement heatstroke every now and then, if the frostbite bar is not at 100,
-- then start replenishing it
-- if not under or over those values, slowly restore the bar to 0.
-- environmental timer is 15 seconds
@ -663,7 +516,7 @@ local function local_area_stamina()
end
minetest.after(math.random(15, 30), local_area_stamina) -- restart the loop at a random time to simulate reality. (not really)
minetest.after(math.random(5, 15), local_area_stamina) -- restart the loop at a random time to simulate reality. (not really)
end

View File

@ -0,0 +1,101 @@
return {["top"] = "#ffffff", ["bottom"] = "#110000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#220000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#330000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#440000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#550000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#660000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#770000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#880000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#990000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#aa0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#bb0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#cc0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#dd0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#ee0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#ff0000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#001100", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#002200", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#003300", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#004400", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#005500", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#006600", ["base"] = "#888888", ["light"] = 0.2}
return {["top"] = "#ffffff", ["bottom"] = "#007700", ["base"] = "#888888", ["light"] = 0.4}
return {["top"] = "#ffffff", ["bottom"] = "#008800", ["base"] = "#888888", ["light"] = 0.6}
return {["top"] = "#ffffff", ["bottom"] = "#009900", ["base"] = "#888888", ["light"] = 0.8}
return {["top"] = "#ffffff", ["bottom"] = "#00aa00", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#00bb00", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#00cc00", ["base"] = "#888888", ["light"] = 175}
return {["top"] = "#ffffff", ["bottom"] = "#00dd00", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#00ee00", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#00ff00", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000011", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000022", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000033", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000044", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000055", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000066", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000077", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000088", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#000099", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000aa", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000bb", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000cc", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000dd", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000ee", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#0000ff", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#110000", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#220000", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#330000", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#440000", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#ffffff", ["bottom"] = "#550000", ["base"] = "#888888", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#99AAFF", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}
return {["top"] = "#3B69BB", ["bottom"] = "#e4f3ff", ["base"] = "#8faedd", ["light"] = 1}

View File

@ -0,0 +1,101 @@
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}
return {["top"] = "#ffffff", ["bottom"] = "#000000", ["base"] = "#888888", ["light"] = 0.175}

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -17,7 +17,6 @@ Times returned from "minetest.get_timeofday()"
0.5 is 12:00 PM
0.75 is 18:00 or 6:00 PM
0.79 is 19:00 or 7:00 PM
]]--
-- time to set the "alarm clock" for sleeping players; use table above for more information.

View File

@ -150,4 +150,5 @@ function bucket.register_bucket(name, image, liquid_source, desc, to_place)
end
bucket.register_bucket("water", "bucket_water.png", "core:water_source", "Bucket of Water", "core:water_source")
bucket.register_bucket("water", "bucket_water.png", "core:water_source", "Bucket of Water", "core:water_source")
bucket.register_bucket("lava", "bucket_lava.png", "core:lava_source", "Bucket of Lava", "core:lava_source")

View File

@ -0,0 +1 @@
quickslots

View File

@ -98,6 +98,7 @@ inventory_plus.get_formspec = function(player, page)
formspec = formspec
.. "button[0,0;2.15,1;cguide;Crafting Guide]"
.. "button[0,1;2.15,1;quickslots;QuickSlots]"
.. "list[current_player;craftpreview;7,1;1,1;]"
.. "list[current_player;craft;3,0;3,3;]"
.. "listring[current_name;craft]"
@ -109,36 +110,24 @@ inventory_plus.get_formspec = function(player, page)
--.. "image[1.1,2.1;0.8,0.8;trash_icon.png]"
end
-- main page
if page == "main" then
if page == "quickslots" then
local name = player:get_player_name()
local num = 0
formspec = formspec ..
"button[0,0;3,1;main;Return to Inventory]" ..
"button[0,1;3,1;main;Save Slot Modes]" ..
"label[4,0;punch = item acts as if punched]"..
"label[4,0.3;use = item acts as if used]" ..
"label[4,0.6;place = item acts as if placed]" ..
"dropdown[0.95,2.85;1;slot1;Use,Punch,Place;1]" ..
--"field[1.28,3;1,1;slot1;;use]" ..
"field[2.28,3;1,1;slot2;;use]" ..
"field[3.28,3;1,1;slot3;;use]" ..
"field[4.28,3;1,1;slot4;;use]" ..
"field[5.28,3;1,1;slot5;;use]" ..
"field[6.28,3;1,1;slot6;;use]" ..
"list[current_player;quickslots;1,2;6,1]" ..
"background[-0.45,-0.5;8.9,10;core_inv_plus_guide.png]"
-- count buttons
for k, v in pairs( inventory_plus.buttons[name] ) do
num = num + 1
end
-- buttons
local x = 0
local f = math.ceil(num / 4)
local y = 0
for k, v in pairs( inventory_plus.buttons[name] ) do
formspec = formspec .. "image_button[" .. x .. ","
.. y .. ";2,1;core_button_wood.png;" .. k .. ";" .. v .. ";false;false;core_button_wood_pressed.png]"
x = x + 2
if x == 8 then
x = 0
y = y + 1
end
end
formspec = formspec .. "background[-0.45,-0.5;8.9,10;core_inv_plus.png]"
end
return formspec
@ -172,6 +161,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- quickslots
if fields.quickslots then
inventory_plus.set_inventory_formspec(player,
inventory_plus.get_formspec(player, "quickslots"))
end
-- craft
if fields.main then

View File

@ -1,4 +1,4 @@
-- minetracker, a small mod for solar plains that enables JSON-like line based playback of upto 12 instruments
-- minetracker, a small mod for solar plains that enables JSON-like line based playback of upto an endless amount of instruments
local song_storage = minetest.get_modpath("minetracker").."/modules/"

201
mods/quickslots/init.lua Normal file
View File

@ -0,0 +1,201 @@
-- quickslots - a mod that grants the player upto 6 additional quick actions to perform
-- this can be used to place blocks, activate buckets, etc
-- base configuration options
quickslots_aux1_enabled = true
quickslots_sneak_enabled = true
quickslots_punch_enabled = true -- may break certain mods.
-- hud configuration
quickslots_hud_pos_x = 1 --base position in percentages
quickslots_hud_pos_y = 1
quickslots_hud_offset_x = 0 -- offset from base position in pixels
quickslots_hud_offset_y = 0
quickslots_hud_orientation = "vertical" -- valid options: "vertical", "horizontal"
quickslots_hud_bg_image = "filename.png"
-- namespace for mods to hook for primary commands and checks
quickslots = {}
--[[
Setting information about how quickslots meta works:
0 = on_use
1 = on_place
2 = on_sec_use
]]--
-- load data for players:
minetest.register_on_joinplayer(function(player)
local meta = player:get_meta()
for i=1,6 do
if meta:get_int("quickslots_slot_" .. i) == "" then
meta:set_int("quickslots_slot_" .. i, 0)
end
end
local inv = minetest.get_inventory({type="player", name=player:get_player_name()})
if inv:get_list("quickslots") == nil then
inv:set_size("quickslots", 6)
print("[QuickSlots]" .. player:get_player_name() .. " lacks QuickSlots, constructing them.")
end
end)
-- process formspec data from inv_plus
function quickslots.set_slot_modes(player, fields)
end
-- get the slot the player is using:
function quickslots.get_quick_slots(player)
local pkeys = player:get_player_control()
--print(dump(pkeys))
if pkeys.sneak then
if pkeys.aux1 then
if pkeys.LMB then
print("left mouse, sneak and aux1")
return 6
else
print("right mouse, sneak and aux1")
return 3
end
else
if pkeys.LMB then
print("left mouse, sneak")
return 4
else
print("right mouse, sneak")
return 1
end
end
elseif pkeys.aux1 then
if pkeys.LMB then
print("left mouse, aux1")
return 5
else
print("right mouse, aux1")
return 2
end
end
end
--[[
Writing your first compatible quickslots tool is easy!
The first thing quickslots will check is that if the item is a node, ensuring that the block is placed.
Then, it will check if the registered item has a registered right-click custom function.
_quickslots_use_l = function(itemstack, placer, pointed_thing)
_quickslots_use_r = function(itemstack, user, pointed_thing)
_quickslots_place = function(itemstack, placer, pointed_thing)
For items that are nodes, placement is automatic! You can override this by using:
_quickslots_no_place = true
To ensure they're automatically placed - having the field missing will do the same effect or the two following values.
_quickslots_no_place = false
_quickslots_no_place = nil
However, to use such quick slots, the currently wielded tool must;
Support using sneak and right mouse, alongside using the on_use function.
Use quicktools.on_use(quicktools.player_controls(), user, pointed_thing) for on_use.
Use quicktools.on_sec_use(quicktools.player_controls(), user, pointed_thing) for on_secondary_use.
Use quicktools.on_place(quicktools.player_controls(), user, pointed_thing) for on_place.
See the below example for implementing this yourself. If the tool has an alternate mode that requires sneak or aux1,
perform the action and do not process quicktools.
]]--
minetest.register_craftitem("quickslots:test", {
description = "test for quickslots",
inventory_image = "fire_basic_flame.png",
on_use = function(itemstack, placer, pointed_thing)
-- figure out which slot we're going to use:
slotnum = quickslots.get_quick_slots(placer)
-- get our player's settings for the current slot, if it's in on_use, on_place or on_sec_use
--placer:get_int("quickslots_slot_" .. slotnum)
end,
on_secondary_use = function(itemstack, user, pointed_thing)
slotnum = quickslots.get_quick_slots(user)
end,
on_place = function(itemstack, placer, pointed_thing)
slotnum = quickslots.get_quick_slots(placer)
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB