2013-11-26 21:22:21 +00:00
|
|
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/shooter.lua")
|
|
|
|
|
|
|
|
minetest.register_tool("shooter:pistol", {
|
2013-12-05 20:28:32 +00:00
|
|
|
description = "Pistol",
|
|
|
|
inventory_image = "shooter_pistol.png",
|
2013-11-26 21:22:21 +00:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2014-06-02 18:19:22 +00:00
|
|
|
local name = user:get_player_name()
|
2013-12-05 20:28:32 +00:00
|
|
|
shooter:fire_weapon(user, pointed_thing, {
|
2014-06-02 18:19:22 +00:00
|
|
|
name = name,
|
|
|
|
range = 100,
|
|
|
|
step = 20,
|
|
|
|
tool_caps = {full_punch_interval=0.5, damage_groups={fleshy=2}},
|
2013-12-13 19:18:48 +00:00
|
|
|
groups = {snappy=3, fleshy=3, oddly_breakable_by_hand=3},
|
2013-11-26 21:22:21 +00:00
|
|
|
sound = "shooter_pistol",
|
2014-06-02 18:19:22 +00:00
|
|
|
particle = "shooter_cap.png",
|
2013-11-26 21:22:21 +00:00
|
|
|
})
|
|
|
|
itemstack:add_wear(328) -- 200 Rounds
|
2013-12-06 22:47:55 +00:00
|
|
|
return itemstack
|
2013-11-26 21:22:21 +00:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("shooter:riffle", {
|
2013-12-05 20:28:32 +00:00
|
|
|
description = "Riffle",
|
|
|
|
inventory_image = "shooter_riffle.png",
|
2013-11-26 21:22:21 +00:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2014-06-02 18:19:22 +00:00
|
|
|
local name = user:get_player_name()
|
2013-12-05 20:28:32 +00:00
|
|
|
shooter:fire_weapon(user, pointed_thing, {
|
2014-06-02 18:19:22 +00:00
|
|
|
name = name,
|
|
|
|
range = 200,
|
|
|
|
step = 30,
|
|
|
|
tool_caps = {full_punch_interval=1.0, damage_groups={fleshy=3}},
|
2013-12-13 19:18:48 +00:00
|
|
|
groups = {snappy=3, crumbly=3, choppy=3, fleshy=2, oddly_breakable_by_hand=2},
|
2013-11-26 21:22:21 +00:00
|
|
|
sound = "shooter_riffle",
|
2014-06-02 18:19:22 +00:00
|
|
|
particle = "shooter_bullet.png",
|
2013-11-26 21:22:21 +00:00
|
|
|
})
|
|
|
|
itemstack:add_wear(656) -- 100 Rounds
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2013-12-05 20:28:32 +00:00
|
|
|
minetest.register_tool("shooter:shotgun", {
|
|
|
|
description = "Shotgun",
|
|
|
|
inventory_image = "shooter_shotgun.png",
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2014-06-02 18:19:22 +00:00
|
|
|
local name = user:get_player_name()
|
2013-12-05 20:28:32 +00:00
|
|
|
shooter:fire_weapon(user, pointed_thing, {
|
2014-06-02 18:19:22 +00:00
|
|
|
name = name,
|
|
|
|
range = 50,
|
|
|
|
step = 15,
|
2013-12-05 20:28:32 +00:00
|
|
|
tool_caps = {full_punch_interval=1.5, damage_groups={fleshy=4}},
|
2013-12-13 19:18:48 +00:00
|
|
|
groups = {cracky=3, snappy=2, crumbly=2, choppy=2, fleshy=1, oddly_breakable_by_hand=1},
|
2013-12-05 20:28:32 +00:00
|
|
|
sound = "shooter_shotgun",
|
|
|
|
particle = "smoke_puff.png",
|
|
|
|
})
|
|
|
|
itemstack:add_wear(1311) -- 50 Rounds
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2014-06-02 18:19:22 +00:00
|
|
|
minetest.register_tool("shooter:machine_gun", {
|
|
|
|
description = "Sub Machine Gun",
|
|
|
|
inventory_image = "shooter_smgun.png",
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
local name = user:get_player_name()
|
|
|
|
for i = 0, 0.45, 0.15 do
|
|
|
|
minetest.after(i, function()
|
|
|
|
shooter:fire_weapon(user, pointed_thing, {
|
|
|
|
name = name,
|
|
|
|
range = 100,
|
|
|
|
step = 20,
|
|
|
|
tool_caps = {full_punch_interval=0.1, damage_groups={fleshy=2}},
|
|
|
|
groups = {snappy=3, fleshy=3, oddly_breakable_by_hand=3},
|
|
|
|
sound = "shooter_pistol",
|
|
|
|
particle = "shooter_cap.png",
|
|
|
|
})
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
itemstack:add_wear(328) -- 4 x 200 Rounds
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2013-11-26 21:22:21 +00:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "shooter:pistol",
|
|
|
|
recipe = {
|
2014-06-02 18:19:22 +00:00
|
|
|
{"default:steel_ingot", "default:steel_ingot"},
|
2013-11-26 21:22:21 +00:00
|
|
|
{"", "default:mese_crystal"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "shooter:riffle",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "", ""},
|
|
|
|
{"", "default:bronze_ingot", ""},
|
|
|
|
{"", "default:mese_crystal", "default:bronze_ingot"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2013-12-05 20:28:32 +00:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "shooter:shotgun",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "", ""},
|
|
|
|
{"", "default:steel_ingot", ""},
|
|
|
|
{"", "default:mese_crystal", "default:bronze_ingot"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2014-06-02 18:19:22 +00:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "shooter:machine_gun",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
|
|
|
{"", "default:bronze_ingot", "default:mese_crystal"},
|
|
|
|
{"", "default:bronze_ingot", ""},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|