Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Reinforced Cobblestone harder to break for enemy team #1250

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions mods/ctf/ctf_map/ctf_traps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,49 @@ minetest.register_node("ctf_map:reinforced_cobble", {
description = "Reinforced Cobblestone",
tiles = {"ctf_map_reinforced_cobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 2},
sounds = default.node_sound_stone_defaults(),
on_punch = function(pos, node, digger)
local meta = minetest.get_meta(pos)
local placer_team = meta:get_string("placer_team")
local digger_team = ctf_teams.get(digger)
if placer_team ~= digger_team then
minetest.set_node(pos, {name = "ctf_map:reinforced_cobble_hardened"})
meta = minetest.get_meta(pos)
meta:set_string("placer_team", placer_team)
end
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string("placer_team", ctf_teams.get(placer))
end,
on_dig = function(pos, node, digger)
local meta = minetest.get_meta(pos)
meta:set_string("placer_team", "")
minetest.node_dig(pos, node, digger)
end
})

minetest.register_node("ctf_map:reinforced_cobble_hardened", {
description = "Reinforced Cobblestone Hardened\nYou're not meant to use this",
tiles = {"ctf_map_reinforced_cobble.png"},
is_ground_content = false,
groups = {cracky = 1, stone = 2},
sounds = default.node_sound_stone_defaults(),
drop = "ctf_map:reinforced_cobble",
on_punch = function(pos, node, digger)
local meta = minetest.get_meta(pos)
local placer_team = meta:get_string("placer_team")
local digger_team = ctf_teams.get(digger)
if placer_team == digger_team then
minetest.set_node(pos, {name = "ctf_map:reinforced_cobble"})
meta = minetest.get_meta(pos)
meta:set_string("placer_team", placer_team)
end
end,
on_dig = function(pos, node, digger)
local meta = minetest.get_meta(pos)
meta:set_string("placer_team", "")
minetest.node_dig(pos, node, digger)
end
})
Loading