Compare commits

...

8 Commits

3 changed files with 29 additions and 5 deletions

View File

@ -6,7 +6,7 @@ local S = minetest.get_translator and minetest.get_translator("mob_horse") or
-- 0.4.17 or 5.0 check
local y_off = 20
if minetest.registered_nodes["default:permafrost"] then
if minetest.features.object_independent_selectionbox then
y_off = 10
end
@ -29,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,
@ -104,6 +109,14 @@ mobs:register_mob("mob_horse:horse", {
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
@ -121,8 +134,10 @@ mobs:register_mob("mob_horse:horse", {
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()
@ -184,13 +199,15 @@ mobs:register_mob("mob_horse:horse", {
end
-- 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(" speed: ") .. speed
.. S(" , jump height: ") .. jump
.. S(" , stop speed: ") .. reverse)
tool:take_item() ; clicker:set_wielded_item(tool)
tool:take_item()
clicker:set_wielded_item(tool)
return
end

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

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.