From 61a2f98b2bff7c3abfcc76f16964d0842bcdfc80 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 29 Oct 2024 07:45:00 -0500 Subject: [PATCH] Remove instance of debug logging, change movement.lua function export --- mods/ENTITIES/mcl_minecarts/carts.lua | 14 +++++++------- mods/ENTITIES/mcl_minecarts/movement.lua | 9 +++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index 9b9cc0d6a..3f5085b6d 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -13,10 +13,10 @@ local save_cart_data = mod.save_cart_data local update_cart_data = mod.update_cart_data local destroy_cart_data = mod.destroy_cart_data local find_carts_by_block_map = mod.find_carts_by_block_map -local do_movement,do_detached_movement,handle_cart_enter = dofile(modpath.."/movement.lua") -assert(do_movement) -assert(do_detached_movement) -assert(handle_cart_enter) +local movement = dofile(modpath.."/movement.lua") +assert(movement.do_movement) +assert(movement.do_detached_movement) +assert(movement.handle_cart_enter) -- Constants local max_step_distance = 0.5 @@ -345,7 +345,7 @@ function DEFAULT_CART_DEF:on_step(dtime) if not staticdata.connected_at then - do_detached_movement(self, dtime) + movement.do_detached_movement(self, dtime) else mod.update_cart_orientation(self) end @@ -407,7 +407,7 @@ function mod.place_minecart(itemstack, pointed_thing, placer) end if railpos then - handle_cart_enter(staticdata, railpos) + movement.handle_cart_enter(staticdata, railpos) end local pname = placer and placer:get_player_name() or "" @@ -619,7 +619,7 @@ minetest.register_globalstep(function(dtime) --- Non-entity code if staticdata.connected_at then - do_movement(staticdata, dtime) + movement.do_movement(staticdata, dtime) end end diff --git a/mods/ENTITIES/mcl_minecarts/movement.lua b/mods/ENTITIES/mcl_minecarts/movement.lua index 49feb8e9e..8e8132996 100644 --- a/mods/ENTITIES/mcl_minecarts/movement.lua +++ b/mods/ENTITIES/mcl_minecarts/movement.lua @@ -2,6 +2,7 @@ local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) local mod = mcl_minecarts local S = minetest.get_translator(modname) +local submod = {} -- Constants local mcl_debug,DEBUG = mcl_util.make_mcl_logger("mcl_logging_minecart_debug", "Minecart Debug") @@ -92,6 +93,7 @@ local function handle_cart_enter(staticdata, pos, next_dir) set_metadata_cart_status(pos, staticdata.uuid, 1) handle_cart_enter_exit(staticdata, pos, next_dir, "on_enter" ) end +submod.handle_cart_enter = handle_cart_enter local function handle_cart_leave(staticdata, pos, next_dir) --print("leaving "..tostring(pos)) set_metadata_cart_status(pos, staticdata.uuid, nil) @@ -476,7 +478,7 @@ local function do_movement_step(staticdata, dtime) return dtime - timestep end -local function do_movement( staticdata, dtime ) +function submod.do_movement( staticdata, dtime ) assert(staticdata) -- Allow the carts to be delay for the rest of the world to react before moving again @@ -504,7 +506,7 @@ local function do_movement( staticdata, dtime ) end end -local function do_detached_movement(self, dtime) +function submod.do_detached_movement(self, dtime) local staticdata = self._staticdata -- Make sure the object is still valid before trying to move it @@ -575,11 +577,10 @@ local function do_detached_movement(self, dtime) -- Reset pitch if still not attached local rot = self.object:get_rotation() - minetest.log(vector.to_string(rot)) rot.x = 0 self.object:set_rotation(rot) end --return do_movement, do_detatched_movement -return do_movement,do_detached_movement,handle_cart_enter +return submod