Integrate goblins and mobs.

This commit is contained in:
Duane Robertson 2016-04-25 22:15:21 -05:00
parent 6097e844cf
commit 182e32d231
68 changed files with 14500 additions and 13 deletions

118
danglers.lua Normal file
View file

@ -0,0 +1,118 @@
-- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
function fun_caves.climb(self)
if self.state == "stand" and math.random() < 0.2 then
if self.fall_speed == 2 then
self.fall_speed = -2
else
self.fall_speed = 2
end
elseif self.state == "attack" and self.fall_speed ~= -2 then
self.fall_speed = -2
end
end
mobs:register_mob("fun_caves:dangler", {
description = "Dangling Spider",
type = "monster",
passive = false,
attack_type = "dogfight",
attacks_monsters = true,
reach = 2,
damage = 1,
hp_min = 5,
hp_max = 10,
armor = 200,
collisionbox = {-0.32, -0.0, -0.25, 0.25, 0.25, 0.25},
visual = "mesh",
mesh = "fun_caves_spider.x",
drawtype = "front",
textures = {
{"mobs_spider.png"},
},
visual_size = {x = 1.5, y = 1.5},
makes_footstep_sound = false,
sounds = {
random = "mobs_spider",
attack = "mobs_spider",
},
walk_velocity = 1,
run_velocity = 3,
jump = true,
view_range = 15,
floats = 0,
drops = {
{name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "farming:cotton", chance = 2, min = 1, max = 2},
},
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fall_damage = 0,
lifetimer = 360,
follow = nil,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 1,
stand_end = 1,
walk_start = 20,
walk_end = 40,
run_start = 20,
run_end = 40,
punch_start = 50,
punch_end = 90,
},
replace_rate = 50,
--replace_what = {"mobs:cobweb", "fun_caves:glowing_fungal_wood", "fun_caves:sap",},
--replace_with = "air",
--replace_offset = -1,
do_custom = function(self)
fun_caves.climb(self)
fun_caves.search_replace(self.object:getpos(), 200, {"air"}, "mobs:cobweb")
end,
})
mobs:register_spawn("fun_caves:dangler", {"fun_caves:stone_with_moss", "fun_caves:stone_with_lichen", "fun_caves:stone_with_algae"}, 14, 0, 2500, 3, 31000)
mobs:register_egg("fun_caves:dangler", "Dangling Spider", "mobs_cobweb.png", 1)
minetest.register_abm({
nodenames = {"mobs:cobweb"},
interval = 500,
chance = 50,
action = function(pos, node)
minetest.set_node(pos, {name = "air"})
end
})
-- cobweb
minetest.register_node(":mobs:cobweb", {
description = "Cobweb",
drawtype = "plantlike",
visual_scale = 1.1,
tiles = {"mobs_cobweb.png"},
inventory_image = "mobs_cobweb.png",
paramtype = "light",
sunlight_propagates = true,
liquid_viscosity = 11,
liquidtype = "source",
liquid_alternative_flowing = "mobs:cobweb",
liquid_alternative_source = "mobs:cobweb",
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {snappy = 1, liquid = 3},
drop = "farming:cotton",
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
output = "mobs:cobweb",
recipe = {
{"farming:string", "", "farming:string"},
{"", "farming:string", ""},
{"farming:string", "", "farming:string"},
}
})

View file

@ -1,2 +1,4 @@
default default
flowers flowers
wool
mobs?

56
dirt_monster.lua Normal file
View file

@ -0,0 +1,56 @@
-- Dirt Monster by PilzAdam
mobs:register_mob("fun_caves:dirt_monster", {
type = "monster",
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 2,
hp_min = 3,
hp_max = 27,
armor = 100,
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_dirt_monster.png"},
},
blood_texture = "default_dirt.png",
makes_footstep_sound = true,
sounds = {
random = "mobs_dirtmonster",
},
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
jump = true,
drops = {
{name = "default:dirt", chance = 1, min = 3, max = 5},
},
water_damage = 1,
lava_damage = 5,
light_damage = 2,
fear_height = 4,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
})
mobs:register_spawn("fun_caves:dirt_monster",
{"default:dirt"}, 14, 0, 7000, 1, 31000)
mobs:register_egg("fun_caves:dirt_monster", "Dirt Monster", "default_dirt.png", 1)
-- compatibility
mobs:alias_mob("mobs:dirt_monster", "fun_caves:dirt_monster")

View file

@ -4,7 +4,11 @@
local light_max = 9 local light_max = 9
local colors = {"^[colorize:#FF00FF:60", "", "^[colorize:#0000FF:60", "^[colorize:#FF4500:80"} local colors = {}
colors["^[colorize:#FF00FF:60"] = "dye:violet"
colors["^[colorize:#0000FF:60"] = "dye:blue"
colors["^[colorize:#FF4500:80"] = "dye:green"
colors[""] = "dye:white"
fun_caves.fungal_tree_leaves = {} fun_caves.fungal_tree_leaves = {}
-- all leaves -- all leaves
@ -34,7 +38,7 @@ end
-- multicolored growths -- multicolored growths
local count = 0 local count = 0
for _, color in pairs(colors) do for color, dye in pairs(colors) do
count = count + 1 count = count + 1
local name = "fun_caves:fungal_tree_leaves_"..count local name = "fun_caves:fungal_tree_leaves_"..count
fun_caves.fungal_tree_leaves[#fun_caves.fungal_tree_leaves+1] = name fun_caves.fungal_tree_leaves[#fun_caves.fungal_tree_leaves+1] = name
@ -60,13 +64,29 @@ for _, color in pairs(colors) do
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:stick", type = "cooking",
recipe = { output = "farming:straw",
{name} recipe = name,
} cooktime = 2,
}) })
if dye then
minetest.register_craft({
output = dye,
recipe = {
{name}
}
})
end
end end
minetest.register_craft({
output = "dye:yellow",
recipe = {
{"flowers:mushroom_brown"}
}
})
local leaves_and_air = table.copy(fun_caves.fungal_tree_leaves) local leaves_and_air = table.copy(fun_caves.fungal_tree_leaves)
leaves_and_air[#leaves_and_air+1] = "air" leaves_and_air[#leaves_and_air+1] = "air"

144
goblin_coal.lua Normal file
View file

@ -0,0 +1,144 @@
mobs:register_mob("fun_caves:goblin_coal", {
description = "Coal 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.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_coal1.png"},
{"goblins_goblin_coal2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:coal_lump",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
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"},
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, {"group:stone"}, "fun_caves:stone_with_coal_trap")
end,
})
mobs:register_egg("fun_caves:goblin_coal", "Goblin Egg (coal)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_coal", {"default:stone_with_coal"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
mobs:register_spawn("fun_caves:goblin_coal", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:stone_with_coal_trap", {
description = "Coal Trap",
tiles = {"default_cobble.png^default_mineral_coal.png"},
groups = {cracky = 3},
drop = 'default:coal_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_abm({
nodenames = {"fun_caves:stone_with_coal_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
if object:is_player() then
minetest.set_node(pos, {name="fire:basic_flame"})
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-2)
end
end
end
end
})

154
goblin_cobbler.lua Normal file
View file

@ -0,0 +1,154 @@
mobs:register_mob("fun_caves:goblin_cobble", {
description = "Cobble 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.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_cobble1.png"},
{"goblins_goblin_cobble2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:pick_stone",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "fun_caves:glowing_fungus",
chance = 1, min = 2, max = 5},
{name = "default:torch",
chance = 3, min = 1, max = 10},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
lifetimer = 360,
follow = {"default:diamond"},
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 5, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, {"default:mossycobble"}, "fun_caves:mossycobble_trap")
end,
})
mobs:register_egg("fun_caves:goblin_cobble", "Goblin Egg (cobble)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_cobble", {"group:stone"}, 100, 0, 10 * fun_caves.goblin_spawn_frequency, 3, 31000)
mobs:register_spawn("fun_caves:goblin_cobble", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:mossycobble_trap", {
description = "Messy Gobblestone",
tiles = {"default_mossycobble.png"},
is_ground_content = false,
groups = {cracky = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
paramtype = "light",
light_source = 4,
})
--[[ too bad we can't keep track of what physics are set too by other mods...]]
minetest.register_abm({
nodenames = {"fun_caves:mossycobble_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 0.95)) do -- IDKWTF this is but it works
if object:is_player() then
object:set_physics_override({speed = 0.1})
minetest.after(1, function() -- this effect is temporary
object:set_physics_override({speed = 1}) -- we'll just set it to 1 and be done.
end)
end
end
end})
minetest.register_craft({
type = "cooking",
output = "default:stone",
recipe = "fun_caves:mossycobble_trap",
})

163
goblin_copper.lua Normal file
View file

@ -0,0 +1,163 @@
mobs:register_mob("fun_caves:goblin_copper", {
description = "Copper Goblin",
type = "monster",
passive = false,
damage = 2,
attack_type = "dogfight",
attacks_monsters = false,
hp_min = 10,
hp_max = 20,
armor = 100,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_copper1.png"},
{"goblins_goblin_copper2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:copper_lump",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:pick_steel",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, 1, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, 1, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_copper_trap")
end,
})
mobs:register_egg("fun_caves:goblin_copper", "Goblin Egg (copper)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_copper", {"default:stone_with_copper"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
mobs:register_spawn("fun_caves:goblin_copper", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:stone_with_copper_trap", {
description = "Copper Trap",
tiles = {"default_cobble.png^default_mineral_copper.png"},
groups = {cracky = 3},
drop = 'default:copper_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
local function lightning_effects(pos, radius)
minetest.add_particlespawner({
amount = 30,
time = 1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-10, y=-10, z=-10},
maxvel = {x=10, y=10, z=10},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 1,
maxexptime = 3,
minsize = 16,
maxsize = 32,
texture = "goblins_lightning.png",
})
end
--[[ based on dwarves cactus]]
minetest.register_abm({
nodenames = {"fun_caves:stone_with_copper_trap"},
interval = 1,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 3)) do
if object:is_player() then
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-1)
-- sprite
lightning_effects(pos, 3)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end
end})

165
goblin_diamond.lua Normal file
View file

@ -0,0 +1,165 @@
mobs:register_mob("fun_caves:goblin_diamond", {
description = "Diamond Goblin",
type = "monster",
passive = false,
damage = 3,
attack_type = "dogfight",
attacks_monsters = false,
hp_min = 20,
hp_max = 30,
armor = 100,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_diamond1.png"},
{"goblins_goblin_diamond2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:pick_diamond",
chance = 2, min = 1, max = 1},
{name = "default:sword_diamond",
chance = 5, min = 1, max = 1},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:diamond",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, 1, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, 1, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_diamond_trap")
end,
})
mobs:register_egg("fun_caves:goblin_diamond", "Goblin Egg (diamond)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_diamond", {"default:stone_with_diamond" }, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 2, 31000)
mobs:register_spawn("fun_caves:goblin_diamond", {"default:mossycobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:stone_with_diamond_trap", {
description = "Diamond Trap",
tiles = {"default_cobble.png^default_mineral_diamond.png"},
groups = {cracky = 3},
drop = 'default:diamond',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
local singleplayer = minetest.is_singleplayer()
local setting = minetest.setting_getbool("enable_tnt")
if (not singleplayer and setting ~= true) or (singleplayer and setting == false) then
-- wimpier trap for non-tnt settings
minetest.register_abm({
nodenames = {"fun_caves:stone_with_diamond_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 3)) do
if object:is_player() then
minetest.set_node(pos, {name="default:lava_source"})
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-2)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end
end})
else
-- 5... 4... 3... 2... 1...
minetest.register_abm({
nodenames = {"fun_caves:stone_with_diamond_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 3)) do
if object:is_player() then
minetest.set_node(pos, {name="tnt:tnt_burning"})
minetest.get_node_timer(pos):start(5)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end})
end

216
goblin_digger.lua Normal file
View file

@ -0,0 +1,216 @@
-- goblins_digger.lua
--
-- He destroys everything diggable in his path. It's too much trouble
-- to fudge around with particulars. Besides, I don't want them to
-- mine for me.
local diggable_nodes = {"group:stone", "group:sand", "group:soil", "group:plant"}
-- This translates yaw into vectors.
local cardinals = {{x=0,y=0,z=0.75}, {x=-0.75,y=0,z=0}, {x=0,y=0,z=-0.75}, {x=0.75,y=0,z=0}}
fun_caves.goblin_tunneling = function(self, type)
-- Types are available for fine-tuning.
if type == nil then
type = "digger"
end
local pos = self.object:getpos()
if self.state == "tunnel" then
-- Yaw is stored as one of the four cardinal directions.
if not self.digging_dir then
self.digging_dir = math.random(0,3)
end
-- Turn him roughly in the right direction.
-- self.object:setyaw(self.digging_dir * math.pi * 0.5 + math.random() * 0.5 - 0.25)
self.object:setyaw(self.digging_dir * math.pi * 0.5)
-- Get a pair of coordinates that should cover what's in front of him.
local p = vector.add(pos, cardinals[self.digging_dir+1])
p.y = p.y - 0.5 -- What's this about?
local p1 = vector.add(p, -0.3)
local p2 = vector.add(p, 0.3)
-- Get any diggable nodes in that area.
local np_list = minetest.find_nodes_in_area(p1, p2, diggable_nodes)
if #np_list > 0 then
-- Dig it.
for _, np in pairs(np_list) do
if np.name ~= "default:cobble" then
minetest.remove_node(np)
end
end
end
if math.random() < 0.2 then
local d = {-1,1}
self.digging_dir = (self.digging_dir + d[math.random(2)]) % 4
end
set_animation(self, "walk")
set_velocity(self, self.walk_velocity)
elseif self.state == "room" then -- Dig a room.
if not self.room_radius then
self.room_radius = 1
end
set_animation(self, "stand")
set_velocity(self, 0)
-- Work from the inside, out.
for r = 1,self.room_radius do
-- Get a pair of coordinates that form a room.
local p1 = vector.add(pos, -r)
local p2 = vector.add(pos, r)
-- But not below him.
p1.y = pos.y
local np_list = minetest.find_nodes_in_area(p1, p2, diggable_nodes)
-- I wanted to leave the outer layer incomplete, but this
-- actually tends to make it look worse.
if r >= self.room_radius and #np_list == 0 then
self.room_radius = math.random(1,2) + math.random(0,1)
self.state = "stand"
break
end
if #np_list > 0 then
-- Dig it.
minetest.remove_node(np_list[math.random(#np_list)])
break
end
end
end
if self.state == "stand" and math.random() < 0.05 then
self.state = "tunnel"
elseif self.state == "tunnel" and math.random() < 0.05 then
self.state = "room"
elseif self.state == "tunnel" and math.random() < 0.1 then
self.state = "stand"
end
end
mobs:register_mob("fun_caves: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.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_digger.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:mossycobble",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:torch",
chance = 3, min = 1, max = 10},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
lifetimer = 360,
follow = {"default:diamond"},
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.goblin_tunneling(self, "digger")
fun_caves.search_replace(self.object:getpos(), 5, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 10, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, {"default:mossycobble"}, "fun_caves:mossycobble_trap")
end,
})
mobs:register_egg("fun_caves:goblin_digger", "Goblin Egg (digger)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_digger", {"group:stone"}, 100, 0, 20 * fun_caves.goblin_spawn_frequency, 3, 31000)
mobs:register_spawn("fun_caves:goblin_digger", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)

239
goblin_gold.lua Normal file
View file

@ -0,0 +1,239 @@
mobs:register_mob("fun_caves:goblin_gold", {
description = "Gold Goblin",
type = "monster",
passive = false,
damage = 3,
attack_type = "dogfight",
attacks_monsters = false,
hp_min = 10,
hp_max = 30,
armor = 100,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_gold1.png"},
{"goblins_goblin_gold2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:gold_lump",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:gold_ingot",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, 1, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, 1, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_gold_trap")
end,
})
mobs:register_egg("fun_caves:goblin_gold", "Goblin Egg (gold)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_gold", {"default:stone_with_gold" }, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 2, 31000)
mobs:register_spawn("fun_caves:goblin_gold", {"default:mossycobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:molten_gold_source", {
description = "Molten Gold Source",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "liquid",
tiles = {
{
name = "goblins_molten_gold_source_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.0,
},
},
},
special_tiles = {
-- New-style lava source material (mostly unused)
{
name = "goblins_molten_gold_source_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.0,
},
backface_culling = false,
},
},
paramtype = "light",
light_source = default.LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "fun_caves:molten_gold_flowing",
liquid_alternative_source = "fun_caves:molten_gold_source",
liquid_viscosity = 7,
liquid_renewable = false,
liquid_range = 3,
damage_per_second = 4 * 2,
post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=2, hot=3, igniter=1},
})
minetest.register_node("fun_caves:molten_gold_flowing", {
description = "Flowing Molten Gold",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "flowingliquid",
tiles = {"default_lava.png"},
special_tiles = {
{
name = "goblins_molten_gold_flowing_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3,
},
},
{
name = "goblins_molten_gold_flowing_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3,
},
},
},
paramtype = "light",
paramtype2 = "flowingliquid",
light_source = default.LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "fun_caves:molten_gold_flowing",
liquid_alternative_source = "fun_caves:molten_gold_source",
liquid_viscosity = 7,
liquid_renewable = false,
liquid_range = 3,
damage_per_second = 4 * 2,
post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
})
minetest.register_node("fun_caves:stone_with_gold_trap", {
description = "Gold Trap",
tiles = {"default_cobble.png^default_mineral_gold.png"},
groups = {cracky = 3},
drop = 'default:gold_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_abm({
nodenames = {"fun_caves:stone_with_gold_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
if object:is_player() then
minetest.set_node(pos, {name="fun_caves:molten_gold_source"})
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-2)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end
end})

146
goblin_iron.lua Normal file
View file

@ -0,0 +1,146 @@
mobs:register_mob("fun_caves:goblin_iron", {
description = "Iron Goblin",
type = "monster",
passive = false,
damage = 2,
attack_type = "dogfight",
attacks_monsters = false,
hp_min = 10,
hp_max = 20,
armor = 100,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_iron1.png"},
{"goblins_goblin_iron2.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:iron_lump",
chance = 1, min = 1, max = 3},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:pick_steel",
chance = 5, min = 1, max = 1},
{name = "default:sword_steel",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 5, 1, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, 1, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_iron_trap")
end,
})
mobs:register_egg("fun_caves:goblin_iron", "Goblin Egg (iron)", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_iron", {"default:stone_with_iron"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, 31000)
mobs:register_spawn("fun_caves:goblin_iron", {"default:mossycobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, 31000)
minetest.register_node("fun_caves:stone_with_iron_trap", {
description = "Iron Trap",
tiles = {"default_cobble.png^default_mineral_iron.png"},
groups = {cracky = 3},
drop = 'default:iron_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
-- summon a metallic goblin?
-- pit of iron razors?
minetest.register_abm({
nodenames = {"fun_caves:stone_with_iron_trap"},
interval = 2,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
if object:is_player() then
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-1)
minetest.sound_play("default_dig_crumbly", {pos = pos, gain = 0.5, max_hear_distance = 10})
end
end
end
end})

123
goblin_king.lua Normal file
View file

@ -0,0 +1,123 @@
mobs:register_mob("fun_caves:goblin_king", {
description = "Goblin King",
type = "monster",
passive = false,
damage = 4,
attack_type = "dogfight",
attacks_monsters = false,
hp_min = 20,
hp_max = 40,
armor = 100,
collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35},
visual = "mesh",
mesh = "goblins_goblin.b3d",
drawtype = "front",
textures = {
{"goblins_goblin_king.png"},
},
makes_footstep_sound = true,
sounds = {
random = "goblins_goblin_ambient",
warcry = "goblins_goblin_attack",
attack = "goblins_goblin_attack",
damage = "goblins_goblin_damage",
death = "goblins_goblin_death",
distance = 15,
},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:pick_mese",
chance = 2, min = 1, max = 1},
{name = "default:sword_mese",
chance = 4, min = 1, max = 1},
{name = "fun_caves:mushroom_steak",
chance = 2, min = 1, max = 2},
{name = "default:mese_crystal",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = "default:diamond",
view_range = 10,
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 fun_caves.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 = fun_caves.goblin_drops[math.random(1, #fun_caves.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:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
do_custom = function(self)
fun_caves.search_replace(self.object:getpos(), 2, {"default:torch"}, "air")
fun_caves.search_replace(self.object:getpos(), 20, {"default:stone"}, "default:mossycobble")
fun_caves.search_replace(self.object:getpos(), 50, {"default:mossycobble"}, "fun_caves:mossycobble_trap")
fun_caves.search_replace(self.object:getpos(), 50, {"group:stone"}, "fun_caves:stone_with_coal_trap")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_copper_trap")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_gold_trap")
fun_caves.search_replace(self.object:getpos(), 50, 5, {"group:stone"}, "fun_caves:stone_with_iron_trap")
end,
})
mobs:register_egg("fun_caves:goblin_king", "Goblin King Egg", "default_mossycobble.png", 1)
mobs:register_spawn("fun_caves:goblin_king", {"default:stone_with_mese"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 1, 31000)
mobs:register_spawn("fun_caves:goblin_king", {"default:mossycobble"}, 100, 0, 3 * fun_caves.goblin_spawn_frequency, 3, 31000)

View file

@ -5,6 +5,11 @@ fun_caves.world = false
fun_caves.time_factor = 10 fun_caves.time_factor = 10
if not mobs or not mobs.mod then
dofile(fun_caves.path .. "/mobs_api.lua")
end
minetest.register_on_mapgen_init(function(mgparams) minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"}) minetest.set_mapgen_params({mgname="singlenode", flags="nolight"})
end) end)
@ -85,6 +90,7 @@ end
dofile(fun_caves.path .. "/nodes.lua") dofile(fun_caves.path .. "/nodes.lua")
dofile(fun_caves.path .. "/fungal_tree.lua") dofile(fun_caves.path .. "/fungal_tree.lua")
dofile(fun_caves.path .. "/mapgen.lua") dofile(fun_caves.path .. "/mapgen.lua")
dofile(fun_caves.path .. "/mobs.lua")
minetest.register_on_newplayer(fun_caves.respawn) minetest.register_on_newplayer(fun_caves.respawn)

141
lava_flan.lua Normal file
View file

@ -0,0 +1,141 @@
-- Lava Flan by Zeg9 (additional textures by JurajVajda)
mobs:register_mob("fun_caves:lava_flan", {
type = "monster",
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 3,
hp_min = 10,
hp_max = 35,
armor = 80,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5},
visual = "mesh",
mesh = "zmobs_lava_flan.x",
textures = {
{"zmobs_lava_flan.png"},
{"zmobs_lava_flan2.png"},
{"zmobs_lava_flan3.png"},
},
blood_texture = "fire_basic_flame.png",
makes_footstep_sound = false,
sounds = {
random = "mobs_lavaflan",
war_cry = "mobs_lavaflan",
},
walk_velocity = 0.5,
run_velocity = 2,
jump = true,
view_range = 10,
floats = 1,
drops = {
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1},
},
water_damage = 5,
lava_damage = 0,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 8,
walk_start = 10,
walk_end = 18,
run_start = 20,
run_end = 28,
punch_start = 20,
punch_end = 28,
},
on_die = function(self, pos)
minetest.set_node(pos, {name = "fire:basic_flame"})
end,
})
mobs:register_spawn("fun_caves:lava_flan", {"default:lava_source"}, 15, 0, 1000, 2, 31000)
mobs:register_egg("fun_caves:lava_flan", "Lava Flan", "default_lava.png", 1)
-- compatibility
mobs:alias_mob("mobs:lava_flan", "fun_caves:lava_flan")
-- lava orb
minetest.register_craftitem(":mobs:lava_orb", {
description = "Lava orb",
inventory_image = "zmobs_lava_orb.png",
})
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
minetest.register_craft({
type = "fuel",
recipe = "mobs:lava_orb",
burntime = 80,
})
-- Lava Pick (digs and smelts at same time)
local old_handle_node_drops = minetest.handle_node_drops
function minetest.handle_node_drops(pos, drops, digger)
-- are we holding Lava Pick?
if digger:get_wielded_item():get_name() ~= ("mobs:pick_lava") then
return old_handle_node_drops(pos, drops, digger)
end
-- reset new smelted drops
local hot_drops = {}
-- loop through current node drops
for _, drop in pairs(drops) do
-- get cooked output of current drops
local stack = ItemStack(drop)
local output = minetest.get_craft_result({
method = "cooking",
width = 1,
items = {drop}
})
-- if we have cooked result then add to new list
if output
and output.item
and not output.item:is_empty() then
table.insert(hot_drops,
ItemStack({
name = output.item:get_name(),
count = stack:get_count()
})
)
else -- if not then return normal drops
table.insert(hot_drops, stack)
end
end
return old_handle_node_drops(pos, hot_drops, digger)
end
minetest.register_tool(":mobs:pick_lava", {
description = "Lava Pickaxe",
inventory_image = "mobs_pick_lava.png",
tool_capabilities = {
full_punch_interval = 0.4,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=1.80, [2]=0.90, [3]=0.45}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=6},
},
})
minetest.register_craft({
output = "mobs:pick_lava",
recipe = {
{"mobs:lava_orb", "mobs:lava_orb", "mobs:lava_orb"},
{"", "default:obsidian_shard", ""},
{"", "default:obsidian_shard", ""},
}
})

View file

@ -488,8 +488,8 @@ function fun_caves.generate(p_minp, p_maxp, seed)
data[ivm] = node("air") data[ivm] = node("air")
made_a_big_one = true made_a_big_one = true
else else
local n1 = (math.abs(cave_1[index3d]) < 0.08) local n1 = (math.abs(cave_1[index3d]) < 0.2)
local n2 = (math.abs(cave_2[index3d]) < 0.08) local n2 = (math.abs(cave_2[index3d]) < 0.2)
if n1 and n2 then if n1 and n2 then
local sr = 1000 local sr = 1000
@ -550,15 +550,18 @@ function fun_caves.generate(p_minp, p_maxp, seed)
end end
elseif biome_val < -0.7 then elseif biome_val < -0.7 then
stone_type = node("fun_caves:stone_with_lichen") stone_type = node("fun_caves:stone_with_lichen")
elseif biome_val < -0.3 then elseif biome_val < -0.4 then
stone_type = node("fun_caves:stone_with_moss") stone_type = node("fun_caves:stone_with_moss")
elseif biome_val < 0.2 then elseif biome_val < 0.1 then
stone_type = node("fun_caves:stone_with_lichen") stone_type = node("fun_caves:stone_with_lichen")
elseif biome_val < 0.5 then elseif biome_val < 0.4 then
stone_type = node("fun_caves:stone_with_algae") stone_type = node("fun_caves:stone_with_algae")
elseif biome_val < 0.6 then elseif biome_val < 0.55 then
stone_type = node("fun_caves:stone_with_salt") stone_type = node("fun_caves:stone_with_salt")
stone_depth = 2 stone_depth = 2
elseif biome_val < 0.7 then
stone_type = node("default:sand")
stone_depth = 2
elseif biome_val < 0.8 then elseif biome_val < 0.8 then
stone_type = node("default:coalblock") stone_type = node("default:coalblock")
stone_depth = 2 stone_depth = 2
@ -676,7 +679,7 @@ function fun_caves.respawn(player)
local biome_bn = minetest.get_perlin(biome_blend):get2d({x=pos.x, y=pos.z}) local biome_bn = minetest.get_perlin(biome_blend):get2d({x=pos.x, y=pos.z})
local biome = biome_n + biome_bn local biome = biome_n + biome_bn
while biome < 0.3 or biome > 0.5 do while biome < -0.4 or biome > 0.4 do
pos.x = pos.x + math.random(20) - 10 pos.x = pos.x + math.random(20) - 10
pos.z = pos.z + math.random(20) - 10 pos.z = pos.z + math.random(20) - 10

42
mobs.lua Normal file
View file

@ -0,0 +1,42 @@
fun_caves.search_replace = function(pos, search_rate, replace_what, replace_with)
if math.random(1, search_rate) == 1 then
local p1 = vector.subtract(pos, 1)
local p2 = vector.add(pos, 1)
--look for nodes
local nodelist = minetest.find_nodes_in_area(p1, p2, replace_what)
if #nodelist > 0 then
for key,value in pairs(nodelist) do
minetest.set_node(value, {name = replace_with})
return -- only one at a time
end
end
end
end
dofile(fun_caves.path .. "/mobs_crafts.lua")
dofile(fun_caves.path .. "/danglers.lua")
dofile(fun_caves.path .. "/spider.lua")
dofile(fun_caves.path .. "/dirt_monster.lua")
dofile(fun_caves.path .. "/stone_monster.lua")
dofile(fun_caves.path .. "/lava_flan.lua")
--dofile(fun_caves.path .. "/dungeon_master.lua")
--dofile(fun_caves.path .. "/mese_monster.lua")
--dofile(fun_caves.path .. "/sand_monster.lua")
fun_caves.goblin_spawn_frequency = 150
fun_caves.goblin_drops = { "default:pick_steel", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water", "default:pick_stone", "default:sword_stone" }
--{"group:stone"} = { "default:stone", "default:mossycobble", "default:sandstone", "default:desert_stone", "default:stone_with_coal", "default:stone_with_iron", "default:stone_with_copper", "default:stone_with_gold", "default:stone_with_diamond" }
dofile(fun_caves.path.."/goblin_cobbler.lua")
dofile(fun_caves.path.."/goblin_digger.lua")
dofile(fun_caves.path.."/goblin_coal.lua")
dofile(fun_caves.path.."/goblin_copper.lua")
dofile(fun_caves.path.."/goblin_iron.lua")
dofile(fun_caves.path.."/goblin_gold.lua")
dofile(fun_caves.path.."/goblin_diamond.lua")
dofile(fun_caves.path.."/goblin_king.lua")

2875
mobs_api.lua Normal file

File diff suppressed because it is too large Load diff

69
mobs_crafts.lua Normal file
View file

@ -0,0 +1,69 @@
-- name tag
minetest.register_craftitem(":mobs:nametag", {
description = "Nametag",
inventory_image = "mobs_nametag.png",
})
core.register_craft({
type = "shapeless",
output = "mobs:nametag",
recipe = {"default:paper", "dye:black", "farming:string"},
})
-- leather
minetest.register_craftitem(":mobs:leather", {
description = "Leather",
inventory_image = "mobs_leather.png",
})
-- raw meat
minetest.register_craftitem(":mobs:meat_raw", {
description = "Raw Meat",
inventory_image = "mobs_meat_raw.png",
on_use = minetest.item_eat(3),
})
-- cooked meat
minetest.register_craftitem(":mobs:meat", {
description = "Meat",
inventory_image = "mobs_meat.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "mobs:meat",
recipe = "mobs:meat_raw",
cooktime = 5,
})
-- golden lasso
minetest.register_tool(":mobs:magic_lasso", {
description = "Magic Lasso (right-click animal to put in inventory)",
inventory_image = "mobs_magic_lasso.png",
})
minetest.register_craft({
output = "mobs:magic_lasso",
recipe = {
{"farming:string", "default:gold_lump", "farming:string"},
{"default:gold_lump", "default:diamondblock", "default:gold_lump"},
{"farming:string", "default:gold_lump", "farming:string"},
}
})
-- net
minetest.register_tool(":mobs:net", {
description = "Net (right-click animal to put in inventory)",
inventory_image = "mobs_net.png",
})
minetest.register_craft({
output = "mobs:net",
recipe = {
{"default:stick", "", "default:stick"},
{"default:stick", "", "default:stick"},
{"farming:string", "default:stick", "farming:string"},
}
})

6102
models/fun_caves_spider.x Normal file

File diff suppressed because it is too large Load diff

BIN
models/goblins_goblin.b3d Normal file

Binary file not shown.

Binary file not shown.

3506
models/zmobs_lava_flan.x Normal file

File diff suppressed because it is too large Load diff

View file

@ -62,6 +62,27 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "mobs:leather",
recipe = {
{"fun_caves:giant_mushroom_cap"}
}
})
minetest.register_craft({
output = "dye:red",
recipe = {
{"flowers:mushroom_red"}
}
})
--minetest.register_craft({
-- output = "dye:yellow",
-- recipe = {
-- {"flowers:mushroom_brown"}
-- }
--})
-- Caps can be cooked and eaten. -- Caps can be cooked and eaten.
minetest.register_node("fun_caves:mushroom_steak", { minetest.register_node("fun_caves:mushroom_steak", {
description = "Mushroom Steak", description = "Mushroom Steak",
@ -542,3 +563,10 @@ minetest.register_abm({
end end
}) })
minetest.register_craft({
output = 'default:paper 6',
recipe = {
{'fun_caves:giant_mushroom_stem', 'fun_caves:giant_mushroom_stem', 'fun_caves:giant_mushroom_stem'},
}
})

55
sand_monster.lua Normal file
View file

@ -0,0 +1,55 @@
-- Sand Monster by PilzAdam
mobs:register_mob("mobs_monster:sand_monster", {
type = "monster",
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 1,
hp_min = 4,
hp_max = 20,
armor = 100,
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_sand_monster.b3d",
textures = {
{"mobs_sand_monster.png"},
},
makes_footstep_sound = true,
sounds = {
random = "mobs_sandmonster",
},
walk_velocity = 1.5,
run_velocity = 4,
view_range = 15,
jump = true,
floats = 0,
drops = {
{name = "default:desert_sand", chance = 1, min = 3, max = 5},
},
water_damage = 3,
lava_damage = 4,
light_damage = 0,
fear_height = 4,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 39,
walk_start = 41,
walk_end = 72,
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
},
})
mobs:register_spawn("mobs_monster:sand_monster", {"default:desert_sand"}, 20, 0, 7000, 1, 31000)
mobs:register_egg("mobs_monster:sand_monster", "Sand Monster", "default_desert_sand.png", 1)
-- compatibility
mobs:alias_mob("mobs:sand_monster", "mobs_monster:sand_monster")

BIN
sounds/mobs_dirtmonster.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_fireball.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_lavaflan.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_sandmonster.ogg Normal file

Binary file not shown.

BIN
sounds/mobs_spider.ogg Normal file

Binary file not shown.

Binary file not shown.

57
spider.lua Normal file
View file

@ -0,0 +1,57 @@
-- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
mobs:register_mob("fun_caves:spider", {
docile_by_day = true,
type = "monster",
passive = false,
attack_type = "dogfight",
reach = 2,
damage = 3,
hp_min = 20,
hp_max = 40,
armor = 200,
collisionbox = {-0.9, -0.01, -0.7, 0.7, 0.6, 0.7},
visual = "mesh",
mesh = "fun_caves_spider.x",
textures = {
{"mobs_spider.png"},
},
visual_size = {x = 7, y = 7},
makes_footstep_sound = false,
sounds = {
random = "mobs_spider",
attack = "mobs_spider",
},
walk_velocity = 1,
run_velocity = 3,
jump = true,
view_range = 15,
floats = 0,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
{name = "wool:black", chance = 1, min = 1, max = 3},
},
water_damage = 5,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 1,
stand_end = 1,
walk_start = 20,
walk_end = 40,
run_start = 20,
run_end = 40,
punch_start = 50,
punch_end = 90,
},
})
mobs:register_spawn("fun_caves:spider", {"fun_caves:stone_with_moss", "fun_caves:stone_with_lichen", "fun_caves:stone_with_algae"}, 14, 0, 5000, 2, 31000)
mobs:register_egg("fun_caves:spider", "Spider", "mobs_cobweb.png", 1)
-- compatibility
mobs:alias_mob("mobs:spider", "fun_caves:spider")

57
stone_monster.lua Normal file
View file

@ -0,0 +1,57 @@
-- Stone Monster by PilzAdam
mobs:register_mob("fun_caves:stone_monster", {
type = "monster",
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 3,
hp_min = 12,
hp_max = 35,
armor = 80,
collisionbox = {-0.4, -1, -0.4, 0.4, 0.9, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_stone_monster.png"},
{"mobs_stone_monster2.png"}, -- by AMMOnym
},
makes_footstep_sound = true,
sounds = {
random = "mobs_stonemonster",
},
walk_velocity = 1,
run_velocity = 2,
jump = true,
floats = 0,
view_range = 10,
drops = {
{name = "default:torch", chance = 2, min = 3, max = 5},
{name = "default:iron_lump", chance = 5, min = 1, max = 2},
{name = "default:coal_lump", chance = 3, min = 1, max = 3},
},
water_damage = 0,
lava_damage = 1,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
})
mobs:register_spawn("fun_caves:stone_monster", {"default:stone", "default:desert_stone", "fun_caves:stone_with_salt"}, 14, 0, 7000, 1, 31000)
mobs:register_egg("fun_caves:stone_monster", "Stone Monster", "default_stone.png", 1)
-- compatibility
mobs:alias_mob("mobs:stone_monster", "fun_caves:stone_monster")

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
textures/mobs_blood.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

BIN
textures/mobs_cobweb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
textures/mobs_fireball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

BIN
textures/mobs_leather.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

BIN
textures/mobs_meat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

BIN
textures/mobs_meat_raw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

BIN
textures/mobs_nametag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

BIN
textures/mobs_net.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

BIN
textures/mobs_pick_lava.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
textures/mobs_spider.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
textures/zmobs_lava_orb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B