2023-11-19 01:48:35 +01:00
|
|
|
local S = minetest.get_translator()
|
|
|
|
|
2023-08-07 22:56:29 +02:00
|
|
|
--------------------------------------RED KATAR--------------------------------------
|
|
|
|
|
|
|
|
local katar_on_use = function(itemstack, player, pointed_thing)
|
|
|
|
local click_test = exchangeclone.check_on_rightclick(itemstack, player, pointed_thing)
|
|
|
|
if click_test ~= false then
|
|
|
|
return click_test
|
|
|
|
end
|
|
|
|
|
|
|
|
if player:get_player_control().aux1 then
|
2024-01-24 04:23:32 +01:00
|
|
|
return exchangeclone.charge_update(itemstack, player, 5)
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if pointed_thing.type == "object" then
|
|
|
|
local name = pointed_thing.ref:get_entity_name()
|
|
|
|
if name == "mobs_mc:sheep" or name == "mobs_mc:mooshroom" then
|
|
|
|
return -- Don't do AOE when pointed at sheep/mooshroom, shear instead.
|
|
|
|
end
|
|
|
|
end
|
2024-02-04 22:29:48 +01:00
|
|
|
|
2023-08-07 22:56:29 +02:00
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
local node = minetest.get_node(pointed_thing.under)
|
2024-02-04 22:29:48 +01:00
|
|
|
local on_shears_place = minetest.registered_items[node.name]._on_shears_place
|
|
|
|
if on_shears_place then
|
|
|
|
return on_shears_place(itemstack, player, pointed_thing)
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
2024-02-04 22:29:48 +01:00
|
|
|
if node.name == "mcl_farming:pumpkin" and (pointed_thing.above.y ~= pointed_thing.under.y) then
|
|
|
|
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
|
|
|
|
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
|
|
|
|
local param2 = minetest.dir_to_facedir(dir)
|
|
|
|
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
|
|
|
|
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
|
|
|
|
elseif minetest.get_item_group(node.name, "exchangeclone_dirt") > 0 then
|
2023-08-07 22:56:29 +02:00
|
|
|
if player:get_player_control().sneak then
|
2024-02-04 22:29:48 +01:00
|
|
|
local meta = itemstack:get_meta()
|
|
|
|
local current_mode = meta:get_string("exchangeclone_multidig_mode")
|
|
|
|
if current_mode == "3x3" then
|
|
|
|
meta:set_string("exchangeclone_multidig_mode", "1x1")
|
|
|
|
minetest.chat_send_player(player:get_player_name(), S("Single node mode"))
|
2023-08-07 22:56:29 +02:00
|
|
|
else
|
2024-02-04 22:29:48 +01:00
|
|
|
meta:set_string("exchangeclone_multidig_mode", "3x3")
|
|
|
|
minetest.chat_send_player(player:get_player_name(), S("3x3 mode"))
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
else
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.hoe_action(itemstack, player, pointed_thing.under)
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
2024-02-24 18:12:30 +01:00
|
|
|
elseif (minetest.get_item_group(node.name, "tree") > 0)
|
|
|
|
or (minetest.get_item_group(node.name, "bamboo_block") > 0) then
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.axe_action(itemstack, player, pointed_thing.under)
|
2024-02-24 18:12:30 +01:00
|
|
|
elseif exchangeclone.mcl2 and minetest.registered_items[node.name]._mcl_stripped_variant then
|
|
|
|
exchangeclone.axe_action(itemstack, player, pointed_thing.under, true)
|
|
|
|
elseif exchangeclone.mcla and minetest.registered_items[node.name]._on_axe_place then
|
|
|
|
exchangeclone.axe_action(itemstack, player, pointed_thing.under, true)
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif exchangeclone.mcl
|
|
|
|
and (minetest.get_item_group(node.name, "shearsy") > 0
|
|
|
|
or minetest.get_item_group(node.name, "shearsy_cobweb") > 0) then
|
|
|
|
exchangeclone.shear_action(itemstack, player, pointed_thing.under)
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
|
|
|
else
|
|
|
|
local damage_all = itemstack:get_meta():get_int("exchangeclone_damage_all")
|
2023-10-04 02:08:07 +02:00
|
|
|
if damage_all ~= 0 then damage_all = 1 end
|
2023-08-07 22:56:29 +02:00
|
|
|
if player:get_player_control().sneak then
|
|
|
|
if damage_all == 0 then
|
|
|
|
damage_all = 1
|
|
|
|
minetest.chat_send_player(player:get_player_name(), "Damage all mobs")
|
|
|
|
else
|
|
|
|
damage_all = 0
|
|
|
|
minetest.chat_send_player(player:get_player_name(), "Damage hostile mobs")
|
|
|
|
end
|
|
|
|
itemstack:get_meta():set_int("exchangeclone_damage_all", damage_all)
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
local aoe_function = exchangeclone.aoe_attack({damage = 1000, knockback = 20, radius = 10, damage_all = damage_all, cooldown = 0.625})
|
2023-08-07 22:56:29 +02:00
|
|
|
aoe_function(itemstack, player, pointed_thing)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
minetest.register_tool("exchangeclone:red_katar", {
|
2023-11-19 01:48:35 +01:00
|
|
|
description = S("Red Katar").."\n"..S("Single node mode"),
|
2023-08-07 22:56:29 +02:00
|
|
|
wield_image = "exchangeclone_red_katar.png",
|
|
|
|
inventory_image = "exchangeclone_red_katar.png",
|
|
|
|
on_secondary_use = katar_on_use,
|
|
|
|
on_place = katar_on_use,
|
2023-12-25 18:56:50 +01:00
|
|
|
groups = { tool=1, red_katar = 1, sword = 1, axe=1, hoe = 1, shears = 1, dig_speed_class=7, enchantability=0, disable_repair = 1, fire_immune = 1, exchangeclone_upgradable = 1},
|
2023-08-07 22:56:29 +02:00
|
|
|
wield_scale = exchangeclone.wield_scale,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.3,
|
2023-10-30 23:42:11 +01:00
|
|
|
max_drop_level=8,
|
|
|
|
damage_groups = {fleshy=28},
|
2023-08-07 22:56:29 +02:00
|
|
|
punch_attack_uses = 0,
|
|
|
|
groupcaps={
|
2024-02-15 22:00:26 +01:00
|
|
|
exchangeclone_dirt = {times=exchangeclone.get_mtg_times(64, nil, "crumbly"), uses=0, maxlevel=4},
|
|
|
|
snappy = {times=exchangeclone.get_mtg_times(64, nil, "snappy"), uses=0, maxlevel=5},
|
|
|
|
choppy = {times=exchangeclone.get_mtg_times(64, nil, "choppy"), uses=0, maxlevel=5},
|
2023-08-07 22:56:29 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
sound = { breaks = "default_tool_breaks" },
|
|
|
|
_mcl_toollike_wield = true,
|
|
|
|
_mcl_diggroups = {
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone_dirt = { speed = 64, level = 7, uses = 0 },
|
2024-01-26 17:52:38 +01:00
|
|
|
shearsy = { speed = 64, level = 3, uses = 0 },
|
2024-02-04 22:29:48 +01:00
|
|
|
shearsy_wool = { speed = 64, level = 7, uses = 0 },
|
|
|
|
shearsy_cobweb = { speed = 64, level = 7, uses = 0 },
|
|
|
|
hoey = { speed = 64, level = 7, uses = 0 },
|
|
|
|
swordy = { speed = 64, level = 7, uses = 0 },
|
|
|
|
axey = { speed = 64, level = 7, uses = 0 }
|
2023-08-07 22:56:29 +02:00
|
|
|
},
|
2024-02-04 22:29:48 +01:00
|
|
|
})
|
2023-08-07 22:56:29 +02:00
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
minetest.register_alias("exchangeclone:red_katar_3x3", "exchangeclone:red_katar")
|
|
|
|
exchangeclone.register_multidig_tool("exchangeclone:red_katar", {"group:exchangeclone_dirt"})
|
|
|
|
exchangeclone.set_charge_type("exchangeclone:red_katar", "red_multi")
|
2023-11-19 01:48:35 +01:00
|
|
|
|
2023-08-07 22:56:29 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "exchangeclone:red_katar",
|
|
|
|
type = "shapeless",
|
|
|
|
recipe = {
|
|
|
|
"exchangeclone:red_matter_sword",
|
|
|
|
"exchangeclone:red_matter_axe",
|
|
|
|
"group:red_matter_hoe",
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.mcl and "exchangeclone:red_matter_shears" or "exchangeclone:red_matter",
|
2023-08-07 22:56:29 +02:00
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
--------------------------------------RED MORNINGSTAR--------------------------------------
|
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
-- If pointed_thing has on_rightclick
|
|
|
|
-- Run on_rightclick function
|
|
|
|
-- Elseif player holding aux1
|
|
|
|
-- Range update
|
|
|
|
-- Elseif pointed at node:
|
|
|
|
-- If node is an ore:
|
|
|
|
-- Vein mine
|
|
|
|
-- Elseif node is dirt and MCL:
|
|
|
|
-- Shovel action (since paths exist, there has to be a way to do it without sneaking)
|
|
|
|
-- Elseif node is shovely and player is sneaking
|
|
|
|
-- Shovel action
|
|
|
|
-- Elseif node is pickaxey:
|
|
|
|
-- Hammer action
|
|
|
|
-- Elseif player is sneaking
|
|
|
|
-- Update the mode
|
2023-08-07 22:56:29 +02:00
|
|
|
|
|
|
|
local function morningstar_on_use(itemstack, player, pointed_thing)
|
|
|
|
local click_test = exchangeclone.check_on_rightclick(itemstack, player, pointed_thing)
|
|
|
|
if click_test ~= false then
|
|
|
|
return click_test
|
|
|
|
end
|
|
|
|
|
|
|
|
if player:get_player_control().aux1 then
|
2024-02-04 22:29:48 +01:00
|
|
|
return exchangeclone.charge_update(itemstack, player)
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
local sneaking = player:get_player_control().sneak
|
2023-08-07 22:56:29 +02:00
|
|
|
if pointed_thing.type == "node" then
|
2024-02-04 22:29:48 +01:00
|
|
|
local name = minetest.get_node(pointed_thing.under).name
|
2024-02-13 01:25:25 +01:00
|
|
|
if minetest.get_item_group(name, "exchangeclone_ore") > 0 then
|
2023-08-07 22:56:29 +02:00
|
|
|
if exchangeclone.check_cooldown(player, "pickaxe") then return itemstack end
|
2024-02-13 01:25:25 +01:00
|
|
|
exchangeclone.play_sound(player, "exchangeclone_destruct")
|
2024-01-25 16:21:43 +01:00
|
|
|
exchangeclone.multidig_data[player:get_player_name()] = true
|
2023-11-19 01:48:35 +01:00
|
|
|
exchangeclone.mine_vein(player, pointed_thing.under)
|
2024-01-25 16:21:43 +01:00
|
|
|
exchangeclone.multidig_data[player:get_player_name()] = nil
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.start_cooldown(player, "pickaxe", 0.5)
|
2023-08-07 22:56:29 +02:00
|
|
|
return
|
2024-02-24 18:12:30 +01:00
|
|
|
-- I don't remember why I'm doing the dirt group separetely... but there must be a reason.
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif minetest.get_item_group(name, "exchangeclone_dirt") > 0 and exchangeclone.mcl then
|
|
|
|
exchangeclone.shovel_action(itemstack, player, pointed_thing.under)
|
2024-02-23 19:53:21 +01:00
|
|
|
elseif minetest.get_item_group(name, exchangeclone.shovel_group) > 0 then
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.shovel_action(itemstack, player, pointed_thing.under)
|
2024-02-24 18:12:30 +01:00
|
|
|
elseif exchangeclone.mcla and minetest.registered_items[name]._on_shovel_place then
|
|
|
|
exchangeclone.shovel_action(itemstack, player, pointed_thing)
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif minetest.get_item_group(name, exchangeclone.pickaxe_group) > 0 and sneaking then
|
|
|
|
exchangeclone.hammer_action(itemstack, player, pointed_thing.under)
|
2023-08-07 22:56:29 +02:00
|
|
|
else
|
2024-02-04 22:29:48 +01:00
|
|
|
exchangeclone.place_torch(player, pointed_thing)
|
2024-02-23 19:53:21 +01:00
|
|
|
exchangeclone.add_player_emc(player, -math.max(exchangeclone.get_item_emc(exchangeclone.itemstrings.torch) or 8, 8))
|
2024-02-14 02:12:48 +01:00
|
|
|
-- If the torch could not be placed, it still costs EMC... not sure how to fix that
|
2023-08-07 22:56:29 +02:00
|
|
|
return
|
|
|
|
end
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif sneaking then
|
2023-08-07 22:56:29 +02:00
|
|
|
local meta = itemstack:get_meta()
|
2024-02-04 22:29:48 +01:00
|
|
|
local current_mode = itemstack:get_meta():get_string("exchangeclone_multidig_mode")
|
2023-08-07 22:56:29 +02:00
|
|
|
if current_mode == "" or not current_mode then current_mode = "1x1" end
|
|
|
|
if current_mode == "1x1" then
|
2024-02-04 22:29:48 +01:00
|
|
|
meta:set_string("exchangeclone_multidig_mode", "3x3")
|
2023-11-19 01:48:35 +01:00
|
|
|
minetest.chat_send_player(player:get_player_name(), S("3x3 mode"))
|
2023-08-07 22:56:29 +02:00
|
|
|
elseif current_mode == "3x3" then
|
2024-02-04 22:29:48 +01:00
|
|
|
meta:set_string("exchangeclone_multidig_mode", "3x1_tall")
|
2023-11-19 01:48:35 +01:00
|
|
|
minetest.chat_send_player(player:get_player_name(), S("3x1 tall mode"))
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif current_mode == "3x1_tall" then
|
|
|
|
meta:set_string("exchangeclone_multidig_mode", "3x1_wide")
|
2023-11-19 01:48:35 +01:00
|
|
|
minetest.chat_send_player(player:get_player_name(), S("3x1 wide mode"))
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif current_mode == "3x1_wide" then
|
|
|
|
meta:set_string("exchangeclone_multidig_mode", "3x1_long")
|
2023-11-19 01:48:35 +01:00
|
|
|
minetest.chat_send_player(player:get_player_name(), S("3x1 long mode"))
|
2024-02-04 22:29:48 +01:00
|
|
|
elseif current_mode == "3x1_long" then
|
|
|
|
meta:set_string("exchangeclone_multidig_mode", "1x1")
|
2023-11-19 01:48:35 +01:00
|
|
|
minetest.chat_send_player(player:get_player_name(), S("Single node mode"))
|
2023-08-07 22:56:29 +02:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
minetest.register_tool("exchangeclone:red_morningstar", {
|
2023-11-19 01:48:35 +01:00
|
|
|
description = S("Red Morningstar").."\n"..S("Single node mode"),
|
2023-08-07 22:56:29 +02:00
|
|
|
wield_image = "exchangeclone_red_morningstar.png",
|
|
|
|
inventory_image = "exchangeclone_red_morningstar.png",
|
|
|
|
on_secondary_use = morningstar_on_use,
|
|
|
|
on_place = morningstar_on_use,
|
2023-12-25 18:56:50 +01:00
|
|
|
groups = { tool=1, red_morningstar = 1, shovel = 1, hammer=1, pickaxe = 1, dig_speed_class=7, enchantability=0, disable_repair = 1, fire_immune = 1, exchangeclone_upgradable = 1},
|
2023-08-07 22:56:29 +02:00
|
|
|
wield_scale = exchangeclone.wield_scale,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.3,
|
2023-10-30 23:42:11 +01:00
|
|
|
max_drop_level=8,
|
|
|
|
damage_groups = {fleshy=25},
|
2023-08-07 22:56:29 +02:00
|
|
|
punch_attack_uses = 0,
|
|
|
|
groupcaps={
|
2024-02-23 19:53:21 +01:00
|
|
|
cracky = {times=exchangeclone.get_mtg_times(64, nil, "cracky"), uses=0, maxlevel=5},
|
|
|
|
crumbly = {times=exchangeclone.get_mtg_times(64, nil, "crumbly"), uses=0, maxlevel=5},
|
|
|
|
choppy = {times=exchangeclone.get_mtg_times(64, nil, "choppy"), uses=0, maxlevel=5},
|
2023-08-07 22:56:29 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
sound = { breaks = "default_tool_breaks" },
|
|
|
|
_mcl_toollike_wield = true,
|
|
|
|
_mcl_diggroups = {
|
2024-01-26 17:52:38 +01:00
|
|
|
pickaxey = {speed = 64, level = 7, uses = 0},
|
|
|
|
shovely = {speed = 64, level = 7, uses = 0},
|
|
|
|
axey = { speed = 64, level = 7, uses = 0 },
|
2023-08-07 22:56:29 +02:00
|
|
|
},
|
2024-02-04 22:29:48 +01:00
|
|
|
})
|
2023-08-07 22:56:29 +02:00
|
|
|
|
2024-02-04 22:29:48 +01:00
|
|
|
minetest.register_alias("exchangeclone:red_morningstar_3x1", "exchangeclone:red_morningstar")
|
|
|
|
minetest.register_alias("exchangeclone:red_morningstar_3x3", "exchangeclone:red_morningstar")
|
|
|
|
exchangeclone.register_multidig_tool("exchangeclone:red_morningstar", {"group:"..exchangeclone.pickaxe_group, "group:"..exchangeclone.shovel_group})
|
|
|
|
exchangeclone.set_charge_type("exchangeclone:red_morningstar", "red_multi")
|
2023-11-19 01:48:35 +01:00
|
|
|
|
2023-08-07 22:56:29 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "exchangeclone:red_morningstar",
|
|
|
|
type = "shapeless",
|
|
|
|
recipe = {
|
|
|
|
"group:red_matter_hammer",
|
|
|
|
"exchangeclone:red_matter_shovel",
|
|
|
|
"group:red_matter_pickaxe",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter",
|
|
|
|
"exchangeclone:red_matter"
|
|
|
|
}
|
|
|
|
})
|