From 2f9d41c11ea85752d10063ab509594aecc5f5a88 Mon Sep 17 00:00:00 2001 From: Duane Date: Thu, 4 Aug 2016 08:03:00 -0500 Subject: [PATCH] Add traps to dungeons. --- abms.lua | 6 +++--- dungeon.lua | 13 ++++++++++++- goblin.lua | 8 ++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/abms.lua b/abms.lua index 8ef2c16..701fc1e 100644 --- a/abms.lua +++ b/abms.lua @@ -391,11 +391,11 @@ minetest.register_abm({ minetest.register_abm({ nodenames = {"fun_caves:dungeon_floor_1"}, - interval = 20 * time_factor, + interval = 10 * time_factor, chance = 250, catch_up = false, action = function(pos, node, aoc, active_object_count_wider) - if not (pos and node) or active_object_count_wider > 10 then + if not (pos and node) or active_object_count_wider > 5 then return end @@ -453,7 +453,7 @@ minetest.register_abm({ minetest.register_abm({ nodenames = {"fun_caves:dungeon_floor_1"}, interval = 20 * time_factor, - chance = 1000, + chance = 500, catch_up = false, action = function(pos, node) if not (pos and node) then diff --git a/dungeon.lua b/dungeon.lua index f7f0c46..7868f9b 100644 --- a/dungeon.lua +++ b/dungeon.lua @@ -390,7 +390,18 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm if not leave_alone[data[ivm]] then if ry == 0 and (cy > 0 or not centered_in) then if content[cx][cy][cz] == 'room' then - data[ivm] = node['fun_caves:dungeon_floor_1'] + local r = math.random(5000) + if r == 1 then + data[ivm] = node['fun_caves:stone_with_gold_trap'] + elseif r == 2 then + data[ivm] = node['fun_caves:stone_with_coal_trap'] + elseif r == 3 then + data[ivm] = node['fun_caves:stone_with_iron_trap'] + elseif r == 4 then + data[ivm] = node['fun_caves:stone_with_diamond_trap'] + else + data[ivm] = node['fun_caves:dungeon_floor_1'] + end else data[ivm] = node['fun_caves:dungeon_floor_2'] end diff --git a/goblin.lua b/goblin.lua index 1503a52..b1fcf5a 100644 --- a/goblin.lua +++ b/goblin.lua @@ -505,7 +505,7 @@ end minetest.register_node("fun_caves:stone_with_diamond_trap", { description = "Diamond Trap", - tiles = {"default_cobble.png^default_mineral_diamond.png"}, + tiles = {"default_cobble.png^(default_mineral_diamond.png^[colorize:#000000:160)"}, groups = {cracky = 3}, drop = 'default:diamond', is_ground_content = false, @@ -588,7 +588,7 @@ end minetest.register_node("fun_caves:stone_with_gold_trap", { description = "Gold Trap", - tiles = {"default_cobble.png^default_mineral_gold.png"}, + tiles = {"default_cobble.png^(default_mineral_gold.png^[colorize:#000000:160)"}, groups = {cracky = 3}, drop = 'default:gold_lump', is_ground_content = false, @@ -731,7 +731,7 @@ end minetest.register_node("fun_caves:stone_with_copper_trap", { description = "Copper Trap", - tiles = {"default_cobble.png^default_mineral_copper.png"}, + tiles = {"default_cobble.png^(default_mineral_copper.png^[colorize:#000000:160)"}, groups = {cracky = 3}, drop = 'default:copper_lump', is_ground_content = false, @@ -777,7 +777,7 @@ minetest.register_abm({ -- pit of iron razors? minetest.register_node("fun_caves:stone_with_iron_trap", { description = "Iron Trap", - tiles = {"default_cobble.png^default_mineral_iron.png"}, + tiles = {"default_cobble.png^(default_mineral_iron.png^[colorize:#000000:160)"}, groups = {cracky = 3}, drop = 'default:iron_lump', is_ground_content = false,