From: Rui Date: Sun, 13 Aug 2017 11:47:13 +0000 (+0900) Subject: Carts: Fix player position (#1872) X-Git-Tag: 5.0.0~187 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b431ae1c77aa9686ec1b3e941cb2d0052aec572e;p=oweals%2Fminetest_game.git Carts: Fix player position (#1872) --- diff --git a/mods/carts/depends.txt b/mods/carts/depends.txt index 4ad96d51..8e482ce2 100644 --- a/mods/carts/depends.txt +++ b/mods/carts/depends.txt @@ -1 +1,2 @@ default +player_api diff --git a/mods/carts/functions.lua b/mods/carts/functions.lua index 9b7e2c65..8408cc1a 100644 --- a/mods/carts/functions.lua +++ b/mods/carts/functions.lua @@ -12,13 +12,13 @@ function carts:manage_attachment(player, obj) end local status = obj ~= nil local player_name = player:get_player_name() - if default.player_attached[player_name] == status then + if player_api.player_attached[player_name] == status then return end - default.player_attached[player_name] = status + player_api.player_attached[player_name] = status if status then - player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0}) + player:set_attach(obj, "", {x=0, y=-4.5, z=0}, {x=0, y=0, z=0}) player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0}) else player:set_detach() diff --git a/mods/carts/init.lua b/mods/carts/init.lua index 53b33cc2..b2ba5f37 100644 --- a/mods/carts/init.lua +++ b/mods/carts/init.lua @@ -11,10 +11,4 @@ carts.punch_speed_max = 5 dofile(carts.modpath.."/functions.lua") dofile(carts.modpath.."/rails.lua") - --- Support for non-default games -if not default.player_attached then - default.player_attached = {} -end - dofile(carts.modpath.."/cart_entity.lua")