merge from mob_horse repo

master
Juraj Vajda 2018-12-11 00:11:56 -05:00
parent ddea73117d
commit 2bffcbf22c
13 changed files with 213 additions and 20 deletions

View File

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

View File

@ -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
end

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- 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

59
locale/ms.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: 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)"

58
locale/template.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 ""

18
readme.md Normal file
View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 851 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 148 B