Update 1.1.2

This commit is contained in:
Noodlemire 2020-08-05 21:20:34 -05:00
parent d7da9ca3d0
commit b171496e6c
9 changed files with 167 additions and 49 deletions

10
api.lua

@ -276,17 +276,19 @@ function projectile.shoot(wep, user, level)
--Look through each inventory slot...
for i = 1, inv:get_size("main") do
--get the stack itself
--Get the stack itself
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 not ammo:is_empty() and projectile.registered_projectiles[def.rw_category][ammo:get_name()] then
local adef = minetest.registered_entities[ammo:get_name()]
if not ammo:is_empty() and ammo_entity then
local adef = minetest.registered_entities[ammo_entity]
--Fire an amount of projectiles at once according to the ammo's defined "count".
for n = 1, (adef.count or 1) do
--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
local luapro = projectile:get_luaentity()

@ -1 +0,0 @@
projectile isn't unloaded when player leaves

@ -23,3 +23,20 @@ v1.1.0:
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.
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

@ -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
--]]
--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
minetest.register_craftitem("projectile:arrow", {
description = "Arrow",
@ -79,6 +95,7 @@ minetest.register_craftitem("projectile:shot_pile_mithril", {
if hardtrees then
--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({
@ -96,6 +113,25 @@ minetest.register_craft({
{"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.
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
--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 = {
{"pipeworks:pipe_1_empty", ""},
{"mesecons_walllever:wall_lever_off", "default:steel_ingot"},
{"group:stick", ""}
{"basic_materials:steel_strip", "default:steel_ingot"},
{"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({
output = "projectile:musket",
recipe = {
{"pipeworks:pipe_1_empty", "", ""},
{"", "pipeworks:pipe_1_empty", "default:steel_ingot"},
{"", "mesecons_walllever:wall_lever_off", "group:stick"}
{"basic_materials:steel_strip", "group:stick", "default:flint"}
}
})
end
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"}
}
})
--Blunderbusses are thucker, so a second steel ingot is used in place of a pipe segment.
--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({
output = "projectile:blunderbuss",
recipe = {
{"default:steel_ingot", ""},
{"mesecons_walllever:wall_lever_off", "default:steel_ingot"},
{"group:stick", ""}
{"basic_materials:steel_strip", "default:steel_ingot"},
{"group:stick", "default:flint"}
}
})

@ -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
if hardtrees then
projectile.register_projectile("projectile:rock", "slingshot", "hardtrees:rock", {
image = "rock_lump.png",
damage = 5,
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.
local is_mesecon = function(pos)

@ -1,3 +1,3 @@
name = projectile
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B