diff --git a/depends.txt b/depends.txt index 0dc5ef3..5ccba0d 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ mobs lucky_block? +intllib? diff --git a/init.lua b/init.lua index 8ee928a..a769731 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,8 @@ +-- intllib +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP .. "/intllib.lua") + -- rideable horse mobs:register_mob("mob_horse:horse", { @@ -18,7 +22,7 @@ mobs:register_mob("mob_horse:horse", { run_end = 100, }, textures = { - {"mobs_horse.png"}, + {"mobs_horse.png"}, -- textures by Mjollna {"mobs_horsepeg.png"}, {"mobs_horseara.png"} }, @@ -34,10 +38,10 @@ mobs:register_mob("mob_horse:horse", { armor = 100, lava_damage = 10, fall_damage = 10, - water_damage = 5, + water_damage = 10, makes_footstep_sound = true, drops = { - {name = "mobs:meat_raw", chance = 1, min = 2, max = 3} + {name = "mobs:leather", chance = 1, min = 0, max = 2} }, do_custom = function(self, dtime) @@ -71,6 +75,7 @@ mobs:register_mob("mob_horse:horse", { if self.driver then minetest.add_item(pos, "mobs:saddle") mobs.detach(self.driver, {x = 1, y = 0, z = 1}) +self.saddle = nil end -- drop any horseshoes added @@ -114,15 +119,22 @@ mobs:register_mob("mob_horse:horse", { minetest.add_item(clicker:get_pos(), "mobs:saddle") end +self.saddle = nil + -- attach player to horse - elseif not self.driver - and clicker:get_wielded_item():get_name() == "mobs:saddle" then + elseif (not self.driver + and clicker:get_wielded_item():get_name() == "mobs:saddle") + or self.saddle then self.object:set_properties({stepheight = 1.1}) mobs.attach(self, clicker) -- take saddle from inventory - inv:remove_item("main", "mobs:saddle") + if not self.saddle then + inv:remove_item("main", "mobs:saddle") + end + +self.saddle = true end end @@ -134,15 +146,15 @@ mobs:register_mob("mob_horse:horse", { mobs:spawn({ name = "mob_horse:horse", nodes = {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, - chance = 15000, - min_light = 10, + min_light = 14, + interval = 60, + chance = 16000, min_height = 10, max_height = 31000, - active_object_count = 1, day_toggle = true, }) -mobs:register_egg("mob_horse:horse", "Horse", "wool_brown.png", 1) +mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1) -- horseshoe helper function @@ -165,21 +177,21 @@ local apply_shoes = function(name, itemstack, obj, shoes, speed, jump, reverse) ent.accel = speed ent.shoed = shoes - minetest.chat_send_player(name, "Horse shoes fitted -" - .. " speed: " .. speed - .. " , jump height: " .. jump - .. " , stop speed: " .. reverse) + 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, "Horse shoes only work on horses!") + minetest.chat_send_player(name, S("Horse shoes only work on horses!")) end end -- steel horseshoes minetest.register_craftitem(":mobs:horseshoe_steel", { - description = "Steel HorseShoes (use on horse to apply)", + 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, @@ -198,7 +210,7 @@ minetest.register_craft({ -- bronze horseshoes minetest.register_craftitem(":mobs:horseshoe_bronze", { - description = "Bronze HorseShoes (use on horse to apply)", + 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, @@ -217,7 +229,7 @@ minetest.register_craft({ -- mese horseshoes minetest.register_craftitem(":mobs:horseshoe_mese", { - description = "Mese HorseShoes (use on horse to apply)", + 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, @@ -236,7 +248,7 @@ minetest.register_craft({ -- diamond horseshoes minetest.register_craftitem(":mobs:horseshoe_diamond", { - description = "Diamond HorseShoes (use on horse to apply)", + 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, @@ -263,4 +275,4 @@ lucky_block:add_blocks({ {"dro", {"mobs:horseshoe_diamond"}}, }) -end \ No newline at end of file +end diff --git a/intllib.lua b/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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 diff --git a/locale/ms.po b/locale/ms.po new file mode 100644 index 0000000..fa76d1a --- /dev/null +++ b/locale/ms.po @@ -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 , 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) \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)" diff --git a/locale/template.pot b/locale/template.pot new file mode 100644 index 0000000..7811c0e --- /dev/null +++ b/locale/template.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..952bc2e --- /dev/null +++ b/readme.md @@ -0,0 +1,18 @@ +# MOB Horse + +### Spawning +There are three different horse textures (white, brown, black) which will spawn on green grassy areas and dry dirt areas in Ethereal mapgen. + +--- +### 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. + +--- +### 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. + +--- +### Dead Horse +When riding a horse monsters will generally attack the horse first to get to player riding it, when horse dies the player is dismounted and it will drop any shoes or saddles in use as well as some horse meat. + +#### Lucky Blocks: 4 diff --git a/textures/mobs_horse.png b/textures/mobs_horse.png index e0c6f61..7ceced5 100644 Binary files a/textures/mobs_horse.png and b/textures/mobs_horse.png differ diff --git a/textures/mobs_horseara.png b/textures/mobs_horseara.png index 7068bf9..ae8ce30 100644 Binary files a/textures/mobs_horseara.png and b/textures/mobs_horseara.png differ diff --git a/textures/mobs_horsepeg.png b/textures/mobs_horsepeg.png index f4a7e76..7407842 100644 Binary files a/textures/mobs_horsepeg.png and b/textures/mobs_horsepeg.png differ diff --git a/textures/mobs_horseshoe_bronze.png b/textures/mobs_horseshoe_bronze.png index 95ea057..5add502 100644 Binary files a/textures/mobs_horseshoe_bronze.png and b/textures/mobs_horseshoe_bronze.png differ diff --git a/textures/mobs_horseshoe_diamond.png b/textures/mobs_horseshoe_diamond.png index 7026f79..e67c404 100644 Binary files a/textures/mobs_horseshoe_diamond.png and b/textures/mobs_horseshoe_diamond.png differ diff --git a/textures/mobs_horseshoe_mese.png b/textures/mobs_horseshoe_mese.png index 0a3ce62..f235331 100644 Binary files a/textures/mobs_horseshoe_mese.png and b/textures/mobs_horseshoe_mese.png differ diff --git a/textures/mobs_horseshoe_steel.png b/textures/mobs_horseshoe_steel.png index 57ec7ce..c7c51b9 100644 Binary files a/textures/mobs_horseshoe_steel.png and b/textures/mobs_horseshoe_steel.png differ