first working version!
This commit is contained in:
parent
06ccdc4292
commit
079efbffaa
92
api.lua
92
api.lua
@ -26,7 +26,9 @@ end
|
||||
|
||||
gems.clearobjects = function(pos1,pos2)
|
||||
npos1, npos2 = worldedit.sort_pos(pos1, pos2)
|
||||
minetest.after(1,function(npos1,npos2)
|
||||
worldedit.clear_objects(npos1, npos2)
|
||||
end,npos1,npos2)
|
||||
end
|
||||
|
||||
|
||||
@ -42,7 +44,8 @@ gems.place_arena = function(arena)
|
||||
if arena.schem_name == "You_dont_need_the_file_extention" or arena.schem_location == { x = 0, y = 0, z = 0 } then
|
||||
msg = "[Gems] [arena:".. arena.name .."] ERROR: failed to place Minetest schematic.. no schem or location specified! Check arena properties."
|
||||
end
|
||||
if not minetest.place_schematic( pos , arena.schem_name ) then
|
||||
local path = minetest.get_worldpath()
|
||||
if not minetest.place_schematic( pos , path .. "/schems/" .. arena.schem_name ..".mts" ) then
|
||||
msg = "[Gems] [arena:".. arena.name .."] ERROR: failed to place Minetest schematic.. Schem not found! Check arena properties."
|
||||
end
|
||||
if msg then
|
||||
@ -88,7 +91,7 @@ gems.on_death = function( arena , p_name , reason )
|
||||
|
||||
end
|
||||
|
||||
msg = msg .. ", leaving team " .. p_team .. " with " .. tostring( #arenalib.get_players_in_team( arena , p_team_id ) ) .. " players."
|
||||
msg = msg .. ", leaving team " .. p_team .. " with " .. tostring( #arena_lib.get_players_in_team( arena , p_team_id ) ) .. " players."
|
||||
|
||||
--send our update message to everyone in the minigame
|
||||
|
||||
@ -108,55 +111,72 @@ end
|
||||
|
||||
|
||||
|
||||
--++++++++++++++++++get_id_by_name()
|
||||
|
||||
gems.get_team_id_by_name = function(arena , name)
|
||||
|
||||
for id, stats in pairs( arena.teams ) do
|
||||
if stats.name == name then
|
||||
return id
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--=========== on_time_tick ===============
|
||||
--on_time_tick, 1) handle mine drops, 2) check if the great gem is at the location of each team's great gem location:
|
||||
-- if it is not, set that team's properties to indicate gem_exists = false
|
||||
|
||||
|
||||
gems.on_time_tick = function(arena)
|
||||
-- gems.on_time_tick = function(arena)
|
||||
|
||||
|
||||
|
||||
local gem_names = {
|
||||
"ruby", -- red
|
||||
"sapphire", --blue
|
||||
"emerald", --green
|
||||
"opal", --yellow
|
||||
}
|
||||
-- local gem_names = {
|
||||
-- "ruby", -- red
|
||||
-- "sapphire", --blue
|
||||
-- "emerald", --green
|
||||
-- "opal", --yellow
|
||||
-- }
|
||||
|
||||
for _, gem_name in pairs(gem_names) do
|
||||
-- -- for _, gem_name in pairs(gem_names) do
|
||||
|
||||
-- handle mine drops
|
||||
if arena[gem_name .. "_mines"] then
|
||||
for _ , pos in pairs( arena[gem_name .. "_mines"]) do
|
||||
-- -- -- handle mine drops
|
||||
-- -- if arena[gem_name .. "_mines"] then
|
||||
-- -- for _ , pos in ipairs( arena[gem_name .. "_mines"]) do
|
||||
|
||||
pos.y = pos.y + 1
|
||||
minetest.add_item( pos , "gems:".. gem_name)
|
||||
end
|
||||
end
|
||||
-- -- pos.y = pos.y + 1
|
||||
-- -- minetest.add_item( pos , "gems:".. gem_name )
|
||||
-- -- end
|
||||
-- -- else minetest.chat_send_all("NOT arena[gem_name .. _mines]")
|
||||
|
||||
end
|
||||
-- -- end
|
||||
|
||||
|
||||
for _, gem_name in pairs(gem_names) do
|
||||
for id, stats in pairs(arena.teams) do
|
||||
if gem_name == arena.teams[id].name then
|
||||
local pos = arena[ gem_name .. "_gem "]
|
||||
if pos and minetest.get_node( pos ).name ~= "gems:great_gem_" .. gem_name then
|
||||
-- The great gem is missing! Now the players shall die.
|
||||
if arena.teams[id].gem_exists == true then
|
||||
-- send msg and switch off gem_exists
|
||||
arena_lib.send_message_in_arena( arena , 'both' , gem_name .. " team's Great Gem has been destroyed! Now shall no " ..gem_name .. " respawn!" )
|
||||
arena.teams[id].gem_exists = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
-- -- for _, gem_name in pairs(gem_names) do
|
||||
-- -- for id, stats in pairs(arena.teams) do
|
||||
-- -- if gem_name == arena.teams[id].name then
|
||||
-- -- local pos = arena[ gem_name .. "_gem "]
|
||||
-- -- if pos and minetest.get_node( pos ).name ~= "gems:great_gem_" .. gem_name then
|
||||
-- -- -- The great gem is missing! Now the players shall die.
|
||||
-- -- if arena.teams[id].gem_exists == true then
|
||||
-- -- -- send msg and switch off gem_exists
|
||||
-- -- arena_lib.send_message_in_arena( arena , 'both' , gem_name .. " team's Great Gem has been destroyed! Now shall no " ..gem_name .. " respawn!" )
|
||||
-- -- arena.teams[id].gem_exists = false
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- -- end
|
||||
|
||||
|
||||
|
||||
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
|
50
auto.lua
50
auto.lua
@ -15,7 +15,8 @@
|
||||
arena_lib.on_load('gems_2', function(arena)
|
||||
|
||||
gems.place_arena(arena)
|
||||
gems.clearobjects()
|
||||
worldedit.keep_loaded(arena.area_to_clear_pos_1, arena.area_to_clear_pos_2)
|
||||
gems.clearobjects(arena.area_to_clear_pos_1, arena.area_to_clear_pos_2)
|
||||
-- for id, stats in pairs(arena.teams) do
|
||||
-- local team_name = arena.teams[id].name
|
||||
-- if arena[team_name .. ]
|
||||
@ -25,7 +26,8 @@ end)
|
||||
arena_lib.on_load('gems_4', function(arena)
|
||||
|
||||
gems.place_arena(arena)
|
||||
gems.clearobjects()
|
||||
worldedit.keep_loaded(arena.area_to_clear_pos_1, arena.area_to_clear_pos_2)
|
||||
gems.clearobjects(arena.area_to_clear_pos_1, arena.area_to_clear_pos_2)
|
||||
|
||||
end)
|
||||
|
||||
@ -64,11 +66,49 @@ end)
|
||||
|
||||
|
||||
arena_lib.on_time_tick('gems_2', function(arena)
|
||||
gems.on_time_tick(arena)
|
||||
-- gems.on_time_tick(arena)
|
||||
local teams = {"ruby", "emerald"}
|
||||
|
||||
|
||||
for _, team_name in ipairs (teams) do
|
||||
|
||||
local team_id = gems.get_team_id_by_name( arena , team_name )
|
||||
|
||||
local node_at_gem = minetest.get_node( arena[ team_name.."_gem"] ).name
|
||||
|
||||
if node_at_gem ~= "gems:great_gem_" .. team_name and arena.teams[team_id].gem_exists then
|
||||
--The great gem is missing! Now the players shall die.
|
||||
|
||||
-- send msg and switch off gem_exists
|
||||
local uc = string.upper(team_name)
|
||||
arena_lib.send_message_in_arena( arena , 'both' , uc .. " team's Great Gem has been destroyed! Now shall no "..uc.." player respawn!" )
|
||||
arena.teams[team_id].gem_exists = false
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
arena_lib.on_time_tick('gems_4', function(arena)
|
||||
gems.on_time_tick(arena)
|
||||
end
|
||||
local teams = {"ruby","sapphire","emerald", "opal"}
|
||||
|
||||
|
||||
for _, team_name in ipairs (teams) do
|
||||
|
||||
local team_id = gems.get_team_id_by_name( arena , team_name )
|
||||
|
||||
local node_at_gem = minetest.get_node( arena[ team_name.."_gem"] ).name
|
||||
|
||||
if node_at_gem ~= "gems:great_gem_" .. team_name and arena.teams[team_id].gem_exists then
|
||||
--The great gem is missing! Now the players shall die.
|
||||
|
||||
-- send msg and switch off gem_exists
|
||||
local uc = string.upper(team_name)
|
||||
arena_lib.send_message_in_arena( arena , 'both' , uc .. " team's Great Gem has been destroyed! Now shall no "..uc.." player respawn!" )
|
||||
arena.teams[team_id].gem_exists = false
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
48
init.lua
48
init.lua
@ -19,21 +19,22 @@ arena_lib.register_minigame("gems_2", {
|
||||
area_to_clear_pos_1 = { x = 0, y = 0, z = 0 },
|
||||
area_to_clear_pos_2 = { x = 0, y = 0, z = 0 },
|
||||
ruby_gem = { x = 0, y = 0, z = 0 },
|
||||
sapphire_gem = { x = 0, y = 0, z = 0 },
|
||||
ruby_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
sapphire_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
emerald_gem = { x = 0, y = 0, z = 0 },
|
||||
-- ruby_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- -- },
|
||||
-- emerald_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- },
|
||||
|
||||
},
|
||||
team_properties = {
|
||||
gem_location = { x = 0, y = 0, z = 0 },
|
||||
--gem_location = { x = 0, y = 0, z = 0 },
|
||||
gem_exists = true,
|
||||
},
|
||||
disabled_damage_types = {"fall"},
|
||||
is_team_chat_default = true,
|
||||
time_mode = "incremental",
|
||||
|
||||
})
|
||||
|
||||
@ -62,29 +63,28 @@ arena_lib.register_minigame("gems_4", {
|
||||
sapphire_gem = { x = 0, y = 0, z = 0 },
|
||||
emerald_gem = { x = 0, y = 0, z = 0 },
|
||||
opal_gem = { x = 0, y = 0, z = 0 },
|
||||
ruby_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
sapphire_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
emerald_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
opal_mines = {
|
||||
{ x = 0, y = 0, z = 0 },
|
||||
},
|
||||
-- ruby_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- },
|
||||
-- sapphire_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- },
|
||||
-- emerald_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- },
|
||||
-- opal_mines = {
|
||||
-- { x = 0, y = 0, z = 0 },
|
||||
-- },
|
||||
|
||||
},
|
||||
temp_properties = {
|
||||
tick_timer = 0,
|
||||
},
|
||||
|
||||
team_properties = {
|
||||
gem_location = { x = 0, y = 0, z = 0 },
|
||||
--gem_location = { x = 0, y = 0, z = 0 },
|
||||
gem_exists = true,
|
||||
},
|
||||
disabled_damage_types = {"fall"},
|
||||
is_team_chat_default = true,
|
||||
time_mode = "incremental",
|
||||
|
||||
})
|
||||
|
||||
|
48
items.lua
48
items.lua
@ -14,33 +14,50 @@ local gem_names_caps = {
|
||||
|
||||
|
||||
|
||||
-- minetest.register_tool("gems:pick_ruby" , {
|
||||
-- description = "Ruby Pickaxe \nUsed to break Gem blocks, and Great Gems of\nAny team except Emerald",
|
||||
-- inventory_image = "pick_ruby.png",
|
||||
-- tool_capabilities = {
|
||||
-- full_punch_interval = 0.9,
|
||||
-- max_drop_level=3,
|
||||
-- groupcaps={
|
||||
-- --cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
|
||||
-- ruby = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
-- sapphire = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
-- emerald = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
-- opal = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
-- },
|
||||
-- },
|
||||
-- sound = {breaks = "default_tool_breaks"},
|
||||
-- groups = {pickaxe = 1 ,
|
||||
-- not_in_creative_inventory = 1,
|
||||
-- },
|
||||
-- })
|
||||
|
||||
|
||||
|
||||
for _, gem_name in pairs(gem_names) do
|
||||
|
||||
minetest.register_craftitem("gems:".. gem_name , {
|
||||
description = gem_name_caps[_]
|
||||
inventory_image = "item_"..gem_name..".png"
|
||||
description = gem_names_caps[_],
|
||||
inventory_image = "item_"..gem_name..".png",
|
||||
})
|
||||
|
||||
--==================== Picks =========================
|
||||
-- picks are used to break blocks of the other gems, but they are easiest to use when turned against their own color. They are
|
||||
-- the only way to break gem blocks and Great gems, and the fastest way to break gem glass.
|
||||
|
||||
|
||||
|
||||
--groupcaps
|
||||
local gc = {cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},}
|
||||
gc[ gem_name ] = {times={[1]=25, [2]=13, [3]=4}, uses=20, maxlevel=3}
|
||||
|
||||
minetest.register_tool("gems:pick_" .. gem_name, {
|
||||
description = gem_name_caps[_] .. " Pickaxe \nUsed to break Gem blocks, and Great Gems of\nAny team except " .. gems.get_opposite_team(gem_name),
|
||||
description = gem_names_caps[_] .. " Pickaxe \nUsed to break Gem blocks, and Great Gems of\nAny team except " .. gems.get_opposite_team(gem_name),
|
||||
inventory_image = "pick_"..gem_name..".png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level=3,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
|
||||
ruby = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
sapphire = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
emerald = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
opal = {times={[1]=7, [2]=3, [3]=1}, uses=20, maxlevel=3},
|
||||
},
|
||||
groupcaps = gc ,
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = {pickaxe = 1 ,
|
||||
@ -48,13 +65,15 @@ for _, gem_name in pairs(gem_names) do
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
--==================== Swords =========================
|
||||
-- gem swords are the best swords available, and they are most effecive against players of the same gem team.
|
||||
--
|
||||
|
||||
minetest.register_tool("gems:sword_" .. gem_name, {
|
||||
description = gem_name_caps[_] .. " Sword - \nMost useful against the".. gem_name .. " team (Coming Soon!)",
|
||||
inventory_image = "default_tool_steelsword.png",
|
||||
description = gem_names_caps[_] .. " Sword - \nMost useful against the".. gem_name .. " team (Coming Soon!)",
|
||||
inventory_image = "sword_"..gem_name..".png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.7,
|
||||
max_drop_level=1,
|
||||
@ -84,6 +103,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||
return hp_change
|
||||
end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
local p_team_id = arena.players[ p_name ].teamID
|
||||
local p_team_name = arena.teams[p_team_id].name
|
||||
|
||||
|
198
nodes.lua
198
nodes.lua
@ -19,59 +19,83 @@ local gem_names_caps = {
|
||||
minetest.register_node( "gems:block_ruby", {
|
||||
description = "Ruby Block",
|
||||
tiles = {"block_ruby.png"},
|
||||
groups = { "ruby" = 3 , "sapphire" = 2, "opal" = 2, "emerald" = 1},
|
||||
groups = { ruby = 3 , sapphire = 2, opal = 2, emerald = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:block_sapphire", {
|
||||
description = "Sapphire Block",
|
||||
tiles = {"block_sapphire.png"},
|
||||
groups = { "sapphire" = 3, "emerald" = 2 ,"ruby" = 2, "opal" = 1},
|
||||
groups = { sapphire = 3, emerald = 2 ,ruby = 2, opal = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:block_emerald", {
|
||||
description = "Emerald Block",
|
||||
tiles = {"block_emerald.png"},
|
||||
groups = { "emerald" = 3, "opal" = 2, "sapphire" = 2 , "ruby" = 1},
|
||||
groups = { emerald = 3, opal = 2, sapphire = 2 , ruby = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:block_opal", {
|
||||
description = "Opal Block",
|
||||
tiles = {"block_opal.png"},
|
||||
groups = { "opal" = 3, "ruby" = 3, "emerald" = 2, "sapphire" = 2},
|
||||
groups = { opal = 3, ruby = 2, emerald = 2, sapphire = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
||||
--================== GLASS ======================
|
||||
--Glass made from gems is hard to break
|
||||
--Glass made from gems cant be broken with regular tools, but it only slows gem tools down a bit
|
||||
|
||||
minetest.register_node( "gems:glass_ruby", {
|
||||
description = "Ruby Glass",
|
||||
tiles = {"glass_ruby.png"},
|
||||
groups = { "ruby" = 3 , "sapphire" = 3, "opal" = 2, "emerald" = 2, "cracky" = 1},
|
||||
groups = { ruby = 3 , sapphire = 3, opal = 2, emerald = 2,},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:glass_sapphire", {
|
||||
description = "Sapphire Glass",
|
||||
tiles = {"glass_sapphire.png"},
|
||||
groups = { "sapphire" = 3, "emerald" = 3 ,"ruby" = 2, "opal" = 2, "cracky" = 1},
|
||||
groups = { sapphire = 3, emerald = 3 ,ruby = 2, opal = 2, },
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:glass_emerald", {
|
||||
description = "Emerald Glass",
|
||||
tiles = {"glass_emerald.png"},
|
||||
groups = { "emerald" = 3, "opal" = 3, "sapphire" = 2 , "ruby" = 2, "cracky" = 1},
|
||||
groups = { emerald = 3, opal = 3, sapphire = 2 , ruby = 2, },
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:glass_opal", {
|
||||
description = "Opal Glass",
|
||||
tiles = {"glass_opal.png"},
|
||||
groups = { "opal" = 3, "ruby" = 3, "emerald" = 2, "sapphire" = 2, "cracky" = 1},
|
||||
groups = { opal = 3, ruby = 3, emerald = 2, sapphire = 2, },
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike",
|
||||
})
|
||||
|
||||
|
||||
@ -85,8 +109,20 @@ minetest.register_node( "gems:great_gem_ruby", {
|
||||
description = "Ruby Great Gem",
|
||||
drawtype = "mesh",
|
||||
mesh = "hex_crystal_big.obj",
|
||||
groups = { "ruby" = 2 , "sapphire" = 1, "opal" = 1, },
|
||||
drop = "",Glass
|
||||
groups = { ruby = 2 , sapphire = 1, opal = 1, },
|
||||
drop = "",
|
||||
tiles = { "glow_ruby4x.png","glow_ruby.png",},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -94,8 +130,20 @@ minetest.register_node( "gems:great_gem_sapphire", {
|
||||
description = "Sapphire Great Gem",
|
||||
drawtype = "mesh",
|
||||
mesh = "hex_crystal_big.obj",
|
||||
groups = { "sapphire" = 2, "emerald" = 1 ,"ruby" = 1, },
|
||||
drop = "",Glass
|
||||
groups = { sapphire = 2, emerald = 1 ,ruby = 1, },
|
||||
drop = "",
|
||||
tiles = { "glow_sapphire4x.png","glow_sapphire.png",},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -103,8 +151,20 @@ minetest.register_node( "gems:great_gem_emerald", {
|
||||
description = "Emerald Great Gem",
|
||||
drawtype = "mesh",
|
||||
mesh = "hex_crystal_big.obj",
|
||||
groups = { "emerald" = 2, "opal" = 1, "sapphire" = 1 , },
|
||||
drop = "",Glass
|
||||
groups = { emerald = 2, opal = 1, sapphire = 1 , },
|
||||
drop = "",
|
||||
tiles = { "glow_emerald4x.png","glow_emerald.png",},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -112,8 +172,20 @@ minetest.register_node( "gems:great_gem_opal", {
|
||||
description = "Opal Great Gem",
|
||||
drawtype = "mesh",
|
||||
mesh = "hex_crystal_big.obj",
|
||||
groups = { "opal" = 2, "ruby" = 1, "emerald" = 1, },
|
||||
drop = "",Glass
|
||||
groups = { opal = 2, ruby = 1, emerald = 1, },
|
||||
drop = "",
|
||||
tiles = { "glow_opal4x.png","glow_opal.png",},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 3, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -123,30 +195,46 @@ minetest.register_node( "gems:great_gem_opal", {
|
||||
-- Protectors hurt players of all other teams in a radius of 4 nodes
|
||||
|
||||
minetest.register_node( "gems:protector_ruby", {
|
||||
description = "Ruby Block",
|
||||
description = "Ruby Protector",
|
||||
tiles = {"glow_ruby.png"},
|
||||
groups = { "ruby" = 3 , "sapphire" = 3, "opal" = 2, "emerald" = 2, "cracky" = 1 , "oddly_breakable_by_hand" = 1},
|
||||
groups = { ruby = 3 , sapphire = 3, opal = 2, emerald = 2, cracky = 1 , oddly_breakable_by_hand = 1},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike"
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:protector_sapphire", {
|
||||
description = "Sapphire Block",
|
||||
description = "Sapphire Protector",
|
||||
tiles = {"glow_sapphire.png"},
|
||||
groups = { "sapphire" = 3, "emerald" = 3 ,"ruby" = 2, "opal" = 2, "cracky" = 1 , "oddly_breakable_by_hand" = 1},
|
||||
groups = { sapphire = 3, emerald = 3 ,ruby = 2, opal = 2, cracky = 1 , oddly_breakable_by_hand = 1},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike"
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:protector_emerald", {
|
||||
description = "Emerald Block",
|
||||
description = "Emerald Protector",
|
||||
tiles = {"glow_emerald.png"},
|
||||
groups = { "emerald" = 3, "opal" = 3, "sapphire" = 2 , "ruby" = 2, "cracky" = 1 , "oddly_breakable_by_hand" = 1},
|
||||
groups = { emerald = 3, opal = 3, sapphire = 2 , ruby = 2, cracky = 1 , oddly_breakable_by_hand = 1},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike"
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node( "gems:protector_opal", {
|
||||
description = "Opal Block",
|
||||
description = "Opal Protector",
|
||||
tiles = {"glow_opal.png"},
|
||||
groups = { "opal" = 3, "ruby" = 3, "emerald" = 2, "sapphire" = 2, "cracky" = 1 , "oddly_breakable_by_hand" = 1},
|
||||
groups = { opal = 3, ruby = 3, emerald = 2, sapphire = 2, cracky = 1 , oddly_breakable_by_hand = 1},
|
||||
paramtype = "light",
|
||||
use_texture_alpha = "blend",
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drawtype = "glasslike"
|
||||
})
|
||||
|
||||
|
||||
@ -154,13 +242,25 @@ minetest.register_node( "gems:protector_opal", {
|
||||
|
||||
for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
local gem_name_cap = gem_name_caps[_]
|
||||
local gem_name_cap = gem_names_caps[_]
|
||||
|
||||
minetest.register_node( "gems:mine_".. gem_name, {
|
||||
description = gem_name_cap .. " Mine",
|
||||
tiles = { "default_stone.png^item_" .. gem_name .. ".png" },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm{
|
||||
label = "gems:mine_".. gem_name .." dropper",
|
||||
nodenames = {"gems:mine_".. gem_name},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
minetest.spawn_item({x=pos.x, y=pos.y+1, z=pos.z}, "gems:".. gem_name)
|
||||
end,
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -172,7 +272,7 @@ end
|
||||
--formspecs
|
||||
for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
local gem_name_cap = gem_name_caps[_]
|
||||
local gem_name_cap = gem_names_caps[_]
|
||||
|
||||
|
||||
|
||||
@ -180,7 +280,7 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
|
||||
|
||||
gems[ gem_name .. "_shop_main_menu"] =
|
||||
gems[ gem_name .. "_shop_main_menu"] = (
|
||||
"size[10,7]" ..
|
||||
-- gems menu, name = <gem_name>_gems_menu
|
||||
"item_image_button[1,1;2,2;gems:".. gem_name .. ";".. gem_name .. "_gems_menu;]" ..
|
||||
@ -204,7 +304,7 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
-- special menu, name = <gem_name>_special_menu
|
||||
"item_image_button[7,4;2,2;default:mese_crystal;".. gem_name .. "_special_menu;]" ..
|
||||
"tooltip[".. gem_name .. "_special_menu;Special (coming soon!)]" ..
|
||||
"tooltip[".. gem_name .. "_special_menu;Special (coming soon!)]" )
|
||||
|
||||
|
||||
|
||||
@ -212,7 +312,10 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
|
||||
|
||||
gems[ gem_name .. "_shop_gems_menu"] =
|
||||
gems[ gem_name .. "_shop_gems_menu"] = (
|
||||
|
||||
|
||||
|
||||
"size[10,7]" ..
|
||||
|
||||
-- gem block, name = <gem_name>_block_button
|
||||
@ -229,15 +332,16 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
-- Gem Sword, name = <gem_name>_sword_button
|
||||
"item_image_button[1,4;2,2;gems:sword_".. gem_name .. ";".. gem_name .. "_sword_button;4:1]" ..
|
||||
"tooltip[".. gem_name .. "_sword_button;"..gem_name_cap.." Pick]" ..
|
||||
"tooltip[".. gem_name .. "_sword_button;"..gem_name_cap.." Sword]" ..
|
||||
|
||||
-- Gem Protector, name = <gem_name>_protector_button
|
||||
"item_image_button[4,4;2,2;gems:protector_".. gem_name .. ";".. gem_name .. "_protector_button;9:1]" ..
|
||||
"tooltip[".. gem_name .. "_protector_button;"..gem_name_cap.." Protector (coming soon!)]" ..
|
||||
"tooltip[".. gem_name .. "_protector_button;"..gem_name_cap.." Protector (coming soon!)]"
|
||||
|
||||
-- Empty for now
|
||||
-- "item_image_button[7,4;2,2;;".. gem_name .. "_special_menu;]" ..
|
||||
-- "tooltip[".. gem_name .. "_special_menu;Special (coming soon!)]" ..
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -246,7 +350,8 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
|
||||
|
||||
gems[ gem_name .. "_shop_tools_menu"] =
|
||||
gems[ gem_name .. "_shop_tools_menu"] = (
|
||||
|
||||
"size[10,7]" ..
|
||||
|
||||
-- Steel Pick, name = <gem_name>_steel_pick_button
|
||||
@ -271,14 +376,17 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
--Bronze axe, name = <gem_name>_bronze_axe_button
|
||||
"item_image_button[7,4;2,2;default:axe_bronze;".. gem_name .. "_bronze_axe_button;1:1]" ..
|
||||
"tooltip[".. gem_name .. "_bronze_axe_button;Bronze Axe]" ..
|
||||
"tooltip[".. gem_name .. "_bronze_axe_button;Bronze Axe]"
|
||||
|
||||
)
|
||||
|
||||
|
||||
-- Blocks menu (for regular blocks)
|
||||
|
||||
|
||||
|
||||
gems[ gem_name .. "_shop_blocks_menu"] =
|
||||
gems[ gem_name .. "_shop_blocks_menu"] = (
|
||||
|
||||
"size[10,7]" ..
|
||||
|
||||
-- Stone, name = <gem_name>_stone_button
|
||||
@ -303,20 +411,20 @@ for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
-- obsidian glass, name = <gem_name>_obsidian_glass_button
|
||||
"item_image_button[7,4;2,2;default:obsidian_glass;".. gem_name .. "_obsidian_glass_button;1:18]" ..
|
||||
"tooltip[".. gem_name .. "_obsidian_glass_button;Obsidian Glass]" ..
|
||||
|
||||
"tooltip[".. gem_name .. "_obsidian_glass_button;Obsidian Glass]"
|
||||
|
||||
)
|
||||
|
||||
-- Food menu (for regaining health)
|
||||
|
||||
|
||||
|
||||
gems[ gem_name .. "_shop_food_menu"] =
|
||||
gems[ gem_name .. "_shop_food_menu"] = (
|
||||
"size[10,7]" ..
|
||||
|
||||
-- apple, name = <gem_name>_apple_button
|
||||
"item_image_button[1,1;2,2;default:apple;".. gem_name .. "_apple_button;1:5]" ..
|
||||
"tooltip[".. gem_name .. "_apple_button;Apple]" ..
|
||||
"tooltip[".. gem_name .. "_apple_button;Apple]"
|
||||
|
||||
-- -- obsidian, name = <gem_name>_obsidian_button
|
||||
-- "item_image_button[4,1;2,2;default:obsidian;".. gem_name .. "_obsidian_button;]" ..
|
||||
@ -339,7 +447,7 @@ for _ , gem_name in pairs(gem_names) do
|
||||
-- "tooltip[".. gem_name .. "_obsidian_glass_button;Obsidian Glass]" ..
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -352,11 +460,13 @@ for _ , gem_name in pairs(gem_names) do
|
||||
groups = {unbreakable = 1},
|
||||
drop = "",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"easyvend_vendor_top_blue.png", "easyvend_vendor_top_blue.png", "easyvend_vendor_side_blue.png", "easyvend_vendor_side_blue.png", "easyvend_vendor_side_blue.png", "easyvend_vendor_front_on_blue.png"},
|
||||
tiles = {"default_steel_block.png^item_" ..gem_name .. ".png",},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local name = player:get_player_name()
|
||||
minetest.show_formspec(name, "gems:shop_main", gems[ gem_name .. "_shop_main_menu"])
|
||||
end
|
||||
end,
|
||||
groups = {},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
|
||||
@ -385,7 +495,7 @@ end
|
||||
|
||||
for _ , gem_name in pairs(gem_names) do
|
||||
|
||||
local gem_name_cap = gem_name_caps[_]
|
||||
local gem_name_cap = gem_names_caps[_]
|
||||
|
||||
if formname == "gems:shop_main" then
|
||||
|
||||
@ -547,6 +657,8 @@ end
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user