nastier traps

master
FreeLikeGNU 2015-09-07 20:25:07 -07:00
parent ab98780348
commit bdc6a4a7c9
3 changed files with 176 additions and 1 deletions

View File

@ -5,7 +5,7 @@ local path = minetest.get_modpath("mobs_goblins")
dofile(path.."/api.lua")
dofile(path.."/goblins.lua") -- TenPlus1 and FreeLikeGNU
dofile(path.."/goblin_traps.lua")
dofile(path.."/nodes.lua")
--if minetest.setting_get("log_mods") then
minetest.log("action", "GOBLINS is lowdids!")
--end

9
nodes.lua Normal file
View File

@ -0,0 +1,9 @@
minetest.register_node(":default:mossycobble", {
description = "Mossy Cobblestone",
tiles = {"default_mossycobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 1},
sounds = default.node_sound_stone_defaults(),
paramtype = "light",
light_source = 4,
})

166
traps.lua Normal file
View File

@ -0,0 +1,166 @@
--[[some nasty things goblins can do]]
minetest.register_node("mobs_goblins: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,
})
minetest.register_node("mobs_goblins:stone_with_coal_trap", {
description = "Iron Gore",
tiles = {"default_cobble.png^default_mineral_coal.png"},
groups = {cracky = 1, level = 2},
drop = 'default:iron_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mobs_goblins:stone_with_iron_trap", {
description = "Iron Gore",
tiles = {"default_cobble.png^default_mineral_iron.png"},
groups = {cracky = 1, level = 2},
drop = 'default:iron_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mobs_goblins:stone_with_copper_trap", {
description = "Copper Gore",
tiles = {"default_cobble.png^default_mineral_copper.png"},
groups = {cracky = 1, level = 2},
drop = 'default:copper_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mobs_goblins:stone_with_gold_trap", {
description = "Gold Gore",
tiles = {"default_cobble.png^default_mineral_gold.png"},
groups = {cracky = 1,level = 2},
drop = 'default:gold_lump',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("mobs_goblins:stone_with_diamond_trap", {
description = "Diamond Gore",
tiles = {"default_cobble.png^default_mineral_diamond.png"},
groups = {cracky = 1, level = 3},
drop = 'default:diamond',
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
})
--[[ too bad we can't keep track of what physics are set too by other mods...]]
minetest.register_abm({
nodenames = {"mobs_goblins:mossycobble_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 15.1/16)) do -- IDKWTF this is but it works
if object:is_player() then
--player_speed = object:get_physics_override({speed}) -- this can get out of control
object:set_physics_override({speed = .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})
--[[ based on dwarves cactus]]
minetest.register_abm({
nodenames = {"mobs_goblins:stone_with_coal_trap"},
interval = 2,
chance = 3,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 3)) do--1.3
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
--elseif not object:is_player() and object:get_hp() == 0 and object:get_luaentity().name ~= "__builtin:item" then
-- object:remove()
--end
end
end})
minetest.register_abm({
nodenames = {"mobs_goblins:stone_with_iron_trap"},
interval = 2,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 4)) do--1.3
if object:is_player() then
minetest.set_node(pos, {name = "default:water_source"})
minetest.after(10, function()
minetest.set_node(pos, {name = "mobs_goblins:stone_with_iron_trap"})
end)
end
--elseif not object:is_player() and object:get_hp() == 0 and object:get_luaentity().name ~= "__builtin:item" then
-- object:remove()
--end
end
end})
minetest.register_abm({
nodenames = {"mobs_goblins:stone_with_copper_trap"},
interval = 1,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 3)) do--1.3
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
--elseif not object:is_player() and object:get_hp() == 0 and object:get_luaentity().name ~= "__builtin:item" then
-- object:remove()
--end
end
end})
minetest.register_abm({
nodenames = {"mobs_goblins:stone_with_gold_trap"},
interval = 1,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 4)) do--1.3
if object:is_player() then
minetest.set_node(pos, {name = "default:lava_source"})
minetest.after(4, function()
minetest.set_node(pos, {name = "mobs_goblins:stone_with_gold_trap"})
end)
end
--elseif not object:is_player() and object:get_hp() == 0 and object:get_luaentity().name ~= "__builtin:item" then
-- object:remove()
--end
end
end})
minetest.register_abm({
nodenames = {"mobs_goblins:stone_with_diamond_trap"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--pos.y =pos.y-0.4
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 4)) do--1.3
if object:is_player() then
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
--elseif not object:is_player() and object:get_hp() == 0 and object:get_luaentity().name ~= "__builtin:item" then
-- object:remove()
--end
end
end})