minetest
-> core
This commit is contained in:
parent
b981bd0b9d
commit
70749c9123
16
init.lua
16
init.lua
@ -1,11 +1,11 @@
|
||||
|
||||
local S = minetest.get_translator('volumetric_lighting')
|
||||
local storage = minetest.get_mod_storage()
|
||||
local S = core.get_translator('volumetric_lighting')
|
||||
local storage = core.get_mod_storage()
|
||||
|
||||
local default_strength = tonumber(minetest.settings:get("volumetric_lighting_default_strength") or 0.1)
|
||||
local default_strength = tonumber(core.settings:get("volumetric_lighting_default_strength") or 0.1)
|
||||
local strength = tonumber(storage:get("strength") or default_strength)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
core.register_on_joinplayer(function(player)
|
||||
player:set_lighting({
|
||||
volumetric_light = { strength = strength }
|
||||
})
|
||||
@ -23,20 +23,20 @@ core.register_chatcommand("light_strength", {
|
||||
end
|
||||
|
||||
if new_strength < 0 or new_strength > 1 or new_strength == nil then
|
||||
minetest.chat_send_player(name, minetest.colorize("#ff0000", S("Invalid strength.")))
|
||||
core.chat_send_player(name, core.colorize("#ff0000", S("Invalid strength.")))
|
||||
return true
|
||||
end
|
||||
|
||||
if new_strength ~= default_strength then
|
||||
minetest.chat_send_player(name, S("Set strength to @1.", new_strength))
|
||||
core.chat_send_player(name, S("Set strength to @1.", new_strength))
|
||||
storage:set_float("strength", new_strength)
|
||||
else
|
||||
minetest.chat_send_player(name, S("Set strength to default value (@1).", default_strength))
|
||||
core.chat_send_player(name, S("Set strength to default value (@1).", default_strength))
|
||||
storage:set_string("strength", "")
|
||||
end
|
||||
|
||||
strength = new_strength
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
for _,player in pairs(core.get_connected_players()) do
|
||||
player:set_lighting({
|
||||
volumetric_light = { strength = new_strength }
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user