Carts: Fix player position (#1872)
authorRui <rui.minetest@gmail.com>
Sun, 13 Aug 2017 11:47:13 +0000 (20:47 +0900)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sun, 13 Aug 2017 11:47:13 +0000 (13:47 +0200)
mods/carts/depends.txt
mods/carts/functions.lua
mods/carts/init.lua

index 4ad96d51599fb734101f6229f6c1a8a509bd6255..8e482ce2fe8a5b8eb87bd653ad13c93d7b83c2b1 100644 (file)
@@ -1 +1,2 @@
 default
+player_api
index 9b7e2c653d7a57ea985f1d406501e6d20358b651..8408cc1a900ce23ed706cd57c3fed682715c5098 100644 (file)
@@ -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()
index 53b33cc22c24ce9a1799818dfe76bb986854d961..b2ba5f373992dc37207d49b76f9be57d73047ffe 100644 (file)
@@ -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")