Block of changes; uses the new 0.4.16 syntax for settings values

This commit is contained in:
KaadmY 2017-06-27 12:13:30 -07:00
parent e83ae8c7b2
commit 01d22d1d63
24 changed files with 56 additions and 53 deletions

View File

@ -8,15 +8,18 @@ Pixture is Copyright (C) 2015-2017 KaadmY
# Notes
- Do not use mapgen v6, it is not supported and will fail. Use v5 or v7 instead.
- Currently known to support Minetest 0.4.16 (and possibly later versions)
- Do **not** use mapgen v6, it is not supported and will fail. Use v5 or v7
instead.
# Credits
- [Kenney](http://kenney.nl) for the inspiration, most of aesthetic.
- [Kenney](http://kenney.nl) for the inspiration, most of the aesthetic.
- Sounds in the default mod are all by Kenney(CC0)
- All textures/models by KaadmY (CC BY-SA 4.0)
# Licenses
- Assets: all CC BY-SA 4.0, CC0, or GPL (The GPL ones I want replaced with CC), see per-mod READMEs.
- Assets: all CC BY-SA 4.0, CC0, or GPL (The GPL ones I want replaced with CC),
see per-mod READMEs.
- Source: all LGPLv2.1+ or MIT, see per-mod READMEs.

View File

@ -49,9 +49,9 @@ ambiance.sounds["flowing_water"] = {
nodename = "group:flowing_water",
}
local ambiance_volume = tonumber(minetest.setting_get("ambiance_volume")) or 1.0
local ambiance_volume = tonumber(minetest.settings:get("ambiance_volume")) or 1.0
if minetest.setting_getbool("ambiance_enable") == true then
if minetest.settings:get_bool("ambiance_enable") == true then
local soundspec = {}
local lastsound = {}
@ -73,7 +73,7 @@ if minetest.setting_getbool("ambiance_enable") == true then
local name = player:get_player_name()
for soundname, sound in pairs(ambiance.sounds) do
if not minetest.setting_getbool("ambiance_disable_" .. soundname) then
if not minetest.settings:get_bool("ambiance_disable_" .. soundname) then
if lastsound[name][soundname] then
lastsound[name][soundname] = lastsound[name][soundname] + dtime
else

View File

@ -326,7 +326,7 @@ minetest.register_node(
meta:set_string("player", "")
elseif meta:get_string("player") == "" and not default.player_attached[name]
and bed.userdata[name].in_bed == false then
if not minetest.setting_getbool("bed_enabled") then
if not minetest.settings:get_bool("bed_enabled") then
return
end

View File

@ -93,7 +93,7 @@ minetest.register_entity(
end,
on_step = function(self, dtime)
local time = tonumber(minetest.setting_get("remove_items"))
local time = tonumber(minetest.settings:get("remove_items"))
if not time then time = 600 end
if not self.timer then self.timer = 0 end

View File

@ -5,7 +5,7 @@
-- Chest naming via signs
function default.write_name(pos, text)
-- check above, if allowed
if minetest.setting_getbool("signs_allow_name_above") then
if minetest.settings:get_bool("signs_allow_name_above") then
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local abovedef = nil
if minetest.registered_nodes[minetest.get_node(above).name] then

View File

@ -69,7 +69,7 @@ function default.hud.initialize_builtin_statbars(player)
player:hud_set_flags(flg)
end
if minetest.is_yes(minetest.setting_get("enable_damage")) then
if minetest.is_yes(minetest.settings:get("enable_damage")) then
if default.hud.ids[name].id_healthbar == nil then
health_bar_definition.number = player:get_hp()
default.hud.ids[name].id_healthbar_bg = player:hud_add(health_bar_bg)
@ -83,7 +83,7 @@ function default.hud.initialize_builtin_statbars(player)
end
if (player:get_breath() < 11) then
if minetest.is_yes(minetest.setting_get("enable_damage")) then
if minetest.is_yes(minetest.settings:get("enable_damage")) then
if default.hud.ids[name].id_breathbar == nil then
default.hud.ids[name].id_breathbar_bg = player:hud_add(breath_bar_bg)

View File

@ -8,7 +8,7 @@ local creative_digtime = 0.15
local tool_levels = nil
-- Creative mode/hand defs
if minetest.setting_getbool("creative_mode") == true then
if minetest.settings:get_bool("creative_mode") == true then
tool_levels = {
wood = {
crumbly = {

View File

@ -7,7 +7,7 @@ drop_items_on_die = {}
drop_items_on_die.registered_listnames = {}
local enable_drop = minetest.setting_getbool("drop_items_on_die") or false
local enable_drop = minetest.settings:get_bool("drop_items_on_die") or false
function drop_items_on_die.register_listname(listname)
table.insert(drop_items_on_die.registered_listnames, listname)

View File

@ -3,8 +3,8 @@
-- By Kaadmy, for Pixture
--
local give_initial_enable = minetest.setting_getbool("give_initial_enable")
local give_initial_items = util.split(minetest.setting_get("give_initial_items"), ",")
local give_initial_enable = minetest.settings:get_bool("give_initial_enable")
local give_initial_items = util.split(minetest.settings:get("give_initial_items"), ",")
local function on_newplayer(player)
if give_initial_enable then

View File

@ -5,12 +5,12 @@
headbars = {}
local enable_damage = minetest.setting_getbool("enable_damage")
local enable_damage = minetest.settings:get_bool("enable_damage")
local enable_headbars = minetest.setting_getbool("headbars_enable")
local enable_headbars = minetest.settings:get_bool("headbars_enable")
if enable_headbars == nil then enable_headbars = true end
local headbars_scale = tonumber(minetest.setting_get("headbars_scale")) or 1.0
local headbars_scale = tonumber(minetest.settings:get("headbars_scale")) or 1.0
function headbars.get_sprite(icon, background, max, amt)
local img = "[combine:" .. (max * 8) .. "x16:0,0=ui_null.png:0,0=ui_null.png"

View File

@ -19,7 +19,7 @@ local hunger_file = minetest.get_worldpath() .. "/hunger.dat"
local saving = false
-- Seconds per hunger update, 2.0 is slightly fast
local timer_interval = tonumber(minetest.setting_get("hunger_step")) or 3.0
local timer_interval = tonumber(minetest.settings:get("hunger_step")) or 3.0
local timer = 0
local function save_hunger()
@ -336,7 +336,7 @@ local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
return itemstack
end
if minetest.setting_getbool("enable_damage") and minetest.setting_getbool("hunger_enable") then
if minetest.settings:get_bool("enable_damage") and minetest.settings:get_bool("hunger_enable") then
minetest.after(0, on_load)

View File

@ -12,7 +12,7 @@ end
minetest.register_globalstep(
function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.setting_getbool("enable_damage") then
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
local pos = player:getpos()
local inv = player:get_inventory()
@ -111,8 +111,8 @@ function minetest.handle_node_drops(pos, drops, digger)
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
-- FIXME this doesnt work for deactiveted objects
if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then
minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj)
if minetest.settings:get("remove_items") and tonumber(minetest.settings:get("remove_items")) then
minetest.after(tonumber(minetest.settings:get("remove_items")), function(obj)
obj:remove()
end, obj)
end

View File

@ -8,8 +8,8 @@ locks = {}
-- Settings
local picked_time = tonumber(minetest.setting_get("locks_picked_time")) or 15 -- unlocked for 15 seconds
local all_unlocked = minetest.setting_getbool("locks_all_unlocked")
local picked_time = tonumber(minetest.settings:get("locks_picked_time")) or 15 -- unlocked for 15 seconds
local all_unlocked = minetest.settings:get_bool("locks_all_unlocked")
-- API functions

View File

@ -6,20 +6,20 @@ mobs.mod = "redo"
-- Initial settings check
local damage_enabled = minetest.setting_getbool("enable_damage") or false
local peaceful_only = minetest.setting_getbool("only_peaceful_mobs") or false
local enable_blood = minetest.setting_getbool("mobs_enable_blood") or false
local damage_enabled = minetest.settings:get_bool("enable_damage") or false
local peaceful_only = minetest.settings:get_bool("only_peaceful_mobs") or false
local enable_blood = minetest.settings:get_bool("mobs_enable_blood") or false
mobs.protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 0
mobs.remove = minetest.setting_getbool("remove_far_mobs") or false
mobs.protected = tonumber(minetest.settings:get("mobs_spawn_protected")) or 0
mobs.remove = minetest.settings:get_bool("remove_far_mobs") or false
local function is_too_near_spawn(pos)
if minetest.is_singleplayer() or not minetest.setting_getbool("mobs_safe_spawn") then
if minetest.is_singleplayer() or not minetest.settings:get_bool("mobs_safe_spawn") then
return false
end
local sp = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 0, z = 0}
local rad = minetest.setting_get("static_spawn_radius") or 256
local rad = minetest.settings:get("static_spawn_radius") or 256
return (vector.distance(pos, sp) < rad)
end
@ -1343,7 +1343,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
return
end
if minetest.setting_getbool("display_mob_spawn") then
if minetest.settings:get_bool("display_mob_spawn") then
minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))
end
@ -1634,7 +1634,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed)
if name ~= nil then
-- Take item
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)

View File

@ -87,7 +87,7 @@ for _, npc_type in pairs(npc_types) do
self.object:set_hp(hp)
-- take item
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end

View File

@ -6,15 +6,15 @@
music = {}
music.default_track = minetest.setting_get("music_track") or "music_catsong"
music.track_length = tonumber(minetest.setting_get("music_track_length")) or 30.0
music.volume = tonumber(minetest.setting_get("music_volume")) or 1.0
music.default_track = minetest.settings:get("music_track") or "music_catsong"
music.track_length = tonumber(minetest.settings:get("music_track_length")) or 30.0
music.volume = tonumber(minetest.settings:get("music_volume")) or 1.0
-- Array of music players
music.players = {}
if minetest.setting_getbool("music_enable") then
if minetest.settings:get_bool("music_enable") then
function music.stop(pos)
local dp = minetest.hash_node_position(pos)

View File

@ -9,8 +9,8 @@ player_skins = {}
player_skins.skin_names = {"male", "female"}
if minetest.setting_get("player_skins_names") then
player_skins.skin_names = util.split(minetest.setting_get("player_skins_names"), ",")
if minetest.settings:get("player_skins_names") then
player_skins.skin_names = util.split(minetest.settings:get("player_skins_names"), ",")
end
player_skins.old_skins = {}

View File

@ -3,7 +3,7 @@
-- By Kaadmy, for Pixture
--
local enable_saving = minetest.setting_getbool("pm_enable_saving")
local enable_saving = minetest.settings:get_bool("pm_enable_saving")
if enable_saving == nil then enable_saving = true end
if minetest.is_singleplayer() then
enable_saving = false

View File

@ -3,7 +3,7 @@
-- By Kaadmy, for Pixture
--
if minetest.setting_getbool("testing_enable") then
if minetest.settings:get_bool("testing_enable") then
local t1 = os.clock()
for i = 1, 10000 do
dump({x=0,y=50,z=100})

View File

@ -10,13 +10,13 @@ tnt = {}
-- Default to enabled in singleplayer and disabled in multiplayer
local singleplayer = minetest.is_singleplayer()
local setting = minetest.setting_getbool("tnt_enable")
local setting = minetest.settings:get_bool("tnt_enable")
if (not singleplayer and setting ~= true) or (singleplayer and setting == false) then
return
end
local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3)
local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3)
-- Loss probabilities array (one in X will be lost)

View File

@ -42,7 +42,7 @@ function util.fixlight(pos1, pos2)
return #nodes
end
if minetest.setting_getbool("fixlight_command_enable") then
if minetest.settings:get_bool("fixlight_command_enable") then
minetest.register_privilege(
"fixlight",
{

View File

@ -4,7 +4,7 @@
--
local spawn_pos = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 0, z = 0}
local spawn_radius = minetest.setting_get("static_spawn_radius") or 256
local spawn_radius = minetest.settings:get("static_spawn_radius") or 256
-- Nodes
@ -69,7 +69,7 @@ minetest.register_lbm(
action = function(pos, node)
minetest.remove_node(pos)
if minetest.setting_getbool("mapgen_disable_villages") == true then
if minetest.settings:get_bool("mapgen_disable_villages") == true then
return
end
@ -101,7 +101,7 @@ minetest.register_lbm(
-- Spawn decoration
if not minetest.setting_getbool("mapgen_disable_villages") then
if not minetest.settings:get_bool("mapgen_disable_villages") then
minetest.register_decoration(
{
deco_type = "simple",

View File

@ -11,7 +11,7 @@ local function addvec(v1, v2)
return {x = v1.x + v2.x, y = v1.y + v2.y, z = v1.z + v2.z}
end
local snow_enable = minetest.setting_getbool("weather_snow_enable") or false
local snow_enable = minetest.settings:get_bool("weather_snow_enable") or false
local weather_soundspec=nil
local weather_pr=PseudoRandom(minetest.get_mapgen_params().seed + 2387)
@ -51,7 +51,7 @@ end
minetest.register_globalstep(
function(dtime)
if minetest.setting_getbool("weather_enable") then
if minetest.settings:get_bool("weather_enable") then
if weather_pr:next(0, 5000) < 1 then
local weathertype = weather_pr:next(0, 19)

View File

@ -15,7 +15,7 @@ welcome.rules = {
}
function welcome.get_formspec(name)
if not minetest.setting_getbool("welcome_enable") then
if not minetest.settings:get_bool("welcome_enable") then
minetest.chat_send_player(name, "Welcoming is disabled")
return ""
end
@ -81,7 +81,7 @@ minetest.register_on_joinplayer(
function(player)
local name = player:get_player_name()
if not minetest.check_player_privs(name, {interact = true}) and minetest.setting_getbool("welcome_enable") then
if not minetest.check_player_privs(name, {interact = true}) and minetest.settings:get_bool("welcome_enable") then
welcome.show_rules(name)
end
end)