[throwing] Update to Git patch b33ffde:

https://github.com/AntumMT/mtmod-throwing/tree/b33ffde
master
AntumDeluge 2017-06-28 15:01:40 -07:00
parent 86dd60c649
commit c6ba0b6e1c
2 changed files with 13 additions and 6 deletions

View File

@ -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.snowdrift]: https://github.com/AntumMT/mtmod-snowdrift/tree/1b9da4f
[patch.spawneggs]: https://github.com/AntumMT/mtmod-spawneggs/tree/f2cc4cc [patch.spawneggs]: https://github.com/AntumMT/mtmod-spawneggs/tree/f2cc4cc
[patch.technic]: https://github.com/AntumMT/mtmod-technic/tree/b608509 [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.tools_obsidian]: https://github.com/AntumMT/mtmod-tools_obsidian/tree/2d19297
[patch.trash_can]: https://github.com/AntumMT/mtmod-trash_can/tree/5a92bf4 [patch.trash_can]: https://github.com/AntumMT/mtmod-trash_can/tree/5a92bf4
[patch.walking_light]: https://github.com/AntumMT/mtmod-walking_light/tree/e602515 [patch.walking_light]: https://github.com/AntumMT/mtmod-walking_light/tree/e602515

View File

@ -6,10 +6,17 @@ arrows = {
{"throwing:arrow_build", "throwing:arrow_build_entity"} {"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) local throwing_shoot_arrow = function(itemstack, player)
for _,arrow in ipairs(arrows) do for _,arrow in ipairs(arrows) do
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then 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]) player:get_inventory():remove_item("main", arrow[1])
end end
local playerpos = player:getpos() local playerpos = player:getpos()
@ -35,7 +42,7 @@ minetest.register_tool("throwing:bow_wood", {
stack_max = 1, stack_max = 1,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(itemstack, user, pointed_thing) then 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) itemstack:add_wear(65535/50)
end end
end end
@ -58,7 +65,7 @@ minetest.register_tool("throwing:bow_stone", {
stack_max = 1, stack_max = 1,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then 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) itemstack:add_wear(65535/100)
end end
end end
@ -81,7 +88,7 @@ minetest.register_tool("throwing:bow_steel", {
stack_max = 1, stack_max = 1,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then 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) itemstack:add_wear(65535/200)
end end
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").."/dig_arrow.lua")
dofile(minetest.get_modpath("throwing").."/build_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") minetest.log("action", "throwing loaded")
end end