add 0.4.x support ?

This commit is contained in:
tenplus1 2022-02-19 08:58:25 +00:00
parent 0b0776e17d
commit 3c26410261
3 changed files with 40 additions and 4 deletions

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
intllib?
mesecons?
dungeon_loot?

View File

@ -1,3 +1,5 @@
local is_50 = minetest.get_translator
function carts:get_sign(z)
if z == 0 then
return 0
@ -15,7 +17,12 @@ function carts:manage_attachment(player, obj)
if obj and player:get_attach() == obj then
return
end
player_api.player_attached[player_name] = status
if is_50 then
player_api.player_attached[player_name] = status
else
default.player_attached[player_name] = status
end
if status then
player:set_attach(obj, "", {x=0, y=-4.5, z=0}, {x=0, y=0, z=0})
@ -23,7 +30,12 @@ function carts:manage_attachment(player, obj)
-- player_api does not update the animation
-- when the player is attached, reset to default animation
player_api.set_animation(player, "stand")
if is_50 then
player_api.set_animation(player, "stand")
else
default.player_set_animation(player, "stand")
end
else
player:set_detach()
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})

View File

@ -1,7 +1,27 @@
-- carts/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator("carts")
-- translation support
local S
if minetest.get_translator ~= nil then
S = minetest.get_translator("carts") -- 5.x translation function
else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
end
end
carts = {}
carts.modpath = minetest.get_modpath("carts")