forked from VoxeLibre/VoxeLibre
Compare commits
1 Commits
master
...
luaformatt
Author | SHA1 | Date |
---|---|---|
bakawun | 45867966d1 |
|
@ -21,33 +21,48 @@ local carpets = {
|
||||||
unicolor_cyan = {"mcl_wool:cyan_carpet", "cyan"},
|
unicolor_cyan = {"mcl_wool:cyan_carpet", "cyan"},
|
||||||
unicolor_red_violet = {"mcl_wool:magenta_carpet", "magenta"},
|
unicolor_red_violet = {"mcl_wool:magenta_carpet", "magenta"},
|
||||||
unicolor_black = {"mcl_wool:black_carpet", "black"},
|
unicolor_black = {"mcl_wool:black_carpet", "black"},
|
||||||
unicolor_light_blue = { "mcl_wool:light_blue_carpet", "light_blue" },
|
unicolor_light_blue = {"mcl_wool:light_blue_carpet", "light_blue"}
|
||||||
}
|
}
|
||||||
|
|
||||||
local function get_drops(self)
|
local function get_drops(self)
|
||||||
self.drops = {}
|
self.drops = {}
|
||||||
table.insert(self.drops,
|
table.insert(
|
||||||
{name = "mcl_mobitems:leather",
|
self.drops,
|
||||||
|
{
|
||||||
|
name = "mcl_mobitems:leather",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 2,
|
max = 2,
|
||||||
looting = "common",
|
looting = "common"
|
||||||
})
|
}
|
||||||
|
)
|
||||||
if self.carpet then
|
if self.carpet then
|
||||||
table.insert(self.drops,{name = self.carpet,
|
table.insert(
|
||||||
|
self.drops,
|
||||||
|
{
|
||||||
|
name = self.carpet,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,})
|
max = 1
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
if self._has_chest then
|
if self._has_chest then
|
||||||
table.insert(self.drops,{name = "mcl_chests:chest",
|
table.insert(
|
||||||
|
self.drops,
|
||||||
|
{
|
||||||
|
name = "mcl_chests:chest",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,})
|
max = 1
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:llama", {
|
mcl_mobs.register_mob(
|
||||||
|
"mobs_mc:llama",
|
||||||
|
{
|
||||||
description = S("Llama"),
|
description = S("Llama"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -58,14 +73,12 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
shoot_offset = 1, --3.5 *would* be a good value visually but it somehow messes with the projectiles trajectory
|
shoot_offset = 1, --3.5 *would* be a good value visually but it somehow messes with the projectiles trajectory
|
||||||
spawn_in_group_min = 2, -- was 4
|
spawn_in_group_min = 2, -- was 4
|
||||||
spawn_in_group = 4, -- was 6 nerfed until we can cap them properly locally. this is a group size, not a per spawn attempt
|
spawn_in_group = 4, -- was 6 nerfed until we can cap them properly locally. this is a group size, not a per spawn attempt
|
||||||
|
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 11,
|
bone_eye_height = 11,
|
||||||
head_eye_height = 3,
|
head_eye_height = 3,
|
||||||
horizontal_head_height = 0,
|
horizontal_head_height = 0,
|
||||||
curiosity = 60,
|
curiosity = 60,
|
||||||
head_yaw = "z",
|
head_yaw = "z",
|
||||||
|
|
||||||
hp_min = 15,
|
hp_min = 15,
|
||||||
hp_max = 30,
|
hp_max = 30,
|
||||||
xp_min = 1,
|
xp_min = 1,
|
||||||
|
@ -73,12 +86,13 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45},
|
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_llama.b3d",
|
mesh = "mobs_mc_llama.b3d",
|
||||||
textures = { -- 1: chest -- 2: decor (carpet) -- 3: llama base texture
|
textures = {
|
||||||
|
-- 1: chest -- 2: decor (carpet) -- 3: llama base texture
|
||||||
{"blank.png", "blank.png", "mobs_mc_llama_brown.png"},
|
{"blank.png", "blank.png", "mobs_mc_llama_brown.png"},
|
||||||
{"blank.png", "blank.png", "mobs_mc_llama_creamy.png"},
|
{"blank.png", "blank.png", "mobs_mc_llama_creamy.png"},
|
||||||
{"blank.png", "blank.png", "mobs_mc_llama_gray.png"},
|
{"blank.png", "blank.png", "mobs_mc_llama_gray.png"},
|
||||||
{"blank.png", "blank.png", "mobs_mc_llama_white.png"},
|
{"blank.png", "blank.png", "mobs_mc_llama_white.png"},
|
||||||
{"blank.png", "blank.png", "mobs_mc_llama.png"},
|
{"blank.png", "blank.png", "mobs_mc_llama.png"}
|
||||||
},
|
},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
runaway = false,
|
runaway = false,
|
||||||
|
@ -87,33 +101,44 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
follow_velocity = 4.4,
|
follow_velocity = 4.4,
|
||||||
floats = 1,
|
floats = 1,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_mobitems:leather",
|
{
|
||||||
|
name = "mcl_mobitems:leather",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 2,
|
max = 2,
|
||||||
looting = "common",},
|
looting = "common"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "mobs_mc_llama",
|
random = "mobs_mc_llama",
|
||||||
eat = "mobs_mc_animal_eat_generic",
|
eat = "mobs_mc_animal_eat_generic",
|
||||||
-- TODO: Death and damage sounds
|
-- TODO: Death and damage sounds
|
||||||
distance = 16,
|
distance = 16
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
stand_start = 0, stand_end = 0,
|
stand_start = 0,
|
||||||
walk_start = 0, walk_end = 40, walk_speed = 35,
|
stand_end = 0,
|
||||||
run_start = 0, run_end = 40, run_speed = 50,
|
walk_start = 0,
|
||||||
|
walk_end = 40,
|
||||||
|
walk_speed = 35,
|
||||||
|
run_start = 0,
|
||||||
|
run_end = 40,
|
||||||
|
run_speed = 50
|
||||||
},
|
},
|
||||||
child_animations = {
|
child_animations = {
|
||||||
stand_start = 41, stand_end = 41,
|
stand_start = 41,
|
||||||
walk_start = 41, walk_end = 81, walk_speed = 50,
|
stand_end = 41,
|
||||||
run_start = 41, run_end = 81, run_speed = 75,
|
walk_start = 41,
|
||||||
|
walk_end = 81,
|
||||||
|
walk_speed = 50,
|
||||||
|
run_start = 41,
|
||||||
|
run_end = 81,
|
||||||
|
run_speed = 75
|
||||||
},
|
},
|
||||||
follow = {"mcl_farming:wheat_item", "mcl_farming:hay_block"},
|
follow = {"mcl_farming:wheat_item", "mcl_farming:hay_block"},
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
|
||||||
-- set needed values if not already present
|
-- set needed values if not already present
|
||||||
if not self.v3 then
|
if not self.v3 then
|
||||||
self.v3 = 0
|
self.v3 = 0
|
||||||
|
@ -128,7 +153,6 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
|
|
||||||
-- if driver present allow control of llama
|
-- if driver present allow control of llama
|
||||||
if self.driver then
|
if self.driver then
|
||||||
|
|
||||||
mcl_mobs.drive(self, "walk", "stand", false, dtime)
|
mcl_mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
return false -- skip rest of mob functions
|
return false -- skip rest of mob functions
|
||||||
|
@ -136,18 +160,13 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_die = function(self, pos)
|
on_die = function(self, pos)
|
||||||
|
|
||||||
-- detach from llama properly
|
-- detach from llama properly
|
||||||
if self.driver then
|
if self.driver then
|
||||||
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
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
|
return
|
||||||
|
@ -156,16 +175,20 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == "mcl_farming:hay_block" then
|
if item:get_name() == "mcl_farming:hay_block" then
|
||||||
-- Breed with hay bale
|
-- Breed with hay bale
|
||||||
if self:feed_tame(clicker, 1, true, false) then return end
|
if self:feed_tame(clicker, 1, true, false) then
|
||||||
|
return
|
||||||
|
end
|
||||||
elseif not self._has_chest and item:get_name() == "mcl_chests:chest" then
|
elseif not self._has_chest and item:get_name() == "mcl_chests:chest" then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
self._has_chest = true
|
self._has_chest = true
|
||||||
self.base_texture = table.copy(self.base_texture)
|
self.base_texture = table.copy(self.base_texture)
|
||||||
self.base_texture[1] = self.base_texture[3]
|
self.base_texture[1] = self.base_texture[3]
|
||||||
self.object:set_properties({
|
self.object:set_properties(
|
||||||
textures = self.base_texture,
|
{
|
||||||
})
|
textures = self.base_texture
|
||||||
|
}
|
||||||
|
)
|
||||||
get_drops(self)
|
get_drops(self)
|
||||||
return
|
return
|
||||||
elseif self._has_chest and clicker:get_player_control().sneak then
|
elseif self._has_chest and clicker:get_player_control().sneak then
|
||||||
|
@ -173,9 +196,13 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
-- Feed with anything else
|
-- Feed with anything else
|
||||||
if self:feed_tame(clicker, 1, false, true) then return end
|
if self:feed_tame(clicker, 1, false, true) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if mcl_mobs:protect(self, clicker) then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
if mcl_mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
-- Make sure tamed llama is mature and being clicked by owner only
|
-- Make sure tamed llama is mature and being clicked by owner only
|
||||||
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
|
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
|
||||||
|
@ -191,9 +218,11 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
local tex_carpet = "mobs_mc_llama_decor_" .. substr .. ".png"
|
local tex_carpet = "mobs_mc_llama_decor_" .. substr .. ".png"
|
||||||
self.base_texture = table.copy(self.base_texture)
|
self.base_texture = table.copy(self.base_texture)
|
||||||
self.base_texture[2] = tex_carpet
|
self.base_texture[2] = tex_carpet
|
||||||
self.object:set_properties({
|
self.object:set_properties(
|
||||||
textures = self.base_texture,
|
{
|
||||||
})
|
textures = self.base_texture
|
||||||
|
}
|
||||||
|
)
|
||||||
self.carpet = item:get_name()
|
self.carpet = item:get_name()
|
||||||
get_drops(self)
|
get_drops(self)
|
||||||
return
|
return
|
||||||
|
@ -203,15 +232,14 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
|
|
||||||
-- detatch player already riding llama
|
-- detatch player already riding llama
|
||||||
if self.driver and clicker == self.driver then
|
if self.driver and clicker == self.driver then
|
||||||
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
|
||||||
-- attach player to llama
|
-- attach player to llama
|
||||||
|
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
self.object:set_properties({stepheight = 1.1})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mcl_mobs.attach(self, clicker)
|
mcl_mobs.attach(self, clicker)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_breed = function(parent1, parent2)
|
on_breed = function(parent1, parent2)
|
||||||
-- When breeding, make sure the child has no carpet
|
-- When breeding, make sure the child has no carpet
|
||||||
local pos = parent1.object:get_pos()
|
local pos = parent1.object:get_pos()
|
||||||
|
@ -248,30 +276,37 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
self._inv_size = 3
|
self._inv_size = 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
mcl_entity_invs.register_inv("mobs_mc:llama", "Llama", nil, true)
|
mcl_entity_invs.register_inv("mobs_mc:llama", "Llama", nil, true)
|
||||||
|
|
||||||
-- spit arrow (weapon)
|
-- spit arrow (weapon)
|
||||||
mcl_mobs.register_arrow("mobs_mc:llamaspit", {
|
mcl_mobs.register_arrow(
|
||||||
|
"mobs_mc:llamaspit",
|
||||||
|
{
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.10, y = 0.10},
|
visual_size = {x = 0.10, y = 0.10},
|
||||||
textures = {"mobs_mc_llama_spit.png"},
|
textures = {"mobs_mc_llama_spit.png"},
|
||||||
velocity = 5,
|
velocity = 5,
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
player:punch(self.object, 1.0, {
|
player:punch(
|
||||||
|
self.object,
|
||||||
|
1.0,
|
||||||
|
{
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 1},
|
damage_groups = {fleshy = 1}
|
||||||
}, nil)
|
},
|
||||||
|
nil
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
end
|
end
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
mcl_mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
|
@ -286,7 +321,7 @@ mcl_mobs:spawn_specific(
|
||||||
"Savanna_ocean",
|
"Savanna_ocean",
|
||||||
"ExtremeHills",
|
"ExtremeHills",
|
||||||
"ExtremeHills_beach",
|
"ExtremeHills_beach",
|
||||||
"ExtremeHillsM",
|
"ExtremeHillsM"
|
||||||
}, --FIXME: Needs Windswept Forest when that is added.
|
}, --FIXME: Needs Windswept Forest when that is added.
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX + 1,
|
minetest.LIGHT_MAX + 1,
|
||||||
|
@ -294,7 +329,9 @@ minetest.LIGHT_MAX+1,
|
||||||
15000,
|
15000,
|
||||||
5,
|
5,
|
||||||
mobs_mc.water_level + 15,
|
mobs_mc.water_level + 15,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max
|
||||||
|
)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mcl_mobs.register_egg("mobs_mc:llama", S("Llama"), "#c09e7d", "#995f40", 0)
|
mcl_mobs.register_egg("mobs_mc:llama", S("Llama"), "#c09e7d", "#995f40", 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue