mirror of
https://github.com/Noodlemire/projectile.git
synced 2024-12-12 16:53:17 +01:00
Update 1.1.2
This commit is contained in:
parent
d7da9ca3d0
commit
b171496e6c
10
api.lua
10
api.lua
@ -276,17 +276,19 @@ function projectile.shoot(wep, user, level)
|
|||||||
|
|
||||||
--Look through each inventory slot...
|
--Look through each inventory slot...
|
||||||
for i = 1, inv:get_size("main") do
|
for i = 1, inv:get_size("main") do
|
||||||
--get the stack itself
|
--Get the stack itself
|
||||||
local ammo = inv:get_stack("main", i)
|
local ammo = inv:get_stack("main", i)
|
||||||
|
--Get the name of the entity that will be created by this ammo type.
|
||||||
|
local ammo_entity = projectile.registered_projectiles[def.rw_category][ammo:get_name()]
|
||||||
|
|
||||||
--If there is an item stack, and it's registered as an ammo type that this weapon can use...
|
--If there is an item stack, and it's registered as an ammo type that this weapon can use...
|
||||||
if not ammo:is_empty() and projectile.registered_projectiles[def.rw_category][ammo:get_name()] then
|
if not ammo:is_empty() and ammo_entity then
|
||||||
local adef = minetest.registered_entities[ammo:get_name()]
|
local adef = minetest.registered_entities[ammo_entity]
|
||||||
|
|
||||||
--Fire an amount of projectiles at once according to the ammo's defined "count".
|
--Fire an amount of projectiles at once according to the ammo's defined "count".
|
||||||
for n = 1, (adef.count or 1) do
|
for n = 1, (adef.count or 1) do
|
||||||
--Create the projectile entity at the determined position
|
--Create the projectile entity at the determined position
|
||||||
local projectile = minetest.add_entity(pos, projectile.registered_projectiles[def.rw_category][ammo:get_name()])
|
local projectile = minetest.add_entity(pos, ammo_entity)
|
||||||
--A shorthand of the luaentity version of the projectile, where data can easily be stored
|
--A shorthand of the luaentity version of the projectile, where data can easily be stored
|
||||||
local luapro = projectile:get_luaentity()
|
local luapro = projectile:get_luaentity()
|
||||||
|
|
||||||
|
1
bugs.txt
1
bugs.txt
@ -1 +0,0 @@
|
|||||||
projectile isn't unloaded when player leaves
|
|
@ -23,3 +23,20 @@ v1.1.0:
|
|||||||
|
|
||||||
v1.1.1:
|
v1.1.1:
|
||||||
Added optional support for my new node_damage mod. With it an tnt, bomb arrows will crack blocks just outside the destruction radius.
|
Added optional support for my new node_damage mod. With it an tnt, bomb arrows will crack blocks just outside the destruction radius.
|
||||||
|
|
||||||
|
v1.1.2:
|
||||||
|
New:
|
||||||
|
+Waterworks support: waterworks pipes can be used as gun barrels in craft recipes
|
||||||
|
+screenshot.png
|
||||||
|
|
||||||
|
Made optional dependencies more optional:
|
||||||
|
+Craftable rocks are available if hardtrees isn't present
|
||||||
|
+Craftable steel pipes if both pipeworks and waterworks aren't present.
|
||||||
|
*Flintlock recipes now use steel strips and flint in place of mesecon wall levers.
|
||||||
|
|
||||||
|
Removed:
|
||||||
|
-Optional dependency on mesecons_walllever
|
||||||
|
-bugs.txt
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
-Slingshots crashing the game when used
|
||||||
|
130
crafts.lua
130
crafts.lua
@ -17,6 +17,22 @@ License along with this library; if not, write to the Free Software
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
--Gun components
|
||||||
|
if not (pipeworks or waterworks) then
|
||||||
|
minetest.register_craftitem("projectile:steel_pipe", {
|
||||||
|
description = "Steel Pipe",
|
||||||
|
inventory_image = "projectile_steel_pipe.png"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--Basic slingshot ammo
|
||||||
|
if not hardtrees then
|
||||||
|
minetest.register_craftitem("projectile:rock", {
|
||||||
|
description = "Rock",
|
||||||
|
inventory_image = "projectile_rock.png"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
--A basic arrow
|
--A basic arrow
|
||||||
minetest.register_craftitem("projectile:arrow", {
|
minetest.register_craftitem("projectile:arrow", {
|
||||||
description = "Arrow",
|
description = "Arrow",
|
||||||
@ -79,23 +95,43 @@ minetest.register_craftitem("projectile:shot_pile_mithril", {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Two cobblestone blocks can shapelessly be used to craft 18 rocks.
|
if hardtrees then
|
||||||
--Two are used since it's very possible that other mods use one rock to make other things.
|
--Two cobblestone blocks can shapelessly be used to craft 18 rocks.
|
||||||
minetest.register_craft({
|
--Two are used since it's very possible that other mods use one rock to make other things.
|
||||||
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "hardtrees:rock 18",
|
output = "hardtrees:rock 18",
|
||||||
recipe = {"default:cobble", "default:cobble"}
|
recipe = {"default:cobble", "default:cobble"}
|
||||||
})
|
})
|
||||||
|
|
||||||
--If the player no longer needs rocks, 9 can be crafted back into a cobblestone block.
|
--If the player no longer needs rocks, 9 can be crafted back into a cobblestone block.
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "default:cobble",
|
output = "default:cobble",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"},
|
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"},
|
||||||
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"},
|
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"},
|
||||||
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"}
|
{"hardtrees:rock", "hardtrees:rock", "hardtrees:rock"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
--Two cobblestone blocks can shapelessly be used to craft 18 rocks.
|
||||||
|
--Two are used since it's very possible that other mods use one rock to make other things.
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "projectile:rock 18",
|
||||||
|
recipe = {"default:cobble", "default:cobble"}
|
||||||
|
})
|
||||||
|
|
||||||
|
--If the player no longer needs rocks, 9 can be crafted back into a cobblestone block.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "default:cobble",
|
||||||
|
recipe = {
|
||||||
|
{"projectile:rock", "projectile:rock", "projectile:rock"},
|
||||||
|
{"projectile:rock", "projectile:rock", "projectile:rock"},
|
||||||
|
{"projectile:rock", "projectile:rock", "projectile:rock"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
--Four sticks in a diagonal Y, with a string on top, makes a slingshot.
|
--Four sticks in a diagonal Y, with a string on top, makes a slingshot.
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -139,33 +175,89 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--Flintlocks are made from metal and steel, with a pipe segment for the barrel and a lever for the trigger.
|
if pipeworks then
|
||||||
minetest.register_craft({
|
--Flintlocks are made from metal and steel, with a steel pipe for the barrel and a lever for the trigger.
|
||||||
|
minetest.register_craft({
|
||||||
output = "projectile:flintlock_pistol",
|
output = "projectile:flintlock_pistol",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"pipeworks:pipe_1_empty", ""},
|
{"pipeworks:pipe_1_empty", ""},
|
||||||
{"mesecons_walllever:wall_lever_off", "default:steel_ingot"},
|
{"basic_materials:steel_strip", "default:steel_ingot"},
|
||||||
{"group:stick", ""}
|
{"group:stick", "default:flint"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--Muskets add an extra barrel because they're long.
|
--Muskets add an extra pipe because they're long.
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "projectile:musket",
|
output = "projectile:musket",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"pipeworks:pipe_1_empty", "", ""},
|
{"pipeworks:pipe_1_empty", "", ""},
|
||||||
{"", "pipeworks:pipe_1_empty", "default:steel_ingot"},
|
{"", "pipeworks:pipe_1_empty", "default:steel_ingot"},
|
||||||
{"", "mesecons_walllever:wall_lever_off", "group:stick"}
|
{"basic_materials:steel_strip", "group:stick", "default:flint"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
--Blunderbusses are thucker, so a second steel ingot is used in place of a pipe segment.
|
if waterworks then
|
||||||
|
--Flintlocks are made from metal and steel, with a steel pipe for the barrel and a lever for the trigger.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "projectile:flintlock_pistol",
|
||||||
|
recipe = {
|
||||||
|
{"waterworks:pipe", ""},
|
||||||
|
{"basic_materials:steel_strip", "default:steel_ingot"},
|
||||||
|
{"group:stick", "default:flint"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--Muskets add an extra pipe because they're long.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "projectile:musket",
|
||||||
|
recipe = {
|
||||||
|
{"waterworks:pipe", "", ""},
|
||||||
|
{"", "waterworks:pipe", "default:steel_ingot"},
|
||||||
|
{"basic_materials:steel_strip", "group:stick", "default:flint"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (pipeworks or waterworks) then
|
||||||
|
--6 steel ingots in an = shape can make any kind of pipe.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "projectile:steel_pipe 12",
|
||||||
|
recipe = {
|
||||||
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||||
|
{"", "", ""},
|
||||||
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--Flintlocks are made from metal and steel, with a steel pipe for the barrel and a lever for the trigger.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "projectile:flintlock_pistol",
|
||||||
|
recipe = {
|
||||||
|
{"projectile:steel_pipe", ""},
|
||||||
|
{"basic_materials:steel_strip", "default:steel_ingot"},
|
||||||
|
{"group:stick", "default:flint"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--Muskets add an extra pipe because they're long.
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "projectile:musket",
|
||||||
|
recipe = {
|
||||||
|
{"projectile:steel_pipe", "", ""},
|
||||||
|
{"", "projectile:steel_pipe", "default:steel_ingot"},
|
||||||
|
{"basic_materials:steel_strip", "group:stick", "default:flint"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--Blunderbusses are thucker, so a second steel ingot is used in place of a steel pipe.
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "projectile:blunderbuss",
|
output = "projectile:blunderbuss",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:steel_ingot", ""},
|
{"default:steel_ingot", ""},
|
||||||
{"mesecons_walllever:wall_lever_off", "default:steel_ingot"},
|
{"basic_materials:steel_strip", "default:steel_ingot"},
|
||||||
{"group:stick", ""}
|
{"group:stick", "default:flint"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
14
init.lua
14
init.lua
@ -224,12 +224,20 @@ projectile.register_weapon("projectile:blunderbuss", {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--The basic slingshot projectile: rocks from hardtrees
|
--The basic slingshot projectile: rocks, optionally the ones from hardtrees
|
||||||
projectile.register_projectile("projectile:rock", "slingshot", "hardtrees:rock", {
|
if hardtrees then
|
||||||
|
projectile.register_projectile("projectile:rock", "slingshot", "hardtrees:rock", {
|
||||||
image = "rock_lump.png",
|
image = "rock_lump.png",
|
||||||
damage = 5,
|
damage = 5,
|
||||||
speed = 15
|
speed = 15
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
projectile.register_projectile("projectile:rock", "slingshot", "projectile:rock", {
|
||||||
|
image = "projectile_rock.png",
|
||||||
|
damage = 5,
|
||||||
|
speed = 15
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
--A helper function for mese projectiles, to check if a particular node can be powered.
|
--A helper function for mese projectiles, to check if a particular node can be powered.
|
||||||
local is_mesecon = function(pos)
|
local is_mesecon = function(pos)
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,3 +1,3 @@
|
|||||||
name = projectile
|
name = projectile
|
||||||
description = Adds a small slingshot that can launch certain small objects as projectiles, such as rocks.
|
description = Adds a small slingshot that can launch certain small objects as projectiles, such as rocks.
|
||||||
optional_depends = animalmaterials, creatures, default, farming, fire, hardtrees, mesecons_walllever, mesecons, mobs, moreores, node_damage, parties, pipeworks, tnt
|
optional_depends = animalmaterials, creatures, default, farming, fire, hardtrees, mesecons, mobs, moreores, node_damage, parties, pipeworks, tnt, waterworks
|
||||||
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
textures/projectile_rock.png
Normal file
BIN
textures/projectile_rock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 399 B |
BIN
textures/projectile_steel_pipe.png
Normal file
BIN
textures/projectile_steel_pipe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 316 B |
Loading…
Reference in New Issue
Block a user