mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-15 15:41:06 +01:00
Merge (latest .luacheckrc)
This commit is contained in:
commit
7e6abe8398
5 changed files with 45 additions and 47 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue