fix many warnings (644 remaining)

This commit is contained in:
AFCMS 2021-04-17 09:26:37 +02:00
parent 22a2fdbf5f
commit 02f393998f
11 changed files with 38 additions and 44 deletions

View file

@ -12,7 +12,7 @@ read_globals = {
"dump", "dump2", "dump", "dump2",
"vector", "vector",
"VoxelManip", "VoxelArea", "VoxelManip", "VoxelArea",
"PseudoRandom", "PcgRandom", "PerlinNoise", "PseudoRandom", "PcgRandom", "PerlinNoise", "PerlinNoiseMap",
"ItemStack", "ItemStack",
"Settings", "Settings",
"unpack", "unpack",

View file

@ -25,11 +25,9 @@ dofile(modpath .. "/lingering.lua")
dofile(modpath .. "/tipped_arrow.lua") dofile(modpath .. "/tipped_arrow.lua")
dofile(modpath .. "/potions.lua") dofile(modpath .. "/potions.lua")
local brewhelp = S("Try different combinations to create potions.")
minetest.register_craftitem("mcl_potions:fermented_spider_eye", { minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
description = S("Fermented Spider Eye"), description = S("Fermented Spider Eye"),
_doc_items_longdesc = brewhelp, _doc_items_longdesc = S("Try different combinations to create potions."),
wield_image = "mcl_potions_spider_eye_fermented.png", wield_image = "mcl_potions_spider_eye_fermented.png",
inventory_image = "mcl_potions_spider_eye_fermented.png", inventory_image = "mcl_potions_spider_eye_fermented.png",
groups = { brewitem = 1, }, groups = { brewitem = 1, },
@ -65,14 +63,12 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
-- Try to fill glass bottle with water -- Try to fill glass bottle with water
local get_water = false local get_water = false
local from_liquid_source = false --local from_liquid_source = false
local river_water = false local river_water = false
if not def then if def and def.groups and def.groups.water and def.liquidtype == "source" then
-- Unknown node: no-op
elseif def.groups and def.groups.water and def.liquidtype == "source" then
-- Water source -- Water source
get_water = true get_water = true
from_liquid_source = true --from_liquid_source = true
river_water = node.name == "mclx_core:river_water_source" river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1 -- Or reduce water level of cauldron by 1
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then
@ -440,7 +436,6 @@ function mcl_potions.get_alchemy(ingr, pot)
if brew_table[ingr] ~= nil then if brew_table[ingr] ~= nil then
return brew_table[ingr] return brew_table[ingr]
end end
end end
if mod_table[ingr] ~= nil then if mod_table[ingr] ~= nil then

View file

@ -1,5 +1,5 @@
local S = minetest.get_translator("mcl_potions") local S = minetest.get_translator("mcl_potions")
local brewhelp = S("Try different combinations to create potions.") --local brewhelp = S("Try different combinations to create potions.")
local potion_image = function(colorstring, opacity) local potion_image = function(colorstring, opacity)
if not opacity then if not opacity then
@ -98,7 +98,7 @@ local function register_potion(def)
end end
elseif def.name == "healing" or def.name == "harming" then elseif def.name == "healing" or def.name == "harming" then
_tt = S("@1 HP", effect) _tt = S("@1 HP", effect)
else else
_tt = tt or time_string(dur) or S("No effect") _tt = tt or time_string(dur) or S("No effect")
end end
return _tt return _tt

View file

@ -123,6 +123,6 @@ function mcl_potions.register_splash(name, descr, color, def)
}) })
end end
local function time_string(dur) --[[local function time_string(dur)
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
end end]]

View file

@ -4,12 +4,12 @@ local ARROW_TIMEOUT = 60
-- Time after which stuck arrow is rechecked for being stuck -- Time after which stuck arrow is rechecked for being stuck
local STUCK_RECHECK_TIME = 5 local STUCK_RECHECK_TIME = 5
local GRAVITY = 9.81 --local GRAVITY = 9.81
local YAW_OFFSET = -math.pi/2 local YAW_OFFSET = -math.pi/2
local dir_to_pitch = function(dir) local dir_to_pitch = function(dir)
local dir2 = vector.normalize(dir) --local dir2 = vector.normalize(dir)
local xz = math.abs(dir.x) + math.abs(dir.z) local xz = math.abs(dir.x) + math.abs(dir.z)
return -math.atan2(-dir.y, xz) return -math.atan2(-dir.y, xz)
end end
@ -197,7 +197,6 @@ function mcl_potions.register_arrow(name, desc, color, def)
glow = 1, glow = 1,
}) })
end end
-- We just check for any hurtable objects nearby. -- We just check for any hurtable objects nearby.
-- The radius of 3 is fairly liberal, but anything lower than than will cause -- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often. -- arrow to hilariously go through mobs often.
@ -360,7 +359,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
if not v then if not v then
v = 0 v = 0
end end
local old_v = self._viscosity --local old_v = self._viscosity
self._viscosity = v self._viscosity = v
local vpenalty = math.max(0.1, 0.98 - 0.1 * v) local vpenalty = math.max(0.1, 0.98 - 0.1 * v)
if math.abs(vel.x) > 0.001 then if math.abs(vel.x) > 0.001 then

View file

@ -93,7 +93,7 @@ local generate_line = function(s, ypos)
local chars = 0 local chars = 0
local printed_char_width = CHAR_WIDTH + 1 local printed_char_width = CHAR_WIDTH + 1
while chars < LINE_LENGTH and i <= #s do while chars < LINE_LENGTH and i <= #s do
local file = nil local file
-- Get and render character -- Get and render character
if charmap[s:sub(i, i)] ~= nil then if charmap[s:sub(i, i)] ~= nil then
file = charmap[s:sub(i, i)] file = charmap[s:sub(i, i)]
@ -185,7 +185,7 @@ local function get_wall_signtext_info(param2, nodename)
end end
end end
local sign_groups = {handy=1,axey=1, flammable=1, deco_block=1, material_wood=1, attached_node=1, dig_by_piston=1, flammable=-1} local sign_groups = {handy=1,axey=1, deco_block=1, material_wood=1, attached_node=1, dig_by_piston=1, flammable=-1}
local destruct_sign = function(pos) local destruct_sign = function(pos)
local objects = minetest.get_objects_inside_radius(pos, 0.5) local objects = minetest.get_objects_inside_radius(pos, 0.5)
@ -322,7 +322,7 @@ minetest.register_node("mcl_signs:wall_sign", {
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
local placer_pos = placer:get_pos() --local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir) local fdir = minetest.dir_to_facedir(dir)

View file

@ -20,7 +20,7 @@ local function place_slab_normal(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under local p0 = pointed_thing.under
local p1 = pointed_thing.above local p1 = pointed_thing.above
local placer_pos = placer:get_pos() --local placer_pos = placer:get_pos()
local fpos = get_fpos(placer, pointed_thing) local fpos = get_fpos(placer, pointed_thing)
@ -179,7 +179,7 @@ end
-- Slab facedir to placement 6d matching table -- Slab facedir to placement 6d matching table
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4} --local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
-- Register slabs. -- Register slabs.
-- Node will be called mcl_stairs:slab_<subname> -- Node will be called mcl_stairs:slab_<subname>
@ -268,6 +268,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
end end
end, end,
_mcl_hardness = hardness, _mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
_mcl_other_slab_half = upper_slab, _mcl_other_slab_half = upper_slab,
on_rotate = function(pos, node, user, mode, param2) on_rotate = function(pos, node, user, mode, param2)
-- Flip slab -- Flip slab
@ -331,6 +332,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
sounds = sounds, sounds = sounds,
drop = lower_slab .. " 2", drop = lower_slab .. " 2",
_mcl_hardness = hardness, _mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
}) })
if recipeitem then if recipeitem then

View file

@ -224,7 +224,7 @@ local pearl_on_step = function(self, dtime)
lv, ld = math.abs(vc.x), "x" lv, ld = math.abs(vc.x), "x"
end end
if math.abs(vc.z) > lv then if math.abs(vc.z) > lv then
lv, ld = math.abs(vc.z), "z" ld = "z" --math.abs(vc.z)
end end
if ld ~= "x" then vc.x = 0 end if ld ~= "x" then vc.x = 0 end
if ld ~= "y" then vc.y = 0 end if ld ~= "y" then vc.y = 0 end

View file

@ -30,7 +30,7 @@ local spawn_flames_floor = function(pos)
end end
local spawn_flames_wall = function(pos) local spawn_flames_wall = function(pos)
local minrelpos, maxrelpos --local minrelpos, maxrelpos
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local dir = minetest.wallmounted_to_dir(node.param2) local dir = minetest.wallmounted_to_dir(node.param2)

View file

@ -49,12 +49,12 @@ local dungeonsizes = {
{ x=7, y=4, z=7}, { x=7, y=4, z=7},
} }
local dirs = { --[[local dirs = {
{ x= 1, y=0, z= 0 }, { x= 1, y=0, z= 0 },
{ x= 0, y=0, z= 1 }, { x= 0, y=0, z= 1 },
{ x=-1, y=0, z= 0 }, { x=-1, y=0, z= 0 },
{ x= 0, y=0, z=-1 }, { x= 0, y=0, z=-1 },
} }]]
local surround_vectors = { local surround_vectors = {
{ x=-1, y=0, z=0 }, { x=-1, y=0, z=0 },
@ -66,7 +66,7 @@ local surround_vectors = {
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
if calls_remaining >= 1 then return end if calls_remaining >= 1 then return end
local p1, p2, dim, pr = param.p1, param.p2, param.dim, param.pr local p1, _, dim, pr = param.p1, param.p2, param.dim, param.pr
local x, y, z = p1.x, p1.y, p1.z local x, y, z = p1.x, p1.y, p1.z
local check = not (param.dontcheck or false) local check = not (param.dontcheck or false)
@ -404,8 +404,7 @@ local function dungeons_nodes(minp, maxp, blockseed)
local p1 = {x=x,y=y,z=z} local p1 = {x=x,y=y,z=z}
local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1} local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1}
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
local param = {p1=p1, p2=p2, dim=dim, pr=pr} emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
emerge_area(p1, p2, ecb_spawn_dungeon, param)
end end
end end
@ -414,8 +413,7 @@ function mcl_dungeons.spawn_dungeon(p1, _, pr)
local dim = dungeonsizes[pr:next(1, #dungeonsizes)] local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1} local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1}
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
local param = {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true} emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true})
emerge_area(p1, p2, ecb_spawn_dungeon, param)
end end
mcl_mapgen_core.register_generator("dungeons", nil, dungeons_nodes, 999999) mcl_mapgen_core.register_generator("dungeons", nil, dungeons_nodes, 999999)

View file

@ -65,21 +65,21 @@ local c_dirt = minetest.get_content_id("mcl_core:dirt")
local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass") local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass")
local c_dirt_with_grass_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow") local c_dirt_with_grass_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
local c_sand = minetest.get_content_id("mcl_core:sand") local c_sand = minetest.get_content_id("mcl_core:sand")
local c_sandstone = minetest.get_content_id("mcl_core:sandstone") --local c_sandstone = minetest.get_content_id("mcl_core:sandstone")
local c_void = minetest.get_content_id("mcl_core:void") local c_void = minetest.get_content_id("mcl_core:void")
local c_lava = minetest.get_content_id("mcl_core:lava_source") local c_lava = minetest.get_content_id("mcl_core:lava_source")
local c_water = minetest.get_content_id("mcl_core:water_source") local c_water = minetest.get_content_id("mcl_core:water_source")
local c_soul_sand = minetest.get_content_id("mcl_nether:soul_sand") local c_soul_sand = minetest.get_content_id("mcl_nether:soul_sand")
local c_netherrack = minetest.get_content_id("mcl_nether:netherrack") local c_netherrack = minetest.get_content_id("mcl_nether:netherrack")
local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source") local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source")
local c_end_stone = minetest.get_content_id("mcl_end:end_stone") --local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier") local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier")
local c_top_snow = minetest.get_content_id("mcl_core:snow") local c_top_snow = minetest.get_content_id("mcl_core:snow")
local c_snow_block = minetest.get_content_id("mcl_core:snowblock") local c_snow_block = minetest.get_content_id("mcl_core:snowblock")
local c_clay = minetest.get_content_id("mcl_core:clay") local c_clay = minetest.get_content_id("mcl_core:clay")
local c_leaves = minetest.get_content_id("mcl_core:leaves") local c_leaves = minetest.get_content_id("mcl_core:leaves")
local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves") local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves")
local c_jungletree = minetest.get_content_id("mcl_core:jungletree") --local c_jungletree = minetest.get_content_id("mcl_core:jungletree")
local c_cocoa_1 = minetest.get_content_id("mcl_cocoas:cocoa_1") local c_cocoa_1 = minetest.get_content_id("mcl_cocoas:cocoa_1")
local c_cocoa_2 = minetest.get_content_id("mcl_cocoas:cocoa_2") local c_cocoa_2 = minetest.get_content_id("mcl_cocoas:cocoa_2")
local c_cocoa_3 = minetest.get_content_id("mcl_cocoas:cocoa_3") local c_cocoa_3 = minetest.get_content_id("mcl_cocoas:cocoa_3")
@ -1169,13 +1169,13 @@ end
-- minp and maxp (from an on_generated callback) and returns the real world coordinates -- minp and maxp (from an on_generated callback) and returns the real world coordinates
-- as X, Z. -- as X, Z.
-- Inverse function of xz_to_biomemap -- Inverse function of xz_to_biomemap
local biomemap_to_xz = function(index, minp, maxp) --[[local biomemap_to_xz = function(index, minp, maxp)
local xwidth = maxp.x - minp.x + 1 local xwidth = maxp.x - minp.x + 1
local zwidth = maxp.z - minp.z + 1 local zwidth = maxp.z - minp.z + 1
local x = ((index-1) % xwidth) + minp.x local x = ((index-1) % xwidth) + minp.x
local z = ((index-1) / zwidth) + minp.z local z = ((index-1) / zwidth) + minp.z
return x, z return x, z
end end]]
-- Takes x and z coordinates and minp and maxp of a generated chunk -- Takes x and z coordinates and minp and maxp of a generated chunk
-- (in on_generated callback) and returns a biomemap index) -- (in on_generated callback) and returns a biomemap index)
@ -1897,7 +1897,7 @@ function mcl_mapgen_core.unregister_generator(id)
local rec = registered_generators[id] local rec = registered_generators[id]
registered_generators[id] = nil registered_generators[id] = nil
if rec.vf then lvm = lvm - 1 end if rec.vf then lvm = lvm - 1 end
if rev.nf then nodes = nodes - 1 end if rec.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 1 end if rec.needs_param2 then param2 = param2 - 1 end
if rec.needs_level0 then level0 = level0 - 1 end if rec.needs_level0 then level0 = level0 - 1 end
end end
@ -1979,7 +1979,7 @@ end
-- Below the bedrock, generate air/void -- Below the bedrock, generate air/void
local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local biomemap, ymin, ymax local biomemap --ymin, ymax
local lvm_used = false local lvm_used = false
local pr = PseudoRandom(blockseed) local pr = PseudoRandom(blockseed)
@ -2077,7 +2077,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local n = nodes[n] local n = nodes[n]
local p_pos = area:index(n.x, n.y, n.z) local p_pos = area:index(n.x, n.y, n.z)
local p_pos_above = area:index(n.x, n.y+1, n.z) local p_pos_above = area:index(n.x, n.y+1, n.z)
local p_pos_below = area:index(n.x, n.y-1, n.z) --local p_pos_below = area:index(n.x, n.y-1, n.z)
local b_pos = aream:index(n.x, 0, n.z) local b_pos = aream:index(n.x, 0, n.z)
local bn = minetest.get_biome_name(biomemap[b_pos]) local bn = minetest.get_biome_name(biomemap[b_pos])
if bn then if bn then
@ -2126,7 +2126,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Remove stone, sand, dirt in v6 so our End map generator works in v6. -- * Remove stone, sand, dirt in v6 so our End map generator works in v6.
-- * Generate spawn platform (End portal destination) -- * Generate spawn platform (End portal destination)
elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then
local nodes, n local nodes
if mg_name == "v6" then if mg_name == "v6" then
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"}) nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
else else
@ -2134,7 +2134,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
end end
if #nodes > 0 then if #nodes > 0 then
lvm_used = true lvm_used = true
for _, n in pairs(nodes) do for _,n in pairs(nodes) do
data[area:index(n.x, n.y, n.z)] = c_air data[area:index(n.x, n.y, n.z)] = c_air
end end
end end
@ -2144,8 +2144,8 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
minp.x <= mcl_vars.mg_end_platform_pos.x and maxp.x >= mcl_vars.mg_end_platform_pos.z and minp.x <= mcl_vars.mg_end_platform_pos.x and maxp.x >= mcl_vars.mg_end_platform_pos.z and
minp.z <= mcl_vars.mg_end_platform_pos.z and maxp.z >= mcl_vars.mg_end_platform_pos.z then minp.z <= mcl_vars.mg_end_platform_pos.z and maxp.z >= mcl_vars.mg_end_platform_pos.z then
local pos1 = {x = math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), y = math.max(minp.y, mcl_vars.mg_end_platform_pos.y), z = math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2)} --local pos1 = {x = math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), y = math.max(minp.y, mcl_vars.mg_end_platform_pos.y), z = math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2)}
local pos2 = {x = math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2), y = math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2), z = math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2)} --local pos2 = {x = math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2), y = math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2), z = math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2)}
for x=math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2) do for x=math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2) do
for z=math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2), math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2) do for z=math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2), math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2) do