Separate weapons and API
Use less generic mod names to avoid conflicts
26
init.lua
|
@ -1,26 +0,0 @@
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/shooter.lua")
|
||||
|
||||
if SHOOTER_ENABLE_CROSSBOW == true then
|
||||
dofile(modpath.."/crossbow.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_GUNS == true then
|
||||
dofile(modpath.."/guns.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_FLARES == true then
|
||||
dofile(modpath.."/flaregun.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_HOOK == true then
|
||||
dofile(modpath.."/grapple.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_GRENADES == true then
|
||||
dofile(modpath.."/grenade.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_ROCKETS == true then
|
||||
dofile(modpath.."/rocket.lua")
|
||||
end
|
||||
if SHOOTER_ENABLE_TURRETS == true then
|
||||
dofile(modpath.."/turret.lua")
|
||||
end
|
||||
|
1
modpack.txt
Normal file
|
@ -0,0 +1 @@
|
|||
The presence of this file indicates that the current folder is a modpack.
|
7
shooter/init.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/api.lua")
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 659 B |
2
shooter_crossbow/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
wool
|
||||
shooter
|
|
@ -2,7 +2,7 @@ SHOOTER_CROSSBOW_USES = 50
|
|||
SHOOTER_ARROW_TOOL_CAPS = {damage_groups={fleshy=2}}
|
||||
SHOOTER_ARROW_LIFETIME = 180 -- 3 minutes
|
||||
|
||||
minetest.register_alias("shooter:arrow", "shooter:arrow_white")
|
||||
minetest.register_alias("shooter_crossbow:arrow", "shooter_crossbow:arrow_white")
|
||||
minetest.register_alias("shooter:crossbow_loaded", "shooter:crossbow_loaded_white")
|
||||
|
||||
local dye_basecolors = (dye and dye.basecolors) or
|
||||
|
@ -30,7 +30,7 @@ local function get_texture(name, colour)
|
|||
return "shooter_"..name..".png^wool_"..colour..".png^shooter_"..name..".png^[makealpha:255,126,126"
|
||||
end
|
||||
|
||||
minetest.register_entity("shooter:arrow_entity", {
|
||||
minetest.register_entity("shooter_crossbow:arrow_entity", {
|
||||
physical = false,
|
||||
visual = "mesh",
|
||||
mesh = "shooter_arrow.b3d",
|
||||
|
@ -84,7 +84,7 @@ minetest.register_entity("shooter:arrow_entity", {
|
|||
on_punch = function(self, puncher)
|
||||
if puncher then
|
||||
if puncher:is_player() then
|
||||
local stack = "shooter:arrow_"..self.color
|
||||
local stack = "shooter_crossbow:arrow_"..self.color
|
||||
local inv = puncher:get_inventory()
|
||||
if inv:room_for_item("main", stack) then
|
||||
inv:add_item("main", stack)
|
||||
|
@ -169,11 +169,11 @@ minetest.register_entity("shooter:arrow_entity", {
|
|||
})
|
||||
|
||||
for _, color in pairs(dye_basecolors) do
|
||||
minetest.register_craftitem("shooter:arrow_"..color, {
|
||||
minetest.register_craftitem("shooter_crossbow:arrow_"..color, {
|
||||
description = color:gsub("%a", string.upper, 1).." Arrow",
|
||||
inventory_image = get_texture("arrow_inv", color),
|
||||
})
|
||||
minetest.register_tool("shooter:crossbow_loaded_"..color, {
|
||||
minetest.register_tool("shooter_crossbow:crossbow_loaded_"..color, {
|
||||
description = "Crossbow",
|
||||
inventory_image = get_texture("crossbow_loaded", color),
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
@ -182,13 +182,13 @@ for _, color in pairs(dye_basecolors) do
|
|||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/SHOOTER_CROSSBOW_USES)
|
||||
end
|
||||
itemstack = "shooter:crossbow 1 "..itemstack:get_wear()
|
||||
itemstack = "shooter_crossbow:crossbow 1 "..itemstack:get_wear()
|
||||
local pos = user:getpos()
|
||||
local dir = user:get_look_dir()
|
||||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "shooter:arrow_entity")
|
||||
local obj = minetest.add_entity(pos, "shooter_crossbow:arrow_entity")
|
||||
local ent = nil
|
||||
if obj then
|
||||
ent = obj:get_luaentity()
|
||||
|
@ -235,27 +235,27 @@ for _, color in pairs(dye_basecolors) do
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_tool("shooter:crossbow", {
|
||||
minetest.register_tool("shooter_crossbow:crossbow", {
|
||||
description = "Crossbow",
|
||||
inventory_image = "shooter_crossbow.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local inv = user:get_inventory()
|
||||
local stack = inv:get_stack("main", user:get_wield_index() + 1)
|
||||
local color = string.match(stack:get_name(), "shooter:arrow_(%a+)")
|
||||
local color = string.match(stack:get_name(), "shooter_crossbow:arrow_(%a+)")
|
||||
if color then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||
inv:remove_item("main", "shooter_crossbow:arrow_"..color.." 1")
|
||||
end
|
||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
return "shooter_crossbow:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
end
|
||||
for _, color in pairs(dye_basecolors) do
|
||||
if inv:contains_item("main", "shooter:arrow_"..color) then
|
||||
if inv:contains_item("main", "shooter_crossbow:arrow_"..color) then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||
inv:remove_item("main", "shooter_crossbow:arrow_"..color.." 1")
|
||||
end
|
||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
return "shooter_crossbow:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||
end
|
||||
end
|
||||
minetest.sound_play("shooter_click", {object=user})
|
||||
|
@ -264,7 +264,7 @@ minetest.register_tool("shooter:crossbow", {
|
|||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:crossbow",
|
||||
output = "shooter_crossbow:crossbow",
|
||||
recipe = {
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
{"default:stick", "default:stick", ""},
|
||||
|
@ -272,7 +272,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:arrow_white",
|
||||
output = "shooter_crossbow:arrow_white",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", ""},
|
||||
{"", "default:stick", "default:paper"},
|
||||
|
@ -282,12 +282,19 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
for _, color in pairs(dye_basecolors) do
|
||||
if color ~= "white" then
|
||||
minetest.register_craft({
|
||||
output = "shooter:arrow_"..color,
|
||||
output = "shooter_crossbow:arrow_"..color,
|
||||
recipe = {
|
||||
{"", "dye:"..color, "shooter:arrow_white"},
|
||||
{"", "dye:"..color, "shooter_crossbow:arrow_white"},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:crossbow", "shooter_crossbow:crossbow")
|
||||
for _, color in pairs(dye_basecolors) do
|
||||
minetest.register_alias("shooter:arrow_"..color, "shooter_crossbow:arrow_"..color)
|
||||
minetest.register_alias("shooter:crossbow_loaded_"..color, "shooter_crossbow:crossbow_loaded_"..color)
|
||||
end
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 389 B |
3
shooter_flaregun/depends.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
tnt
|
||||
wool
|
||||
shooter
|
|
@ -1,9 +1,9 @@
|
|||
minetest.register_craftitem("shooter:flare", {
|
||||
minetest.register_craftitem("shooter_flaregun:flare", {
|
||||
description = "Flare",
|
||||
inventory_image = "shooter_flare_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_node("shooter:flare_light", {
|
||||
minetest.register_node("shooter_flaregun:flare_light", {
|
||||
drawtype = "glasslike",
|
||||
tiles = {"shooter_flare_light.png"},
|
||||
paramtype = "light",
|
||||
|
@ -17,7 +17,7 @@ minetest.register_node("shooter:flare_light", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = "shooter:flare_light",
|
||||
nodenames = "shooter_flaregun:flare_light",
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
|
@ -34,7 +34,7 @@ minetest.register_abm({
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("shooter:flare_entity", {
|
||||
minetest.register_entity("shooter_flaregun:flare_entity", {
|
||||
physical = true,
|
||||
timer = 0,
|
||||
visual = "cube",
|
||||
|
@ -66,7 +66,7 @@ minetest.register_entity("shooter:flare_entity", {
|
|||
if minetest.get_node(pos).name == "air" and
|
||||
node.name ~= "default:water_source" and
|
||||
node.name ~= "default:water_flowing" then
|
||||
minetest.place_node(pos, {name="shooter:flare_light"})
|
||||
minetest.place_node(pos, {name="shooter_flaregun:flare_light"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
pos.y = pos.y - 0.1
|
||||
local id = minetest.add_particlespawner(
|
||||
|
@ -95,12 +95,12 @@ minetest.register_entity("shooter:flare_entity", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:flaregun", {
|
||||
minetest.register_tool("shooter_flaregun:flaregun", {
|
||||
description = "Flare Gun",
|
||||
inventory_image = "shooter_flaregun.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local inv = user:get_inventory()
|
||||
if not inv:contains_item("main", "shooter:flare") then
|
||||
if not inv:contains_item("main", "shooter_flaregun:flare") then
|
||||
minetest.sound_play("shooter_click", {object=user})
|
||||
return itemstack
|
||||
end
|
||||
|
@ -113,7 +113,7 @@ minetest.register_tool("shooter:flaregun", {
|
|||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "shooter:flare_entity")
|
||||
local obj = minetest.add_entity(pos, "shooter_flaregun:flare_entity")
|
||||
if obj then
|
||||
minetest.sound_play("shooter_flare_fire", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 16, y=dir.y * 16, z=dir.z * 16})
|
||||
|
@ -131,13 +131,13 @@ minetest.register_tool("shooter:flaregun", {
|
|||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:flare",
|
||||
output = "shooter_flaregun:flare",
|
||||
recipe = {
|
||||
{"tnt:gunpowder", "wool:red"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:flaregun",
|
||||
output = "shooter_flaregun:flaregun",
|
||||
recipe = {
|
||||
{"wool:red", "wool:red", "wool:red"},
|
||||
{"", "", "default:steel_ingot"}
|
||||
|
@ -145,3 +145,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
})
|
||||
end
|
||||
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:flaregun", "shooter_flaregun:flaregun")
|
||||
minetest.register_alias("shooter:flare", "shooter_flaregun:flare")
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
2
shooter_grenade/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
tnt
|
||||
shooter
|
|
@ -1,4 +1,4 @@
|
|||
minetest.register_entity("shooter:grenade_entity", {
|
||||
minetest.register_entity("shooter_grenade:grenade_entity", {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "cube",
|
||||
|
@ -35,7 +35,7 @@ minetest.register_entity("shooter:grenade_entity", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:grenade", {
|
||||
minetest.register_tool("shooter_grenade:grenade", {
|
||||
description = "Grenade",
|
||||
inventory_image = "shooter_hand_grenade.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
@ -54,7 +54,7 @@ minetest.register_tool("shooter:grenade", {
|
|||
local yaw = user:get_look_yaw()
|
||||
if pos and dir then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "shooter:grenade_entity")
|
||||
local obj = minetest.add_entity(pos, "shooter_grenade:grenade_entity")
|
||||
if obj then
|
||||
obj:setvelocity({x=dir.x * 15, y=dir.y * 15, z=dir.z * 15})
|
||||
obj:setacceleration({x=dir.x * -3, y=-10, z=dir.z * -3})
|
||||
|
@ -71,10 +71,13 @@ minetest.register_tool("shooter:grenade", {
|
|||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:grenade",
|
||||
output = "shooter_grenade:grenade",
|
||||
recipe = {
|
||||
{"tnt:gunpowder", "default:steel_ingot"},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:grenade", "shooter_grenade:grenade")
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
2
shooter_guns/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
tnt
|
||||
shooter
|
|
@ -1,4 +1,4 @@
|
|||
shooter:register_weapon("shooter:pistol", {
|
||||
shooter:register_weapon("shooter_guns:pistol", {
|
||||
description = "Pistol",
|
||||
inventory_image = "shooter_pistol.png",
|
||||
rounds = 200,
|
||||
|
@ -12,7 +12,7 @@ shooter:register_weapon("shooter:pistol", {
|
|||
},
|
||||
})
|
||||
|
||||
shooter:register_weapon("shooter:rifle", {
|
||||
shooter:register_weapon("shooter_guns:rifle", {
|
||||
description = "Rifle",
|
||||
inventory_image = "shooter_rifle.png",
|
||||
rounds = 100,
|
||||
|
@ -26,7 +26,7 @@ shooter:register_weapon("shooter:rifle", {
|
|||
},
|
||||
})
|
||||
|
||||
shooter:register_weapon("shooter:shotgun", {
|
||||
shooter:register_weapon("shooter_guns:shotgun", {
|
||||
description = "Shotgun",
|
||||
inventory_image = "shooter_shotgun.png",
|
||||
rounds = 50,
|
||||
|
@ -40,7 +40,7 @@ shooter:register_weapon("shooter:shotgun", {
|
|||
},
|
||||
})
|
||||
|
||||
shooter:register_weapon("shooter:machine_gun", {
|
||||
shooter:register_weapon("shooter_guns:machine_gun", {
|
||||
description = "Sub Machine Gun",
|
||||
inventory_image = "shooter_smgun.png",
|
||||
rounds = 50,
|
||||
|
@ -55,21 +55,21 @@ shooter:register_weapon("shooter:machine_gun", {
|
|||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("shooter:ammo", {
|
||||
minetest.register_craftitem("shooter_guns:ammo", {
|
||||
description = "Ammo pack",
|
||||
inventory_image = "shooter_ammo.png",
|
||||
})
|
||||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:pistol 1 65535",
|
||||
output = "shooter_guns:pistol 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:mese_crystal"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:rifle 1 65535",
|
||||
output = "shooter_guns:rifle 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", ""},
|
||||
{"", "default:bronze_ingot", ""},
|
||||
|
@ -77,7 +77,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:shotgun 1 65535",
|
||||
output = "shooter_guns:shotgun 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", ""},
|
||||
{"", "default:steel_ingot", ""},
|
||||
|
@ -85,15 +85,15 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:machine_gun 1 65535",
|
||||
output = "shooter_guns:machine_gun 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"shooter_guns:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:bronze_ingot", "default:mese_crystal"},
|
||||
{"", "default:bronze_ingot", ""},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:ammo",
|
||||
output = "shooter_guns:ammo",
|
||||
recipe = {
|
||||
{"tnt:gunpowder", "default:bronze_ingot"},
|
||||
},
|
||||
|
@ -125,3 +125,10 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end)
|
||||
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:shotgun", "shooter_guns:shotgun")
|
||||
minetest.register_alias("shooter:pistol", "shooter_guns:pistol")
|
||||
minetest.register_alias("shooter:machine_gun", "shooter_guns:machine_gun")
|
||||
minetest.register_alias("shooter:rifle", "shooter_guns:rifle")
|
||||
minetest.register_alias("shooter:ammo", "shooter_guns:ammo")
|
BIN
shooter_guns/textures/shooter_ammo.png
Normal file
After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
2
shooter_hook/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
shooter
|
||||
shooter_guns
|
|
@ -8,7 +8,7 @@ local function throw_hook(itemstack, user, vel)
|
|||
itemstack:add_wear(65535/100)
|
||||
end
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "shooter:hook")
|
||||
local obj = minetest.add_entity(pos, "shooter_hook:hook")
|
||||
if obj then
|
||||
minetest.sound_play("shooter_throw", {object=obj})
|
||||
obj:setvelocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel})
|
||||
|
@ -23,12 +23,12 @@ local function throw_hook(itemstack, user, vel)
|
|||
end
|
||||
end
|
||||
|
||||
minetest.register_entity("shooter:hook", {
|
||||
minetest.register_entity("shooter_hook:hook", {
|
||||
physical = true,
|
||||
timer = 0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=1/2, y=1/2},
|
||||
textures = {"shooter:grapple_hook"},
|
||||
textures = {"shooter_hook:grapple_hook"},
|
||||
player = nil,
|
||||
itemstack = "",
|
||||
collisionbox = {-1/4,-1/4,-1/4, 1/4,1/4,1/4},
|
||||
|
@ -67,7 +67,7 @@ minetest.register_entity("shooter:hook", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:grapple_hook", {
|
||||
minetest.register_tool("shooter_hook:grapple_hook", {
|
||||
description = "Grappling Hook",
|
||||
inventory_image = "shooter_hook.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
@ -79,17 +79,17 @@ minetest.register_tool("shooter:grapple_hook", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:grapple_gun", {
|
||||
minetest.register_tool("shooter_hook:grapple_gun", {
|
||||
description = "Grappling Gun",
|
||||
inventory_image = "shooter_hook_gun.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local inv = user:get_inventory()
|
||||
if inv:contains_item("main", "shooter:grapple_hook") and
|
||||
if inv:contains_item("main", "shooter_hook:grapple_hook") and
|
||||
inv:contains_item("main", "tnt:gunpowder") then
|
||||
inv:remove_item("main", "tnt:gunpowder")
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
local stack = inv:remove_item("main", "shooter:grapple_hook")
|
||||
itemstack = "shooter:grapple_gun_loaded 1 "..stack:get_wear()
|
||||
local stack = inv:remove_item("main", "shooter_hook:grapple_hook")
|
||||
itemstack = "shooter_hook:grapple_gun_loaded 1 "..stack:get_wear()
|
||||
else
|
||||
minetest.sound_play("shooter_click", {object=user})
|
||||
end
|
||||
|
@ -97,7 +97,7 @@ minetest.register_tool("shooter:grapple_gun", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:grapple_gun_loaded", {
|
||||
minetest.register_tool("shooter_hook:grapple_gun_loaded", {
|
||||
description = "Grappling Gun",
|
||||
inventory_image = "shooter_hook_gun_loaded.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
@ -106,15 +106,15 @@ minetest.register_tool("shooter:grapple_gun_loaded", {
|
|||
return itemstack
|
||||
end
|
||||
minetest.sound_play("shooter_pistol", {object=user})
|
||||
itemstack = ItemStack("shooter:grapple_hook 1 "..itemstack:get_wear())
|
||||
itemstack = ItemStack("shooter_hook:grapple_hook 1 "..itemstack:get_wear())
|
||||
throw_hook(itemstack, user, 20)
|
||||
return "shooter:grapple_gun"
|
||||
return "shooter_hook:grapple_gun"
|
||||
end,
|
||||
})
|
||||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:grapple_hook",
|
||||
output = "shooter_hook:grapple_hook",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:diamond"},
|
||||
{"default:steel_ingot", "default:steel_ingot", ""},
|
||||
|
@ -122,7 +122,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:grapple_gun",
|
||||
output = "shooter_hook:grapple_gun",
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "", "default:diamond"},
|
||||
|
@ -130,3 +130,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
})
|
||||
end
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:grapple_hook", "shooter_hook:grapple_hook")
|
||||
minetest.register_alias("shooter:grapple_gun", "shooter_hook:grapple_gun")
|
||||
minetest.register_alias("shooter:grapple_gun_loaded", "shooter_hook:grapple_gun_loaded")
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
2
shooter_rocket/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
tnt
|
||||
shooter
|
|
@ -1,10 +1,10 @@
|
|||
minetest.register_craftitem("shooter:rocket", {
|
||||
minetest.register_craftitem("shooter_rocket:rocket", {
|
||||
description = "Rocket",
|
||||
stack_max = 1,
|
||||
inventory_image = "shooter_rocket_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_entity("shooter:rocket_entity", {
|
||||
minetest.register_entity("shooter_rocket:rocket_entity", {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "cube",
|
||||
|
@ -41,7 +41,7 @@ minetest.register_entity("shooter:rocket_entity", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:rocket_gun_loaded", {
|
||||
minetest.register_tool("shooter_rocket:rocket_gun_loaded", {
|
||||
description = "Rocket Gun",
|
||||
inventory_image = "shooter_rocket_gun_loaded.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
@ -49,7 +49,7 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
|
|||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/50)
|
||||
end
|
||||
itemstack = "shooter:rocket_gun 1 "..itemstack:get_wear()
|
||||
itemstack = "shooter_rocket:rocket_gun 1 "..itemstack:get_wear()
|
||||
if pointed_thing.type ~= "nothing" then
|
||||
local pointed = minetest.get_pointed_thing_position(pointed_thing)
|
||||
if vector.distance(user:getpos(), pointed) < 8 then
|
||||
|
@ -62,7 +62,7 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
|
|||
local yaw = user:get_look_yaw()
|
||||
if pos and dir and yaw then
|
||||
pos.y = pos.y + 1.5
|
||||
local obj = minetest.add_entity(pos, "shooter:rocket_entity")
|
||||
local obj = minetest.add_entity(pos, "shooter_rocket:rocket_entity")
|
||||
if obj then
|
||||
minetest.sound_play("shooter_rocket_fire", {object=obj})
|
||||
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
|
||||
|
@ -78,17 +78,17 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("shooter:rocket_gun", {
|
||||
minetest.register_tool("shooter_rocket:rocket_gun", {
|
||||
description = "Rocket Gun",
|
||||
inventory_image = "shooter_rocket_gun.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local inv = user:get_inventory()
|
||||
if inv:contains_item("main", "shooter:rocket") then
|
||||
if inv:contains_item("main", "shooter_rocket:rocket") then
|
||||
minetest.sound_play("shooter_reload", {object=user})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "shooter:rocket 1")
|
||||
inv:remove_item("main", "shooter_rocket:rocket 1")
|
||||
end
|
||||
itemstack = "shooter:rocket_gun_loaded 1 "..itemstack:get_wear()
|
||||
itemstack = "shooter_rocket:rocket_gun_loaded 1 "..itemstack:get_wear()
|
||||
else
|
||||
minetest.sound_play("shooter_click", {object=user})
|
||||
end
|
||||
|
@ -98,17 +98,23 @@ minetest.register_tool("shooter:rocket_gun", {
|
|||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:rocket_gun",
|
||||
output = "shooter_rocket:rocket_gun",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "", "default:diamond"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:rocket",
|
||||
output = "shooter_rocket:rocket",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "tnt:gunpowder", "default:bronze_ingot"},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("shooter:rocket", "shooter_rocket:rocket")
|
||||
minetest.register_alias("shooter:rocket_gun", "shooter_rocket:rocket_gun")
|
||||
minetest.register_alias("shooter:rocket_gun_loaded", "shooter_rocket:rocket_gun_loaded")
|
||||
|
||||
|
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 690 B |
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 679 B |
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 376 B |
2
shooter_turret/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
shooter
|
||||
shooter_guns
|
|
@ -4,7 +4,7 @@ local function get_turret_entity(pos)
|
|||
for _, obj in ipairs(objects) do
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
if ent.name == "shooter:turret_entity" then
|
||||
if ent.name == "shooter_turret:turret_entity" then
|
||||
-- Remove duplicates
|
||||
if entity then
|
||||
obj:remove()
|
||||
|
@ -17,7 +17,7 @@ local function get_turret_entity(pos)
|
|||
return entity
|
||||
end
|
||||
|
||||
minetest.register_entity("shooter:tnt_entity", {
|
||||
minetest.register_entity("shooter_turret:tnt_entity", {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
visual = "cube",
|
||||
|
@ -53,7 +53,7 @@ minetest.register_entity("shooter:tnt_entity", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("shooter:turret_entity", {
|
||||
minetest.register_entity("shooter_turret:turret_entity", {
|
||||
physical = true,
|
||||
visual = "mesh",
|
||||
mesh = "shooter_turret.b3d",
|
||||
|
@ -70,7 +70,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
on_activate = function(self, staticdata)
|
||||
self.pos = self.object:getpos()
|
||||
self.yaw = self.object:getyaw()
|
||||
if minetest.get_node(self.pos).name ~= "shooter:turret" then
|
||||
if minetest.get_node(self.pos).name ~= "shooter_turret:turret" then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
minetest.sound_play("shooter_click", {object=self.object})
|
||||
return
|
||||
end
|
||||
minetest.sound_play("shooter_shotgun", {object=self.object})
|
||||
minetest.sound_play("guns_shotgun", {object=self.object})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "tnt:tnt")
|
||||
end
|
||||
|
@ -160,7 +160,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
})
|
||||
local pos = {x=self.pos.x, y=self.pos.y + 0.87, z=self.pos.z}
|
||||
pos = vector.add(pos, {x=dir.x * 1.5, y=dir.y * 1.5, z=dir.z * 1.5})
|
||||
local obj = minetest.add_entity(pos, "shooter:tnt_entity")
|
||||
local obj = minetest.add_entity(pos, "shooter_turret:tnt_entity")
|
||||
if obj then
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
|
@ -183,7 +183,7 @@ minetest.register_entity("shooter:turret_entity", {
|
|||
end
|
||||
})
|
||||
|
||||
minetest.register_node("shooter:turret", {
|
||||
minetest.register_node("shooter_turret:turret", {
|
||||
description = "Turret Gun",
|
||||
tiles = {"shooter_turret_base.png"},
|
||||
inventory_image = "shooter_turret_gun.png",
|
||||
|
@ -217,7 +217,7 @@ minetest.register_node("shooter:turret", {
|
|||
local node = minetest.get_node({x=pos.x, y=pos.y + 1, z=pos.z})
|
||||
if node.name == "air" then
|
||||
if not get_turret_entity(pos) then
|
||||
minetest.add_entity(pos, "shooter:turret_entity")
|
||||
minetest.add_entity(pos, "shooter_turret:turret_entity")
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -255,7 +255,7 @@ minetest.register_node("shooter:turret", {
|
|||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
minetest.register_craft({
|
||||
output = "shooter:turret",
|
||||
output = "shooter_turret:turret",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "default:bronze_ingot", "default:steel_ingot"},
|
||||
{"", "default:bronze_ingot", "default:steel_ingot"},
|
||||
|
@ -264,3 +264,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
|||
})
|
||||
end
|
||||
|
||||
|
||||
--Backward compatibility
|
||||
minetest.register_alias("shooter:turret", "shooter_turret:turret")
|
||||
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 364 B |