forked from mtcontrib/mob_horse
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2ff662c2e1
64
init.lua
64
init.lua
@ -1,11 +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 MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
||||||
|
|
||||||
-- Translation support
|
|
||||||
local S = minetest.get_translator("mob_horse")
|
|
||||||
|
|
||||||
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
|
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
|
||||||
|
|
||||||
local shoes = {
|
local shoes = {
|
||||||
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
|
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
|
||||||
["mobs:horseshoe_bronze"] = {7, 4, 4, "mobs_horseshoe_bronzeo.png"},
|
["mobs:horseshoe_bronze"] = {7, 4, 4, "mobs_horseshoe_bronzeo.png"},
|
||||||
@ -14,8 +14,8 @@ local shoes = {
|
|||||||
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
|
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- rideable horse
|
-- rideable horse
|
||||||
|
|
||||||
mobs:register_mob("mob_horse:horse", {
|
mobs:register_mob("mob_horse:horse", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
@ -23,19 +23,12 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
mesh = "mobs_horse.x",
|
mesh = "mobs_horse.x",
|
||||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4},
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4},
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 15,
|
speed_normal = 15, speed_run = 30,
|
||||||
speed_run = 30,
|
stand_start = 25, stand_end = 50, -- 75
|
||||||
stand_start = 25,
|
stand2_start = 25, stand2_end = 25,
|
||||||
stand_end = 50, -- 75
|
stand3_start = 55, stand3_end = 75, stand3_loop = false,
|
||||||
stand2_start = 25,
|
walk_start = 75, walk_end = 100,
|
||||||
stand2_end = 25,
|
run_start = 75, run_end = 100
|
||||||
stand3_start = 55,
|
|
||||||
stand3_end = 75,
|
|
||||||
stand3_loop = false,
|
|
||||||
walk_start = 75,
|
|
||||||
walk_end = 100,
|
|
||||||
run_start = 75,
|
|
||||||
run_end = 100
|
|
||||||
},
|
},
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_horse.png"}, -- textures by Mjollna
|
{"mobs_horse.png"}, -- textures by Mjollna
|
||||||
@ -56,7 +49,7 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
hp_max = 16,
|
hp_max = 16,
|
||||||
armor = 200,
|
armor = 200,
|
||||||
lava_damage = 5,
|
lava_damage = 5,
|
||||||
fall_damage = 5,
|
fall_damage = 1,
|
||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
drops = {
|
drops = {
|
||||||
@ -117,19 +110,13 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
-- make sure player is clicking
|
-- make sure player is clicking
|
||||||
if not clicker or not clicker:is_player() then
|
if not clicker or not clicker:is_player() then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- feed, tame or heal horse
|
-- feed, tame or heal horse
|
||||||
if mobs:feed_tame(self, clicker, 10, true, true) then
|
if mobs:feed_tame(self, clicker, 10, true, true) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- applying protection rune
|
-- applying protection rune
|
||||||
if mobs:protect(self, clicker) then
|
if mobs:protect(self, clicker) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local player_name = clicker:get_player_name()
|
local player_name = clicker:get_player_name()
|
||||||
|
|
||||||
@ -149,8 +136,7 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- attach saddle to horse
|
-- attach saddle to horse
|
||||||
if not self.driver
|
if not self.driver and not self.child
|
||||||
and not self.child
|
|
||||||
and clicker:get_wielded_item():get_name() == "mobs:saddle"
|
and clicker:get_wielded_item():get_name() == "mobs:saddle"
|
||||||
and not self.saddle then
|
and not self.saddle then
|
||||||
|
|
||||||
@ -222,10 +208,17 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
if self.saddle and self.owner == player_name then
|
if self.saddle and self.owner == player_name then
|
||||||
mobs.attach(self, clicker)
|
mobs.attach(self, clicker)
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
--[[
|
||||||
|
on_sound = function(self, def)
|
||||||
|
-- loudness ranges from (0.0 = cannot hear, to 1.0 = next to sound)
|
||||||
|
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
|
end
|
||||||
|
]]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- check for custom spawn.lua
|
-- check for custom spawn.lua
|
||||||
local input = io.open(MP .. "spawn.lua", "r")
|
local input = io.open(MP .. "spawn.lua", "r")
|
||||||
|
|
||||||
@ -247,11 +240,12 @@ else
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- spawn egg
|
||||||
|
|
||||||
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
|
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
|
||||||
|
|
||||||
|
|
||||||
-- steel horseshoes
|
-- steel horseshoes
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_steel", {
|
minetest.register_craftitem(":mobs:horseshoe_steel", {
|
||||||
description = S("Steel HorseShoes (use on horse to apply)"),
|
description = S("Steel HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_steel.png",
|
inventory_image = "mobs_horseshoe_steel.png",
|
||||||
@ -267,6 +261,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- bronze horseshoes
|
-- bronze horseshoes
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_bronze", {
|
minetest.register_craftitem(":mobs:horseshoe_bronze", {
|
||||||
description = S("Bronze HorseShoes (use on horse to apply)"),
|
description = S("Bronze HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_bronze.png"
|
inventory_image = "mobs_horseshoe_bronze.png"
|
||||||
@ -282,6 +277,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- mese horseshoes
|
-- mese horseshoes
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_mese", {
|
minetest.register_craftitem(":mobs:horseshoe_mese", {
|
||||||
description = S("Mese HorseShoes (use on horse to apply)"),
|
description = S("Mese HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_mese.png"
|
inventory_image = "mobs_horseshoe_mese.png"
|
||||||
@ -297,6 +293,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- diamond horseshoes
|
-- diamond horseshoes
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_diamond", {
|
minetest.register_craftitem(":mobs:horseshoe_diamond", {
|
||||||
description = S("Diamond HorseShoes (use on horse to apply)"),
|
description = S("Diamond HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_diamond.png"
|
inventory_image = "mobs_horseshoe_diamond.png"
|
||||||
@ -312,6 +309,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- crystal horseshoes
|
-- crystal horseshoes
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if minetest.get_modpath("ethereal") then
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_crystal", {
|
minetest.register_craftitem(":mobs:horseshoe_crystal", {
|
||||||
@ -329,8 +327,8 @@ if minetest.get_modpath("ethereal") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- lucky blocks
|
-- lucky blocks
|
||||||
|
|
||||||
if minetest.get_modpath("lucky_block") then
|
if minetest.get_modpath("lucky_block") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
|
Loading…
Reference in New Issue
Block a user