Compare commits

24 Commits

Author SHA1 Message Date
94351e84e0 Merge remote-tracking branch 'upstream/master' 2025-03-20 11:48:18 +01:00
3deab2d01c view range 7 2025-01-11 11:36:03 +00:00
58d84da9eb horse can defend itself 2025-01-11 11:35:27 +00:00
ac8cb2ec70 tweak on_sound example 2024-10-01 09:10:37 +01:00
2ff662c2e1 Merge remote-tracking branch 'upstream/master' 2024-09-15 09:21:46 +02:00
868e5a88f4 tidy code 2024-08-10 14:57:23 +01:00
12e6d718cb edit on_sound example to use new loudness scale 2024-08-04 08:27:28 +01:00
9f272940f6 add on_sound example 2024-08-03 11:35:57 +01:00
b70e7d81b5 fix fall damage value 2024-07-01 07:45:14 +01:00
e36feea1a4 Merge remote-tracking branch 'upstream/master' 2023-11-22 23:46:14 +01:00
cf4bf3df99 increase saddled horse stepheight to 1.2 2023-10-09 07:21:14 +01:00
a97f7e04bb tidy code 2023-08-13 10:45:19 +01:00
83198a8531 remove intllib 2023-08-08 16:43:18 +01:00
1c10898fb2 Merge remote-tracking branch 'upstream/master' 2023-06-07 21:48:27 +02:00
2d2211c51d amend loaded msg 2022-12-19 17:08:55 +00:00
2e4cc8a90b fix driver eye level 2022-09-29 14:47:53 +01:00
55f921d7c9 code tidy 2022-09-27 11:34:33 +01:00
af59d1e2b7 Merge remote-tracking branch 'upstream/master' 2022-03-05 11:24:11 +01:00
4022ae9a02 horses are good swimmers, remove water damage 2022-02-15 09:21:08 +00:00
f7ac229ccf fix typo (thx SwissaplS) 2022-02-08 18:20:38 +00:00
6d4701ca5f Merge remote-tracking branch 'upstream/master' 2022-01-22 20:01:06 +01:00
8996ad27d8 update translation checks 2022-01-20 08:57:36 +00:00
f550d5b4a1 Merge remote-tracking branch 'upstream/master' 2021-11-26 21:42:13 +01:00
9e0021a0f8 fix intllib return 2021-11-14 14:23:03 +00:00
10 changed files with 71 additions and 340 deletions

View File

@ -1,3 +0,0 @@
mobs
lucky_block?
intllib?

142
init.lua
View File

@ -1,18 +1,11 @@
-- Load support for intllib.
-- translation and get mod path
local S = minetest.get_translator("mob_horse")
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local S = minetest.get_translator and minetest.get_translator("mob_horse") or
dofile(MP .. "intllib.lua")
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
-- 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"},
@ -21,8 +14,8 @@ local shoes = {
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
}
-- rideable horse
mobs:register_mob("mob_horse:horse", {
type = "animal",
visual = "mesh",
@ -30,19 +23,13 @@ mobs:register_mob("mob_horse:horse", {
mesh = "mobs_horse.x",
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4},
animation = {
speed_normal = 15,
speed_run = 30,
stand_start = 25,
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,
run_end = 100
speed_normal = 15, speed_run = 30,
stand_start = 25, 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, run_end = 100,
punch_start = 55, punch_end = 75, punch_speed = 35,
},
textures = {
{"mobs_horse.png"}, -- textures by Mjollna
@ -50,23 +37,27 @@ mobs:register_mob("mob_horse:horse", {
{"mobs_horseara.png"}
},
fear_height = 3,
runaway = true,
--runaway = true,
fly = false,
walk_chance = 60,
view_range = 5,
view_range = 7,
follow = {
"farming:wheat", "default:apple", "farming:oat",
"farming:barley", "farming:corn"},
passive = true,
hp_min = 12,
hp_max = 16,
armor = 200,
"farming:barley", "farming:corn"
},
passive = false, attack_type = "dogfight", reach = 2.5, damage = 3,
attack_monsters = true,
hp_min = 15,
hp_max = 23,
armor = 100,
lava_damage = 5,
fall_damage = 5,
water_damage = 1,
fire_damage = 4,
fall_damage = 1,
water_damage = 0,
makes_footstep_sound = true,
drops = {
{name = "mobs:leather", chance = 1, min = 0, max = 2}
{name = "mobs:leather", chance = 1, min = 0, max = 2},
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2}
},
do_custom = function(self, dtime)
@ -78,8 +69,8 @@ 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 = y_off, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_attach_at = {x = 0, y = 10, z = -2}
self.driver_eye_offset = {x = 0, y = 10 + 3, z = 0}
self.driver_scale = {x = 0.8, y = 0.8} -- shrink driver to fit model
end
@ -123,19 +114,13 @@ mobs:register_mob("mob_horse:horse", {
on_rightclick = function(self, clicker)
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
if not clicker or not clicker:is_player() then return end
-- feed, tame or heal horse
if mobs:feed_tame(self, clicker, 10, true, true) then
return
end
if mobs:feed_tame(self, clicker, 10, true, true) then return end
-- applying protection rune
if mobs:protect(self, clicker) then
return
end
if mobs:protect(self, clicker) then return end
local player_name = clicker:get_player_name()
@ -155,14 +140,13 @@ mobs:register_mob("mob_horse:horse", {
end
-- attach saddle to horse
if not self.driver
and not self.child
if not self.driver and not self.child
and clicker:get_wielded_item():get_name() == "mobs:saddle"
and not self.saddle then
self.saddle = true
self.order = "stand"
self.object:set_properties({stepheight = 1.1})
self.object:set_properties({stepheight = 1.2})
-- take saddle from inventory
inv:remove_item("main", "mobs:saddle")
@ -195,6 +179,7 @@ mobs:register_mob("mob_horse:horse", {
-- apply horseshoe overlay to current horse texture
if overlay then
self.texture_mods = "^" .. overlay
if self.saddle then
@ -227,10 +212,16 @@ mobs:register_mob("mob_horse:horse", {
if self.saddle and self.owner == player_name then
mobs.attach(self, clicker)
end
end,
--[[
on_sound = function(self, def)
if def.loudness > 0.8 then -- if loud enough startle horse into jumping
self.object:set_velocity({x = 0, y = 5, z = 0})
end
end
]]
})
-- check for custom spawn.lua
local input = io.open(MP .. "spawn.lua", "r")
@ -252,11 +243,12 @@ else
})
end
-- spawn egg
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
-- steel horseshoes
minetest.register_craftitem(":mobs:horseshoe_steel", {
description = S("Steel HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_steel.png",
@ -272,6 +264,7 @@ minetest.register_craft({
})
-- bronze horseshoes
minetest.register_craftitem(":mobs:horseshoe_bronze", {
description = S("Bronze HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_bronze.png"
@ -287,6 +280,7 @@ minetest.register_craft({
})
-- mese horseshoes
minetest.register_craftitem(":mobs:horseshoe_mese", {
description = S("Mese HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_mese.png"
@ -302,6 +296,7 @@ minetest.register_craft({
})
-- diamond horseshoes
minetest.register_craftitem(":mobs:horseshoe_diamond", {
description = S("Diamond HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_diamond.png"
@ -317,36 +312,35 @@ minetest.register_craft({
})
-- crystal horseshoes
if minetest.get_modpath("ethereal") then
minetest.register_craftitem(":mobs:horseshoe_crystal", {
description = S("Crystal HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_crystal.png"
})
minetest.register_craft({
output = "mobs:horseshoe_crystal",
recipe = {
{"", "ethereal:crystal_block", ""},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"}
}
})
minetest.register_craftitem(":mobs:horseshoe_crystal", {
description = S("Crystal HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_crystal.png"
})
minetest.register_craft({
output = "mobs:horseshoe_crystal",
recipe = {
{"", "ethereal:crystal_block", ""},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"}
}
})
end
-- lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"mobs:horseshoe_steel"}},
{"dro", {"mobs:horseshoe_bronze"}},
{"dro", {"mobs:horseshoe_mese"}},
{"dro", {"mobs:horseshoe_diamond"}},
{"dro", {"mobs:horseshoe_crystal"}}
})
lucky_block:add_blocks({
{"dro", {"mobs:horseshoe_steel"}},
{"dro", {"mobs:horseshoe_bronze"}},
{"dro", {"mobs:horseshoe_mese"}},
{"dro", {"mobs:horseshoe_diamond"}},
{"dro", {"mobs:horseshoe_crystal"}}
})
end
minetest.log("action", "[mob_horse] loaded.")
print("[MOD] Mobs Redo Horse loaded")

View File

@ -1,3 +0,0 @@
-- Support for the old multi-load method
dofile(minetest.get_modpath("intllib").."/init.lua")

View File

@ -1,59 +0,0 @@
# 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)"

View File

@ -1,59 +0,0 @@
# 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: 2018-02-06 00:14+0800\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.0.6\n"
"Last-Translator: MuhdNurHidayat (MNH48) <mnh48mail@gmail.com>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Language: ms\n"
#: init.lua
msgid "Horse"
msgstr "Kuda"
#: init.lua
msgid "Horse shoes fitted -"
msgstr "Ladam telah dipasang pada kuda -"
#: init.lua
msgid " speed: "
msgstr " kelajuan: "
#: init.lua
msgid " , jump height: "
msgstr " , ketinggian lompat: "
#: init.lua
msgid " , stop speed: "
msgstr " , kelajuan berhenti: "
#: init.lua
msgid "Horse shoes only work on horses!"
msgstr "Ladam hanya boleh dipakaikan pada kuda!"
#: init.lua
msgid "Steel HorseShoes (use on horse to apply)"
msgstr "Ladam Kuda Keluli (guna pada kuda untuk pakaikan ia)"
#: init.lua
msgid "Bronze HorseShoes (use on horse to apply)"
msgstr "Ladam Kuda Gangsa (guna pada kuda untuk pakaikan ia)"
#: init.lua
msgid "Mese HorseShoes (use on horse to apply)"
msgstr "Ladam Kuda Mese (guna pada kuda untuk pakaikan ia)"
#: init.lua
msgid "Diamond HorseShoes (use on horse to apply)"
msgstr "Ladam Kuda Intan (guna pada kuda untuk pakaikan ia)"

View File

@ -1,58 +0,0 @@
# 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 ""

View File

@ -1,58 +0,0 @@
# 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 "钻石马蹄铁(用在马匹上)"

View File

@ -1,12 +0,0 @@
#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) = 钻石马蹄铁(用在马匹上)

View File

@ -1,12 +0,0 @@
#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) = 鑽石馬蹄鐵(用在馬匹上)

View File

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