fix many codestyle errors

This commit is contained in:
AFCMS 2021-04-17 07:42:49 +02:00
parent 457f61a532
commit 5f076d372a
7 changed files with 47 additions and 52 deletions

View File

@ -1,6 +1,7 @@
unused_args = false
allow_defined_top = true
max_line_length = false
redefined = false
globals = {
"minetest", "core",
@ -11,7 +12,7 @@ read_globals = {
"dump", "dump2",
"vector",
"VoxelManip", "VoxelArea",
"PseudoRandom", "PcgRandom",
"PseudoRandom", "PcgRandom", "PerlinNoise",
"ItemStack",
"Settings",
"unpack",

View File

@ -12,19 +12,19 @@ function settlements.build_schematic(vm, data, va, pos, building, replace_wall,
-- pick random material
local material = wallmaterial[math.random(1,#wallmaterial)]
-- schematic conversion to lua
local schem_lua = minetest.serialize_schematic(building,
"lua",
local schem_lua = minetest.serialize_schematic(building,
"lua",
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
-- replace material
if replace_wall == "y" then
schem_lua = schem_lua:gsub("mcl_core:cobble", material)
end
schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass",
schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass",
platform_material)
-- Disable special junglewood for now.
-- special material for spawning npcs
-- schem_lua = schem_lua:gsub("mcl_core:junglewood",
-- schem_lua = schem_lua:gsub("mcl_core:junglewood",
-- "settlements:junglewood")
--
@ -37,25 +37,25 @@ function settlements.build_schematic(vm, data, va, pos, building, replace_wall,
local possible_rotations = {"0", "90", "180", "270"}
local rotation = possible_rotations[ math.random( #possible_rotations ) ]
settlements.foundation(
pos,
width,
depth,
height,
pos,
width,
depth,
height,
rotation)
vm:set_data(data)
-- place schematic
minetest.place_schematic_on_vmanip(
vm,
pos,
schematic,
rotation,
nil,
vm,
pos,
schematic,
rotation,
nil,
true)
vm:write_to_map(true)
end]]
-------------------------------------------------------------------------------
-- initialize settlement_info
-- initialize settlement_info
-------------------------------------------------------------------------------
function settlements.initialize_settlement_info(pr)
local count_buildings = {}
@ -81,8 +81,8 @@ function settlements.create_site_plan(maxp, minp, pr)
local possible_rotations = {"0", "90", "180", "270"}
-- find center of chunk
local center = {
x=math.floor((minp.x+maxp.x)/2),
y=maxp.y,
x=math.floor((minp.x+maxp.x)/2),
y=maxp.y,
z=math.floor((minp.z+maxp.z)/2)
}
-- find center_surface of chunk
@ -105,8 +105,8 @@ function settlements.create_site_plan(maxp, minp, pr)
-- add to settlement info table
local index = 1
settlement_info[index] = {
pos = center_surface,
name = building_all_info["name"],
pos = center_surface,
name = building_all_info["name"],
hsize = building_all_info["hsize"],
rotat = rotation,
surface_mat = surface_material
@ -149,8 +149,8 @@ function settlements.create_site_plan(maxp, minp, pr)
rotation = possible_rotations[ pr:next(1, #possible_rotations ) ]
number_built = number_built + 1
settlement_info[index] = {
pos = pos_surface,
name = building_all_info["name"],
pos = pos_surface,
name = building_all_info["name"],
hsize = building_all_info["hsize"],
rotat = rotation,
surface_mat = surface_material
@ -215,10 +215,10 @@ function settlements.place_schematics(settlement_info, pr)
end
end
local pos = settlement_info[i]["pos"]
local rotation = settlement_info[i]["rotat"]
local pos = settlement_info[i]["pos"]
local rotation = settlement_info[i]["rotat"]
-- get building node material for better integration to surrounding
local platform_material = settlement_info[i]["surface_mat"]
local platform_material = settlement_info[i]["surface_mat"]
--platform_material_name = minetest.get_name_from_content_id(platform_material)
-- pick random material
--local material = wallmaterial[pr:next(1,#wallmaterial)]
@ -226,8 +226,8 @@ function settlements.place_schematics(settlement_info, pr)
local building = building_all_info["mts"]
local replace_wall = building_all_info["rplc"]
-- schematic conversion to lua
local schem_lua = minetest.serialize_schematic(building,
"lua",
local schem_lua = minetest.serialize_schematic(building,
"lua",
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
schem_lua = schem_lua:gsub("mcl_core:stonebrickcarved", "mcl_villages:stonebrickcarved")
-- replace material
@ -269,10 +269,10 @@ function settlements.place_schematics(settlement_info, pr)
-- build foundation for the building an make room above
-- place schematic
mcl_structures.place_schematic(
pos,
schematic,
rotation,
nil,
pos,
schematic,
rotation,
nil,
true,
nil,
init_nodes,

View File

@ -8,15 +8,15 @@ end
--[[ Manually set in 'buildings.lua'
-- material to replace cobblestone with
wallmaterial = {
"mcl_core:junglewood",
"mcl_core:sprucewood",
"mcl_core:wood",
"mcl_core:birchwood",
"mcl_core:acaciawood",
"mcl_core:stonebrick",
"mcl_core:cobble",
"mcl_core:sandstonecarved",
"mcl_core:sandstone",
"mcl_core:junglewood",
"mcl_core:sprucewood",
"mcl_core:wood",
"mcl_core:birchwood",
"mcl_core:acaciawood",
"mcl_core:stonebrick",
"mcl_core:cobble",
"mcl_core:sandstonecarved",
"mcl_core:sandstone",
"mcl_core:sandstonesmooth2"
}
--]]
@ -78,4 +78,4 @@ max_height_difference = 56
--
--
half_map_chunk_size = 40
quarter_map_chunk_size = 20
--quarter_map_chunk_size = 20

View File

@ -823,7 +823,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da
local s = sign
local ud = false -- Up or down
local udn = false -- Up or down is next
local udp = false -- Up or down was previous
local udp -- Up or down was previous
local up = false -- true if going up
local upp = false -- true if was going up previously
for i=1,length do
@ -911,7 +911,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da
a="z"
elseif a=="z" then
a="x"
end;
end;
s = pr:next(1, 2) == 1
end
end

View File

@ -119,7 +119,7 @@ local function find_biome(pos, biomes)
local edge_dist = 0
local dir_step = 0
local dir_ind = 1
local success = false
local success
local spawn_pos
local biome_ids
@ -166,7 +166,7 @@ local function find_biome(pos, biomes)
spawn_pos = {x = spos.x, y = spos.y, z = spos.z}
end
if spawn_pos then
local adjusted_pos, outside = adjust_pos_to_biome_limits(spawn_pos, biome_id)
local _,outside = adjust_pos_to_biome_limits(spawn_pos, biome_id)
if is_in_world(spawn_pos) and not outside then
return true
end

View File

@ -22,7 +22,6 @@ local math = math
-- Internal player state
local mcl_playerplus_internal = {}
local def = {}
local time = 0
local look_pitch = 0
@ -376,9 +375,6 @@ minetest.register_globalstep(function(dtime)
return
end
-- set defaults
def.speed = 1
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots)
if node_stand == "mcl_nether:soul_sand" then
-- TODO: Tweak walk speed

View File

@ -500,10 +500,8 @@ function mcl_spawn.shadow_worker()
if success then
local wsp_node = minetest.get_node(wsp)
if wsp_node and wsp_node.name == "ignore" then
-- special case - respawn area unloaded from memory - it's okay, skip for now
elseif ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
if not (wsp_node and wsp_node.name == "ignore")
and ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
success = false
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp))
mcl_spawn.search()