fix some codestyle issues

AFCMS 2021-05-25 10:56:06 +02:00
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
return(green_flag_1)
return green_flag_1
end
--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
return(green_flag_1)
return green_flag_1
end
--this is to swap the built in engine acceleration modifier

@ -157,7 +157,7 @@ local calculate_pitch = function(self)
return false
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
--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
end
end
return(winner_mate)
return winner_mate
end
--make the baby grow up

@ -76,8 +76,7 @@ mobs.detect_closest_player_within_radius = function(self, line_of_sight, radius,
winner_player = player
end
end
return(winner_player)
return winner_player
end
@ -104,14 +103,13 @@ mobs.jump_check = function(self,dtime)
if green_flag_1 and green_flag_2 then
--can jump over node
return(1)
return 1
elseif green_flag_1 and not green_flag_2 then
--wall in front of mob
return(2)
return 2
end
--nothing to jump over
return(0)
return 0
end
-- 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)
if distance < radius then
--found a player
return(true)
return true
end
end
end
--did not find a player
return(false)
return false
end
@ -236,7 +234,7 @@ end
mobs.get_2d_distance = function(pos1,pos2)
pos1.y = 0
pos2.y = 0
return(vector_distance(pos1, pos2))
return vector_distance(pos1, pos2)
end
-- fall damage onto solid ground

@ -3,7 +3,7 @@ local vector = vector
--converts yaw to degrees
local degrees = function(yaw)
return(yaw*180.0/math.pi)
return yaw*180.0/math.pi
end
mobs.do_head_logic = function(self,dtime)

@ -312,7 +312,7 @@ mobs.calculate_pitch = function(pos1, pos2)
return false
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
--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.x = pos.x + math_random(-outer,outer)
end
return(pos)
return pos
end
--[[

@ -120,9 +120,9 @@ end
hud_manager.hud_exists = function(player,hud_name)
local name = player:get_player_name()
if player_huds[name] and player_huds[name][hud_name] then
return(true)
return true
else
return(false)
return false
end
end
-------------------
@ -150,7 +150,7 @@ end)
function mcl_experience.get_player_xp_level(player)
local name = player:get_player_name()
return(pool[name].level)
return pool[name].level
end
function mcl_experience.set_player_xp_level(player,level)

@ -7,7 +7,7 @@ end
function mcl_enchanting.get_enchantments(itemstack)
if not itemstack then
return({})
return {}
end
return minetest.deserialize(itemstack:get_meta():get_string("mcl_enchanting:enchantments")) or {}
end

@ -15,7 +15,7 @@ local function ecb_place(blockpos, action, calls_remaining, param)
end
end
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
local x, z = s.size.x, s.size.z
if rotation then

@ -14,7 +14,7 @@ function settlements.build_schematic(vm, data, va, pos, building, replace_wall,
-- schematic conversion to lua
local schem_lua = minetest.serialize_schematic(building,
"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
if replace_wall == "y" then
schem_lua = schem_lua:gsub("mcl_core:cobble", material)
@ -228,7 +228,7 @@ function settlements.place_schematics(settlement_info, pr)
-- schematic conversion to lua
local schem_lua = minetest.serialize_schematic(building,
"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")
-- replace material
if replace_wall then

@ -49,7 +49,7 @@ local player_collision = function(player)
end
end
return({x,z})
return {x,z}
end
-- converts yaw to degrees