Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2021-06-20 17:11:26 +02:00
commit 0cbaa0b223
3 changed files with 41 additions and 29 deletions

View File

@ -77,6 +77,7 @@ mobs:register_mob("mob_horse:horse", {
self.terrain_type = 3 self.terrain_type = 3
self.driver_attach_at = {x = 0, y = y_off, z = -2} self.driver_attach_at = {x = 0, y = y_off, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0} self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 0.8, y = 0.8} -- shrink driver to fit model
end end
-- if driver present allow control of horse -- if driver present allow control of horse
@ -92,22 +93,20 @@ mobs:register_mob("mob_horse:horse", {
on_die = function(self, pos) on_die = function(self, pos)
-- drop saddle when horse is killed while riding -- detach player from horse properly
-- also detach from horse properly
if self.driver then if self.driver then
minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1}) mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
self.saddle = nil -- drop saddle if found
if self.saddle then
minetest.add_item(pos, "mobs:saddle")
end end
-- drop any horseshoes added -- drop any horseshoes added
if self.shoed then if self.shoed then
minetest.add_item(pos, self.shoed) minetest.add_item(pos, self.shoed)
end end
end, end,
do_punch = function(self, hitter) do_punch = function(self, hitter)
@ -149,29 +148,27 @@ mobs:register_mob("mob_horse:horse", {
mobs.detach(clicker, {x = 1, y = 0, z = 1}) mobs.detach(clicker, {x = 1, y = 0, z = 1})
-- add saddle back to inventory return
if inv:room_for_item("main", "mobs:saddle") then end
inv:add_item("main", "mobs:saddle")
else
minetest.add_item(clicker:get_pos(), "mobs:saddle")
end
self.saddle = nil -- attach saddle to horse
if not self.driver
-- attach player to horse and not self.child
elseif (not self.driver 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
or self.saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
if not self.saddle then
inv:remove_item("main", "mobs:saddle")
end
self.saddle = true self.saddle = true
self.order = "stand"
self.object:set_properties({stepheight = 1.1})
-- take saddle from inventory
inv:remove_item("main", "mobs:saddle")
self.texture_mods = self.texture_mods .. "^mobs_saddle_overlay.png"
self.object:set_texture_mod(self.texture_mods)
return
end end
-- apply horseshoes -- apply horseshoes
@ -196,6 +193,12 @@ mobs:register_mob("mob_horse:horse", {
-- apply horseshoe overlay to current horse texture -- apply horseshoe overlay to current horse texture
if overlay then if overlay then
self.texture_mods = "^" .. overlay self.texture_mods = "^" .. overlay
if self.saddle then
self.texture_mods = self.texture_mods
.. "^mobs_saddle_overlay.png"
end
self.object:set_texture_mod(self.texture_mods) self.object:set_texture_mod(self.texture_mods)
end end
@ -215,8 +218,13 @@ mobs:register_mob("mob_horse:horse", {
end end
-- used to capture horse with magic lasso -- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) if mobs:capture_mob(self, clicker, nil, nil, 100, false, nil) then return end
end,
-- ride horse if saddled
if self.saddle and self.owner == player_name then
mobs.attach(self, clicker)
end
end
}) })
mobs:spawn({ mobs:spawn({

View File

@ -7,6 +7,10 @@ There are three different horse textures (white, brown, black) which will spawn
### Taming ### Taming
Horses can be tamed with 10x wheat, apple, barley, oats of corn which then allows the player to pick up the horse using a lasso and ride by right-clicking with a saddle. Horses can be tamed with 10x wheat, apple, barley, oats of corn which then allows the player to pick up the horse using a lasso and ride by right-clicking with a saddle.
---
### Saddle
Right clicking a horse with a saddle equips it and the horse will be ordered to stand still until you wish to ride.
--- ---
### Horseshoes ### Horseshoes
Horseshoes can be crafted using steel, bronze, mese, diamond and crystal (4x ingots - 2 down either side with 1x block top middle) and placed on a horse by right clicking with the item. These can make horses run faster or jump higher while riding depending on tier. Horseshoes can be crafted using steel, bronze, mese, diamond and crystal (4x ingots - 2 down either side with 1x block top middle) and placed on a horse by right clicking with the item. These can make horses run faster or jump higher while riding depending on tier.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB