Replace mobs_redo horse mod with one ported to creatures engine...

Release: https://github.com/AntumMT/mod-horse/tree/d7c73f6
master
Jordan Irwin 2021-05-03 05:37:25 -07:00
parent 116c396dff
commit 608662dd67
27 changed files with 6580 additions and 250 deletions

View File

@ -88,6 +88,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [folks][] ([GPL][lic.gpl3.0]) -- version: [0.2.0][ver.folks] *2021-02-23*
* general/
* [mobs_animal][] ([MIT][lic.mobs_animal]) -- version: [80e72a4 Git][ver.mobs_animal] *2021-04-13* ([patched][patch.mobs_animal])
* [horse][] ([MIT][lic.horse]) -- version: [d7c73f6 Git][ver.horse] *2021-05-03*
* [monsters_aggressive][] (see individual mods for licensing) -- version: [89a8187 Git][ver.monsters_aggressive] *2017-08-30*
* [ghost][creatures] ([Zlib][lic.creatures] / [CC BY-SA][lic.ccbysa3.0]) -- version: [2d3308c Git][ver.ghost] *2021-04-30*
* [oerkki][creatures] ([Zlib][lic.creatures] / [CC BY-SA][lic.ccbysa3.0]) -- version: [eb98833 Git][ver.oerkki] *2021-04-30*
@ -293,6 +294,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[home_gui]: http://cornernote.github.io/minetest-home_gui/
[home_workshop]: https://gitlab.com/VanessaE/home_workshop_modpack
[homedecor]: https://forum.minetest.net/viewtopic.php?t=2041
[horse]: https://github.com/AntumMT/mod-horse
[hovercraft]: https://forum.minetest.net/viewtopic.php?t=6722
[hudbars]: https://forum.minetest.net/viewtopic.php?t=11153
[hudmap]: https://github.com/stujones11/hudmap
@ -396,6 +398,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.fort_spikes]: mods/buildings/fort_spikes/LICENSE
[lic.headanim]: mods/player/visuals/headanim/LICENSE
[lic.home_gui]: mods/ui/home_gui/LICENSE
[lic.horse]: mods/mobiles/horse/LICENSE.txt
[lic.hidename]: mods/antum/hidename/LICENSE.txt
[lic.hill_nodebox]: mods/world/hill_nodebox/LICENSE
[lic.homedecor]: mods/modpacks/homedecor/LICENSE
@ -521,6 +524,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.home_gui]: https://github.com/cornernote/minetest-home_gui/tree/a291a09
[ver.home_workshop]: https://gitlab.com/VanessaE/home_workshop_modpack/tree/03325e8
[ver.homedecor]: https://gitlab.com/VanessaE/homedecor_modpack/tree/81e0d4e
[ver.horse]: https://github.com/AntumMT/mod-horse/tree/d7c73f6
[ver.hovercraft]: https://github.com/stujones11/hovercraft/tree/4d50e68
[ver.hudbars]: http://repo.or.cz/minetest_hudbars.git/tree/0684bac
[ver.hudmap]: https://github.com/stujones11/hudmap/tree/3b8bdc0

View File

@ -1 +0,0 @@
mobs

View File

@ -1,249 +0,0 @@
-- rideable horse
mobs:register_mob("mob_horse:horse", {
type = "animal",
visual = "mesh",
visual_size = {x = 1.20, y = 1.20},
mesh = "mobs_horse.x",
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4},
animation = {
speed_normal = 15,
speed_run = 30,
stand_start = 25,
stand_end = 75,
walk_start = 75,
walk_end = 100,
run_start = 75,
run_end = 100,
},
textures = {
{"mobs_horse.png"},
{"mobs_horsepeg.png"},
{"mobs_horseara.png"}
},
fear_height = 3,
runaway = true,
fly = false,
walk_chance = 60,
view_range = 5,
follow = {"farming:wheat", "default:apple"},
passive = true,
hp_min = 12,
hp_max = 16,
armor = 200,
lava_damage = 5,
fall_damage = 5,
water_damage = 1,
makes_footstep_sound = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 3},
{name = "mobs:leather", chance = 1, min = 1, max = 1},
},
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 6
self.max_speed_reverse = 2
self.accel = 6
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 20, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
end
-- if driver present allow control of horse
if self.driver then
mobs.drive(self, "walk", "stand", false, dtime)
return false -- skip rest of mob functions
end
return true
end,
on_die = function(self, pos)
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
-- drop any horseshoes added
if self.shoed then
minetest.add_item(pos, self.shoed)
end
end,
on_rightclick = function(self, clicker)
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
-- feed, tame or heal horse
if mobs:feed_tame(self, clicker, 10, true, true) then
return
end
-- make sure tamed horse is being clicked by owner only
if self.tamed and self.owner == clicker:get_player_name() then
local inv = clicker:get_inventory()
-- detatch player already riding horse
if self.driver and clicker == self.driver then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
-- add saddle back to inventory
if inv:room_for_item("main", "mobs:saddle") then
inv:add_item("main", "mobs:saddle")
else
minetest.add_item(clicker:getpos(), "mobs:saddle")
end
-- attach player to horse
elseif not self.driver
and clicker:get_wielded_item():get_name() == "mobs:saddle" then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
inv:remove_item("main", "mobs:saddle")
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
mobs:spawn({
name = "mob_horse:horse",
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
min_light = 10,
chance = 15000,
min_height = 10,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mob_horse:horse", "Horse", "wool_brown.png", 1)
-- horseshoe helper function
local apply_shoes = function(name, itemstack, obj, shoes, speed, jump, reverse)
if obj.type ~= "object" then return end
local mob = obj.ref
local ent = mob:get_luaentity()
if ent.name and ent.name == "mob_horse:horse" then
if ent.shoed then
minetest.add_item(mob:getpos(), ent.shoed)
end
ent.max_speed_forward = speed
ent.jump_height = jump
ent.max_speed_reverse = reverse
ent.accel = speed
ent.shoed = shoes
minetest.chat_send_player(name, "Horse shoes fitted -"
.. " speed: " .. speed
.. " , jump height: " .. jump
.. " , stop speed: " .. reverse)
itemstack:take_item() ; return itemstack
else
minetest.chat_send_player(name, "Horse shoes only work on horses!")
end
end
-- steel horseshoes
minetest.register_craftitem(":mobs:horseshoe_steel", {
description = "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,
"mobs:horseshoe_steel", 7, 4, 2)
end,
})
minetest.register_craft({
output = "mobs:horseshoe_steel",
recipe = {
{"", "default:steelblock", ""},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
}
})
-- bronze horseshoes
minetest.register_craftitem(":mobs:horseshoe_bronze", {
description = "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,
"mobs:horseshoe_bronze", 7, 4, 4)
end,
})
minetest.register_craft({
output = "mobs:horseshoe_bronze",
recipe = {
{"", "default:bronzeblock", ""},
{"default:bronze_ingot", "", "default:bronze_ingot"},
{"default:bronze_ingot", "", "default:bronze_ingot"},
}
})
-- mese horseshoes
minetest.register_craftitem(":mobs:horseshoe_mese", {
description = "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,
"mobs:horseshoe_mese", 9, 5, 8)
end,
})
minetest.register_craft({
output = "mobs:horseshoe_mese",
recipe = {
{"", "default:mese", ""},
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
}
})
-- diamond horseshoes
minetest.register_craftitem(":mobs:horseshoe_diamond", {
description = "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,
"mobs:horseshoe_diamond", 10, 6, 6)
end,
})
minetest.register_craft({
output = "mobs:horseshoe_diamond",
recipe = {
{"", "default:diamondblock", ""},
{"default:diamond", "", "default:diamond"},
{"default:diamond", "", "default:diamond"},
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

View File

@ -0,0 +1,23 @@
The MIT License (MIT)
Copyright © 2021 Jordan Irwin (AntumDeluge)
Copyright © 2014 Krupnov Pavel
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,33 @@
## Horse Mob for [Minetest](http://minetest.net/)
---
### Description:
A ridable horse forked from [KPGMobs][kpgmobs] originally by PilzAdam & KrupnovPavel. It has been ported to use the [Creatures MOB-Framework API][git.creatures].
---
### Licensing:
- Code & models: [MIT](LICENSE.txt) (models by Krupnov Pavel)
- Sounds: see [sources.txt](sounds/sources.txt)
---
### Dependencies:
- Required:
- [default][git.default]
- [creatures][git.creatures]
- Optional:
- none
---
### Links:
- [Original KPGMobs forum thread][kpgmobs]
- [Git repo](https://github.com/AntumMT/mod-horse)
[kpgmobs]: https://forum.minetest.net/viewtopic.php?t=8798
[git.creatures]: https://github.com/AntumMT/mod-creatures
[git.default]: https://github.com/minetest/minetest_game/tree/master/mods/default

View File

@ -0,0 +1,3 @@
TODO:
- fix walking so player can control when riding

687
mods/mobiles/horse/init.lua Normal file
View File

@ -0,0 +1,687 @@
--HORSE go go goooo :)
local horse = {
physical = true,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
stepheight = 1.1,
visual_size = {x=1,y=1},
mesh = "mobs_horseh1.x",
textures = {"mobs_horseh1.png"},
driver = nil,
v = 0,
}
local function is_ground(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "crumbly") ~= 0
end
local function get_sign(i)
-- FIXME:
if i == nil then i = 0 end
if i == 0 then
return 0
else
return i/math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = math.cos(yaw)*v
local z = math.sin(yaw)*v
return {x=x, y=y, z=z}
end
local function get_v(v)
return math.sqrt(v.x^2+v.z^2)
end
function horse:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
-- FIXME: only owner shoud be able to ride
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:set_yaw(clicker:get_look_horizontal())
end
end
function horse:on_activate(staticdata, dtime_s)
--self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
end
end
function horse:get_staticdata()
return tostring(self.v)
end
function horse:on_punch(puncher, time_from_last_punch, tool_capabilities, dir, damage)
if puncher and puncher:is_player() then
local wielded = puncher:get_wielded_item()
if wielded then
if wielded:get_name() == "mobs:lasso" then
local pname = puncher:get_player_name()
local owner = self.owner
if owner and pname ~= owner then
core.chat_send_player(pname, "This horse is owned by " .. owner)
return true
else
self.object:remove()
puncher:get_inventory():add_item("main", self.name .. "_spawn_egg")
return true
end
end
end
end
return false
end
function horse:on_step(dtime)
if not self.driver then return false end
self.v = get_v(self.object:get_velocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v+2
end
if ctrl.down then
self.v = self.v-0.1
end
if ctrl.left then
self.object:set_yaw(self.object:get_yaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:set_yaw(self.object:get_yaw()-math.pi/120-dtime*math.pi/120)
end
if ctrl.jump then
local p = self.object:get_pos()
p.y = p.y-0.5
if is_ground(p) then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+4
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
end
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:set_velocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:get_pos()
p.y = p.y-0.5
if not is_ground(p) then
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
self.v = 0
end
self.object:set_acceleration({x=0, y=-10, z=0})
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
else
p.y = p.y+1
if is_ground(p) then
self.object:set_acceleration({x=0, y=3, z=0})
local y = self.object:get_velocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:set_acceleration({x=0, y=10, z=0})
end
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), y))
else
self.object:set_acceleration({x=0, y=0, z=0})
if math.abs(self.object:get_velocity().y) < 1 then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+0.5
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
else
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
end
end
end
return true
end
--[[
--horse white
local horsepeg = {
physical = true,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
stepheight = 1.1,
visual_size = {x=1,y=1},
mesh = "mobs_horseh1.x",
textures = {"mobs_horsepegh1.png"},
driver = nil,
v = 0,
}
]]
--[[
function horsepeg:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:set_yaw(clicker:get_look_horizontal())
end
end
function horsepeg:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
end
end
function horsepeg:get_staticdata()
return tostring(v)
end
function horsepeg:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "kpgmobs:horsepegh1")
end
end
function horsepeg:on_step(dtime)
self.v = get_v(self.object:get_velocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v+2
end
if ctrl.down then
self.v = self.v-0.1
end
if ctrl.left then
self.object:set_yaw(self.object:get_yaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:set_yaw(self.object:get_yaw()-math.pi/120-dtime*math.pi/120)
end
if ctrl.jump then
local p = self.object:get_pos()
p.y = p.y-0.5
if is_ground(p) then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+4
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
end
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:set_velocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:get_pos()
p.y = p.y-0.5
if not is_ground(p) then
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
self.v = 0
end
self.object:set_acceleration({x=0, y=-10, z=0})
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
else
p.y = p.y+1
if is_ground(p) then
self.object:set_acceleration({x=0, y=3, z=0})
local y = self.object:get_velocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:set_acceleration({x=0, y=10, z=0})
end
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), y))
else
self.object:set_acceleration({x=0, y=0, z=0})
if math.abs(self.object:get_velocity().y) < 1 then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+0.5
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
else
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
end
end
end
end
--horse arabik
local horseara = {
physical = true,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
stepheight = 1.1,
visual_size = {x=1,y=1},
mesh = "mobs_horseh1.x",
textures = {"mobs_horsearah1.png"},
driver = nil,
v = 0,
}
]]
--[[
function horseara:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:set_yaw(clicker:get_look_horizontal())
end
end
function horseara:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self.v = tonumber(staticdata)
end
end
function horseara:get_staticdata()
return tostring(v)
end
function horseara:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "kpgmobs:horsearah1")
end
end
function horseara:on_step(dtime)
self.v = get_v(self.object:get_velocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v+3
end
if ctrl.down then
self.v = self.v-0.1
end
if ctrl.left then
self.object:set_yaw(self.object:get_yaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:set_yaw(self.object:get_yaw()-math.pi/120-dtime*math.pi/120)
end
if ctrl.jump then
local p = self.object:get_pos()
p.y = p.y-0.5
if is_ground(p) then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+4
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
end
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:set_velocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:get_pos()
p.y = p.y-0.5
if not is_ground(p) then
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
self.v = 0
end
self.object:set_acceleration({x=0, y=-10, z=0})
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
else
p.y = p.y+1
if is_ground(p) then
self.object:set_acceleration({x=0, y=3, z=0})
local y = self.object:get_velocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:set_acceleration({x=0, y=10, z=0})
end
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), y))
else
self.object:set_acceleration({x=0, y=0, z=0})
if math.abs(self.object:get_velocity().y) < 1 then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y)+0.5
self.object:set_pos(pos)
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), 0))
else
self.object:set_velocity(get_velocity(self.v, self.object:get_yaw(), self.object:get_velocity().y))
end
end
end
end
]]
local likes = {"default:apple"}
if core.global_exists("farming") then
table.insert(likes, "farming:wheat")
end
local drops = {}
if core.global_exists("mobs") then
table.insert(drops, {"mobs:meat_raw", {min=2, max=3}, 1.0})
end
local base_sound = {
name = "creatures_horse",
gain = 1.0,
}
-- FIXME:
-- - mounted horse movement is incorrect
local base_def = {
--name = "creatures:horse_brown",
ownable = true,
stats = {
hp = 5,
hostile = false,
lifetime = 300,
can_jump = 1.1,
},
modes = {
idle = {
chance = 0.3,
},
--attack = {},
follow = {
chance = 0.7,
moving_speed = 1,
items = likes,
},
--eat = {},
},
model = {
mesh = "mobs_horse.x",
--textures = {"mobs_horse.png"},
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
rotation = -90.0,
--backface_culling = ,
animations = {
idle = {
start = 25,
stop = 75,
speed = 15,
},
--attack = {},
follow = {
start = 75,
stop = 100,
speed = 15,
},
--eat = {},
},
},
sounds = {
random = {idle=base_sound, follow=base_sound,},
},
drops = drops,
--[[
combat = {
},
]]
spawning = {
abm_nodes = {
spawn_on = {"default:dirt_with_grass"},
neighbors = {},
},
abm_interval = 60,
abm_chance = 9000,
max_number = 2,
--number = 1,
--time_range = {},
light = {min=8, max=20},
height_limit = {min=-50, max=31000},
spawn_egg = {
--description = "Brown Horse",
--texture = "mobs_horse_inv.png",
},
--spawner = {},
},
on_rightclick = function(self, clicker)
return horse.on_rightclick(self, clicker)
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
return horse.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
end,
on_step = function(self, dtime)
return horse.on_step(self, dtime)
end,
on_activate = function(self, staticdata)
return horse.on_activate(self, staticdata)
end,
get_staticdata = function(self)
return horse.get_staticdata(self)
end,
}
--[[
minetest.register_craftitem("kpgmobs:horseh1", {
description = "Horse",
inventory_image = "mobs_horse_inventar.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "kpgmobs:horseh1")
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_entity("kpgmobs:horseh1", horse)
minetest.register_craftitem("kpgmobs:horsepegh1", {
description = "HorseWhite",
inventory_image = "mobs_horse_inventar.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "kpgmobs:horsepegh1")
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_entity("kpgmobs:horsepegh1", horsepeg)
minetest.register_craftitem("kpgmobs:horsearah1", {
description = "HorseBlack",
inventory_image = "mobs_horse_inventar.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.env:add_entity(pointed_thing.above, "kpgmobs:horsearah1")
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_entity("kpgmobs:horsearah1", horseara)
kpgmobs:register_mob("kpgmobs:horse3", {
type = "animal",
hp_max = 5,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {"mobs_horseara.png"},
visual = "mesh",
mesh = "mobs_horse.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "kpgmobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
stand_start = 25,
stand_end = 75,
walk_start = 75,
walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then
clicker:get_inventory():add_item("main", "kpgmobs:horsearah1")
self.object:remove()
end
end,
})
kpgmobs:register_spawn("kpgmobs:horse3", {"default:desert_sand"}, 20, 8, 9000, 1, 31000)
kpgmobs:register_mob("kpgmobs:horse2", {
type = "animal",
hp_max = 5,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {"mobs_horsepeg.png"},
visual = "mesh",
mesh = "mobs_horse.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "kpgmobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
stand_start = 25,
stand_end = 75,
walk_start = 75,
walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then
clicker:get_inventory():add_item("main", "kpgmobs:horsepegh1")
self.object:remove()
end
end,
})
kpgmobs:register_spawn("kpgmobs:horse2", {"default:dirt_with_grass"}, 20, 8, 10000, 1, 31000)
]]
local horses = {
{
name = "creatures:horse_brown",
description = "Brown Horse",
textures = {"mobs_horse.png"},
inventory_image = "mobs_horse_brown_inv.png",
},
{
name = "creatures:horse_white",
description = "White Horse",
textures = {"mobs_horsepeg.png"},
inventory_image = "mobs_horse_white_inv.png",
},
{
name = "creatures:horse_black",
description = "Black Horse",
textures = {"mobs_horseara.png"},
inventory_image = "mobs_horse_black_inv.png",
},
}
for _, horse in ipairs(horses) do
local def = table.copy(base_def)
def.name = horse.name
def.model.textures = horse.textures
def.spawning.spawn_egg.description = horse.description
def.spawning.spawn_egg.texture = horse.inventory_image
creatures.register_mob(def)
end
if not core.global_exists("mobs") then
creatures.register_alias("mob_horse:horse", "creatures:horse_brown")
end
if core.settings:get_bool("log_mods", false) then
core.log("action", "horse loaded")
end

View File

@ -0,0 +1,4 @@
name = horse
description = A ridable horse based on kpgmobs
depends = creatures, default
optional_depends = mobs

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 851 B

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

View File

@ -0,0 +1,5 @@
- creatures_horse:
- author: GoodListener
- license: CC BY 3.0
- link: https://freesound.org/people/GoodListener/sounds/322443/

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B