Compare commits

...

13 Commits

10 changed files with 94 additions and 54 deletions

View File

@ -1,12 +1,12 @@
-- intllib -- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP .. "/intllib.lua") local S = minetest.get_translator and minetest.get_translator("mob_horse") or
dofile(MP .. "/intllib.lua")
-- 0.4.17 or 5.0 check -- 0.4.17 or 5.0 check
local y_off = 20 local y_off = 20
if minetest.registered_nodes["default:permafrost"] then if minetest.features.object_independent_selectionbox then
y_off = 10 y_off = 10
end end
@ -18,9 +18,7 @@ local shoes = {
["mobs:horseshoe_diamond"] = {10, 6, 6, "mobs_horseshoe_diamondo.png"} ["mobs:horseshoe_diamond"] = {10, 6, 6, "mobs_horseshoe_diamondo.png"}
} }
-- rideable horse -- rideable horse
mobs:register_mob("mob_horse:horse", { mobs:register_mob("mob_horse:horse", {
type = "animal", type = "animal",
visual = "mesh", visual = "mesh",
@ -31,7 +29,12 @@ mobs:register_mob("mob_horse:horse", {
speed_normal = 15, speed_normal = 15,
speed_run = 30, speed_run = 30,
stand_start = 25, stand_start = 25,
stand_end = 75, stand_end = 50, -- 75
stand2_start = 25,
stand2_end = 25,
stand3_start = 55,
stand3_end = 75,
stand3_loop = false,
walk_start = 75, walk_start = 75,
walk_end = 100, walk_end = 100,
run_start = 75, run_start = 75,
@ -106,6 +109,14 @@ mobs:register_mob("mob_horse:horse", {
end, end,
do_punch = function(self, hitter)
-- don't cut the branch you're... ah, that's not about that
if hitter ~= self.driver then
return true
end
end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
-- make sure player is clicking -- make sure player is clicking
@ -123,8 +134,10 @@ mobs:register_mob("mob_horse:horse", {
return return
end end
local player_name = clicker:get_player_name()
-- make sure tamed horse is being clicked by owner only -- make sure tamed horse is being clicked by owner only
if self.tamed and self.owner == clicker:get_player_name() then if self.tamed and self.owner == player_name then
local inv = clicker:get_inventory() local inv = clicker:get_inventory()
local tool = clicker:get_wielded_item() local tool = clicker:get_wielded_item()
@ -186,13 +199,15 @@ mobs:register_mob("mob_horse:horse", {
end end
-- show horse speed and jump stats with shoes fitted -- show horse speed and jump stats with shoes fitted
minetest.chat_send_player(clicker:get_player_name(), minetest.chat_send_player(player_name,
S("Horse shoes fitted -") S("Horse shoes fitted -")
.. S(" speed: ") .. speed .. S(" speed: ") .. speed
.. S(" , jump height: ") .. jump .. S(" , jump height: ") .. jump
.. S(" , stop speed: ") .. reverse) .. S(" , stop speed: ") .. reverse)
tool:take_item() ; clicker:set_wielded_item(tool) tool:take_item()
clicker:set_wielded_item(tool)
return return
end end

View File

@ -1,45 +1,3 @@
-- Support for the old multi-load method
dofile(minetest.get_modpath("intllib").."/init.lua")
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

3
license.txt Normal file
View File

@ -0,0 +1,3 @@
Code: MIT
Textures: CC-BY-SA 3.0 by Mjollna
Model: MIT by KrupnovPavel

10
locale/mob_horse.en.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
# , jump height: =
# , stop speed: =
# speed: =
#Bronze HorseShoes (use on horse to apply)=
#Diamond HorseShoes (use on horse to apply)=
#Horse=
#Horse shoes fitted -=
#Mese HorseShoes (use on horse to apply)=
#Steel HorseShoes (use on horse to apply)=

10
locale/mob_horse.fr.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
, jump height: = , hauteur des sauts :
, stop speed: = , décélération :
speed: = vitesse :
Bronze HorseShoes (use on horse to apply)=Fers à cheval de bronze (clic droit pour ferrer)
Diamond HorseShoes (use on horse to apply)=Fers à cheval en diamant (clic droit pour ferrer)
Horse=Cheval
Horse shoes fitted -= Ferré -
Mese HorseShoes (use on horse to apply)=Fers à cheval en mese (clic droit pour ferrer)
Steel HorseShoes (use on horse to apply)=Fers à cheval en acier (clic droit pour ferrer)

10
locale/mob_horse.it_IT.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
, jump height: = , altezza di salto:
, stop speed: = , velocità di arresto:
speed: = velocità:
Bronze HorseShoes (use on horse to apply)=Ferri di cavallo di bronzo (usarli su un cavallo per applicarli)
Diamond HorseShoes (use on horse to apply)=Ferri di cavallo di diamante (usarli su un cavallo per applicarli)
Horse=Cavallo
Horse shoes fitted -=Ferri di cavallo indossati -
Mese HorseShoes (use on horse to apply)=Ferri di cavallo di mese (usarli su un cavallo per applicarli)
Steel HorseShoes (use on horse to apply)=Ferri di cavallo d'acciaio (usarli su un cavallo per applicarli)

10
locale/mob_horse.ms.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
, jump height: = , ketinggian lompat:
, stop speed: = , kelajuan berhenti:
speed: = kelajuan:
Bronze HorseShoes (use on horse to apply)=Ladam Kuda Gangsa (guna pada kuda untuk pakaikan ia)
Diamond HorseShoes (use on horse to apply)=Ladam Kuda Intan (guna pada kuda untuk pakaikan ia)
Horse=Kuda
Horse shoes fitted -=Ladam telah dipasang pada kuda -
Mese HorseShoes (use on horse to apply)=Ladam Kuda Mese (guna pada kuda untuk pakaikan ia)
Steel HorseShoes (use on horse to apply)=Ladam Kuda Keluli (guna pada kuda untuk pakaikan ia)

10
locale/mob_horse.zh_CN.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
, jump height: =,跳跃高度:
, stop speed: =,停止速度:
speed: =速度:
Bronze HorseShoes (use on horse to apply)=青铜马蹄铁(用在马匹上)
Diamond HorseShoes (use on horse to apply)=钻石马蹄铁(用在马匹上)
Horse=马
Horse shoes fitted -=马蹄铁 -
Mese HorseShoes (use on horse to apply)=黄石马蹄铁(用在马匹上)
Steel HorseShoes (use on horse to apply)=钢马蹄铁(用在马匹上)

10
locale/mob_horse.zh_TW.tr Normal file
View File

@ -0,0 +1,10 @@
# textdomain:mob_horse
, jump height: =,跳躍高度:
, stop speed: =,停止速度:
speed: =速度:
Bronze HorseShoes (use on horse to apply)=青銅馬蹄鐵(用在馬匹上)
Diamond HorseShoes (use on horse to apply)=鑽石馬蹄鐵(用在馬匹上)
Horse=馬
Horse shoes fitted -=馬蹄鐵 -
Mese HorseShoes (use on horse to apply)=黃石馬蹄鐵(用在馬匹上)
Steel HorseShoes (use on horse to apply)=鋼馬蹄鐵(用在馬匹上)

4
mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = mob_horse
depends = mobs
optional_depends = lucky_block, intllib
description = Adds a rideable horse into game with horse shoe upgrades.