forked from mtcontrib/throwing
		
	1.0rc1
This commit is contained in:
		
							
								
								
									
										142
									
								
								bows.lua
									
									
									
									
									
								
							
							
						
						
									
										142
									
								
								bows.lua
									
									
									
									
									
								
							| @@ -1,4 +1,8 @@ | ||||
| local stiffness= 0  | ||||
| --~  | ||||
| --~ Shot and reload system | ||||
| --~  | ||||
|  | ||||
| local stiffness= 0 | ||||
| local reload = 0 | ||||
|  | ||||
| minetest.register_on_joinplayer(function(player) | ||||
| @@ -69,14 +73,18 @@ local function reloading (player) | ||||
| 	minetest.after(reload, reloaded, player, throwing_hud) | ||||
| end | ||||
|  | ||||
| if not disable_wooden_bow then | ||||
| --~  | ||||
| --~ Bows | ||||
| --~  | ||||
|  | ||||
| if not DISABLE_WOODEN_BOW then | ||||
| 	minetest.register_tool("throwing:bow_wood", { | ||||
| 		description = "Wooden Bow", | ||||
| 		inventory_image = "throwing_bow_wood.png", | ||||
| 		wield_scale = {x=1, y=1, z=0.5}, | ||||
| 	    stack_max = 1, | ||||
| 		on_use = function(itemstack, user, pointed_thing) | ||||
| 			stiffness = 13 | ||||
| 			stiffness = 11 | ||||
| 			reload = 1.2 | ||||
| 			if throwing_shoot_arrow(itemstack, user, pointed_thing) then | ||||
| 				reloading(user) | ||||
| @@ -91,69 +99,31 @@ if not disable_wooden_bow then | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_wood', | ||||
| 		recipe = { | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 			{'farming:string', '', 'group:wood'}, | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 			{'', 'default:stick', ''}, | ||||
| 			{'farming:string', '', 'default:stick'}, | ||||
| 			{'', 'default:stick', ''}, | ||||
| 		} | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_wood', | ||||
| 		recipe = { | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 			{'group:wood', '', 'farming:string'}, | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 			{'', 'default:stick', ''}, | ||||
| 			{'default:stick', '', 'farming:string'}, | ||||
| 			{'', 'default:stick', ''}, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if not disable_golden_bow then	-- To be changed soon | ||||
| 	minetest.register_tool("throwing:bow_gold", { | ||||
| 		description = "Golden Bow", | ||||
| 		inventory_image = "throwing_bow_gold.png", | ||||
| 		wield_scale = {x=1, y=1, z=0.5}, | ||||
| 	    stack_max = 1, | ||||
| 		on_use = function(itemstack, user, pointed_thing) | ||||
| 			stiffness = 16 | ||||
| 			reload = 1.6 | ||||
| 			if throwing_shoot_arrow(itemstack, user, pointed_thing) then | ||||
| 				reloading(user) | ||||
| 				if not minetest.setting_getbool("creative_mode") then | ||||
| 					itemstack:add_wear(65535/400) | ||||
| 				end | ||||
| 			end | ||||
| 			return itemstack | ||||
| 		end, | ||||
| 	}) | ||||
| 	 | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_gold', | ||||
| 		recipe = { | ||||
| 			{'farming:string', 'default:gold_ingot', ''}, | ||||
| 			{'farming:string', '', 'default:gold_ingot'}, | ||||
| 			{'farming:string', 'default:gold_ingot', ''}, | ||||
| 		} | ||||
| 	}) | ||||
| 	 | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_gold', | ||||
| 		recipe = { | ||||
| 			{'', 'default:gold_ingot', 'farming:string'}, | ||||
| 			{'default:gold_ingot', '', 'farming:string'}, | ||||
| 			{'', 'default:gold_ingot', 'farming:string'}, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if not disable_composite_bow then | ||||
| 	minetest.register_tool("throwing:bow_composite", { | ||||
| 		description = "Composite Bow", | ||||
| 		inventory_image = "throwing_bow_composite.png", | ||||
| 		wield_scale = {x=1, y=1, z=0.5}, | ||||
| if not DISABLE_LONGBOW then | ||||
| 	minetest.register_tool("throwing:longbow", { | ||||
| 		description = "Longbow", | ||||
| 		inventory_image = "throwing_longbow.png", | ||||
| 		wield_scale = {x=1, y=2.5, z=0.5}, | ||||
| 	    stack_max = 1, | ||||
| 		on_use = function(itemstack, user, pointed_thing) | ||||
| 			stiffness = 18 | ||||
| 			reload = 1.4 | ||||
| 			reload = 2.5 | ||||
| 			if throwing_shoot_arrow(itemstack, user, pointed_thing) then | ||||
| 				reloading(user) | ||||
| 				if not minetest.setting_getbool("creative_mode") then | ||||
| @@ -163,39 +133,77 @@ if not disable_composite_bow then | ||||
| 			return itemstack | ||||
| 		end, | ||||
| 	}) | ||||
| 	 | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_composite', | ||||
| 		output = 'throwing:longbow', | ||||
| 		recipe = { | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 			{'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, | ||||
| 			{'farming:string', '', 'group:wood'}, | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 		} | ||||
| 	}) | ||||
| 	 | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_composite', | ||||
| 		output = 'throwing:longbow', | ||||
| 		recipe = { | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 			{'default:steel_ingot', 'default:steel_ingot', 'farming:string'}, | ||||
| 			{'group:wood', '', 'farming:string'}, | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if not disable_steel_bow then | ||||
| 	minetest.register_tool("throwing:bow_steel", { | ||||
| 		description = "Steel Bow", | ||||
| 		inventory_image = "throwing_bow_steel.png", | ||||
| 		wield_scale = {x=1, y=1, z=0.5}, | ||||
| if not DISABLE_COMPOSITE_BOW then | ||||
| 	minetest.register_tool("throwing:bow_composite", { | ||||
| 		description = "Composite Bow", | ||||
| 		inventory_image = "throwing_bow_composite.png", | ||||
| 		wield_scale = {x=1, y=1.4, z=0.5}, | ||||
| 	    stack_max = 1, | ||||
| 		on_use = function(itemstack, user, pointed_thing) | ||||
| 			stiffness = 20 | ||||
| 			reload = 1.6 | ||||
| 			stiffness = 18 | ||||
| 			reload = 1.5 | ||||
| 			if throwing_shoot_arrow(itemstack, user, pointed_thing) then | ||||
| 				reloading(user) | ||||
| 				if not minetest.setting_getbool("creative_mode") then | ||||
| 					itemstack:add_wear(65535/200) | ||||
| 					itemstack:add_wear(65535/150) | ||||
| 				end | ||||
| 			end | ||||
| 			return itemstack | ||||
| 		end, | ||||
| 	}) | ||||
| 	 | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_composite', | ||||
| 		recipe = { | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 			{'farming:string', '', 'default:steel_ingot'}, | ||||
| 			{'farming:string', 'group:wood', ''}, | ||||
| 		} | ||||
| 	}) | ||||
| 	 | ||||
| 	minetest.register_craft({ | ||||
| 		output = 'throwing:bow_composite', | ||||
| 		recipe = { | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 			{'default:steel_ingot', '', 'farming:string'}, | ||||
| 			{'', 'group:wood', 'farming:string'}, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if not DISABLE_STEEL_BOW then | ||||
| 	minetest.register_tool("throwing:bow_steel", { | ||||
| 		description = "Steel Bow", | ||||
| 		inventory_image = "throwing_bow_steel.png", | ||||
| 		wield_scale = {x=1, y=1.4, z=0.5}, | ||||
| 	    stack_max = 1, | ||||
| 		on_use = function(itemstack, user, pointed_thing) | ||||
| 			stiffness = 20 | ||||
| 			reload = 1.7 | ||||
| 			if throwing_shoot_arrow(itemstack, user, pointed_thing) then | ||||
| 				reloading(user) | ||||
| 				if not minetest.setting_getbool("creative_mode") then | ||||
| 					itemstack:add_wear(65535/250) | ||||
| 				end | ||||
| 			end | ||||
| 			return itemstack | ||||
|   | ||||
							
								
								
									
										84
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										84
									
								
								init.lua
									
									
									
									
									
								
							| @@ -13,42 +13,58 @@ arrows = { | ||||
| 	{"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"}, | ||||
| } | ||||
|  | ||||
| dofile(minetest.get_modpath("throwing").."/config.lua") | ||||
| dofile(minetest.get_modpath("throwing").."/bows.lua") | ||||
| if not disable_steel_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") | ||||
| end | ||||
| if not disable_stone_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") | ||||
| end | ||||
| if not disable_stone_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") | ||||
| end | ||||
| if not disable_fire_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") | ||||
| end | ||||
| if not disable_teleport_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") | ||||
| end | ||||
| if not disable_dig_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") | ||||
| end | ||||
| if not disable_build_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/build_arrow.lua") | ||||
| end | ||||
| if not disable_tnt_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") | ||||
| end | ||||
| if not disable_torch_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") | ||||
| end | ||||
| if not disable_diamond_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") | ||||
| end | ||||
| if not disable_shell_arrow then | ||||
| 	dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") | ||||
| local input = io.open(minetest.get_modpath("throwing").."/throwing.conf", "r") | ||||
| if input then | ||||
| 	dofile(minetest.get_modpath("throwing").."/throwing.conf") | ||||
| 	input:close() | ||||
| 	input = nil | ||||
| end | ||||
|  | ||||
| dofile(minetest.get_modpath("throwing").."/bows.lua") | ||||
|  | ||||
| if not DISABLE_STEEL_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_STONE_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_STONE_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_FIRE_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_TELEPORT_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_DIG_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_BUILD_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/build_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_TNT_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_TORCH_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_DIAMOND_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") | ||||
| end | ||||
|  | ||||
| if not DISABLE_SHELL_ARROW then | ||||
| 	dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") | ||||
| end | ||||
|  | ||||
| if minetest.setting_get("log_mods") then | ||||
| 	minetest.log("action", "throwing loaded") | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 581 B | 
							
								
								
									
										
											BIN
										
									
								
								textures/throwing_longbow.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								textures/throwing_longbow.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 661 B | 
							
								
								
									
										1
									
								
								throwing.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								throwing.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| DISABLE_TNT_ARROW = true | ||||
							
								
								
									
										6
									
								
								throwing.conf.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								throwing.conf.example
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| # You can disable any bow and arrow by writing lines like these inside throwing.conf | ||||
| # | ||||
| # DISABLE_WOODEN_BOW = true | ||||
| # | ||||
| # DISABLE_TNT_ARROW = true | ||||
|  | ||||
		Reference in New Issue
	
	Block a user