Merge all horse code into one file

This commit is contained in:
Wuzzy 2017-06-27 03:25:42 +02:00
parent 059a6bea6b
commit 85f97a707d
5 changed files with 51 additions and 429 deletions

View File

@ -13,10 +13,9 @@
-- Horse
mobs:register_mob("mobs_mc:horse", {
local horse = {
type = "animal",
visual = "mesh",
--visual_size = {x = 1.20, y = 1.20},
mesh = "mobs_mc_horse.b3d",
visual_size = {x=3, y=3},
rotate = -180,
@ -136,7 +135,52 @@ mobs:register_mob("mobs_mc:horse", {
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
}
mobs:register_mob("mobs_mc:horse", horse)
-- Skeleton horse
local skeleton_horse = table.copy(horse)
skeleton_horse.textures = {{"horseskeleton.png"}}
skeleton_horse.drops = {
{name = mobs_mc.items.bone,
chance = 1,
min = 1,
max = 1,},
}
skeleton_horse.sounds = {
random = "skeleton1",
death = "skeletondeath",
damage = "skeletonhurt1",
}
mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
-- Zombie horse
local zombie_horse = table.copy(horse)
zombie_horse.textures = {{"horsezombie.png"}}
zombie_horse.drops = {
{name = mobs_mc.items.rotten_flesh,
chance = 1,
min = 1,
max = 1,},
}
zombie_horse.sounds = {
random = "zombie1",
death = "zombiedeath",
damage = "zombiehurt1",
}
mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
-- Mule
local mule = table.copy(horse)
mule.mesh = "mobs_mc_mule.b3d"
mule.textures = {{"mule.png"},{"mule1.png"}}
mule.animation = {
speed_normal = 25,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
}
mobs:register_mob("mobs_mc:mule", mule)
--===========================
@ -146,18 +190,12 @@ mobs:register_spawn("mobs_mc:horse", mobs_mc.spawn.grassland_savanna, minetest.L
-- compatibility
mobs:alias_mob("mobs:horse", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse1", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse2", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse3", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse4", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse5", "mobs_mc:horse")
mobs:alias_mob("mobs_mc:horse6", "mobs_mc:horse")
-- spawn eggs
mobs:register_egg("mobs_mc:horse", "Horse", "horse_inv.png", 0)
mobs:register_egg("mobs_mc:skeleton_horse", "Skeleton Horse", "horseskeleton_inv.png", 0)
mobs:register_egg("mobs_mc:zombie_horse", "Zombie Horse", "horsezombie_inv.png", 0)
mobs:register_egg("mobs_mc:mule", "Mule", "mule_inv.png", 0)
if minetest.settings:get_bool("log_mods") then

View File

@ -1,134 +0,0 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
--###################
--################### HORSE MULE
--###################
-- Horse
mobs:register_mob("mobs_mc:horsemule", {
type = "animal",
passive = true,
runaway = true,
stepheight = 1.2,
hp_min = 15,
hp_max = 30,
rotate = -180,
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2, 0.35},
visual = "mesh",
mesh = "mobs_mc_mule.b3d",
textures = {{"mule.png"},{"mule1.png"}},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
{name = mobs_mc.items.leather,
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
animation = {
speed_normal = 25,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
},
follow = mobs_mc.follow.horse,
view_range = 16,
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 2 --swap due to -180 model
self.max_speed_reverse = 4 --swap due to -180 model
self.accel = 4
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 7.5, z = 0}
self.player_rotation = {x = 0, y = 180, z = 0}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 0.3, y = 0.3}
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_mc.items.saddle)
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
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_mc.items.saddle) then
inv:add_item("main", mobs_mc.items.saddle)
else
minetest.add_item(clicker.getpos(), mobs_mc.items.saddle)
end
-- attach player to horse
elseif not self.driver
and clicker:get_wielded_item():get_name() == mobs_mc.items.saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
inv:remove_item("main", mobs_mc.items.saddle)
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
--spawnegg
mobs:register_egg("mobs_mc:horsemule", "Mule", "mule_inv.png", 0)

View File

@ -1,139 +0,0 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
--###################
--################### SKELETON HORSE
--###################
mobs:register_mob("mobs_mc:horseskeleton", {
type = "animal",
hp_min = 15,
hp_max = 30,
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2, 0.35},
rotate = -180,
visual = "mesh",
mesh = "mobs_mc_horse.b3d",
textures = {{"horseskeleton.png"}},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
{name = mobs_mc.items.bone,
chance = 1,
min = 1,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
animation = {
speed_normal = 25,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
},
sounds = {
random = "skeleton1",
death = "skeletondeath",
damage = "skeletonhurt1",
},
follow = mobs_mc.follow.horse,
view_range = 16,
passive = false,
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 2 --swap due to -180 model
self.max_speed_reverse = 4 --swap due to -180 model
self.accel = 4
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 7.5, z = 0}
self.player_rotation = {x = 0, y = 180, z = 0}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 0.3, y = 0.3}
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_mc.items.saddle)
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
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_mc.items.saddle) then
inv:add_item("main", mobs_mc.items.saddle)
else
minetest.add_item(clicker.getpos(), mobs_mc.items.saddle)
end
-- attach player to horse
elseif not self.driver
and clicker:get_wielded_item():get_name() == mobs_mc.items.saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
inv:remove_item("main", mobs_mc.items.saddle)
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
--spawnegg
mobs:register_egg("mobs_mc:horseskeleton", "Skeleton Horse", "horseskeleton_inv.png", 0)
if minetest.settings:get_bool("log_mods") then
minetest.log("action", "MC Skeleton Horse loaded")
end

View File

@ -1,140 +0,0 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
--###################
--################### ZOMBIE HORSE
--###################
mobs:register_mob("mobs_mc:horsezombie", {
type = "animal",
hp_min = 15,
hp_max = 30,
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2, 0.35},
rotate = -180,
visual = "mesh",
mesh = "mobs_mc_horse.b3d",
textures = {{"horsezombie.png"}},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
{name = mobs_mc.items.rotten_flesh,
chance = 1,
min = 1,
max = 1,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
sounds = {
random = "zombie1",
death = "zombiedeath",
damage = "zombiehurt1",
attack = "default_punch3",
},
animation = {
speed_normal = 25,
stand_start = 0, stand_end = 40,
walk_start = 0, walk_end = 40,
},
follow = mobs_mc.items.horse,
view_range = 16,
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 2 --swap due to -180 model
self.max_speed_reverse = 4 --swap due to -180 model
self.accel = 4
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 7.5, z = 0}
self.player_rotation = {x = 0, y = 180, z = 0}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 0.3, y = 0.3}
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_mc.items.saddle)
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
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_mc.items.saddle) then
inv:add_item("main", mobs_mc.items.saddle)
else
minetest.add_item(clicker.getpos(), mobs_mc.items.saddle)
end
-- attach player to horse
elseif not self.driver
and clicker:get_wielded_item():get_name() == mobs_mc.items.saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
inv:remove_item("main", mobs_mc.items.saddle)
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
--spawnegg
mobs:register_egg("mobs_mc:horsezombie", "Zombie Horse", "horsezombie_inv.png", 0)
if minetest.settings:get_bool("log_mods") then
minetest.log("action", "MC Horse Zombie loaded")
end

View File

@ -59,10 +59,7 @@ dofile(path .. "/bat.lua") -- Mesh and animation by toby109tt / https://github.
dofile(path .. "/rabbit.lua") -- Mesh and animation byExeterDad
dofile(path .. "/chicken.lua") -- Mesh and animation by Pavel_S
dofile(path .. "/cow+mooshroom.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/horse.lua") -- KrupnoPavel
dofile(path .. "/horse_mule.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/horse_skeleton.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/horse_zombie.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/horse.lua") -- KrupnoPavel; Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/llama.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/ocelot.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/parrot.lua") -- Mesh and animation by toby109tt / https://github.com/22i