Upload files to 'mods/starnodes'

This commit is contained in:
thunderdog1138 2020-03-25 12:49:23 +00:00
parent 0cb95f70c1
commit de182cb8f6
5 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1 @@
default

6
mods/starnodes/init.lua Normal file
View File

@ -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")

6
mods/starnodes/init.lua~ Normal file
View File

@ -0,0 +1,6 @@
local path = minetest.get_modpath("starsnodes")
dofile(path.."/lightsaber.lua")
dofile(path.."/ores.lua")
--dofile(path.."/mobs.lua")
--dofile(path.."/sky.lua")

View File

@ -0,0 +1,53 @@
cores={"green","blue","red"}
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() == "starwars:lightsaberon"..cor then
player:set_wielded_item("starwars:lightsaberoff"..cor)
elseif player:get_wielded_item():get_name() == "starwars:lightsaberoff"..cor then
player:set_wielded_item("starwars:lightsaberon"..cor)
minetest.sound_play("on0", {object = minetest.get_player_by_name(player:get_player_name()), gain = 1.0, max_hear_distance = 32, loop = false })
end
end
end
end
for n,cor in ipairs(cores) do
minetest.register_tool("starwars:lightsaberoff"..cor, {
description = "Light Saber "..cor,
inventory_image = "lightsaberon"..cor..".png",
wield_image = "lightsaberoff.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
},
})
minetest.register_tool("starwars:lightsaberon"..cor, {
description = "Light Saber "..cor,
inventory_image = "lightsaberon"..cor..".png",
wield_image = "lightsaberon"..cor..".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}
},
})
end
local t=0
minetest.register_globalstep(function(dtime)
t=t+dtime
if t>=0.25 then
on_off("green")
on_off("blue")
on_off("red")
t=0
end
end)

View File

@ -0,0 +1,70 @@
cores={"green","blue","red", "yellow"}
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:lightsaberoff"..cor, {
description = "Light Saber "..cor,
inventory_image = "starsnodes_lightsaberon"..cor..".png",
wield_image = "starsnodes_lightsaberoff.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=0,
},
})
minetest.register_tool("starsnodes:lightsaberon"..cor, {
description = "Light Saber "..cor,
inventory_image = "starsnodes_lightsaberon"..cor..".png",
wield_image = "starsnodes_lightsaberon"..cor..".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:steel_ingot"},
{"starsnodes:adegan"..cor},
{"default:steel_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