fix many warnings (644 remaining)

This commit is contained in:
AFCMS 2021-04-17 09:26:37 +02:00 committed by kay27
parent 3722d2e8fe
commit 05ba837de4
10 changed files with 37 additions and 43 deletions

View file

@ -25,11 +25,9 @@ dofile(modpath .. "/lingering.lua")
dofile(modpath .. "/tipped_arrow.lua")
dofile(modpath .. "/potions.lua")
local brewhelp = S("Try different combinations to create potions.")
minetest.register_craftitem("mcl_potions: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",
inventory_image = "mcl_potions_spider_eye_fermented.png",
groups = { brewitem = 1, },
@ -65,14 +63,12 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
-- Try to fill glass bottle with water
local get_water = false
local from_liquid_source = false
--local from_liquid_source = false
local river_water = false
if not def then
-- Unknown node: no-op
elseif def.groups and def.groups.water and def.liquidtype == "source" then
if def and def.groups and def.groups.water and def.liquidtype == "source" then
-- Water source
get_water = true
from_liquid_source = true
--from_liquid_source = true
river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1
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
return brew_table[ingr]
end
end
if mod_table[ingr] ~= nil then

View file

@ -1,5 +1,5 @@
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)
if not opacity then

View file

@ -123,6 +123,6 @@ function mcl_potions.register_splash(name, descr, color, def)
})
end
local function time_string(dur)
--[[local function time_string(dur)
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
local STUCK_RECHECK_TIME = 5
local GRAVITY = 9.81
--local GRAVITY = 9.81
local YAW_OFFSET = -math.pi/2
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)
return -math.atan2(-dir.y, xz)
end
@ -197,7 +197,6 @@ function mcl_potions.register_arrow(name, desc, color, def)
glow = 1,
})
end
-- We just check for any hurtable objects nearby.
-- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often.
@ -360,7 +359,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
if not v then
v = 0
end
local old_v = self._viscosity
--local old_v = self._viscosity
self._viscosity = v
local vpenalty = math.max(0.1, 0.98 - 0.1 * v)
if math.abs(vel.x) > 0.001 then

View file

@ -93,7 +93,7 @@ local generate_line = function(s, ypos)
local chars = 0
local printed_char_width = CHAR_WIDTH + 1
while chars < LINE_LENGTH and i <= #s do
local file = nil
local file
-- Get and render character
if charmap[s:sub(i, i)] ~= nil then
file = charmap[s:sub(i, i)]
@ -185,7 +185,7 @@ local function get_wall_signtext_info(param2, nodename)
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 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 placer_pos = placer:get_pos()
--local placer_pos = placer:get_pos()
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 p1 = pointed_thing.above
local placer_pos = placer:get_pos()
--local placer_pos = placer:get_pos()
local fpos = get_fpos(placer, pointed_thing)
@ -179,7 +179,7 @@ end
-- 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.
-- Node will be called mcl_stairs:slab_<subname>
@ -268,6 +268,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
end
end,
_mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
_mcl_other_slab_half = upper_slab,
on_rotate = function(pos, node, user, mode, param2)
-- Flip slab
@ -331,6 +332,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
sounds = sounds,
drop = lower_slab .. " 2",
_mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
})
if recipeitem then

View file

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

View file

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

View file

@ -49,12 +49,12 @@ local dungeonsizes = {
{ x=7, y=4, z=7},
}
local dirs = {
--[[local dirs = {
{ x= 1, y=0, z= 0 },
{ x= 0, y=0, z= 1 },
{ x=-1, y=0, z= 0 },
{ x= 0, y=0, z=-1 },
}
}]]
local surround_vectors = {
{ x=-1, y=0, z=0 },
@ -66,7 +66,7 @@ local surround_vectors = {
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
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 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 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))
local param = {p1=p1, p2=p2, dim=dim, pr=pr}
emerge_area(p1, p2, ecb_spawn_dungeon, param)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
end
end
@ -414,8 +413,7 @@ function mcl_dungeons.spawn_dungeon(p1, _, pr)
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}
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, param)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true})
end
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_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
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_lava = minetest.get_content_id("mcl_core:lava_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_netherrack = minetest.get_content_id("mcl_nether:netherrack")
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_top_snow = minetest.get_content_id("mcl_core:snow")
local c_snow_block = minetest.get_content_id("mcl_core:snowblock")
local c_clay = minetest.get_content_id("mcl_core:clay")
local c_leaves = minetest.get_content_id("mcl_core:leaves")
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_2 = minetest.get_content_id("mcl_cocoas:cocoa_2")
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
-- as X, Z.
-- 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 zwidth = maxp.z - minp.z + 1
local x = ((index-1) % xwidth) + minp.x
local z = ((index-1) / zwidth) + minp.z
return x, z
end
end]]
-- Takes x and z coordinates and minp and maxp of a generated chunk
-- (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]
registered_generators[id] = nil
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_level0 then level0 = level0 - 1 end
end
@ -1979,7 +1979,7 @@ end
-- Below the bedrock, generate air/void
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 pr = PseudoRandom(blockseed)
@ -2077,7 +2077,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local n = nodes[n]
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_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 bn = minetest.get_biome_name(biomemap[b_pos])
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.
-- * Generate spawn platform (End portal destination)
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
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
else
@ -2134,7 +2134,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
end
if #nodes > 0 then
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
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.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 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 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)}
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