From 388ab6d8dffea8c7daa5760e962ee0ebf3cbaeb1 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 25 May 2021 10:56:06 +0200 Subject: [PATCH] fix some codestyle issues --- mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua | 4 ++-- .../mcl_mobs/api/mob_functions/animation.lua | 2 +- .../mcl_mobs/api/mob_functions/breeding.lua | 4 +--- .../mcl_mobs/api/mob_functions/environment.lua | 16 +++++++--------- .../mcl_mobs/api/mob_functions/head_logic.lua | 2 +- .../mcl_mobs/api/mob_functions/movement.lua | 2 +- mods/ENTITIES/mcl_mobs/api/spawning.lua | 2 +- mods/HUD/mcl_experience/init.lua | 6 +++--- mods/ITEMS/mcl_enchanting/engine.lua | 2 +- mods/MAPGEN/mcl_structures/init.lua | 2 +- mods/MAPGEN/mcl_villages/buildings.lua | 4 ++-- mods/PLAYER/mcl_playerplus/init.lua | 2 +- 12 files changed, 22 insertions(+), 26 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index df2ccade2..ef2687455 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/animation.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/animation.lua index 8f2ea9e31..cea6d838b 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/animation.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/animation.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua index 57650a9c9..c50fb6300 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/breeding.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/environment.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/environment.lua index 3b204a4bf..5c431135e 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/environment.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/environment.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua index 13bc6584d..0f5615504 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/head_logic.lua @@ -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) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua index 72612b1eb..893f8eede 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/spawning.lua b/mods/ENTITIES/mcl_mobs/api/spawning.lua index 08b161527..bf7176b99 100644 --- a/mods/ENTITIES/mcl_mobs/api/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/api/spawning.lua @@ -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 --[[ diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index 53376c63f..a40599d17 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -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) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 47db36870..d2db2281a 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -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 diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index e3f6b4829..f939b9c1a 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -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 diff --git a/mods/MAPGEN/mcl_villages/buildings.lua b/mods/MAPGEN/mcl_villages/buildings.lua index 9d8e7580f..3f4490bf9 100644 --- a/mods/MAPGEN/mcl_villages/buildings.lua +++ b/mods/MAPGEN/mcl_villages/buildings.lua @@ -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 diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 3ad6ba6e8..40752b835 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -49,7 +49,7 @@ local player_collision = function(player) end end - return({x,z}) + return {x,z} end -- converts yaw to degrees