diff --git a/mods/ctf/ctf_crafting/depends.txt b/mods/ctf/ctf_crafting/depends.txt index a4d3e42..4c94457 100644 --- a/mods/ctf/ctf_crafting/depends.txt +++ b/mods/ctf/ctf_crafting/depends.txt @@ -1 +1,2 @@ crafting +ctf_traps? diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index 380d684..e819d57 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -193,3 +193,43 @@ crafting.register_recipe({ always_known = true, level = 1, }) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:spike 1", + items = { "default:steel_ingot 5" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:dirt 1", + items = { "default:dirt 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:cobble 1", + items = { "default:cobble 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:stone 1", + items = { "default:stone 5", "default:coal_lump" }, + always_known = true, + level = 1, +}) + +crafting.register_recipe({ + type = "inv", + output = "ctf_traps:damage_cobble 1", + items = { "default:cobble", "default:coal_lump 4", "default:steel_ingot 4" }, + always_known = true, + level = 1, +}) diff --git a/mods/ctf/ctf_map/maps b/mods/ctf/ctf_map/maps index 99bac96..9e25819 160000 --- a/mods/ctf/ctf_map/maps +++ b/mods/ctf/ctf_map/maps @@ -1 +1 @@ -Subproject commit 99bac967d656014ee44201936e4c1884a21f3ada +Subproject commit 9e2581925aed31e5572507a0aba8120c18f41fa0 diff --git a/mods/ctf/ctf_traps/depends.txt b/mods/ctf/ctf_traps/depends.txt new file mode 100644 index 0000000..45c82f2 --- /dev/null +++ b/mods/ctf/ctf_traps/depends.txt @@ -0,0 +1,2 @@ +default +ctf diff --git a/mods/ctf/ctf_traps/description.txt b/mods/ctf/ctf_traps/description.txt new file mode 100644 index 0000000..3fccf0e --- /dev/null +++ b/mods/ctf/ctf_traps/description.txt @@ -0,0 +1 @@ +Adds various traps for CTF. Ghost nodes like stone, dirt and cobblestone. The mod also adds spikes and fake cobble diff --git a/mods/ctf/ctf_traps/init.lua b/mods/ctf/ctf_traps/init.lua new file mode 100644 index 0000000..b5c7e65 --- /dev/null +++ b/mods/ctf/ctf_traps/init.lua @@ -0,0 +1,71 @@ +minetest.register_node("ctf_traps:dirt", { + description = "Unwalkable Dirt", + tiles = {"ctf_traps_dirt.png"}, + is_ground_content = false, + walkable = false, + groups = {crumbly=3, soil=1} +}) + +minetest.register_node("ctf_traps:stone", { + description = "Unwalkable Stone", + tiles = {"ctf_traps_stone.png"}, + is_ground_content = false, + walkable = false, + groups = {cracky=3, stone=1} +}) + +minetest.register_node("ctf_traps:cobble", { + description = "Unwalkable Cobblestone", + tiles = {"ctf_traps_cobble.png"}, + is_ground_content = false, + walkable = false, + groups = {cracky=3, stone=2} +}) + +minetest.register_node("ctf_traps:spike", { + description = "Spike", + drawtype = "plantlike", + tiles = {"ctf_traps_spike.png"}, + inventory_image = "ctf_traps_spike.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + damage_per_second = 5, + groups = {cracky=1, level=2}, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, +}) + +minetest.register_node("ctf_traps:damage_cobble", { + description = "Cobblestone that damages digger of enemy team", + tiles = {"ctf_traps_damage_cobble.png"}, + is_ground_content = false, + walkable = true, + groups = {cracky=3, stone=2}, + on_dig = function(pos, node, digger) + local name = digger:get_player_name() + if not digger then + return + end + + local digger_team = ctf.player(name).team + local meta = minetest.get_meta(pos) + local placer_team = meta:get_string("placer") or "missing" + if digger_team ~= placer_team then + local hp = digger:get_hp() + digger:set_hp(hp - 7) + minetest.remove_node(pos) + return + end + + meta:set_string("placer", "") + return minetest.node_dig(pos, node, digger) + end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + local meta = minetest.get_meta(pos) + local name = placer:get_player_name() + meta:set_string("placer", ctf.player(name).team) + end +}) diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_cobble.png b/mods/ctf/ctf_traps/textures/ctf_traps_cobble.png new file mode 100644 index 0000000..7b1b1dd Binary files /dev/null and b/mods/ctf/ctf_traps/textures/ctf_traps_cobble.png differ diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png b/mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png new file mode 100644 index 0000000..2823c5a Binary files /dev/null and b/mods/ctf/ctf_traps/textures/ctf_traps_damage_cobble.png differ diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_dirt.png b/mods/ctf/ctf_traps/textures/ctf_traps_dirt.png new file mode 100644 index 0000000..0b2e7f9 Binary files /dev/null and b/mods/ctf/ctf_traps/textures/ctf_traps_dirt.png differ diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_spike.png b/mods/ctf/ctf_traps/textures/ctf_traps_spike.png new file mode 100644 index 0000000..c07e016 Binary files /dev/null and b/mods/ctf/ctf_traps/textures/ctf_traps_spike.png differ diff --git a/mods/ctf/ctf_traps/textures/ctf_traps_stone.png b/mods/ctf/ctf_traps/textures/ctf_traps_stone.png new file mode 100644 index 0000000..213ff69 Binary files /dev/null and b/mods/ctf/ctf_traps/textures/ctf_traps_stone.png differ