diff options
author | runs <runs@runs-PC.runs.es> | 2020-05-11 21:55:50 +0200 |
---|---|---|
committer | runs <runs@runs-PC.runs.es> | 2020-05-11 21:55:50 +0200 |
commit | 0983c2b14baf88a07b3b22953ed5f2bddc16fb09 (patch) | |
tree | 0954f1387498fcc78beffb650d7d314a233bf11e | |
parent | 6c30aa778d3c6533fc8432da281f8359c958fb50 (diff) | |
download | fireworkz-0983c2b14baf88a07b3b22953ed5f2bddc16fb09.tar.gz fireworkz-0983c2b14baf88a07b3b22953ed5f2bddc16fb09.tar.bz2 fireworkz-0983c2b14baf88a07b3b22953ed5f2bddc16fb09.zip |
fixes
-rw-r--r-- | init.lua | 49 | ||||
-rw-r--r-- | locale/fireworkz.es.tr | 1 | ||||
-rw-r--r-- | mod.conf | 1 | ||||
-rw-r--r-- | textures/fireworkz_rocket_launcher.png | bin | 0 -> 2712 bytes |
4 files changed, 44 insertions, 7 deletions
@@ -153,7 +153,7 @@ local rocket = { timer = 0, rocket_firetime = 0, rocket_flytime = 0, - rdt = {} + rdt = {} -- rocket data table } --Entity Registration @@ -224,6 +224,8 @@ for _, i in pairs(variant_list) do end inv_image = inv_image .. i.colour .. ".png" + local rdt = i.rdt or {{color = i.colour, figure = i.figure, form = i.form},} + minetest.register_node("fireworkz:rocket_"..i.figure.."_"..i.colour, { description = S("Rocket").." (".. i.desc .. "|"..figure_desc..")", drawtype = "plantlike", @@ -246,9 +248,7 @@ for _, i in pairs(variant_list) do local rocket_node = minetest.get_node(pos) if rocket_node.name == node.name then minetest.remove_node(pos) - local obj = minetest.add_entity(pos, "fireworkz:rocket") - local obj_ent = obj:get_luaentity() - obj_ent.rdt = i.rdt or {{color = i.colour, figure = i.figure, form = i.form},} + fireworkz.launch(pos, rdt) end end, node, pos) end @@ -257,14 +257,23 @@ for _, i in pairs(variant_list) do on_use = function(itemstack, user, pointed_thing) pos = minetest.get_pointed_thing_position(pointed_thing, above) if pos then - local obj = minetest.add_entity(pos, "fireworkz:rocket") --activate - local obj_ent = obj:get_luaentity() - obj_ent.rdt = i.rdt or {{color = i.colour, figure = i.figure, form = i.form},} + fireworkz.launch(pos, rdt) end end, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("firework:rdt", minetest.serialize(rdt)) + end, }) end +fireworkz.launch = function(pos, rdt) + local obj = minetest.add_entity(pos, "fireworkz:rocket") --activate + local obj_ent = obj:get_luaentity() + obj_ent.rdt = rdt +end + -- Craffitems minetest.register_craft({ @@ -383,3 +392,29 @@ minetest.register_craft({ {"", "default:coal_lump", ""} }, }) + +--Mesecons Support + +if minetest.get_modpath("mesecons") ~= nil then + minetest.register_node("fireworkz:launcher", { + description = S("Firework Rocket Launcher"), + tiles = {"fireworkz_rocket_launcher.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), + mesecons = {effector = { + action_on = function (pos, node) + pos.y = pos. y + 1 + local node = minetest.get_node_or_nil(pos) + if node then + if node.name:sub(1, 16) == "fireworkz:rocket" then + local meta = minetest.get_meta(pos) + local rdt = minetest.deserialize(meta:get_string("firework:rdt")) + minetest.remove_node(pos) + fireworkz.launch(pos, rdt) + end + end + end, + }} +}) +end diff --git a/locale/fireworkz.es.tr b/locale/fireworkz.es.tr index dff6515..4c23d6a 100644 --- a/locale/fireworkz.es.tr +++ b/locale/fireworkz.es.tr @@ -11,3 +11,4 @@ Default=Defecto Ball=Bola Love Ball=Bola de amor Custom=Personalizado +Firework Rocket Launcher=Lanzador de fuegos artificiales @@ -1,2 +1,3 @@ name = fireworkz depends = default +optional_depends = mesecons diff --git a/textures/fireworkz_rocket_launcher.png b/textures/fireworkz_rocket_launcher.png Binary files differnew file mode 100644 index 0000000..db090b4 --- /dev/null +++ b/textures/fireworkz_rocket_launcher.png |