commit d8329b07fb874a8d06c2f9d94c5b00bec1120b14 Author: npx Date: Mon Dec 5 00:07:14 2016 +0100 Initial commit diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..79d6c8c --- /dev/null +++ b/README.txt @@ -0,0 +1,27 @@ +Not So Simple Mobs by NPX team + +Starting from version 3.0 the mod depends on mobs_redo api: https://github.com/tenplus1/mobs_redo + +We suggest that you play nssm with: + - nssb (Not So Simple Buildings, our second mod that adds many blocks and Morlendor, the new dimension): + - 3d_armors (with which you can use nssm armors): + - unified_inventory (useful to discover all the new recipes and to use the armors): + - a throwing mod (a mod that add bows) if compatible with the Tenplus1's damage_system + +We would like to thank: + - PilzAdam, for his wonderful simple-mobs mod; + - Tenplus1, for his hard work in making mobs_redo; + - Echoes91, for Spears: simple but amazing; + - and obviously Celeron-55 and all the people who contributed to Minetest and its community (and Paramat in particular); + - Denise and Ponzi_Duro for the revision of the guide; + - Double_P, Ponzi_Duro, Andrey01 and Taikedz for the beta testing; + - Taikedz for his support and for hosting a server dedicated to nssm (Not So Simple Server: https://forum.minetest.net/viewtopic.php?f=10&t=15435&hilit=nsss); + +License for the code: LGPL +License for all the models, textures and sound: CC BY-SA 4.0 + +The mod makes the game really hard, please read the wiki before playing: http://wiki.minetest.net/Mods/Not_So_Simple_Mobs (which will be updated as soon as possible) or the old guide for the 2.4 version. + +Here are the trailers of the mod: + - nssm 2.1: https://www.youtube.com/watch?v=ccLUt58mo0k + - nssm 3.0: https://www.youtube.com/watch?v=ZBuAi1sQJxQ diff --git a/appunti b/appunti new file mode 100644 index 0000000..a6eb7ef --- /dev/null +++ b/appunti @@ -0,0 +1,17 @@ + +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 diff --git a/bombs_api.lua b/bombs_api.lua new file mode 100644 index 0000000..5024d02 --- /dev/null +++ b/bombs_api.lua @@ -0,0 +1,165 @@ +function nssbombs:register_throwitem(name, descr, def) + + minetest.register_craftitem("nssbombs:"..name.."_bomb", { + description = descr, + inventory_image = def.textures, + on_use = function(itemstack, placer, pointed_thing) + local velocity = def.velocity or 15 + local dir = placer:get_look_dir() + local playerpos = placer:getpos() + local obj = minetest.env:add_entity({x=playerpos.x+dir.x,y=playerpos.y+2+dir.y,z=playerpos.z+dir.z}, "nssbombs:"..name.."_bomb_flying") + local vec = {x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity} + local acc = {x=0, y=-9.8, z=0} + obj:setvelocity(vec) + obj:setacceleration(acc) + itemstack:take_item() + return itemstack + end, + }) + + minetest.register_entity("nssbombs:"..name.."_bomb_flying",{ + textures = {def.textures}, + hp_max = 50, + collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1}, + visual_size = def.visual_size or {x=1, y=1}, + explosion = def.explosion or {}, + on_step = function(self, dtime) + local pos = self.object:getpos() + local node = minetest.get_node(pos) + local name = node.name + if name ~= "air" then + if def.hit_node then + def.hit_node(self, pos) + else + default_hit_node(self, self.explosion) + end + self.object:remove() + end + end, + }) + + if def.recipe_block then + recepy = { + {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}, + } + end + + local number = def.recipe_number or 1 + minetest.register_craft({ + output = "nssbombs:"..name.."_bomb "..number, + recipe = def.recipe or recepy + }) + +end + +function default_hit_node(self, explosion) + radius = explosion.radius + shape = explosion.shape + block = explosion.block + particles = explosion.particles + + local p = self.object:getpos() + local center = {x=p.x, y=p.y+radius, z=p.z} + + if particles then + add_effects(center, radius, block) + end + + if shape == "cube" then + for dx = -radius,radius do + for dy = 0,2*radius do + for dz = -radius,radius do + local pos1 = {x = p.x+dx, y=p.y+dy, z=p.z+dz} + 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=block}) + end + end + end + end + elseif shape == "sphere" then + for dx = -radius,radius do + for dy = 0,2*radius do + for dz = -radius,radius do + local pos1 = {x = p.x+dx, y=p.y+dy, z=p.z+dz} + if math.abs(vector.length(vector.subtract(pos1,center))) <= radius then + 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=block}) + end + end + end + end + end + end +end + +function add_effects(pos, radius, block) + minetest.add_particle({ + pos = pos, + velocity = vector.new(), + acceleration = vector.new(), + expirationtime = 0.4, + size = radius * 10, + collisiondetection = false, + vertical = false, + texture = "tnt_boom.png", + }) + minetest.add_particlespawner({ + amount = 32, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = radius * 3, + maxsize = radius * 5, + texture = "tnt_smoke.png", + }) + + local texture2 = "tnt_smoke.png" + local def = minetest.registered_nodes[block] + if def and def.tiles and def.tiles[1] and type(def.tiles[1])=="string" then + texture2 = def.tiles[1] + end + + minetest.add_particlespawner({ + amount = 32, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = radius * 3, + maxsize = radius * 5, + texture = texture2, + }) + + local texture1 = "tnt_blast.png" --fallback texture + minetest.add_particlespawner({ + amount = 32, + time = 0.1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -3, y = 0, z = -3}, + maxvel = {x = 3, y = 5, z = 3}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.8, + maxexptime = 2.0, + minsize = radius * 0.66, + maxsize = radius * 2, + texture = texture1, + collisiondetection = true, + }) + + +end diff --git a/bombs_examples.lua b/bombs_examples.lua new file mode 100644 index 0000000..bd35812 --- /dev/null +++ b/bombs_examples.lua @@ -0,0 +1,43 @@ +--Ice bomb +nssbombs:register_throwitem("ice", "Ice Bomb", { + textures = "ice_bomb.png", + recipe_number = 8, + recipe_block = "default:ice", + explosion = { + shape = "sphere", + radius = 5, + block = "default:ice", + particles = true, + }, +}) + +--Fire bomb +nssbombs:register_throwitem("fire", "Fire Bomb", { + textures = "fire_bomb.png", + recipe_block = "bucket:lava_bucket", + explosion = { + shape = "sphere", + radius = 4, + block = "fire:basic_flame", + particles = true, + }, +}) + +--[[ +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, +]] diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/changelog.txt @@ -0,0 +1 @@ + diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..bf28a9d --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +tnt diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b4bdd0e --- /dev/null +++ b/init.lua @@ -0,0 +1,6 @@ +--Not So Simple Bombs +nssbombs = {} +local path = minetest.get_modpath("nssbombs") + +dofile(path.."/bombs_api.lua") +dofile(path.."/bombs_examples.lua") diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..9eb9f20 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = nssbombs diff --git a/textures/fire_bomb.png b/textures/fire_bomb.png new file mode 100644 index 0000000..67fa0fa Binary files /dev/null and b/textures/fire_bomb.png differ diff --git a/textures/ice_bomb.png b/textures/ice_bomb.png new file mode 100644 index 0000000..bda8a22 Binary files /dev/null and b/textures/ice_bomb.png differ