diff --git a/mods/ctf/ctf_classes/medic.lua b/mods/ctf/ctf_classes/medic.lua index 54fb841..561bdaa 100644 --- a/mods/ctf/ctf_classes/medic.lua +++ b/mods/ctf/ctf_classes/medic.lua @@ -151,9 +151,15 @@ local function remove_pillar(pos, pname) local name = minetest.get_node(pos).name if name:find("default") and isdiggable(name) then + local player = minetest.get_player_by_name(pname) + + if minetest.get_modpath("antisabotage") then + -- Fix paxel being capable of mining blocks under teammates + if antisabotage.is_sabotage(pos, minetest.get_node(pos), player) then return end + end + minetest.dig_node(pos) - local player = minetest.get_player_by_name(pname) if player and diggers[pname] and type(diggers[pname]) ~= "table" then if vector.distance(player:get_pos(), pos) <= DIG_DIST_LIMIT then pos.y = pos.y + 1 diff --git a/mods/ctf/ctf_classes/mod.conf b/mods/ctf/ctf_classes/mod.conf index c60fda3..a933eb0 100644 --- a/mods/ctf/ctf_classes/mod.conf +++ b/mods/ctf/ctf_classes/mod.conf @@ -1,3 +1,4 @@ name = ctf_classes -depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_stats, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie, crafting, sniper_rifles, grenades, furnace, ctf_respawn_immunity, ctf_marker, ctf_match description = Adds classes, including knight, shooter, and medic +depends = ctf, ctf_flag, ctf_colors, ctf_map_core, ctf_stats, ctf_bandages, physics, shooter, hpregen, give_initial_stuff, dropondie, crafting, sniper_rifles, grenades, furnace, ctf_respawn_immunity, ctf_marker, ctf_match +optional_depends = antisabotage diff --git a/mods/pvp/antisabotage/init.lua b/mods/pvp/antisabotage/init.lua index be1d6c8..cd8f2f1 100644 --- a/mods/pvp/antisabotage/init.lua +++ b/mods/pvp/antisabotage/init.lua @@ -1,9 +1,9 @@ --- Code by Apelta. Mutelated by Lone_Wolf - -minetest.register_on_dignode(function(pos, oldnode, digger) - if not digger:is_player() then return end +-- Code by Apelta. Mutelated by Lone_Wolf. Mutelated again by Apelta. +antisabotage = {} +function antisabotage.is_sabotage(pos, oldnode, digger) -- used for paxel local dname = digger:get_player_name() + for _, player in pairs(minetest.get_connected_players()) do local name = player:get_player_name() @@ -12,10 +12,21 @@ minetest.register_on_dignode(function(pos, oldnode, digger) if math.floor(player_pos.y) == pos.y and vector.distance(player_pos, pos) <= 1.5 then minetest.set_node(pos, oldnode) - digger:get_inventory():remove_item("main", ItemStack(oldnode)) + + -- Remove all node drops + for _, item in pairs(minetest.get_node_drops(oldnode)) do + digger:get_inventory():remove_item("main", ItemStack(item)) + end + minetest.chat_send_player(dname, "You can't mine blocks under your teammates!") - return + return true end end end +end + +minetest.register_on_dignode(function(pos, oldnode, digger) + if not digger:is_player() then return end + + antisabotage.is_sabotage(pos, oldnode, digger) end)