Remove undefined global for optional environmental physics

This commit is contained in:
teknomunk 2024-04-30 00:15:06 +00:00
parent 4056f5b0e2
commit 68bda2840a
1 changed files with 6 additions and 3 deletions

View File

@ -9,7 +9,10 @@ local mcl_debug,DEBUG = mcl_util.make_mcl_logger("mcl_logging_minecart_debug", "
--mcl_debug = function(msg) print(msg) end --mcl_debug = function(msg) print(msg) end
-- Imports -- Imports
local mcl_physics = mcl_physics or false local env_physics
if minetest.get_modpath("mcl_physics") then
env_physics = mcl_physics
end
local FRICTION = mcl_minecarts.FRICTION local FRICTION = mcl_minecarts.FRICTION
local MAX_TRAIN_LENGTH = mod.MAX_TRAIN_LENGTH local MAX_TRAIN_LENGTH = mod.MAX_TRAIN_LENGTH
local SPEED_MAX = mod.SPEED_MAX local SPEED_MAX = mod.SPEED_MAX
@ -491,8 +494,8 @@ local function do_detached_movement(self, dtime)
if not self.object or not self.object:get_pos() then return end if not self.object or not self.object:get_pos() then return end
-- Apply physics -- Apply physics
if mcl_physics then if env_physics then
mcl_physics.apply_entity_environmental_physics(self) env_physics.apply_entity_environmental_physics(self)
else else
-- Simple physics -- Simple physics
local friction = self.object:get_velocity() or vector.new(0,0,0) local friction = self.object:get_velocity() or vector.new(0,0,0)