mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
fix many codestyle errors
This commit is contained in:
parent
457f61a532
commit
5f076d372a
@ -1,6 +1,7 @@
|
|||||||
unused_args = false
|
unused_args = false
|
||||||
allow_defined_top = true
|
allow_defined_top = true
|
||||||
max_line_length = false
|
max_line_length = false
|
||||||
|
redefined = false
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
"minetest", "core",
|
"minetest", "core",
|
||||||
@ -11,7 +12,7 @@ read_globals = {
|
|||||||
"dump", "dump2",
|
"dump", "dump2",
|
||||||
"vector",
|
"vector",
|
||||||
"VoxelManip", "VoxelArea",
|
"VoxelManip", "VoxelArea",
|
||||||
"PseudoRandom", "PcgRandom",
|
"PseudoRandom", "PcgRandom", "PerlinNoise",
|
||||||
"ItemStack",
|
"ItemStack",
|
||||||
"Settings",
|
"Settings",
|
||||||
"unpack",
|
"unpack",
|
||||||
|
@ -12,19 +12,19 @@ function settlements.build_schematic(vm, data, va, pos, building, replace_wall,
|
|||||||
-- pick random material
|
-- pick random material
|
||||||
local material = wallmaterial[math.random(1,#wallmaterial)]
|
local material = wallmaterial[math.random(1,#wallmaterial)]
|
||||||
-- schematic conversion to lua
|
-- schematic conversion to lua
|
||||||
local schem_lua = minetest.serialize_schematic(building,
|
local schem_lua = minetest.serialize_schematic(building,
|
||||||
"lua",
|
"lua",
|
||||||
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
|
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
|
||||||
-- replace material
|
-- replace material
|
||||||
if replace_wall == "y" then
|
if replace_wall == "y" then
|
||||||
schem_lua = schem_lua:gsub("mcl_core:cobble", material)
|
schem_lua = schem_lua:gsub("mcl_core:cobble", material)
|
||||||
end
|
end
|
||||||
schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass",
|
schem_lua = schem_lua:gsub("mcl_core:dirt_with_grass",
|
||||||
platform_material)
|
platform_material)
|
||||||
|
|
||||||
-- Disable special junglewood for now.
|
-- Disable special junglewood for now.
|
||||||
-- special material for spawning npcs
|
-- special material for spawning npcs
|
||||||
-- schem_lua = schem_lua:gsub("mcl_core:junglewood",
|
-- schem_lua = schem_lua:gsub("mcl_core:junglewood",
|
||||||
-- "settlements: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 possible_rotations = {"0", "90", "180", "270"}
|
||||||
local rotation = possible_rotations[ math.random( #possible_rotations ) ]
|
local rotation = possible_rotations[ math.random( #possible_rotations ) ]
|
||||||
settlements.foundation(
|
settlements.foundation(
|
||||||
pos,
|
pos,
|
||||||
width,
|
width,
|
||||||
depth,
|
depth,
|
||||||
height,
|
height,
|
||||||
rotation)
|
rotation)
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
-- place schematic
|
-- place schematic
|
||||||
|
|
||||||
minetest.place_schematic_on_vmanip(
|
minetest.place_schematic_on_vmanip(
|
||||||
vm,
|
vm,
|
||||||
pos,
|
pos,
|
||||||
schematic,
|
schematic,
|
||||||
rotation,
|
rotation,
|
||||||
nil,
|
nil,
|
||||||
true)
|
true)
|
||||||
vm:write_to_map(true)
|
vm:write_to_map(true)
|
||||||
end]]
|
end]]
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- initialize settlement_info
|
-- initialize settlement_info
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function settlements.initialize_settlement_info(pr)
|
function settlements.initialize_settlement_info(pr)
|
||||||
local count_buildings = {}
|
local count_buildings = {}
|
||||||
@ -81,8 +81,8 @@ function settlements.create_site_plan(maxp, minp, pr)
|
|||||||
local possible_rotations = {"0", "90", "180", "270"}
|
local possible_rotations = {"0", "90", "180", "270"}
|
||||||
-- find center of chunk
|
-- find center of chunk
|
||||||
local center = {
|
local center = {
|
||||||
x=math.floor((minp.x+maxp.x)/2),
|
x=math.floor((minp.x+maxp.x)/2),
|
||||||
y=maxp.y,
|
y=maxp.y,
|
||||||
z=math.floor((minp.z+maxp.z)/2)
|
z=math.floor((minp.z+maxp.z)/2)
|
||||||
}
|
}
|
||||||
-- find center_surface of chunk
|
-- find center_surface of chunk
|
||||||
@ -105,8 +105,8 @@ function settlements.create_site_plan(maxp, minp, pr)
|
|||||||
-- add to settlement info table
|
-- add to settlement info table
|
||||||
local index = 1
|
local index = 1
|
||||||
settlement_info[index] = {
|
settlement_info[index] = {
|
||||||
pos = center_surface,
|
pos = center_surface,
|
||||||
name = building_all_info["name"],
|
name = building_all_info["name"],
|
||||||
hsize = building_all_info["hsize"],
|
hsize = building_all_info["hsize"],
|
||||||
rotat = rotation,
|
rotat = rotation,
|
||||||
surface_mat = surface_material
|
surface_mat = surface_material
|
||||||
@ -149,8 +149,8 @@ function settlements.create_site_plan(maxp, minp, pr)
|
|||||||
rotation = possible_rotations[ pr:next(1, #possible_rotations ) ]
|
rotation = possible_rotations[ pr:next(1, #possible_rotations ) ]
|
||||||
number_built = number_built + 1
|
number_built = number_built + 1
|
||||||
settlement_info[index] = {
|
settlement_info[index] = {
|
||||||
pos = pos_surface,
|
pos = pos_surface,
|
||||||
name = building_all_info["name"],
|
name = building_all_info["name"],
|
||||||
hsize = building_all_info["hsize"],
|
hsize = building_all_info["hsize"],
|
||||||
rotat = rotation,
|
rotat = rotation,
|
||||||
surface_mat = surface_material
|
surface_mat = surface_material
|
||||||
@ -215,10 +215,10 @@ function settlements.place_schematics(settlement_info, pr)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = settlement_info[i]["pos"]
|
local pos = settlement_info[i]["pos"]
|
||||||
local rotation = settlement_info[i]["rotat"]
|
local rotation = settlement_info[i]["rotat"]
|
||||||
-- get building node material for better integration to surrounding
|
-- 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)
|
--platform_material_name = minetest.get_name_from_content_id(platform_material)
|
||||||
-- pick random material
|
-- pick random material
|
||||||
--local material = wallmaterial[pr:next(1,#wallmaterial)]
|
--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 building = building_all_info["mts"]
|
||||||
local replace_wall = building_all_info["rplc"]
|
local replace_wall = building_all_info["rplc"]
|
||||||
-- schematic conversion to lua
|
-- schematic conversion to lua
|
||||||
local schem_lua = minetest.serialize_schematic(building,
|
local schem_lua = minetest.serialize_schematic(building,
|
||||||
"lua",
|
"lua",
|
||||||
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
|
{lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
|
||||||
schem_lua = schem_lua:gsub("mcl_core:stonebrickcarved", "mcl_villages:stonebrickcarved")
|
schem_lua = schem_lua:gsub("mcl_core:stonebrickcarved", "mcl_villages:stonebrickcarved")
|
||||||
-- replace material
|
-- replace material
|
||||||
@ -269,10 +269,10 @@ function settlements.place_schematics(settlement_info, pr)
|
|||||||
-- build foundation for the building an make room above
|
-- build foundation for the building an make room above
|
||||||
-- place schematic
|
-- place schematic
|
||||||
mcl_structures.place_schematic(
|
mcl_structures.place_schematic(
|
||||||
pos,
|
pos,
|
||||||
schematic,
|
schematic,
|
||||||
rotation,
|
rotation,
|
||||||
nil,
|
nil,
|
||||||
true,
|
true,
|
||||||
nil,
|
nil,
|
||||||
init_nodes,
|
init_nodes,
|
||||||
|
@ -8,15 +8,15 @@ end
|
|||||||
--[[ Manually set in 'buildings.lua'
|
--[[ Manually set in 'buildings.lua'
|
||||||
-- material to replace cobblestone with
|
-- material to replace cobblestone with
|
||||||
wallmaterial = {
|
wallmaterial = {
|
||||||
"mcl_core:junglewood",
|
"mcl_core:junglewood",
|
||||||
"mcl_core:sprucewood",
|
"mcl_core:sprucewood",
|
||||||
"mcl_core:wood",
|
"mcl_core:wood",
|
||||||
"mcl_core:birchwood",
|
"mcl_core:birchwood",
|
||||||
"mcl_core:acaciawood",
|
"mcl_core:acaciawood",
|
||||||
"mcl_core:stonebrick",
|
"mcl_core:stonebrick",
|
||||||
"mcl_core:cobble",
|
"mcl_core:cobble",
|
||||||
"mcl_core:sandstonecarved",
|
"mcl_core:sandstonecarved",
|
||||||
"mcl_core:sandstone",
|
"mcl_core:sandstone",
|
||||||
"mcl_core:sandstonesmooth2"
|
"mcl_core:sandstonesmooth2"
|
||||||
}
|
}
|
||||||
--]]
|
--]]
|
||||||
@ -78,4 +78,4 @@ max_height_difference = 56
|
|||||||
--
|
--
|
||||||
--
|
--
|
||||||
half_map_chunk_size = 40
|
half_map_chunk_size = 40
|
||||||
quarter_map_chunk_size = 20
|
--quarter_map_chunk_size = 20
|
||||||
|
@ -823,7 +823,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da
|
|||||||
local s = sign
|
local s = sign
|
||||||
local ud = false -- Up or down
|
local ud = false -- Up or down
|
||||||
local udn = false -- Up or down is next
|
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 up = false -- true if going up
|
||||||
local upp = false -- true if was going up previously
|
local upp = false -- true if was going up previously
|
||||||
for i=1,length do
|
for i=1,length do
|
||||||
@ -911,7 +911,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da
|
|||||||
a="z"
|
a="z"
|
||||||
elseif a=="z" then
|
elseif a=="z" then
|
||||||
a="x"
|
a="x"
|
||||||
end;
|
end;
|
||||||
s = pr:next(1, 2) == 1
|
s = pr:next(1, 2) == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -119,7 +119,7 @@ local function find_biome(pos, biomes)
|
|||||||
local edge_dist = 0
|
local edge_dist = 0
|
||||||
local dir_step = 0
|
local dir_step = 0
|
||||||
local dir_ind = 1
|
local dir_ind = 1
|
||||||
local success = false
|
local success
|
||||||
local spawn_pos
|
local spawn_pos
|
||||||
local biome_ids
|
local biome_ids
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ local function find_biome(pos, biomes)
|
|||||||
spawn_pos = {x = spos.x, y = spos.y, z = spos.z}
|
spawn_pos = {x = spos.x, y = spos.y, z = spos.z}
|
||||||
end
|
end
|
||||||
if spawn_pos then
|
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
|
if is_in_world(spawn_pos) and not outside then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,6 @@ local math = math
|
|||||||
-- Internal player state
|
-- Internal player state
|
||||||
local mcl_playerplus_internal = {}
|
local mcl_playerplus_internal = {}
|
||||||
|
|
||||||
local def = {}
|
|
||||||
local time = 0
|
local time = 0
|
||||||
local look_pitch = 0
|
local look_pitch = 0
|
||||||
|
|
||||||
@ -376,9 +375,6 @@ minetest.register_globalstep(function(dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set defaults
|
|
||||||
def.speed = 1
|
|
||||||
|
|
||||||
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots)
|
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots)
|
||||||
if node_stand == "mcl_nether:soul_sand" then
|
if node_stand == "mcl_nether:soul_sand" then
|
||||||
-- TODO: Tweak walk speed
|
-- TODO: Tweak walk speed
|
||||||
|
@ -500,10 +500,8 @@ function mcl_spawn.shadow_worker()
|
|||||||
|
|
||||||
if success then
|
if success then
|
||||||
local wsp_node = minetest.get_node(wsp)
|
local wsp_node = minetest.get_node(wsp)
|
||||||
if wsp_node and wsp_node.name == "ignore" then
|
if not (wsp_node and wsp_node.name == "ignore")
|
||||||
-- special case - respawn area unloaded from memory - it's okay, skip for now
|
and ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
|
||||||
|
|
||||||
elseif ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
|
|
||||||
success = false
|
success = false
|
||||||
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp))
|
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp))
|
||||||
mcl_spawn.search()
|
mcl_spawn.search()
|
||||||
|
Loading…
Reference in New Issue
Block a user