diff --git a/README.md b/README.md index e38e8665..5c15ec69 100644 --- a/README.md +++ b/README.md @@ -575,7 +575,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m [patch.snowdrift]: https://github.com/AntumMT/mtmod-snowdrift/tree/1b9da4f [patch.spawneggs]: https://github.com/AntumMT/mtmod-spawneggs/tree/f2cc4cc [patch.technic]: https://github.com/AntumMT/mtmod-technic/tree/b608509 -[patch.throwing]: https://github.com/AntumMT/mtmod-throwing/tree/7b48d90 +[patch.throwing]: https://github.com/AntumMT/mtmod-throwing/tree/b33ffde [patch.tools_obsidian]: https://github.com/AntumMT/mtmod-tools_obsidian/tree/2d19297 [patch.trash_can]: https://github.com/AntumMT/mtmod-trash_can/tree/5a92bf4 [patch.walking_light]: https://github.com/AntumMT/mtmod-walking_light/tree/e602515 diff --git a/mods/equipment/throwing/init.lua b/mods/equipment/throwing/init.lua index 700ff3ae..3509e173 100644 --- a/mods/equipment/throwing/init.lua +++ b/mods/equipment/throwing/init.lua @@ -6,10 +6,17 @@ arrows = { {"throwing:arrow_build", "throwing:arrow_build_entity"} } +local creative = minetest.settings:get_bool("creative_mode") +local weapon_wear = minetest.settings:get_bool("enable_weapon_wear") +if weapon_wear == nil then + -- Default is enabled + weapon_wear = true +end + local throwing_shoot_arrow = function(itemstack, player) for _,arrow in ipairs(arrows) do if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then - if not minetest.settings:get_bool("creative_mode") then + if not creative then player:get_inventory():remove_item("main", arrow[1]) end local playerpos = player:getpos() @@ -35,7 +42,7 @@ minetest.register_tool("throwing:bow_wood", { stack_max = 1, on_use = function(itemstack, user, pointed_thing) if throwing_shoot_arrow(itemstack, user, pointed_thing) then - if not minetest.settings:get_bool("creative_mode") then + if not creative and weapon_wear then itemstack:add_wear(65535/50) end end @@ -58,7 +65,7 @@ minetest.register_tool("throwing:bow_stone", { stack_max = 1, on_use = function(itemstack, user, pointed_thing) if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.settings:get_bool("creative_mode") then + if not creative and weapon_wear then itemstack:add_wear(65535/100) end end @@ -81,7 +88,7 @@ minetest.register_tool("throwing:bow_steel", { stack_max = 1, on_use = function(itemstack, user, pointed_thing) if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.settings:get_bool("creative_mode") then + if not creative and weapon_wear then itemstack:add_wear(65535/200) end end @@ -104,6 +111,6 @@ dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") dofile(minetest.get_modpath("throwing").."/build_arrow.lua") -if minetest.settings:get("log_mods") then +if minetest.settings:get_bool("log_mods") then minetest.log("action", "throwing loaded") end