diff --git a/mods/starsnodes/README.txt b/mods/starsnodes/README.txt new file mode 100644 index 00000000..1b13de54 --- /dev/null +++ b/mods/starsnodes/README.txt @@ -0,0 +1,43 @@ +Star Wars Mod for Minetest +========================== +This Mod was developed by iangp + +Ian Giestas Pauli +That's my email: iangiestaspauli@hotmail.com +========================== + +This version: v0.3 + +========================== + +License: + +Textures: +========= + +(CC BY-NC 4.0) + +Code: +===== + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +Authors of media files used in this mod +======================================= + +Sound of the light saber atack (cutted by me and only used in first version): +https://www.freesound.org/people/skytheguy/sounds/186031/ + +Sound of the light saber atack: +https://www.freesound.org/people/gyzhor/sounds/47125/ + +Light saber off: +https://www.freesound.org/people/joe93barlow/sounds/78673/ + +Light saber on: +https://www.freesound.org/people/joe93barlow/sounds/78674/ diff --git a/mods/starsnodes/depends.txt b/mods/starsnodes/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/starsnodes/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/starsnodes/init.lua b/mods/starsnodes/init.lua new file mode 100644 index 00000000..203421d5 --- /dev/null +++ b/mods/starsnodes/init.lua @@ -0,0 +1,6 @@ + +local path = minetest.get_modpath("starsnodes") +dofile(path.."/lightsword.lua") +dofile(path.."/ores.lua") +--dofile(path.."/mobs.lua") +--dofile(path.."/sky.lua") diff --git a/mods/starsnodes/lightsword.lua b/mods/starsnodes/lightsword.lua new file mode 100644 index 00000000..58a6b940 --- /dev/null +++ b/mods/starsnodes/lightsword.lua @@ -0,0 +1,182 @@ +cores={"green","blue","red","yellow","purple"} +function on_off(cor) + for _,player in ipairs(minetest.get_connected_players()) do + if player:get_player_control().RMB == true then + if player:get_wielded_item():get_name() == "starsnodes:lightsaberon"..cor then + player:set_wielded_item("starsnodes:lightsaberoff"..cor) + minetest.sound_play("starsnodes_lightsaberoff", {object = minetest.get_player_by_name(player:get_player_name()), gain = 1.0, max_hear_distance = 32, loop = false }) + elseif player:get_wielded_item():get_name() == "starsnodes:lightsaberoff"..cor then + player:set_wielded_item("starsnodes:lightsaberon"..cor) + minetest.sound_play("starsnodes_lightsaberon", {object = minetest.get_player_by_name(player:get_player_name()), gain = 1.0, max_hear_distance = 32, loop = false }) + end + end + end +end +function atk(cor) + for _,player in ipairs(minetest.get_connected_players()) do + if player:get_player_control().LMB == true and player:get_wielded_item():get_name() == "starsnodes:lightsaberon"..cor then + minetest.sound_play("starsnodes_lightsaberatk", {object = minetest.get_player_by_name(player:get_player_name()), gain = 1.0, max_hear_distance = 32, loop = false }) + end + end +end +for n,cor in ipairs(cores) do + minetest.register_tool("starsnodes:lightsaberoffgreen", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberongreen.png", + wield_image = "starsnodes_lightsaberoff.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + }, + }) + minetest.register_tool("starsnodes:lightsaberoffblue", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonblue.png", + wield_image = "starsnodes_lightsaberoff.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + }, + }) + minetest.register_tool("starsnodes:lightsaberoffyellow", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonyellow.png", + wield_image = "starsnodes_lightsaberoff.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + }, + }) + minetest.register_tool("starsnodes:lightsaberoffpurple", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonpurple.png", + wield_image = "starsnodes_lightsaberoff.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + }, + }) + minetest.register_tool("starsnodes:lightsaberoffred", { + description = "Sith Lightsaber", + inventory_image = "starsnodes_lightsaberonred.png", + wield_image = "starsnodes_lightsaberoff.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + }, + }) + minetest.register_tool("starsnodes:lightsaberongreen", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberongreen.png", + wield_image = "starsnodes_lightsaberongreen.png", + groups = { + not_in_creative_inventory=1, + }, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=10, + groupcaps={ + cracky={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + crumbly={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + snappy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + choppy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + }, + damage_groups = {fleshy=8} + }, + }) + minetest.register_tool("starsnodes:lightsaberonblue", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonblue.png", + wield_image = "starsnodes_lightsaberonblue.png", + groups = { + not_in_creative_inventory=1, + }, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=10, + groupcaps={ + cracky={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + crumbly={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + snappy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + choppy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + }, + damage_groups = {fleshy=8} + }, + }) + minetest.register_tool("starsnodes:lightsaberonyellow", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonyellow.png", + wield_image = "starsnodes_lightsaberonyellow.png", + groups = { + not_in_creative_inventory=1, + }, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=10, + groupcaps={ + cracky={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + crumbly={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + snappy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + choppy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + }, + damage_groups = {fleshy=8} + }, + }) + minetest.register_tool("starsnodes:lightsaberonpurple", { + description = "Lightsaber", + inventory_image = "starsnodes_lightsaberonpurple.png", + wield_image = "starsnodes_lightsaberonpurple.png", + groups = { + not_in_creative_inventory=1, + }, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=10, + groupcaps={ + cracky={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + crumbly={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + snappy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + choppy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + }, + damage_groups = {fleshy=8} + }, + }) + minetest.register_tool("starsnodes:lightsaberonred", { + description = "Sith Lightsaber", + inventory_image = "starsnodes_lightsaberonred.png", + wield_image = "starsnodes_lightsaberonred.png", + groups = { + not_in_creative_inventory=1, + }, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=10, + groupcaps={ + cracky={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + crumbly={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + snappy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + choppy={times={[1]=1.0, [2]=0.5, [3]=0.5}, uses=30, maxlevel=10}, + }, + damage_groups = {fleshy=8} + }, + }) + minetest.register_craft({ + output = "starsnodes:lightsaberoff"..cor, + recipe = { + {"default:durasteel_ingot"}, + {"starsnodes:kyber"..cor}, + {"default:durasteel_ingot"}, + } + }) +end +local t=0 +for n,cor in ipairs(cores) do + minetest.register_globalstep(function(dtime) + t=t+dtime + if t>0.3 then + on_off(cor) + atk(cor) + t=0 + end + end) +end diff --git a/mods/starsnodes/ores.lua b/mods/starsnodes/ores.lua new file mode 100644 index 00000000..482ef598 --- /dev/null +++ b/mods/starsnodes/ores.lua @@ -0,0 +1,39 @@ +cores={"green","blue","yellow","purple"} +for n,cor in ipairs(cores) do + minetest.register_node("starsnodes:stone_with_kyber_"..cor, { + description = "Kyber Crystal in Stone", + tiles = {"default_stone.png^starsnodes_kyber"..cor..".png"}, + is_ground_content = true, + groups = {cracky=18}, + drop = "starsnodes:kyber"..cor, + sounds = default.node_sound_stone_defaults(), + }) + minetest.register_craftitem("starsnodes:kyber"..cor, { + description = "Kyber Crystal", + inventory_image = "starsnodes_kyber"..cor.."crystal.png", + }) + minetest.register_ore({ + ore_type = "scatter", + ore = "starsnodes:stone_with_kyber_"..cor, + wherein = "default:stone", + clust_scarcity = 5000, + clust_num_ores = 4, + clust_size = 3, + height_min = -59, + height_max = -52, + }) + minetest.register_ore({ + ore_type = "scatter", + ore = "starsnodes:stone_with_kyber_"..cor, + wherein = "default:stone", + clust_scarcity = 10000, + clust_num_ores = 3, + clust_size = 2, + height_min = -55, + height_max = -53, + }) +end +minetest.register_craftitem("starsnodes:kyberred", { + description = "Bleeding Kyber Crystal", + inventory_image = "starsnodes_kyberredcrystal.png", +})