From 68bda2840ad0955e73fa23d7883ccf9c75e409da Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 30 Apr 2024 00:15:06 +0000 Subject: [PATCH] Remove undefined global for optional environmental physics --- mods/ENTITIES/mcl_minecarts/movement.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/movement.lua b/mods/ENTITIES/mcl_minecarts/movement.lua index 522d533ab..d9cbb7cb2 100644 --- a/mods/ENTITIES/mcl_minecarts/movement.lua +++ b/mods/ENTITIES/mcl_minecarts/movement.lua @@ -9,7 +9,10 @@ local mcl_debug,DEBUG = mcl_util.make_mcl_logger("mcl_logging_minecart_debug", " --mcl_debug = function(msg) print(msg) end -- 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 MAX_TRAIN_LENGTH = mod.MAX_TRAIN_LENGTH 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 -- Apply physics - if mcl_physics then - mcl_physics.apply_entity_environmental_physics(self) + if env_physics then + env_physics.apply_entity_environmental_physics(self) else -- Simple physics local friction = self.object:get_velocity() or vector.new(0,0,0)