Add Digger, adjust spawn and replacement rates

master
Francisco 2015-08-27 16:21:13 -07:00
parent de3633c2ec
commit 3003d2991d
1 changed files with 120 additions and 12 deletions

View File

@ -44,7 +44,7 @@ mobs_goblins:register_mob("mobs_goblins:goblin_cobble", {
lava_damage = 2,
light_damage = 0,
follow = {"default:diamond"},
replace_rate = 30,
replace_rate = 20,
replace_what = {"default:stone","default:desert_stone",},
replace_with = "default:mossycobble",
replace_offset = 1,
@ -113,6 +113,113 @@ mobs_goblins:register_mob("mobs_goblins:goblin_cobble", {
end,
})
mobs_goblins:register_mob("mobs_goblins:goblin_digger", {
description = "Digger Goblin",
type = "animal",
passive = false,
damage = 1,
attack_type = "dogfight",
attacks_monsters = true,
hp_min = 5,
hp_max = 10,
armor = 100,
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.0,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_cobble2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "mobs_pig",
attack = "mobs_pig_angry",
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:mossycobble",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:torch",
chance = 3, min = 1, max = 10},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = {"default:diamond"},
replace_rate = 20,
replace_what = {"default:stone","default:desert_stone","default:torch"},
replace_with = "air",
replace_offset = 1,
view_range = 15,
owner = "",
order = "follow",
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
},
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- feed to heal goblin
if item:get_name() == "default:apple"
or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
-- return if full health
if hp >= self.hp_max then
minetest.chat_send_player(name, "goblin at full health.")
return
end
hp = hp + 4
if hp > self.hp_max then hp = self.hp_max end
self.object:set_hp(hp)
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
-- right clicking with gold lump drops random item from mobs_goblins.goblin_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs_goblins.goblin_drops[math.random(1, #mobs_goblins.goblin_drops)]})
else
-- if owner switch between follow and stand
if self.owner and self.owner == clicker:get_player_name() then
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
-- else
-- self.owner = clicker:get_player_name()
end
end
mobs_goblins:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
})
mobs_goblins:register_mob("mobs_goblins:goblin_coal", {
description = "Coal Goblin",
type = "animal",
@ -151,7 +258,7 @@ mobs_goblins:register_mob("mobs_goblins:goblin_coal", {
lava_damage = 2,
light_damage = 0,
follow = {"default:diamond"},
replace_rate = 50,
replace_rate = 30,
replace_what = {"default:torch",},
replace_with = "air",
replace_offset = 2,
@ -258,7 +365,7 @@ mobs_goblins:register_mob("mobs_goblins:goblin_iron", {
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
replace_rate = 50,
replace_rate = 40,
replace_what = {"default:torch",},
replace_with = "air",
replace_offset = 2,
@ -365,10 +472,10 @@ mobs_goblins:register_mob("mobs_goblins:goblin_gold", {
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
replace_rate = 50,
replace_rate = 40,
replace_what = {"default:torch",},
replace_with = "air",
replace_offset = 2,
replace_offset = 3,
view_range = 15,
owner = "",
order = "follow",
@ -472,10 +579,10 @@ mobs_goblins:register_mob("mobs_goblins:goblin_diamond", {
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
replace_rate = 50,
replace_rate = 40,
replace_what = {"default:torch",},
replace_with = "air",
replace_offset = 2,
replace_offset = 3,
view_range = 15,
owner = "",
order = "follow",
@ -578,10 +685,10 @@ mobs_goblins:register_mob("mobs_goblins:goblin_king", {
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
replace_rate = 50,
replace_rate = 40,
replace_what = {"default:torch",},
replace_with = "air",
replace_offset = -1,
replace_offset = 3,
view_range = 15,
owner = "",
order = "follow",
@ -647,12 +754,13 @@ mobs_goblins:register_mob("mobs_goblins:goblin_king", {
end,
})
-- spawn underground near ore and dungeons, except cobble goblins who create goblin lairs.
-- spawn underground near ore and dungeons, except cobble goblins who create goblin lairs near stone.
--function mobs_goblins:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height)
mobs_goblins:register_spawn("mobs_goblins:goblin_cobble", {"group:stone"}, 1000, 0, 200, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_cobble", {"group:stone"}, 1000, 0, 50, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_digger", {"group:stone"}, 1000, 0, 50, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_coal", {"default:torch", "default:coal", "default:mossycobble"}, 1000, 0, 30, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_iron", {"default:stone_with_iron","default:mossycobble",}, 10, 0, 30, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_gold", {"default:stone_with_gold","default:mossycobble", }, 10, 0, 30, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_diamond", {"default:stone_with_diamond","default:mossycobble", }, 30, 0, 100, 1, 1)
mobs_goblins:register_spawn("mobs_goblins:goblin_king", {"default:stone_with_mese","default:mossycobble", }, 10, 0, 300, 1, 1)
mobs_goblins:register_egg("mobs_goblins:goblin_coal", "goblin egg", "default:stone_with_coal", 1)
mobs_goblins:register_egg("mobs_goblins:goblin_cobble", "goblin egg", "default:mossycobble", 1)