From fa8601373139b5d74f39a28e1c78765223ff0983 Mon Sep 17 00:00:00 2001 From: Duane Date: Thu, 16 Jun 2016 18:22:23 -0500 Subject: [PATCH] Consolidate goblins. Simplify digging. --- goblin.lua | 608 +++++++++++++++++++++++++++++++++++++++++++++ goblin_coal.lua | 152 ------------ goblin_cobbler.lua | 162 ------------ goblin_copper.lua | 171 ------------- goblin_diamond.lua | 173 ------------- goblin_digger.lua | 130 ---------- goblin_gold.lua | 256 ------------------- goblin_ice.lua | 150 ----------- goblin_iron.lua | 154 ------------ goblin_king.lua | 131 ---------- mobs.lua | 160 ++---------- treegen.lua | 2 + 12 files changed, 637 insertions(+), 1612 deletions(-) create mode 100644 goblin.lua delete mode 100644 goblin_coal.lua delete mode 100644 goblin_cobbler.lua delete mode 100644 goblin_copper.lua delete mode 100644 goblin_diamond.lua delete mode 100644 goblin_digger.lua delete mode 100644 goblin_gold.lua delete mode 100644 goblin_ice.lua delete mode 100644 goblin_iron.lua delete mode 100644 goblin_king.lua diff --git a/goblin.lua b/goblin.lua new file mode 100644 index 0000000..1b1ac21 --- /dev/null +++ b/goblin.lua @@ -0,0 +1,608 @@ +--------------------------------------------------------------- +-- GOBLINS +--------------------------------------------------------------- + +local spawn_frequency = 150 -- 150 +local dig_freq = 5 -- 5 +local trap_freq = 25 -- 25 +local torch_freq = 2 -- 2 + +--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" } + +local diggable = {"group:cracky", "group:snappy", "group:crumbly"} +local traps = { + 'fun_caves:mossycobble_trap', + 'fun_caves:stone_with_coal_trap', + 'fun_caves:stone_with_copper_trap', + 'fun_caves:stone_with_diamond_trap', + 'fun_caves:stone_with_gold_trap', + 'fun_caves:stone_with_iron_trap', +} + + +local function goblin_do(self) + if not fun_caves.custom_ready(self) then + return + end + + local pos = self.object:getpos() + pos.y = pos.y + 0.5 + + -- dig + if self.name == 'fun_caves:goblin_digger' then + fun_caves.search_replace(pos, 1, diggable, 'air') + else + fun_caves.search_replace(pos, dig_freq, diggable, 'air') + end + + -- steal torches + fun_caves.search_replace(self.object:getpos(), torch_freq, {"default:torch"}, "air") + + pos.y = pos.y - 0.5 + + -- place a mossycobble + local cobbling = trap_freq + if self.name == 'fun_caves:goblin_cobbler' then + cobbling = torch_freq + end + fun_caves.search_replace(pos, cobbling, {"group:stone", "default:sandstone"}, "default:mossycobble") + + -- place a trap + local trap = 'fun_caves:mossycobble_trap' + if self.name == 'fun_caves:goblin_ice' then + trap = 'fun_caves:stone_with_ice_trap' + fun_caves.search_replace(pos, trap_freq, {"default:ice"}, trap) + else + if self.name == 'fun_caves:goblin_coal' then + trap = 'fun_caves:stone_with_coal_trap' + elseif self.name == 'fun_caves:goblin_copper' then + trap = 'fun_caves:stone_with_copper_trap' + elseif self.name == 'fun_caves:goblin_diamond' then + trap = 'fun_caves:stone_with_diamond_trap' + elseif self.name == 'fun_caves:goblin_gold' then + trap = 'fun_caves:stone_with_gold_trap' + elseif self.name == 'fun_caves:goblin_iron' then + trap = 'fun_caves:stone_with_iron_trap' + elseif self.name == 'fun_caves:goblin_king' then + trap = traps[math.random(#traps)] + end + if self.name == 'fun_caves:goblin_king' then + print(trap) + end + fun_caves.search_replace(pos, trap_freq, {"group:stone", "default:sandstone"}, trap) + end + + fun_caves.surface_damage(self) +end + + +--local function goblin_right_click(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 + + +local drops = { + digger = { + {name = "default:mossycobble", chance = 1, min = 1, max = 3}, + }, + cobbler = { + {name = "fun_caves:glowing_fungus", chance = 1, min = 2, max = 5}, + }, + coal = { + {name = "default:coal_lump", chance = 1, min = 1, max = 3}, + }, + copper = { + {name = "default:copper_lump", chance = 1, min = 1, max = 3}, + }, + diamond = { + {name = "default:diamond", chance = 5, min = 1, max = 3}, + }, + gold = { + {name = "default:gold_lump", chance = 1, min = 1, max = 3}, + }, + ice = { + {name = "default:coal_lump", chance = 1, min = 1, max = 3}, + }, + iron = { + {name = "default:iron_lump", chance = 1, min = 1, max = 3}, + }, + king = { + {name = "default:mese_crystal", chance = 1, min = 1, max = 3}, + }, +} +for name, drop in pairs(drops) do + if name == 'digger' or name == 'cobbler' or name == 'coal' or name == 'ice' then + drop[#drop+1] = {name = "default:pick_stone", chance = 3, min = 1, max = 3} + drop[#drop+1] = {name = "default:sword_stone", chance = 5, min = 1, max = 1} + elseif name == 'copper' or name == 'iron' then + drop[#drop+1] = {name = "default:pick_steel", chance = 3, min = 1, max = 3} + drop[#drop+1] = {name = "default:sword_steel", chance = 5, min = 1, max = 1} + elseif name == 'diamond' or name == 'gold' then + drop[#drop+1] = {name = "default:pick_diamond", chance = 3, min = 1, max = 3} + drop[#drop+1] = {name = "default:sword_diamond", chance = 5, min = 1, max = 1} + elseif name == 'king' then + drop[#drop+1] = {name = "default:pick_mese", chance = 3, min = 1, max = 3} + drop[#drop+1] = {name = "default:sword_mese", chance = 5, min = 1, max = 1} + end + + drop[#drop+1] = {name = "fun_caves:mushroom_steak", chance = 2, min = 1, max = 2} + drop[#drop+1] = {name = "default:torch", chance = 3, min = 1, max = 10} +end + + +mobs:register_mob("fun_caves:goblin_digger", { + description = "Digger Goblin", + type = "monster", + passive = false, + damage = 1, + attack_type = "dogfight", + attacks_monsters = true, + hp_min = 5, + hp_max = 10, + armor = 100, + fear_height = 4, + 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 = drops['digger'], + water_damage = 1, + 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 = nil, + do_custom = goblin_do, +}) + +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 * spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_digger", {"default:mossycobble"}, 100, 0, spawn_frequency, 3, -51) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_cobbler' +m.textures = { {"goblins_goblin_cobble1.png"}, {"goblins_goblin_cobble2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['cobbler'] +minetest.registered_entities["fun_caves:goblin_cobbler"] = m +mobs.spawning_mobs["fun_caves:goblin_cobbler"] = true + +mobs:register_spawn("fun_caves:goblin_cobbler", {"group:stone"}, 100, 0, 10 * spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_cobbler", {"default:mossycobble"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_cobbler", "Goblin Egg (cobbler)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_coal' +m.textures = { {"goblins_goblin_coal1.png"}, {"goblins_goblin_coal2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['coal'] +minetest.registered_entities["fun_caves:goblin_coal"] = m +mobs.spawning_mobs["fun_caves:goblin_coal"] = true + +mobs:register_spawn("fun_caves:goblin_coal", {'default:coalblock', "default:stone_with_coal"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_coal", {"default:mossycobble"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_coal", "Goblin Egg (coal)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_copper' +m.hp_min = 7 +m.hp_max = 15 +m.armor = 75 +m.textures = { {"goblins_goblin_copper1.png"}, {"goblins_goblin_copper2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['copper'] +minetest.registered_entities["fun_caves:goblin_copper"] = m +mobs.spawning_mobs["fun_caves:goblin_copper"] = true + +mobs:register_spawn("fun_caves:goblin_copper", {"default:stone_with_copper"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_copper", {"default:mossycobble"}, 100, 0, 2 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_copper", "Goblin Egg (copper)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_diamond' +m.damage = 3 +m.hp_min = 7 +m.hp_max = 15 +m.armor = 50 +m.textures = { {"goblins_goblin_diamond1.png"}, {"goblins_goblin_diamond2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['diamond'] +minetest.registered_entities["fun_caves:goblin_diamond"] = m +mobs.spawning_mobs["fun_caves:goblin_diamond"] = true + +mobs:register_spawn("fun_caves:goblin_diamond", {"default:stone_with_diamond"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_diamond", {"default:mossycobble"}, 100, 0, 2 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_diamond", "Goblin Egg (diamond)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_gold' +m.damage = 3 +m.hp_min = 7 +m.hp_max = 15 +m.armor = 75 +m.textures = { {"goblins_goblin_gold1.png"}, {"goblins_goblin_gold2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['gold'] +minetest.registered_entities["fun_caves:goblin_gold"] = m +mobs.spawning_mobs["fun_caves:goblin_gold"] = true + +mobs:register_spawn("fun_caves:goblin_gold", {"default:stone_with_gold"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_gold", {"default:mossycobble"}, 100, 0, 2 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_gold", "Goblin Egg (gold)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_ice' +m.textures = { {"fun_caves_goblin_ice2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['ice'] +minetest.registered_entities["fun_caves:goblin_ice"] = m +mobs.spawning_mobs["fun_caves:goblin_ice"] = true + +mobs:register_spawn("fun_caves:goblin_ice", {"default:ice"}, 100, 0, 10 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_ice", "Goblin Egg (ice)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_iron' +m.damage = 3 +m.hp_min = 7 +m.hp_max = 15 +m.armor = 75 +m.textures = { {"goblins_goblin_iron1.png"}, {"goblins_goblin_iron2.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['iron'] +minetest.registered_entities["fun_caves:goblin_iron"] = m +mobs.spawning_mobs["fun_caves:goblin_iron"] = true + +mobs:register_spawn("fun_caves:goblin_iron", {"default:stone_with_iron"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_iron", {"default:mossycobble"}, 100, 0, 2 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_iron", "Goblin Egg (iron)", "default_mossycobble.png", 1) + + +local m = table.copy(minetest.registered_entities["fun_caves:goblin_digger"]) +m.name = 'fun_caves:goblin_king' +m.damage = 3 +m.hp_min = 10 +m.hp_max = 20 +m.armor = 50 +m.textures = { {"goblins_goblin_king.png"}, } +m.base_texture = m.textures[1] +m.drops = drops['king'] +minetest.registered_entities["fun_caves:goblin_king"] = m +mobs.spawning_mobs["fun_caves:goblin_king"] = true + +mobs:register_spawn("fun_caves:goblin_king", {"default:stone_with_mese"}, 100, 0, spawn_frequency, 3, -51) +mobs:register_spawn("fun_caves:goblin_king", {"default:mossycobble"}, 100, 0, 3 * spawn_frequency, 3, -51) +mobs:register_egg("fun_caves:goblin_king", "Goblin Egg (king)", "default_mossycobble.png", 1) + + +--------------------------------------------------------------- +-- Traps +--------------------------------------------------------------- + +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", +}) + +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 +}) + +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 + +newnode = fun_caves.clone_node("default:lava_source") +newnode.description = "Molten Gold Source" +newnode.wield_image = "goblins_molten_gold.png" +newnode.tiles[1].name = "goblins_molten_gold_source_animated.png" +newnode.special_tiles[1].name = "goblins_molten_gold_source_animated.png" +newnode.liquid_alternative_flowing = "fun_caves:molten_gold_flowing" +newnode.liquid_alternative_source = "fun_caves:molten_gold_source" +newnode.liquid_renewable = false +newnode.post_effect_color = {a=192, r=255, g=64, b=0} +minetest.register_node("fun_caves:molten_gold_source", newnode) + +newnode = fun_caves.clone_node("default:lava_flowing") +newnode.description = "Flowing Molten Gold" +newnode.wield_image = "goblins_molten_gold.png" +newnode.tiles = {"goblins_molten_gold.png"} +newnode.special_tiles[1].name = "goblins_molten_gold_flowing_animated.png" +newnode.liquid_alternative_flowing = "fun_caves:molten_gold_flowing" +newnode.liquid_alternative_source = "fun_caves:molten_gold_source" +newnode.liquid_renewable = false +newnode.post_effect_color = {a=192, r=255, g=64, b=0} +minetest.register_node("fun_caves:molten_gold_flowing", newnode) + +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}) + +minetest.register_node("fun_caves:ice_trap", { + description = "Ice Trap", + tiles = {"default_ice.png^default_mineral_coal.png"}, + groups = {cracky = 3}, + drop = 'default:ice', + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_abm({ + nodenames = {"fun_caves:ice_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 +}) + +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}) + +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}) diff --git a/goblin_coal.lua b/goblin_coal.lua deleted file mode 100644 index 3ca0ee3..0000000 --- a/goblin_coal.lua +++ /dev/null @@ -1,152 +0,0 @@ - - -mobs:register_mob("fun_caves:goblin_coal", { - description = "Coal Goblin", - type = "monster", - passive = false, - damage = 1, - attack_type = "dogfight", - attacks_monsters = true, - hp_min = 5, - hp_max = 10, - armor = 100, - fear_height = 4, - 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 = 0, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_coal_trap") - - fun_caves.surface_damage(self) - end, - -}) -mobs:register_egg("fun_caves:goblin_coal", "Goblin Egg (coal)", "default_mossycobble.png", 1) -mobs:register_spawn("fun_caves:goblin_coal", {"default:coalblock", "default:stone_with_coal"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, -51) -mobs:register_spawn("fun_caves:goblin_coal", {"default:mossycobble", "fun_caves:hot_cobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, -51) - -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 -}) - diff --git a/goblin_cobbler.lua b/goblin_cobbler.lua deleted file mode 100644 index ca697ed..0000000 --- a/goblin_cobbler.lua +++ /dev/null @@ -1,162 +0,0 @@ - - -mobs:register_mob("fun_caves:goblin_cobble", { - description = "Cobble Goblin", - type = "monster", - passive = false, - damage = 1, - attack_type = "dogfight", - attacks_monsters = true, - hp_min = 5, - hp_max = 10, - armor = 100, - fear_height = 4, - 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, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:mossycobble"}, "fun_caves:mossycobble_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_cobble", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, -51) - -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", -}) - diff --git a/goblin_copper.lua b/goblin_copper.lua deleted file mode 100644 index be26adb..0000000 --- a/goblin_copper.lua +++ /dev/null @@ -1,171 +0,0 @@ - - -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, - fear_height = 4, - 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, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_copper_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_copper", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, -51) - -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}) - diff --git a/goblin_diamond.lua b/goblin_diamond.lua deleted file mode 100644 index c659620..0000000 --- a/goblin_diamond.lua +++ /dev/null @@ -1,173 +0,0 @@ - - -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, - fear_height = 4, - 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 = 0, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_diamond_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_diamond", {"default:mossycobble", "fun_caves:hot_cobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, -51) - -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 diff --git a/goblin_digger.lua b/goblin_digger.lua deleted file mode 100644 index 7898734..0000000 --- a/goblin_digger.lua +++ /dev/null @@ -1,130 +0,0 @@ --- goblins_digger.lua --- - -mobs:register_mob("fun_caves:goblin_digger", { - description = "Digger Goblin", - type = "monster", - passive = false, - damage = 1, - attack_type = "dogfight", - attacks_monsters = true, - hp_min = 5, - hp_max = 10, - armor = 100, - fear_height = 4, - 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, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.tunneling(self, "digger") - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:mossycobble"}, "fun_caves:mossycobble_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_digger", {"default:mossycobble"}, 100, 0, 1 * fun_caves.goblin_spawn_frequency, 3, -51) - diff --git a/goblin_gold.lua b/goblin_gold.lua deleted file mode 100644 index 5d97531..0000000 --- a/goblin_gold.lua +++ /dev/null @@ -1,256 +0,0 @@ - - -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, - fear_height = 4, - 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 = 0, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_gold_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_gold", {"default:mossycobble", "fun_caves:hot_cobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, -51) - -minetest.register_node("fun_caves:molten_gold_source", { - description = "Molten Gold Source", - wield_image = "goblins_molten_gold.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", - wield_image = "goblins_molten_gold.png", - drawtype = "flowingliquid", - tiles = {"goblins_molten_gold.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}, -}) - -bucket.register_liquid( - "fun_caves:molten_gold_source", - "fun_caves:molten_gold_flowing", - "fun_caves:bucket_molten_gold", - "fun_caves_bucket_molten_gold.png", - "Molten Gold Bucket", - {lava_bucket = 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}) - diff --git a/goblin_ice.lua b/goblin_ice.lua deleted file mode 100644 index 69b25e4..0000000 --- a/goblin_ice.lua +++ /dev/null @@ -1,150 +0,0 @@ - - -mobs:register_mob("fun_caves:goblin_ice", { - description = "Ice Goblin", - type = "animal", - passive = false, - damage = 1, - attack_type = "dogfight", - attacks_monsters = true, - hp_min = 5, - hp_max = 10, - armor = 100, - fear_height = 4, - collisionbox = {-0.35,-1,-0.35, 0.35,-.1,0.35}, - visual = "mesh", - mesh = "goblins_goblin.b3d", - drawtype = "front", - textures = { - {"fun_caves_goblin_ice2.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 = 4, - cold_damage = 0, - 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() == "fun_caves:mushroom_steak" - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - --fun_caves.search_replace(self.object:getpos(), 20, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:ice"}, "fun_caves:ice_trap") - - fun_caves.surface_damage(self, true) - end, - -}) -mobs:register_egg("fun_caves:goblin_ice", "Goblin Egg (ice)", "default_mossycobble.png", 1) -mobs:register_spawn("fun_caves:goblin_ice", {"default:ice"}, 100, 0, 5 * fun_caves.goblin_spawn_frequency, 3, -51) - -minetest.register_node("fun_caves:ice_trap", { - description = "Ice Trap", - tiles = {"default_ice.png^default_mineral_coal.png"}, - groups = {cracky = 3}, - drop = 'default:ice', - is_ground_content = false, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_abm({ - nodenames = {"fun_caves:ice_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 -}) - diff --git a/goblin_iron.lua b/goblin_iron.lua deleted file mode 100644 index f11a71b..0000000 --- a/goblin_iron.lua +++ /dev/null @@ -1,154 +0,0 @@ - - -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, - fear_height = 4, - 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 = 0, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_iron_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_iron", {"default:mossycobble", "fun_caves:hot_cobble"}, 100, 0, 2 * fun_caves.goblin_spawn_frequency, 3, -51) - -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}) - diff --git a/goblin_king.lua b/goblin_king.lua deleted file mode 100644 index 96700e0..0000000 --- a/goblin_king.lua +++ /dev/null @@ -1,131 +0,0 @@ - - -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, - fear_height = 4, - 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 = 0, - cold_damage = 1, - 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) - if not fun_caves.custom_ready(self) then - return - end - - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_torch_freq, {"default:torch"}, "air") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone", "default:sandstone"}, "default:mossycobble") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"default:mossycobble"}, "fun_caves:mossycobble_trap") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_coal_trap") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_copper_trap") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_gold_trap") - fun_caves.search_replace(self.object:getpos(), fun_caves.goblin_trap_freq, {"group:stone"}, "fun_caves:stone_with_iron_trap") - - fun_caves.surface_damage(self) - 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, -51) -mobs:register_spawn("fun_caves:goblin_king", {"default:mossycobble", "fun_caves:hot_cobble"}, 100, 0, 3 * fun_caves.goblin_spawn_frequency, 3, -51) - diff --git a/mobs.lua b/mobs.lua index 2f88e15..6c84eca 100644 --- a/mobs.lua +++ b/mobs.lua @@ -1,7 +1,7 @@ -- search/replace -- lets mobs change the terrain -- used for goblin traps and torch thieving fun_caves.search_replace = function(pos, search_rate, replace_what, replace_with) - if math.random(1, search_rate) == 1 then + if math.random(search_rate) == 1 then local p1 = vector.subtract(pos, 1) local p2 = vector.add(pos, 1) @@ -9,8 +9,8 @@ fun_caves.search_replace = function(pos, search_rate, replace_what, replace_with 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}) + for _, new_pos in pairs(nodelist) do + minetest.set_node(new_pos, {name = replace_with}) return -- only one at a time end end @@ -61,109 +61,9 @@ fun_caves.surface_damage = function(self, cold_natured) --end end -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}} ---local diggable_nodes = {"group:stone", "group:sand", "group:soil", "group:plant", "default:stone_with_coal", "default:stone_with_iron", "default:stone_with_copper", "default:stone_with_gold", "default:stone_with_mese", "default:stone_with_diamond", "default:mese", "default:coalblock"} -local diggable_nodes = { - digger = {"group:cracky", "group:snappy", "group:crumbly"}, - bee = {"fun_caves:tree", "fun_caves:glowing_fungal_wood", "fun_caves:sap"}, -} -fun_caves.tunneling = function(self, type) - -- Types are available for fine-tuning. - if type == nil then - type = "digger" - end - - -- This translates yaw into vectors. - 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) - - -- Get a pair of coordinates that should cover what's in front of him. - local p = vector.add(pos, cardinals[self.digging_dir+1]) - - -- What's this about? - if type == "digger" then - p.y = p.y - 0.5 - else - p.y = p.y + 0.25 - end - 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[type]) - - if #np_list > 0 then - -- Dig it. - for _, np in pairs(np_list) do - if type ~= 'digger' or 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 or not self.room_count then - self.room_radius = 1 - self.room_count = 0 - 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[type]) - - -- I wanted to leave the outer layer incomplete, but this - -- actually tends to make it look worse. - if r >= self.room_radius and self.room_count > (self.room_radius * 2 + 1) ^ 3 or #np_list == 0 then - self.room_radius = math.random(1,2) + math.random(0,1) - self.state = "stand" - break - end - - self.room_count = self.room_count + 1 - if #np_list > 0 then - -- Dig it. - minetest.remove_node(np_list[math.random(#np_list)]) - break - end - end - end - - if self.state ~= "room" and math.random() < (type == 'digger' and 0.5 or 0.2) then - self.state = "tunnel" - elseif self.state == "tunnel" and math.random() < 0.01 then - self.state = "room" - elseif self.state == "tunnel" and math.random() < 0.1 then - self.state = "stand" - end -end - -- executed in a mob's do_custom() to regulate their actions -- if false, do nothing -local custom_delay = 5000000 +local custom_delay = 2000000 fun_caves.custom_ready = function(self, delay) local time = minetest.get_us_time() if not delay then @@ -382,14 +282,17 @@ if minetest.registered_entities["mobs:bee"] then return end + local pos = self.object:getpos() + pos.y = pos.y + 1 + if self.name == 'fun_caves:killer_bee' then - fun_caves.tunneling(self, "bee") + fun_caves.search_replace(pos, 10, {'group:tree', 'fun_caves:glowing_fungal_wood',}, 'air') end + fun_caves.search_replace(pos, 10, {"fun_caves:tree"}, "fun_caves:glowing_fungal_wood") + fun_caves.search_replace(pos, 60, {"fun_caves:glowing_fungal_wood", 'fun_caves:sap'}, "air") bee_summon(self) - fun_caves.climb(self) - fun_caves.search_replace(self.object:getpos(), 50, {"fun_caves:tree"}, "fun_caves:glowing_fungal_wood") fun_caves.surface_damage(self) end @@ -418,7 +321,8 @@ if minetest.registered_entities["mobs:bee"] then random = "mobs_bee", }, walk_velocity = 1, - run_velocity = 3, + run_velocity = 2, + fall_speed = -3, jump = true, view_range = 15, floats = 0, @@ -429,8 +333,7 @@ if minetest.registered_entities["mobs:bee"] then lava_damage = 5, light_damage = 0, fall_damage = 0, - --fall_speed = -3, - lifetimer = 360, + --lifetimer = 360, follow = nil, animation = { speed_normal = 15, @@ -439,15 +342,12 @@ if minetest.registered_entities["mobs:bee"] then walk_start = 35, walk_end = 65, }, - replace_rate = 50, - replace_what = {"fun_caves:glowing_fungal_wood", "fun_caves:sap",}, - replace_with = "air", - replace_offset = -1, do_custom = bee_do }) mobs:register_spawn("fun_caves:killer_bee", {"fun_caves:tree", "fun_caves:ironwood", "fun_caves:diamondwood"}, 20, -1, 300, 5, 31000) + mobs:register_spawn("fun_caves:killer_bee", {"fun_caves:glowing_fungal_wood"}, 20, -1, 100, 5, 31000) mobs:register_egg("fun_caves:killer_bee", "Killer Bee", "mobs_bee_inv.png", 1) @@ -456,6 +356,7 @@ if minetest.registered_entities["mobs:bee"] then m.damage = 3 m.hp_min = 3 m.hp_max = 9 + m.collisionbox = {-0.25, 0, -0.25, 0.25, 0.25, 0.25} m.visual_size = {x = 1.25, y = 1.25} minetest.registered_entities["fun_caves:killer_bee_drone"] = m @@ -464,10 +365,11 @@ if minetest.registered_entities["mobs:bee"] then mobs:register_spawn("fun_caves:killer_bee_drone", {"fun_caves:tree", "fun_caves:ironwood", "fun_caves:diamondwood"}, 20, -1, 1000, 5, 31000) m = table.copy(minetest.registered_entities["fun_caves:killer_bee"]) + m.name = 'fun_caves:killer_bee_queen' m.damage = 2 m.hp_min = 4 m.hp_max = 12 - m.name = 'fun_caves:killer_bee_queen' + m.collisionbox = {-0.3, 0, -0.3, 0.3, 0.3, 0.3} m.visual_size = {x = 1.5, y = 1.25} minetest.registered_entities["fun_caves:killer_bee_queen"] = m @@ -478,6 +380,7 @@ end if minetest.registered_entities["kpgmobs:wolf"] then local m = table.copy(minetest.registered_entities["kpgmobs:wolf"]) + m.name = 'fun_caves:white_wolf' m.textures = { {"fun_caves_white_wolf.png"}, } m.base_texture = m.textures[1] @@ -498,6 +401,7 @@ end if minetest.registered_entities["kpgmobs:medved"] then local m = table.copy(minetest.registered_entities["kpgmobs:medved"]) + m.name = 'fun_caves:moon_bear' m.textures = { {"fun_caves_moon_bear.png"}, } m.type = 'monster' m.base_texture = m.textures[1] @@ -519,6 +423,7 @@ end if minetest.registered_entities["mobs_monster:spider"] then -- Deep spider local m = table.copy(minetest.registered_entities["mobs_monster:spider"]) + m.name = 'fun_caves:spider' m.docile_by_day = false m.drops = { {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, @@ -543,6 +448,7 @@ if minetest.registered_entities["mobs_monster:spider"] then -- ice spider m = table.copy(minetest.registered_entities["mobs_monster:spider"]) + m.name = 'fun_caves:spider_ice' m.docile_by_day = false m.textures = { {"fun_caves_spider_ice.png"}, } m.base_texture = m.textures[1] @@ -569,6 +475,7 @@ if minetest.registered_entities["mobs_monster:spider"] then -- dangling spiders m = table.copy(minetest.registered_entities["mobs_monster:spider"]) + m.name = 'fun_caves:dangler' m.docile_by_day = false m.attacks_monsters = true m.damage = 2 @@ -604,6 +511,7 @@ if minetest.registered_entities["mobs_monster:spider"] then -- tarantula m = table.copy(minetest.registered_entities["mobs_monster:spider"]) + m.name = 'fun_caves:tarantula' m.type = "animal" m.reach = 1 m.damage = 1 @@ -644,6 +552,7 @@ end if minetest.registered_entities["mobs_monster:sand_monster"] then local m = table.copy(minetest.registered_entities["mobs_monster:sand_monster"]) + m.name = 'fun_caves:tar_monster' m.damage = 2 m.hp_min = 10 m.hp_max = 30 @@ -664,6 +573,7 @@ if minetest.registered_entities["mobs_monster:sand_monster"] then m = table.copy(minetest.registered_entities["mobs_monster:sand_monster"]) + m.name = 'fun_caves:sand_monster' m.textures = { {"fun_caves_sand_monster.png"}, } m.base_texture = m.textures[1] m.drops = { {name = "default:sand", chance = 1, min = 3, max = 5}, } @@ -724,6 +634,7 @@ if minetest.registered_entities["mobs_sharks:shark_lg"] then local l_spawn_in = {"default:water_flowing","default:water_source"} local l_spawn_near = {"default:water_flowing","default:water_source","seawrecks:woodship","seawrecks:uboot"} + m.name = 'fun_caves:shark_giant' m.damage = 7 m.hp_min = 20 m.hp_max = 60 @@ -740,24 +651,7 @@ if minetest.registered_entities["mobs_sharks:shark_lg"] then end dofile(fun_caves.path.."/zombie.lua") - - -fun_caves.goblin_spawn_frequency = 150 -fun_caves.goblin_trap_freq = 25 -fun_caves.goblin_torch_freq = 2 - -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_ice.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") +dofile(fun_caves.path.."/goblin.lua") fun_caves.fortress_spawns = {} local t_mobs = { diff --git a/treegen.lua b/treegen.lua index ca2e2ff..95bf6b4 100644 --- a/treegen.lua +++ b/treegen.lua @@ -5,6 +5,8 @@ local newnode = fun_caves.clone_node("default:tree") newnode.description = "Bark" newnode.tiles = {"default_tree.png"} newnode.is_ground_content = false +newnode.groups.tree = 0 +newnode.groups.flammable = 0 minetest.register_node("fun_caves:bark", newnode) newnode = fun_caves.clone_node("default:tree")