forked from VoxeLibre/VoxeLibre
Remove instance of debug logging, change movement.lua function export
This commit is contained in:
parent
c7a829d59a
commit
4e970a5ea1
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue