Skip to content

Commit

Permalink
Carts: Fix player position (#1872)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui authored and SmallJoker committed Aug 13, 2017
1 parent fe710c9 commit b431ae1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions mods/carts/depends.txt
@@ -1 +1,2 @@
default
player_api
6 changes: 3 additions & 3 deletions mods/carts/functions.lua
Expand Up @@ -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()
Expand Down
6 changes: 0 additions & 6 deletions mods/carts/init.lua
Expand Up @@ -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")

0 comments on commit b431ae1

Please sign in to comment.