Compare commits

26 Commits

Author SHA1 Message Date
2ac1e816ed Merge remote-tracking branch 'upstream/master' 2021-03-25 21:40:28 +01:00
d7a5b88fb4 improve stand animation set 2021-03-18 09:01:23 +00:00
d2c0afcff2 Merge remote-tracking branch 'upstream/master' 2021-03-12 12:23:24 +01:00
aa867c3fa0 add license file 2021-03-02 08:01:01 +00:00
70f40e2fb4 Merge remote-tracking branch 'upstream/master' 2021-01-23 12:53:58 +01:00
858167c386 add mod.conf 2021-01-21 10:13:07 +00:00
5f26b248b1 Merge remote-tracking branch 'upstream/master' 2020-12-15 23:24:51 +01:00
8dfead83c6 add on_punch and proper version checking (thanks MoNTE48) 2020-12-11 19:15:50 +00:00
0919faf76e Merge remote-tracking branch 'upstream/master' 2020-08-29 20:30:38 +02:00
0ddb468645 mt5.x translations added/updated (thanks dacmot) 2020-08-29 09:36:21 +01:00
a826466332 Merge remote-tracking branch 'upstream/master' 2020-08-25 20:05:23 +02:00
4d38b1b233 update translation detection 2020-08-25 09:54:28 +01:00
98617ac075 use translation from api 2020-08-25 09:44:26 +01:00
03127ee343 Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev 2020-06-20 15:34:26 +02:00
d32cc582c6 use 'texture_mods' to overlay horseshoes 2020-05-16 14:43:45 +01:00
e6fbb585ad Added italian locale thanks to Hamlet 2020-05-11 15:36:53 +01:00
a49f766a5f horses can now eat wheat, barley, oats, corn and apples 2020-05-01 08:26:45 +01:00
5414d09a9b right click horse to apply horseshoes 2020-03-27 22:21:15 +00:00
5bf8ecbbf1 apply horseshoe overlay to horse when shoes applied 2020-03-27 10:21:08 +00:00
2769a472cc Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev 2020-02-29 18:04:43 +01:00
4b6fb606a6 added additional languages 2020-02-14 18:10:51 +00:00
6e7db683ac Merge branch 'master' of yunohost.local:mtcontrib/mob_horse into nalc-1.2-dev 2019-12-22 13:50:07 +01:00
ed409a6e9a player cannot ride child horse 2019-06-15 20:29:09 +01:00
6fb7f56af4 Merge branch 'master' into nalc-1.2 2019-05-10 00:44:45 +02:00
8b206882a4 added check for 0.4.17 and 5.0 so player doesn't float above horse when riding new horse :) 2019-03-12 21:09:55 +00:00
77290fdd7e added screenshot 2019-03-02 10:05:16 +00:00
20 changed files with 299 additions and 106 deletions

147
init.lua
View File

@ -1,10 +1,24 @@
-- intllib
-- Load support for intllib.
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
local y_off = 20
if minetest.features.object_independent_selectionbox then
y_off = 10
end
-- horse shoes (speed, jump, break, overlay texture)
local shoes = {
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
["mobs:horseshoe_bronze"] = {7, 4, 4, "mobs_horseshoe_bronzeo.png"},
["mobs:horseshoe_mese"] = {9, 5, 8, "mobs_horseshoe_meseo.png"},
["mobs:horseshoe_diamond"] = {10, 6, 6, "mobs_horseshoe_diamondo.png"}
}
-- rideable horse
mobs:register_mob("mob_horse:horse", {
type = "animal",
visual = "mesh",
@ -15,7 +29,12 @@ mobs:register_mob("mob_horse:horse", {
speed_normal = 15,
speed_run = 30,
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_end = 100,
run_start = 75,
@ -31,7 +50,9 @@ mobs:register_mob("mob_horse:horse", {
fly = false,
walk_chance = 60,
view_range = 5,
follow = {"farming:wheat", "default:apple"},
follow = {
"farming:wheat", "default:apple", "farming:oat",
"farming:barley", "farming:corn"},
passive = true,
hp_min = 12,
hp_max = 16,
@ -53,7 +74,7 @@ mobs:register_mob("mob_horse:horse", {
self.max_speed_reverse = 2
self.accel = 6
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 20, z = -2}
self.driver_attach_at = {x = 0, y = y_off, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
end
@ -73,9 +94,12 @@ mobs:register_mob("mob_horse:horse", {
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
self.saddle = nil
self.saddle = nil
end
-- drop any horseshoes added
@ -85,6 +109,14 @@ self.saddle = nil
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)
-- make sure player is clicking
@ -102,10 +134,14 @@ self.saddle = nil
return
end
local player_name = clicker:get_player_name()
-- 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 tool = clicker:get_wielded_item()
local item = tool:get_name()
-- detatch player already riding horse
if self.driver and clicker == self.driver then
@ -119,10 +155,10 @@ self.saddle = nil
minetest.add_item(clicker:get_pos(), "mobs:saddle")
end
self.saddle = nil
self.saddle = nil
-- attach player to horse
elseif (not self.driver
elseif (not self.driver and not self.child
and clicker:get_wielded_item():get_name() == "mobs:saddle")
or self.saddle then
@ -134,13 +170,52 @@ self.saddle = nil
inv:remove_item("main", "mobs:saddle")
end
self.saddle = true
self.saddle = true
end
-- apply horseshoes
if item:find("mobs:horseshoe") then
-- drop any existing shoes
if self.shoed then
minetest.add_item(self.object:get_pos(), self.shoed)
end
local speed = shoes[item][1]
local jump = shoes[item][2]
local reverse = shoes[item][3]
local overlay = shoes[item][4]
self.max_speed_forward = speed
self.jump_height = jump
self.max_speed_reverse = reverse
self.accel = speed
self.shoed = item
-- apply horseshoe overlay to current horse texture
if overlay then
self.texture_mods = "^" .. overlay
self.object:set_texture_mod(self.texture_mods)
end
-- show horse speed and jump stats with shoes fitted
minetest.chat_send_player(player_name,
S("Horse shoes fitted -")
.. S(" speed: ") .. speed
.. S(" , jump height: ") .. jump
.. S(" , stop speed: ") .. reverse)
tool:take_item()
clicker:set_wielded_item(tool)
return
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
end,
})
mobs:spawn({
@ -157,46 +232,10 @@ mobs:spawn({
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
-- horseshoe helper function
local apply_shoes = function(name, itemstack, obj, shoes, speed, jump, reverse)
if obj.type ~= "object" then return end
local mob = obj.ref
local ent = mob:get_luaentity()
if ent and ent.name and ent.name == "mob_horse:horse" then
if ent.shoed then
minetest.add_item(mob:get_pos(), ent.shoed)
end
ent.max_speed_forward = speed
ent.jump_height = jump
ent.max_speed_reverse = reverse
ent.accel = speed
ent.shoed = shoes
minetest.chat_send_player(name, S("Horse shoes fitted -")
.. S(" speed: ") .. speed
.. S(" , jump height: ") .. jump
.. S(" , stop speed: ") .. reverse)
itemstack:take_item() ; return itemstack
else
minetest.chat_send_player(name, S("Horse shoes only work on horses!"))
end
end
-- steel horseshoes
minetest.register_craftitem(":mobs:horseshoe_steel", {
description = S("Steel HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_steel.png",
on_use = function(itemstack, user, pointed_thing)
return apply_shoes(user:get_player_name(), itemstack, pointed_thing,
"mobs:horseshoe_steel", 7, 4, 2)
end,
})
minetest.register_craft({
@ -212,10 +251,6 @@ minetest.register_craft({
minetest.register_craftitem(":mobs:horseshoe_bronze", {
description = S("Bronze HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_bronze.png",
on_use = function(itemstack, user, pointed_thing)
return apply_shoes(user:get_player_name(), itemstack, pointed_thing,
"mobs:horseshoe_bronze", 7, 4, 4)
end,
})
minetest.register_craft({
@ -231,10 +266,6 @@ minetest.register_craft({
minetest.register_craftitem(":mobs:horseshoe_mese", {
description = S("Mese HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_mese.png",
on_use = function(itemstack, user, pointed_thing)
return apply_shoes(user:get_player_name(), itemstack, pointed_thing,
"mobs:horseshoe_mese", 9, 5, 8)
end,
})
minetest.register_craft({
@ -250,10 +281,6 @@ minetest.register_craft({
minetest.register_craftitem(":mobs:horseshoe_diamond", {
description = S("Diamond HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_diamond.png",
on_use = function(itemstack, user, pointed_thing)
return apply_shoes(user:get_player_name(), itemstack, pointed_thing,
"mobs:horseshoe_diamond", 10, 6, 6)
end,
})
minetest.register_craft({

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

59
locale/it_IT.po Normal file
View File

@ -0,0 +1,59 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-06 00:07+0800\n"
"PO-Revision-Date: 2020-05-11 13:43+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n"
"Last-Translator: Hamlet <hamlatgitlab@riseup.net>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: it_IT\n"
#: init.lua
msgid "Horse"
msgstr "Cavallo"
#: init.lua
msgid "Horse shoes fitted -"
msgstr "Ferri di cavallo indossati -"
#: init.lua
msgid " speed: "
msgstr " velocità: "
#: init.lua
msgid " , jump height: "
msgstr " , altezza di salto: "
#: init.lua
msgid " , stop speed: "
msgstr " , velocità di arresto: "
#: init.lua
msgid "Horse shoes only work on horses!"
msgstr "I ferri di cavallo funzionano solo sui cavalli!"
#: init.lua
msgid "Steel HorseShoes (use on horse to apply)"
msgstr "Ferri di cavallo d'acciaio (usarli su un cavallo per applicarli)"
#: init.lua
msgid "Bronze HorseShoes (use on horse to apply)"
msgstr "Ferri di cavallo di bronzo (usarli su un cavallo per applicarli)"
#: init.lua
msgid "Mese HorseShoes (use on horse to apply)"
msgstr "Ferri di cavallo di mese (usarli su un cavallo per applicarli)"
#: init.lua
msgid "Diamond HorseShoes (use on horse to apply)"
msgstr "Ferri di cavallo di diamante (usarli su un cavallo per applicarli)"

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)=鋼馬蹄鐵(用在馬匹上)

58
locale/zh_CN.pot Normal file
View File

@ -0,0 +1,58 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-06 00:07+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua
msgid "Horse"
msgstr "马"
#: init.lua
msgid "Horse shoes fitted -"
msgstr "马蹄铁 -"
#: init.lua
msgid " speed: "
msgstr "速度:"
#: init.lua
msgid " , jump height: "
msgstr ",跳跃高度"
#: init.lua
msgid " , stop speed: "
msgstr ",停止速度:"
#: init.lua
msgid "Horse shoes only work on horses!"
msgstr "马蹄铁只对马有效!"
#: init.lua
msgid "Steel HorseShoes (use on horse to apply)"
msgstr "钢马蹄铁(用在马匹上)"
#: init.lua
msgid "Bronze HorseShoes (use on horse to apply)"
msgstr "青铜马蹄铁(用在马匹上)"
#: init.lua
msgid "Mese HorseShoes (use on horse to apply)"
msgstr "黄石马蹄铁(用在马匹上)"
#: init.lua
msgid "Diamond HorseShoes (use on horse to apply)"
msgstr "钻石马蹄铁(用在马匹上)"

12
locale/zh_CN.txt Normal file
View File

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

12
locale/zh_TW.txt Normal file
View File

@ -0,0 +1,12 @@
#Mod: mob_horse
Horse = 馬
Horse shoes fitted - = 馬蹄鐵 -
speed: = 速度:
, jump height: = ,跳躍高度:
, stop speed: = ,停止速度:
Horse shoes only work on horses! = 馬蹄鐵只對馬有效!
Steel HorseShoes (use on horse to apply) = 鋼馬蹄鐵(用在馬匹上)
Bronze HorseShoes (use on horse to apply) = 青銅馬蹄鐵(用在馬匹上)
Mese HorseShoes (use on horse to apply) = 黃石馬蹄鐵(用在馬匹上)
Diamond 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.

View File

@ -5,11 +5,11 @@ There are three different horse textures (white, brown, black) which will spawn
---
### Taming
Horses can be tamed with 10x wheat or apples which then allows the player to pick up the horse using a lasso and ride by right-clicking with a saddle.
Horses can be tamed with 10x wheat, apple, barley, oats of corn which then allows the player to pick up the horse using a lasso and ride by right-clicking with a saddle.
---
### Horseshoes
Horseshoes can be crafted using steel, bronze, mese and diamond (4x ingots - 2 down either side with 1x block top middle) and placed on a horse by punching with the item. These can make horses run faster or jump higher depending on tier.
Horseshoes can be crafted using steel, bronze, mese and diamond (4x ingots - 2 down either side with 1x block top middle) and placed on a horse by right clicking with the item. These can make horses run faster or jump higher while riding depending on tier.
---
### Dead Horse

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B