From 67ebf3366fd540e6d29e6b6ef6aea2514d3f6c42 Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Mon, 9 Jul 2018 23:45:54 +0200 Subject: [PATCH] Make player sit in minecarts --- mods/ENTITIES/mcl_minecarts/README.txt | 4 ++++ mods/ENTITIES/mcl_minecarts/init.lua | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/README.txt b/mods/ENTITIES/mcl_minecarts/README.txt index b4b77f21c1..881e2a58fc 100644 --- a/mods/ENTITIES/mcl_minecarts/README.txt +++ b/mods/ENTITIES/mcl_minecarts/README.txt @@ -13,6 +13,10 @@ License of source code: ----------------------- MIT License +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 SmallJoker +Copyright (C) 2012-2016 Various Minetest developers and contributors + Authors/licenses of media files: ----------------------- diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 7d8fd61361..33014228a8 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -417,6 +417,7 @@ register_minecart( "mcl_minecarts_minecart_normal.png", {"mcl_minecarts:minecart"}, function(self, clicker) + local name = clicker:get_player_name() if not clicker or not clicker:is_player() then return end @@ -425,11 +426,21 @@ register_minecart( self._driver = nil self._start_pos = nil clicker:set_detach() + local player = minetest.get_player_by_name(name) + player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) elseif not self._driver then self._driver = player_name self._start_pos = self.object:getpos() mcl_player.player_attached[player_name] = true - clicker:set_attach(self.object, "", {x=0, y=3, z=0}, {x=0, y=0, z=0}) + clicker:set_attach(self.object, "", {x=0, y=8.25, z=-2}, {x=0, y=0, z=0}) + mcl_player.player_attached[name] = true + minetest.after(0.2, function(name) + local player = minetest.get_player_by_name(name) + if player then + mcl_player.player_set_animation(player, "sit" , 30) + player:set_eye_offset({x=0, y=-5.5, z=0},{x=0, y=-4, z=0}) + end + end, name) end end )