Compare commits
12 Commits
c792c4e9ee
...
d1acdf3a5b
Author | SHA1 | Date |
---|---|---|
teknomunk | d1acdf3a5b | |
teknomunk | 5b3985f06f | |
teknomunk | f2de62f013 | |
teknomunk | 569329da56 | |
teknomunk | d2add19024 | |
teknomunk | a66880ea75 | |
teknomunk | ab5b85772f | |
the-real-herowl | aa4fb97935 | |
the-real-herowl | ec4589e93d | |
teknomunk | 06012b5336 | |
the-real-herowl | 0bb9980970 | |
teknomunk | fbc2dd6ea0 |
|
@ -740,3 +740,12 @@ function mcl_util.remove_entity(luaentity)
|
||||||
|
|
||||||
luaentity.object:remove()
|
luaentity.object:remove()
|
||||||
end
|
end
|
||||||
|
function mcl_util.remove_entity(luaentity)
|
||||||
|
if luaentity._removed then return end
|
||||||
|
luaentity._removed = true
|
||||||
|
|
||||||
|
local hook = luaentity._on_remove
|
||||||
|
if hook then hook(luaentity) end
|
||||||
|
|
||||||
|
luaentity.object:remove()
|
||||||
|
end
|
||||||
|
|
|
@ -318,6 +318,12 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Special node drops (crushing) when digging with a hammer
|
||||||
|
local hammer = tooldef.groups.hammer
|
||||||
|
if hammer and hammer > 0 and nodedef._vl_crushing_drop then
|
||||||
|
drops = nodedef._vl_crushing_drop
|
||||||
|
end
|
||||||
|
|
||||||
if tool and nodedef._mcl_fortune_drop and enchantments.fortune then
|
if tool and nodedef._mcl_fortune_drop and enchantments.fortune then
|
||||||
local fortune_level = enchantments.fortune
|
local fortune_level = enchantments.fortune
|
||||||
local fortune_drop = nodedef._mcl_fortune_drop
|
local fortune_drop = nodedef._mcl_fortune_drop
|
||||||
|
|
|
@ -522,10 +522,11 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
local is_player = hitter:is_player()
|
local is_player = hitter:is_player()
|
||||||
local mob_pos = self.object:get_pos()
|
local mob_pos = self.object:get_pos()
|
||||||
local player_pos = hitter:get_pos()
|
local player_pos = hitter:get_pos()
|
||||||
|
local weapon = hitter:get_wielded_item()
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
-- is mob out of reach?
|
-- is mob out of reach?
|
||||||
if vector.distance(mob_pos, player_pos) > 3 then
|
if vector.distance(mob_pos, player_pos) > (weapon:get_definition().range or 3) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- is mob protected?
|
-- is mob protected?
|
||||||
|
@ -572,7 +573,6 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
|
|
||||||
|
|
||||||
-- punch interval
|
-- punch interval
|
||||||
local weapon = hitter:get_wielded_item()
|
|
||||||
local punch_interval = 1.4
|
local punch_interval = 1.4
|
||||||
|
|
||||||
-- exhaust attacker
|
-- exhaust attacker
|
||||||
|
@ -733,6 +733,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
if hitter and is_player then
|
if hitter and is_player then
|
||||||
local wielditem = hitter:get_wielded_item()
|
local wielditem = hitter:get_wielded_item()
|
||||||
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
|
kb = kb + 9 * minetest.get_item_group(wielditem:get_name(), "hammer")
|
||||||
-- add player velocity to mob knockback
|
-- add player velocity to mob knockback
|
||||||
local hv = hitter:get_velocity()
|
local hv = hitter:get_velocity()
|
||||||
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
||||||
|
|
|
@ -772,6 +772,7 @@ minetest.register_node("mcl_core:cobble", {
|
||||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
_mcl_blast_resistance = 6,
|
_mcl_blast_resistance = 6,
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
|
_vl_crushing_drop = { "mcl_core:gravel" }
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_core:mossycobble", {
|
minetest.register_node("mcl_core:mossycobble", {
|
||||||
|
|
|
@ -285,7 +285,8 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
||||||
local wielditem = hitter:get_wielded_item()
|
local wielditem = hitter:get_wielded_item()
|
||||||
--knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
--knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
local enchant = mcl_enchanting.get_enchantment(wielditem, "knockback")
|
local enchant = mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
knockback = knockback + 3.22 * enchant
|
local hammer = minetest.get_item_group(wielditem:get_name(), "hammer")
|
||||||
|
knockback = knockback + 3.22 * enchant + 3.22 * hammer
|
||||||
-- add vertical lift to knockback
|
-- add vertical lift to knockback
|
||||||
local v = player:get_velocity()
|
local v = player:get_velocity()
|
||||||
local added_v = 0
|
local added_v = 0
|
||||||
|
|
|
@ -65,7 +65,7 @@ local hoe_usagehelp = S("Use the hoe on a cultivatable block (by rightclicking i
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_wood", {
|
minetest.register_tool("mcl_farming:hoe_wood", {
|
||||||
description = S("Wood Hoe"),
|
description = S("Wood Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.wood),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
_doc_items_hidden = false,
|
_doc_items_hidden = false,
|
||||||
|
@ -109,7 +109,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_stone", {
|
minetest.register_tool("mcl_farming:hoe_stone", {
|
||||||
description = S("Stone Hoe"),
|
description = S("Stone Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.stone),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_stonehoe.png",
|
inventory_image = "farming_tool_stonehoe.png",
|
||||||
|
@ -147,7 +147,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_iron", {
|
minetest.register_tool("mcl_farming:hoe_iron", {
|
||||||
description = S("Iron Hoe"),
|
description = S("Iron Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.iron),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_steelhoe.png",
|
inventory_image = "farming_tool_steelhoe.png",
|
||||||
|
@ -193,7 +193,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_gold", {
|
minetest.register_tool("mcl_farming:hoe_gold", {
|
||||||
description = S("Golden Hoe"),
|
description = S("Golden Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.gold),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_goldhoe.png",
|
inventory_image = "farming_tool_goldhoe.png",
|
||||||
|
@ -240,7 +240,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_diamond", {
|
minetest.register_tool("mcl_farming:hoe_diamond", {
|
||||||
description = S("Diamond Hoe"),
|
description = S("Diamond Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.diamond),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_diamondhoe.png",
|
inventory_image = "farming_tool_diamondhoe.png",
|
||||||
|
@ -280,7 +280,7 @@ minetest.register_craft({
|
||||||
|
|
||||||
minetest.register_tool("mcl_farming:hoe_netherite", {
|
minetest.register_tool("mcl_farming:hoe_netherite", {
|
||||||
description = S("Netherite Hoe"),
|
description = S("Netherite Hoe"),
|
||||||
_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.netherite),
|
_tt_help = hoe_tt,
|
||||||
_doc_items_longdesc = hoe_longdesc,
|
_doc_items_longdesc = hoe_longdesc,
|
||||||
_doc_items_usagehelp = hoe_usagehelp,
|
_doc_items_usagehelp = hoe_usagehelp,
|
||||||
inventory_image = "farming_tool_netheritehoe.png",
|
inventory_image = "farming_tool_netheritehoe.png",
|
||||||
|
|
|
@ -22,9 +22,13 @@ dig_speed_class group:
|
||||||
-- Help texts
|
-- Help texts
|
||||||
local pickaxe_longdesc = S("Pickaxes are mining tools to mine hard blocks, such as stone. A pickaxe can also be used as weapon, but it is rather inefficient.")
|
local pickaxe_longdesc = S("Pickaxes are mining tools to mine hard blocks, such as stone. A pickaxe can also be used as weapon, but it is rather inefficient.")
|
||||||
local axe_longdesc = S("An axe is your tool of choice to cut down trees, wood-based blocks and other blocks. Axes deal a lot of damage as well, but they are rather slow.")
|
local axe_longdesc = S("An axe is your tool of choice to cut down trees, wood-based blocks and other blocks. Axes deal a lot of damage as well, but they are rather slow.")
|
||||||
|
|
||||||
local sword_longdesc = S("Swords are great in melee combat, as they are fast, deal high damage and can endure countless battles. Swords can also be used to cut down a few particular blocks, such as cobwebs.")
|
local sword_longdesc = S("Swords are great in melee combat, as they are fast, deal high damage and can endure countless battles. Swords can also be used to cut down a few particular blocks, such as cobwebs.")
|
||||||
|
local sword_use = S("To slash multiple enemies, hold the sword in your hand, then use (rightclick) an enemy.")
|
||||||
|
|
||||||
local shovel_longdesc = S("Shovels are tools for digging coarse blocks, such as dirt, sand and gravel. They can also be used to turn grass blocks to grass paths. Shovels can be used as weapons, but they are very weak.")
|
local shovel_longdesc = S("Shovels are tools for digging coarse blocks, such as dirt, sand and gravel. They can also be used to turn grass blocks to grass paths. Shovels can be used as weapons, but they are very weak.")
|
||||||
local shovel_use = S("To turn a grass block into a grass path, hold the shovel in your hand, then use (rightclick) the top or side of a grass block. This only works when there's air above the grass block.")
|
local shovel_use = S("To turn a grass block into a grass path, hold the shovel in your hand, then use (rightclick) the top or side of a grass block. This only works when there's air above the grass block.")
|
||||||
|
|
||||||
local shears_longdesc = S("Shears are tools to shear sheep and to mine a few block types. Shears are a special mining tool and can be used to obtain the original item from grass, leaves and similar blocks that require cutting.")
|
local shears_longdesc = S("Shears are tools to shear sheep and to mine a few block types. Shears are a special mining tool and can be used to obtain the original item from grass, leaves and similar blocks that require cutting.")
|
||||||
local shears_use = S("To shear sheep or carve faceless pumpkins, use the “place” key on them. Faces can only be carved at the side of faceless pumpkins. Mining works as usual, but the drops are different for a few blocks.")
|
local shears_use = S("To shear sheep or carve faceless pumpkins, use the “place” key on them. Faces can only be carved at the side of faceless pumpkins. Mining works as usual, but the drops are different for a few blocks.")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,452 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
|
|
||||||
|
local hammer_tt = S("Can crush blocks") .. "\n" .. S("Increased knockback")
|
||||||
|
local hammer_longdesc = S("Hammers are great in melee combat, as they deal high damage with increased knockback and can endure countless battles. Hammers can also be used to crush things.")
|
||||||
|
local hammer_use = S("To crush a block, dig the block with the hammer. This only works with some blocks.")
|
||||||
|
|
||||||
|
local spear_tt = S("Reaches farther") .. "\n" .. S("Can be thrown")
|
||||||
|
local spear_longdesc = S("Spears are great in melee combat, as they have an increased reach. They can also be thrown.")
|
||||||
|
local spear_use = S("To throw a spear, hold it in your hand, then hold use (rightclick) in the air.")
|
||||||
|
|
||||||
|
local wield_scale = mcl_vars.tool_wield_scale
|
||||||
|
|
||||||
|
local spear_entity = table.copy(mcl_bows.arrow_entity)
|
||||||
|
table.update(spear_entity,{
|
||||||
|
visual = "item",
|
||||||
|
visual_size = {x=-0.5, y=-0.5},
|
||||||
|
textures = {"vl_weaponry:spear_wood"},
|
||||||
|
_on_remove = function(self)
|
||||||
|
-- Prevent item duplication
|
||||||
|
if self._picked_up then return end
|
||||||
|
self._picked_up = true
|
||||||
|
|
||||||
|
vl_projectile.replace_with_item_drop(self, self.object:get_pos())
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
table.update(spear_entity._vl_projectile,{
|
||||||
|
behaviors = {
|
||||||
|
vl_projectile.sticks,
|
||||||
|
vl_projectile.burns,
|
||||||
|
vl_projectile.has_tracer,
|
||||||
|
vl_projectile.has_owner_grace_distance,
|
||||||
|
vl_projectile.collides_with_solids,
|
||||||
|
vl_projectile.raycast_collides_with_entities,
|
||||||
|
|
||||||
|
-- Drop spears that are sliding
|
||||||
|
function(self, dtime)
|
||||||
|
if not self._last_pos then return end
|
||||||
|
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
local y_diff = math.abs(self._last_pos.y - pos.y)
|
||||||
|
if y_diff > 0.0001 then
|
||||||
|
self._flat_time = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local flat_time = (self._flat_time or 0) + dtime
|
||||||
|
self._flat_time = flat_time
|
||||||
|
|
||||||
|
if flat_time < 0.25 then return end
|
||||||
|
|
||||||
|
mcl_util.remove_entity(self)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
pitch_offset = math.pi / 4,
|
||||||
|
})
|
||||||
|
|
||||||
|
vl_projectile.register("vl_weaponry:spear_entity", spear_entity)
|
||||||
|
|
||||||
|
local spear_throw_power = 25
|
||||||
|
|
||||||
|
local spear_on_place = function(wear_divisor)
|
||||||
|
return function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type == "node" then
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if user and not user:get_player_control().sneak then
|
||||||
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||||
|
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(pointed_thing.under, user:get_player_name())
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
|
mcl_util.use_item_durability(itemstack, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = user:get_pos()
|
||||||
|
pos.y = pos.y + 1.5
|
||||||
|
local dir = user:get_look_dir()
|
||||||
|
local yaw = user:get_look_horizontal()
|
||||||
|
local obj = vl_projectile.create("vl_weaponry:spear_entity",{
|
||||||
|
pos = pos,
|
||||||
|
dir = dir,
|
||||||
|
owner = user,
|
||||||
|
velocity = spear_throw_power,
|
||||||
|
})
|
||||||
|
obj:set_properties({textures = {itemstack:get_name()}})
|
||||||
|
local le = obj:get_luaentity()
|
||||||
|
le._shooter = user
|
||||||
|
le._source_object = user
|
||||||
|
le._damage = itemstack:get_definition()._mcl_spear_thrown_damage
|
||||||
|
le._is_critical = false
|
||||||
|
le._startpos = pos
|
||||||
|
le._collectable = true
|
||||||
|
le._arrow_item = itemstack:to_string()
|
||||||
|
minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true)
|
||||||
|
if user and user:is_player() then
|
||||||
|
if obj:get_luaentity().player == "" then
|
||||||
|
obj:get_luaentity().player = user
|
||||||
|
end
|
||||||
|
-- obj:get_luaentity().node = shooter:get_inventory():get_stack("main", 1):get_name()
|
||||||
|
end
|
||||||
|
|
||||||
|
return ItemStack()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local uses = {
|
||||||
|
wood = 60,
|
||||||
|
stone = 132,
|
||||||
|
iron = 251,
|
||||||
|
gold = 33,
|
||||||
|
diamond = 1562,
|
||||||
|
netherite = 2031,
|
||||||
|
}
|
||||||
|
local materials = {
|
||||||
|
wood = "group:wood",
|
||||||
|
stone = "group:cobble",
|
||||||
|
iron = "mcl_core:iron_ingot",
|
||||||
|
gold = "mcl_core:gold_ingot",
|
||||||
|
diamond = "mcl_core:diamond",
|
||||||
|
}
|
||||||
|
|
||||||
|
local SPEAR_RANGE = 4.5
|
||||||
|
|
||||||
|
--Hammers
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_wood", {
|
||||||
|
description = S("Wooden Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
_doc_items_hidden = false,
|
||||||
|
inventory_image = "vl_tool_woodhammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=15 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.2,
|
||||||
|
max_drop_level=1,
|
||||||
|
damage_groups = {fleshy=4},
|
||||||
|
punch_attack_uses = uses.wood,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "group:wood",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 1, level = 1, uses = uses.wood },
|
||||||
|
shovely = { speed = 1, level = 2, uses = uses.wood }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_stone", {
|
||||||
|
description = S("Stone Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
inventory_image = "vl_tool_stonehammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=5 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.3,
|
||||||
|
max_drop_level=3,
|
||||||
|
damage_groups = {fleshy=5},
|
||||||
|
punch_attack_uses = uses.stone,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "group:cobble",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 2, level = 3, uses = uses.stone },
|
||||||
|
shovely = { speed = 2, level = 3, uses = uses.stone }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_iron", {
|
||||||
|
description = S("Iron Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
inventory_image = "vl_tool_steelhammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=14 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.2,
|
||||||
|
max_drop_level=4,
|
||||||
|
damage_groups = {fleshy=6},
|
||||||
|
punch_attack_uses = uses.iron,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:iron_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 3, level = 4, uses = uses.iron },
|
||||||
|
shovely = { speed = 3, level = 4, uses = uses.iron }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_gold", {
|
||||||
|
description = S("Golden Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
inventory_image = "vl_tool_goldhammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=22 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=2,
|
||||||
|
damage_groups = {fleshy=5},
|
||||||
|
punch_attack_uses = uses.gold,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:gold_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 8, level = 4, uses = uses.gold },
|
||||||
|
shovely = { speed = 8, level = 4, uses = uses.gold }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_diamond", {
|
||||||
|
description = S("Diamond Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
inventory_image = "vl_tool_diamondhammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=10 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=5,
|
||||||
|
damage_groups = {fleshy=7},
|
||||||
|
punch_attack_uses = uses.diamond,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:diamond",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 4, level = 5, uses = uses.diamond },
|
||||||
|
pickaxey = { speed = 4, level = 5, uses = uses.diamond }
|
||||||
|
},
|
||||||
|
_mcl_upgradable = true,
|
||||||
|
_mcl_upgrade_item = "vl_weaponry:hammer_netherite"
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:hammer_netherite", {
|
||||||
|
description = S("Netherite Hammer"),
|
||||||
|
_tt_help = hammer_tt,
|
||||||
|
_doc_items_longdesc = hammer_longdesc,
|
||||||
|
_doc_items_usagehelp = hammer_use,
|
||||||
|
inventory_image = "vl_tool_netheritehammer.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
groups = { weapon=1, hammer=1, dig_speed_class=2, enchantability=10, fire_immune=1 },
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
max_drop_level=5,
|
||||||
|
damage_groups = {fleshy=9},
|
||||||
|
punch_attack_uses = uses.netherite,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_nether:netherite_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
pickaxey = { speed = 6, level = 6, uses = uses.netherite },
|
||||||
|
shovely = { speed = 6, level = 6, uses = uses.netherite }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--Spears
|
||||||
|
minetest.register_tool("vl_weaponry:spear_wood", {
|
||||||
|
description = S("Wooden Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
_doc_items_hidden = false,
|
||||||
|
inventory_image = "vl_tool_woodspear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.wood),
|
||||||
|
on_secondary_use = spear_on_place(uses.wood),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=15 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=1,
|
||||||
|
damage_groups = {fleshy=3},
|
||||||
|
punch_attack_uses = uses.wood,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "group:wood",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.wood },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.wood }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 5,
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:spear_stone", {
|
||||||
|
description = S("Stone Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
inventory_image = "vl_tool_stonespear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.stone),
|
||||||
|
on_secondary_use = spear_on_place(uses.stone),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=5 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=3,
|
||||||
|
damage_groups = {fleshy=4},
|
||||||
|
punch_attack_uses = uses.stone,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "group:cobble",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.stone },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.stone }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 6,
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:spear_iron", {
|
||||||
|
description = S("Iron Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
inventory_image = "vl_tool_steelspear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.iron),
|
||||||
|
on_secondary_use = spear_on_place(uses.iron),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=14 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=4,
|
||||||
|
damage_groups = {fleshy=5},
|
||||||
|
punch_attack_uses = uses.iron,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:iron_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.iron },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.iron }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 7,
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:spear_gold", {
|
||||||
|
description = S("Golden Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
inventory_image = "vl_tool_goldspear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.gold),
|
||||||
|
on_secondary_use = spear_on_place(uses.gold),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=22 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=2,
|
||||||
|
damage_groups = {fleshy=3},
|
||||||
|
punch_attack_uses = uses.gold,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:gold_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.gold },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.gold }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 5,
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:spear_diamond", {
|
||||||
|
description = S("Diamond Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
inventory_image = "vl_tool_diamondspear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.diamond),
|
||||||
|
on_secondary_use = spear_on_place(uses.diamond),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=10 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=5,
|
||||||
|
damage_groups = {fleshy=6},
|
||||||
|
punch_attack_uses = uses.diamond,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_core:diamond",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.diamond },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.diamond }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 8,
|
||||||
|
_mcl_upgradable = true,
|
||||||
|
_mcl_upgrade_item = "vl_weaponry:spear_netherite"
|
||||||
|
})
|
||||||
|
minetest.register_tool("vl_weaponry:spear_netherite", {
|
||||||
|
description = S("Netherite Spear"),
|
||||||
|
_tt_help = spear_tt,
|
||||||
|
_doc_items_longdesc = spear_longdesc,
|
||||||
|
_doc_items_usagehelp = spear_use,
|
||||||
|
inventory_image = "vl_tool_netheritespear.png",
|
||||||
|
wield_scale = wield_scale,
|
||||||
|
on_place = spear_on_place(uses.netherite),
|
||||||
|
on_secondary_use = spear_on_place(uses.netherite),
|
||||||
|
groups = { weapon=1, spear=1, dig_speed_class=2, enchantability=10, fire_immune=1 },
|
||||||
|
range = SPEAR_RANGE,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.75,
|
||||||
|
max_drop_level=5,
|
||||||
|
damage_groups = {fleshy=8},
|
||||||
|
punch_attack_uses = uses.netherite,
|
||||||
|
},
|
||||||
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
_repair_material = "mcl_nether:netherite_ingot",
|
||||||
|
_mcl_toollike_wield = true,
|
||||||
|
_mcl_diggroups = {
|
||||||
|
swordy = { speed = 2, level = 1, uses = uses.netherite },
|
||||||
|
swordy_cobweb = { speed = 2, level = 1, uses = uses.netherite }
|
||||||
|
},
|
||||||
|
_mcl_spear_thrown_damage = 12,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Crafting recipes
|
||||||
|
local s = "mcl_core:stick"
|
||||||
|
local b = ""
|
||||||
|
for t,m in pairs(materials) do
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "vl_weaponry:hammer_"..t,
|
||||||
|
recipe = {
|
||||||
|
{ m, b, m },
|
||||||
|
{ m, s, m },
|
||||||
|
{ b, s, b },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "vl_weaponry:spear_"..t,
|
||||||
|
recipe = {
|
||||||
|
{ m, b, b },
|
||||||
|
{ b, s, b },
|
||||||
|
{ b, b, s },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = vl_weaponry
|
||||||
|
author = Herowl
|
||||||
|
depends = mcl_sounds, mcl_init, mcl_bows
|
|
@ -752,9 +752,10 @@ end, -200)
|
||||||
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
-- attack reach limit
|
-- attack reach limit
|
||||||
if hitter and hitter:is_player() then
|
if hitter and hitter:is_player() then
|
||||||
|
local weapon = hitter:get_wielded_item()
|
||||||
local player_pos = player:get_pos()
|
local player_pos = player:get_pos()
|
||||||
local hitter_pos = hitter:get_pos()
|
local hitter_pos = hitter:get_pos()
|
||||||
if vector.distance(player_pos, hitter_pos) > 3 then
|
if vector.distance(player_pos, hitter_pos) > (weapon:get_definition().range or 3) then
|
||||||
damage = 0
|
damage = 0
|
||||||
return damage
|
return damage
|
||||||
end
|
end
|
||||||
|
|
After Width: | Height: | Size: 189 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 171 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 156 B |