Removed unnecessary files, written the manual

master
npx 2017-01-20 00:07:57 +01:00
parent 0ad3852110
commit 8532ecd383
23 changed files with 77 additions and 79 deletions

65
api-manual.txt Normal file
View File

@ -0,0 +1,65 @@
This is a simple api which aims to simplify the work for modders who want to
add throwitems (items you can throw) to minetest.
It also contains some examples with some standard throwitems.
Define a throwitem is really simple, you can use this model:
nssbombs:register_throwitem("name_of_your_mod:name_of_the_item", "Description of the item", { --the "nssbombs" mod has to be a dependency of your mod
--Features of the object:
textures = "your_texture.png", --the texture is used both for the image inventory and for the flying entity
velocity = num, --optional: velocity of the obejct when you throw it
visual_size = {x=xsize, y= ysize}, --option: size of the object when flying
--Recipe for crafting it:
recipe_number = num, --number of the items as output of the recipe
--to define the recipe you need to use one of the following (not both)
recipe_block = "mod:block", --you have to choose a block used for the recipe, if you use this instruction the recipe will be the standard one, see below
recipe = {}, --array with standard recipe definition. You can also use a shapeless recipe, but you need to include also the following:
--recipe_type = "shapeless", --uncomment if your recipe is a shapeless one (and only if you have defined the recipe with the array)
-- Function to be executed when it hits the ground. You have two possibilities:
-- you can specify your custom function with:
hit_node = function (self, pos)
your code here
end,
-- Or you can use one of the default explosion types by including this array:
explosion = { //see below for the options
shape = "something",
radius = num,
block = "something",
particles = boolean,
sound = "something",
}
})
The default recipe (used if you specify only the recipe_block) is:
recipe = {
{def.recipe_block, def.recipe_block, def.recipe_block},
{"tnt:gunpowder", "default:mese_crystal_fragment", "tnt:gunpowder"},
{def.recipe_block, def.recipe_block, def.recipe_block},
}
If you want to use one of the default explosion types you have the include the explosion array with this keys inside:
- radius, number that define the size of the explosion;
- block, it can be:
- name of a block, for example "default:ice";
- name of a schematic file, if you use the shape "schematic";
- name of an entity, for example "nssm:duck", if you use the shape "add_entity";
- shape, you can choose between:
-"cube" --spawns a cube of the block specified of the specified size
-"pool" --spawns a "pool" of the specified block and size, see the lava_bomb as example
-"sphere" --spawns a cube of the block specified of the specified size
-"sphere_shell"
-"cubic_shell"
-"column" --see water column bomb as example
-"circle" --see Fire circle bomb
-"wall" --spawns a big (it depends on the radius specifies) wall where the bomb lands
-"schematic" --to easily add a schematic (see the Schematic bomb for an example), if you specify with the radius parameter the size of the base of the schematic it's going to be centered.
-"add_entity" --to spawn mobs for example
-"tnt_explosion"--if you simply want an explosion in the landing position
- particles, boolean (true/false) to define if you want the particles
- sound, boolean or the name of an audio file
Take a look at the file "examples.lua" for the examples and if you want more
of them you can find them in nssm

50
appunti
View File

@ -1,50 +0,0 @@
Per ogni bomba bisogna definire:
- nome
- descrizione
- def con:
Necessari:
-> textures (usata sia per l'inventario che per la bomba stessa)
-> ricetta / recipe_block (ricetta di default)
-> hit_node(self, pos) / explosion = {
shape = "cube",
radius = 2,
block = "default:ice",
particles = false,
},
Aggiuntivi:
-> velocity
-> recipe_number
Bombe presenti:
mobs_examples.lua:
- stone_wall_bomb
- Cubic Ice Shell bomb
- Fire circle
- Lava pool
- schematic bomb
Nssm_weapons:
- cobweb_bomb
- cubic mantis clay shell bomb
-
nssbombs:register_throwitem("nssm:", "", {
textures = "",
recipe_number = ,
recipe = ,
})
Cosa rimane da fare:
- riscrivere le particles;
- finire di aggiungere le bombe di esempio;
- eliminare le textures non usate;
- scrivere bene delle istruzioni/commentare il codice
- rilasciare.
recipe = {
{'nssm:slothful_soul_fragment', 'nssm:black_powder', 'nssm:slothful_soul_fragment'},
{'nssm:black_powder', 'nssm:slothful_soul_fragment', 'nssm:black_powder'},
{'nssm:slothful_soul_fragment', 'nssm:black_powder', 'nssm:slothful_soul_fragment'},
},

View File

@ -81,15 +81,14 @@ function perpendicular_vector(vec) --returns a vector rotated of 90° in 2D (x a
end
function default_hit_node(self, explosion)
local radius = explosion.radius
local shape = explosion.shape
local radius = explosion.radius --size of the explosion
local shape = explosion.shape --to choose the explosion type
local block = explosion.block -- it can be a name of a block, of a schematic or of an entity
local particles = explosion.particles --if you want to use the particles (boolean)
local sound = explosion.sound -- sound for the explosion, true to use the default sound
local p = self.object:getpos() --position of the impact between the bomb and the ground
local center = {x=p.x, y=p.y, z=p.z}
minetest.chat_send_all("ciao")
if shape == "cube" then
for dx = -radius,radius do

View File

@ -64,6 +64,7 @@ nssbombs:register_throwitem("nssbombs:water_column_bomb", "Water Colun Bomb", {
}
})
--Tnt Bomb
nssbombs:register_throwitem("nssbombs:tnt_bomb", "TNT explosion bomb", {
textures = "bomb_bomb.png",
recipe_block = "tnt:tnt",
@ -74,10 +75,15 @@ nssbombs:register_throwitem("nssbombs:tnt_bomb", "TNT explosion bomb", {
}
})
--Schematic bomb
--Schematic bomb (house)
nssbombs:register_throwitem("nssbombs:schematic_bomb", "Schematic Bomb", {
textures = "schematic_bomb.png",
recipe_block = "bucket:empty_bucket",
recipe_number = 4,
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:brick", "default:mese_crystal_fragment", "default:brick"},
{"default:cobble", "default:cobble", "default:cobble"}
},
explosion = {
shape = "schematic",
radius = 9,
@ -86,29 +92,7 @@ nssbombs:register_throwitem("nssbombs:schematic_bomb", "Schematic Bomb", {
},
})
--[[
hit_node = function(self,pos)
for dx = -1,1 do
for dy = 1,3 do
for dz = -1,1 do
local pos1 = {x = pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local pos2 = {x = pos.x, y=pos.y+1, z=pos.z}
local pos3 = {x = pos.x, y=pos.y+2, z=pos.z}
if not minetest.is_protected(pos1, "") or not minetest.get_item_group(minetest.get_node(pos1).name, "unbreakable") == 1 then
minetest.set_node(pos1, {name="default:ice"})
minetest.set_node(pos2, {name="air"})
minetest.set_node(pos3, {name="air"})
end
end
end
end
end,
]]
--[[
Schematic spawning:
block=minetest.get_modpath("nssb").."/schems/".. build ..".mts"
]]
--Teleport Bomb
nssbombs:register_throwitem("nssbombs:teleport_bomb", "Teleport Bomb", {
textures = "teleport_bomb.png",
recipe_number = 10,

View File

@ -1 +1 @@
1.0 default release

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 854 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B