mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
fix some codestyle issues
This commit is contained in:
parent
981f3d5d74
commit
388ab6d8df
12 changed files with 22 additions and 26 deletions
|
@ -416,7 +416,7 @@ local swim_turn_check = function(self,dtime)
|
||||||
|
|
||||||
local green_flag_1 = minetest_get_item_group(minetest_get_node(test_dir).name, "solid") ~= 0
|
local green_flag_1 = minetest_get_item_group(minetest_get_node(test_dir).name, "solid") ~= 0
|
||||||
|
|
||||||
return(green_flag_1)
|
return green_flag_1
|
||||||
end
|
end
|
||||||
|
|
||||||
--this is to swap the built in engine acceleration modifier
|
--this is to swap the built in engine acceleration modifier
|
||||||
|
@ -561,7 +561,7 @@ local fly_turn_check = function(self,dtime)
|
||||||
|
|
||||||
local green_flag_1 = minetest_get_item_group(minetest_get_node(test_dir).name, "solid") ~= 0
|
local green_flag_1 = minetest_get_item_group(minetest_get_node(test_dir).name, "solid") ~= 0
|
||||||
|
|
||||||
return(green_flag_1)
|
return green_flag_1
|
||||||
end
|
end
|
||||||
|
|
||||||
--this is to swap the built in engine acceleration modifier
|
--this is to swap the built in engine acceleration modifier
|
||||||
|
|
|
@ -157,7 +157,7 @@ local calculate_pitch = function(self)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return(minetest_dir_to_yaw(vector_new(vector_distance(vector_new(pos.x,0,pos.z),vector_new(pos2.x,0,pos2.z)),0,pos.y - pos2.y)) + HALF_PI)
|
return minetest_dir_to_yaw(vector_new(vector_distance(vector_new(pos.x,0,pos.z),vector_new(pos2.x,0,pos2.z)),0,pos.y - pos2.y)) + HALF_PI
|
||||||
end
|
end
|
||||||
|
|
||||||
--this is a helper function used to make mobs pitch rotation dynamically flow when flying/swimming
|
--this is a helper function used to make mobs pitch rotation dynamically flow when flying/swimming
|
||||||
|
|
|
@ -140,9 +140,7 @@ mobs.look_for_mate = function(self)
|
||||||
winner_mate = mate
|
winner_mate = mate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return winner_mate
|
||||||
return(winner_mate)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--make the baby grow up
|
--make the baby grow up
|
||||||
|
|
|
@ -76,8 +76,7 @@ mobs.detect_closest_player_within_radius = function(self, line_of_sight, radius,
|
||||||
winner_player = player
|
winner_player = player
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return winner_player
|
||||||
return(winner_player)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,14 +103,13 @@ mobs.jump_check = function(self,dtime)
|
||||||
|
|
||||||
if green_flag_1 and green_flag_2 then
|
if green_flag_1 and green_flag_2 then
|
||||||
--can jump over node
|
--can jump over node
|
||||||
return(1)
|
return 1
|
||||||
elseif green_flag_1 and not green_flag_2 then
|
elseif green_flag_1 and not green_flag_2 then
|
||||||
--wall in front of mob
|
--wall in front of mob
|
||||||
return(2)
|
return 2
|
||||||
end
|
end
|
||||||
|
|
||||||
--nothing to jump over
|
--nothing to jump over
|
||||||
return(0)
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- a helper function to quickly turn neutral passive mobs hostile
|
-- a helper function to quickly turn neutral passive mobs hostile
|
||||||
|
@ -223,12 +221,12 @@ mobs.check_for_player_within_area = function(self, radius)
|
||||||
local distance = vector_distance(pos1,pos2)
|
local distance = vector_distance(pos1,pos2)
|
||||||
if distance < radius then
|
if distance < radius then
|
||||||
--found a player
|
--found a player
|
||||||
return(true)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--did not find a player
|
--did not find a player
|
||||||
return(false)
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,7 +234,7 @@ end
|
||||||
mobs.get_2d_distance = function(pos1,pos2)
|
mobs.get_2d_distance = function(pos1,pos2)
|
||||||
pos1.y = 0
|
pos1.y = 0
|
||||||
pos2.y = 0
|
pos2.y = 0
|
||||||
return(vector_distance(pos1, pos2))
|
return vector_distance(pos1, pos2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- fall damage onto solid ground
|
-- fall damage onto solid ground
|
||||||
|
|
|
@ -3,7 +3,7 @@ local vector = vector
|
||||||
|
|
||||||
--converts yaw to degrees
|
--converts yaw to degrees
|
||||||
local degrees = function(yaw)
|
local degrees = function(yaw)
|
||||||
return(yaw*180.0/math.pi)
|
return yaw*180.0/math.pi
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs.do_head_logic = function(self,dtime)
|
mobs.do_head_logic = function(self,dtime)
|
||||||
|
|
|
@ -312,7 +312,7 @@ mobs.calculate_pitch = function(pos1, pos2)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return(minetest_dir_to_yaw(vector.new(vector.distance(vector.new(pos1.x,0,pos1.z),vector.new(pos2.x,0,pos2.z)),0,pos1.y - pos2.y)) + HALF_PI)
|
return minetest_dir_to_yaw(vector.new(vector.distance(vector.new(pos1.x,0,pos1.z),vector.new(pos2.x,0,pos2.z)),0,pos1.y - pos2.y)) + HALF_PI
|
||||||
end
|
end
|
||||||
|
|
||||||
--make mobs fly up or down based on their y difference
|
--make mobs fly up or down based on their y difference
|
||||||
|
|
|
@ -501,7 +501,7 @@ local position_calculation = function(pos)
|
||||||
pos.z = pos.z + math_random(inner,outer)*int[math_random(1,2)]
|
pos.z = pos.z + math_random(inner,outer)*int[math_random(1,2)]
|
||||||
pos.x = pos.x + math_random(-outer,outer)
|
pos.x = pos.x + math_random(-outer,outer)
|
||||||
end
|
end
|
||||||
return(pos)
|
return pos
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
|
@ -120,9 +120,9 @@ end
|
||||||
hud_manager.hud_exists = function(player,hud_name)
|
hud_manager.hud_exists = function(player,hud_name)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if player_huds[name] and player_huds[name][hud_name] then
|
if player_huds[name] and player_huds[name][hud_name] then
|
||||||
return(true)
|
return true
|
||||||
else
|
else
|
||||||
return(false)
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -150,7 +150,7 @@ end)
|
||||||
|
|
||||||
function mcl_experience.get_player_xp_level(player)
|
function mcl_experience.get_player_xp_level(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
return(pool[name].level)
|
return pool[name].level
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_experience.set_player_xp_level(player,level)
|
function mcl_experience.set_player_xp_level(player,level)
|
||||||
|
|
|
@ -7,7 +7,7 @@ end
|
||||||
|
|
||||||
function mcl_enchanting.get_enchantments(itemstack)
|
function mcl_enchanting.get_enchantments(itemstack)
|
||||||
if not itemstack then
|
if not itemstack then
|
||||||
return({})
|
return {}
|
||||||
end
|
end
|
||||||
return minetest.deserialize(itemstack:get_meta():get_string("mcl_enchanting:enchantments")) or {}
|
return minetest.deserialize(itemstack:get_meta():get_string("mcl_enchanting:enchantments")) or {}
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ local function ecb_place(blockpos, action, calls_remaining, param)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mcl_structures.place_schematic = function(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
mcl_structures.place_schematic = function(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
||||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return(schematic)")()
|
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
|
||||||
if s and s.size then
|
if s and s.size then
|
||||||
local x, z = s.size.x, s.size.z
|
local x, z = s.size.x, s.size.z
|
||||||
if rotation then
|
if rotation then
|
||||||
|
|
|
@ -14,7 +14,7 @@ function settlements.build_schematic(vm, data, va, pos, building, replace_wall,
|
||||||
-- 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)
|
||||||
|
@ -228,7 +228,7 @@ function settlements.place_schematics(settlement_info, pr)
|
||||||
-- 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
|
||||||
if replace_wall then
|
if replace_wall then
|
||||||
|
|
|
@ -49,7 +49,7 @@ local player_collision = function(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return({x,z})
|
return {x,z}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- converts yaw to degrees
|
-- converts yaw to degrees
|
||||||
|
|
Loading…
Reference in a new issue