First commit in new repo

-- Yawin
master
Yawin 2017-02-07 22:38:26 +01:00
commit 31d4fb9d47
39 changed files with 1067 additions and 0 deletions

275
api.lua Normal file
View File

@ -0,0 +1,275 @@
-----------------------------------------------------------------
-- MULTIBLOCK RECIPES -------------------------------------------
-----------------------------------------------------------------
function magic.register_recipe(name, recipe, action)
magic.recipes[name] = {recipe, action}
end
function magic.do_spell(itemstack, placer, pointed_thing)
local name
if pointed_thing.type == "object" then
return
elseif pointed_thing.type == "node" then
name = minetest.get_node(pointed_thing.under).name
else
return
end
local coincidences = magic.find_possible_recipes(pointed_thing)
if #coincidences > 0 then
for n_rec, rec in ipairs(coincidences) do
local pt = pointed_thing
if magic.check_recipe(rec, pt) then
magic.recipes[rec][2](pt, placer)
return
end
end
end
end
function magic.check_recipe(recipe_id, target)
local recipe = magic.recipes[recipe_id][1]
local posx = target.under.x
local posy = target.under.y
local posz = target.under.z
local reference = {x = posx - math.floor(#recipe[1][1] / 2),
y = posy - math.floor(#recipe / 2),
z = posz - math.floor(#recipe[1] / 2)}
local i = 0
local j = 0
local k = 0
k = 0
for n_lin, lin in ipairs(recipe) do
posy = reference.y + k
j = 0
for n_col, col in ipairs(lin) do
posz = reference.z + j
i = 0
for n_elem, elem in ipairs(col) do
posx = reference.x + i
if elem ~= "" then
local nodedef = minetest.registered_nodes[minetest.get_node({x = posx,y = posy,z = posz}).name]
local grupo = false;
for g, _ in pairs(nodedef.groups) do
if elem == g then
grupo = true;
end
end
if elem ~= minetest.get_node({x = posx,y = posy,z = posz}).name and not grupo then
return false
end
end
i = i + 1
end
j = j + 1
end
k = k + 1
end
return true
end
function magic.find_possible_recipes(node)
local to_ret = {}
local coincide
local nodedef = minetest.registered_nodes[minetest.get_node(node.under).name]
for n_rec, rec in pairs(magic.recipes) do
coincide = false
for n_lin, lin in ipairs(rec[1]) do
for n_col, col in ipairs(lin) do
for n_elem, elem in ipairs(col) do
local grupo = false;
for g, _ in pairs(nodedef.groups) do
if elem == g then
grupo = true;
end
end
if elem == minetest.get_node(node.under).name or grupo then
to_ret[#to_ret+1] = n_rec
coincide = true
end
if coincide then break end
end
if coincide then break end
end
if coincide then break end
end
end
return to_ret
end
-----------------------------------------------------------------
-- ALTAR RITUALS ------------------------------------------------
-----------------------------------------------------------------
function magic.register_ritual(name, ritual, action)
magic.rituals[name] = {ritual, action}
end
function magic.do_ritual(node, player)
local things = magic.get_items(node)
if #things < 1 then
minetest.chat_send_player(player:get_player_name(), "[Mod magic] The altar is empty")
return
end
local itemlist = magic.organice_items(things)
local n_rit = magic.check_ritual(itemlist)
if n_rit then
magic.rituals[n_rit][2](node, player)
end
end
function magic.get_items(node)
local pos = node.under
local things = {}
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
table.insert(things,object:get_luaentity().itemstring)
end
end
return things
end
function magic.organice_items(things)
local did = false
local itemlist = {}
for i, n in pairs(things) do
did = false
for j in ipairs(itemlist) do
if itemlist[j].name == n then
itemlist[j].val = itemlist[j].val + 1
did = true
end
end
if not did then
itemlist[#itemlist+1] = {name = n, val = 1}
end
end
return itemlist
end
function magic.check_ritual(itemlist)
for ritual_id, ritual_content in pairs(magic.rituals) do
if #ritual_content[1] == #itemlist then
local check = false
for i in ipairs(itemlist) do
check = magic.check_item_in_ritual(itemlist[i], ritual_content[1])
if not check then
break
end
end
if check then
return ritual_id
end
end
end
return
end
function magic.check_item_in_ritual(item, itemlist)
for i in ipairs(itemlist) do
if itemlist[i].name == item.name and itemlist[i].val == item.val then
return true
end
end
return false
end
function magic.clear_altar(node)
local pos = node.under
local things = {}
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
object:get_luaentity().itemstring = ""
object:remove()
end
end
return things
end
-----------------------------------------------------------------
-- HOME WARP ----------------------------------------------------
-----------------------------------------------------------------
function magic.warp(player)
local playerName = player:get_player_name()
local home = magic.checkHome(playerName)
if home == -1 then
minetest.chat_send_player(playerName, "[Mod Magic] Unknown home")
return
end
player:setpos(magic.playerHomes[home].homepos)
player:set_look_yaw(0)
end
-----------------------------------------------------------------
-- TIER REGISTERING UTILS ---------------------------------------
-----------------------------------------------------------------
function magic.add_group_to_node(n, group)
local def = minetest.registered_items[n]
if not def then
return false
end
local dg = def.groups or {}
for _group, value in pairs(group) do
if value ~= 0 then
dg[_group] = value
else
dg[_group] = nil
end
end
minetest.override_item(n, {groups = dg})
return true
end
function magic.add_group(group, node_list)
for i in ipairs(node_list) do
magic.add_group_to_node(node_list[i], group)
end
end
-----------------------------------------------------------------
-- OTHER UTILITIES ----------------------------------------------
-----------------------------------------------------------------
function magic.is_near_to_magic(pos, radius)
return minetest.find_node_near(pos, radius, {"magic:magicalcobble", "magic:magicalwater_source", "magic:magicalwater_flowing"})
end

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
bucket
walls
stairs

52
functions/homewarp.lua Normal file
View File

@ -0,0 +1,52 @@
-----------------------------------------------------------------
-- HOME WARP LOGIC ----------------------------------------------
-----------------------------------------------------------------
function magic.loadHomes()
local fh,err = io.open(magic.worldpath .. "/magic_homes.txt", "r")
if err then
print("No existing warps to read.")
return
end
while true do
local line = fh:read()
if line == nil then
break
end
local paramlist = string.split(line, " ")
local w = {
player = paramlist[1],
homepos = {
x = tonumber(paramlist[2]),
y = tonumber(paramlist[3]),
z = tonumber(paramlist[4]),
},
token = paramlist[5],
}
table.insert(magic.playerHomes, w)
end
fh:close()
end
function magic.saveHomes()
local fh,err = io.open(magic.worldpath .. "/magic_homes.txt", "w")
if err then
print("No existing warps to read.")
return
end
for i = 1,table.getn(magic.playerHomes) do
local s = magic.playerHomes[i].player .. " " .. magic.playerHomes[i].homepos.x .. " " .. magic.playerHomes[i].homepos.y .. " " .. magic.playerHomes[i].homepos.z .. " " .. magic.playerHomes[i].token .. "\n"
fh:write(s)
end
fh:close()
end
function magic.checkHome(player)
for i = 1,table.getn(magic.playerHomes) do
if magic.playerHomes[i].player == player then
return i
end
end
return -1
end

35
init.lua Normal file
View File

@ -0,0 +1,35 @@
-- Definitions made by this mod that other mods can use too
magic = {}
magic.recipes = {}
magic.rituals = {}
magic.playerHomes = {}
magic.path = minetest.get_modpath("magic")
magic.worldpath = minetest.get_worldpath()
-- Load files
dofile(magic.path.."/functions/homewarp.lua")
dofile(magic.path.."/api.lua")
dofile(magic.path.."/items/wand.lua")
dofile(magic.path.."/items/home_stone.lua")
dofile(magic.path.."/nodes/magical_altar.lua")
dofile(magic.path.."/nodes/magical_brewing_stand.lua")
dofile(magic.path.."/nodes/magical_cobble.lua")
dofile(magic.path.."/nodes/magical_lightbloom.lua")
dofile(magic.path.."/nodes/magical_obsidian.lua")
dofile(magic.path.."/nodes/magical_water.lua")
dofile(magic.path.."/recipes/t0_begining.lua")
dofile(magic.path.."/recipes/t1_altar.lua")
dofile(magic.path.."/recipes/t1_big_tree.lua")
dofile(magic.path.."/recipes/t1_compass.lua")
dofile(magic.path.."/recipes/t1_home_stone.lua")
dofile(magic.path.."/recipes/t1_home_warp.lua")
dofile(magic.path.."/recipes/t2_lightbloom.lua")
dofile(magic.path.."/tiers.lua")
magic.loadHomes()
-- 927 líneas de código

9
items/home_stone.lua Normal file
View File

@ -0,0 +1,9 @@
minetest.register_craftitem("magic:home_stone",{
description = "Home stone",
inventory_image = "home_stone.png",
stack_max = 1,
on_use = function(itemstack, placer, pointed_thing)
magic.warp(placer)
end,
})

56
items/wand.lua Normal file
View File

@ -0,0 +1,56 @@
-----------------------------------------------------------------
-- WAND -------------------------------------------
-----------------------------------------------------------------
minetest.register_craftitem("magic:wand",{
description = "Magical wand",
inventory_image = "magic_wand.png",
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
magic.do_spell(itemstack, placer, pointed_thing)
end,
})
minetest.override_item("default:stick",{
liquids_pointable = true,
})
minetest.override_item("default:leaves",{
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if itemstack:get_name() == "default:sapling" then
if magic.check_recipe("begining", pointed_thing) then
magic.recipes["begining"][2](pointed_thing)
end
end
end,
})
--[[on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
return user:get_wielded_item()
elseif pointed_thing.type ~= "node" then
-- do nothing if it's neither object nor node
return
end
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count()
if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == "magic:magicalwater_source" or node.name == "magic:magicalwater_flowing") then
return ItemStack("magic:wand")
elseif node.name == "default:leaves" then
if magic.check_recipe("begining", pointed_thing) then
magic.recipes["begining"][2](pointed_thing)
end
end
--return itemstack
end,
minetest.env:add_item(user:get_pos(), "magic:wand")
itemstack:take_item()
return itemstack
]]--

28
nodes/magical_altar.lua Normal file
View File

@ -0,0 +1,28 @@
minetest.register_node("magic:magical_altar", {
description = "Magical altar",
drawtype = "nodebox",
tiles = {"altar_top.png","altar_top.png","altar_side.png"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.19, 0.5},
},
groups = {cracky = 2, oddly_breakable_by_hand=1},
sounds = default.node_sound_stone_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local p = pos
p.x = p.x + math.random(-4, 4)/10
p.z = p.z + math.random(-4, 4)/10
minetest.env:add_item(p, itemstack:get_name())
itemstack:take_item()
player:set_wielded_item(itemstack)
end
})
minetest.override_item("stairs:slab_stone_block",{
liquids_pointable = true,
})

View File

@ -0,0 +1,42 @@
minetest.register_node("magic:brewing_stand", {
description = "Brewing Stand",
groups = {cracky=1, oddly_breakable_by_hand=1},
sounds = default.node_sound_stone_defaults(),
tiles = {"brewing_stand_base.png","altar_top.png","altar_side.png"},
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.19, 0.5},
},
on_rightclick = function(pos, node, clicker, item, _)
end,
})
--[[tiles = {
"brewing_stand_base.png",
"brewing_stand_base.png",
"brewing_stand.png",
"brewing_stand.png",
"brewing_stand.png",
"brewing_stand.png"
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, -0.4375, 0.25}, -- NodeBox1
{-0.0625, -0.5, -0.0625, 0.0625, 0, 0.0625}, -- NodeBox2
{-0.5, 0, -0.125, 0.5, 0.0625, 0.125}, -- NodeBox3
{-0.4375, -0.1875, -0.0625, -0.3125, 0.375, 0.0625}, -- NodeBox4
{0.3125, -0.1875, -0.0625, 0.4375, 0.375, 0.0625}, -- NodeBox5
{-0.125, 0.0625, -0.125, 0.125, 0.125, 0.125}, -- NodeBox6
{-0.1875, 0.125, -0.125, 0.1875, 0.375, 0.125}, -- NodeBox7
{-0.125, 0.125, -0.1875, 0.125, 0.375, 0.1875}, -- NodeBox8
{-0.0625, 0.375, -0.0625, 0.0625, 0.5, 0.0625}, -- NodeBox9
}
},]]--

66
nodes/magical_cobble.lua Normal file
View File

@ -0,0 +1,66 @@
-- Agua mágica, su cubo y la fuenta donde se puede encontrar
minetest.register_node("magic:magicalcobble", {
description = "Magical Cobblestone",
tiles = {
{
name = "magic_magicalcobble_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
},
},
special_tiles = {
-- New-style water source material (mostly unused)
{
name = "magic_magicalcobble_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
--backface_culling = false,
},
},
light_source = 5,
paramtype = "light",
drop = "default:cobble",
groups = {cracky = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
})
walls.register("magic:magicalcobble_wall", "Magical Cobblestone Wall", "magic_magicalcobble.png",
"magic:magicalcobble", default.node_sound_stone_defaults())
minetest.override_item("magic:magicalcobble_wall",{
tiles = {
{
name = "magic_magicalcobble_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
},
},
special_tiles = {
-- New-style water source material (mostly unused)
{
name = "magic_magicalcobble_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
--backface_culling = false,
},
},
light_source = 5,
paramtype = "light",
drop = "walls:cobble",
})

View File

@ -0,0 +1,21 @@
minetest.register_node("magic:lightbloom", {
description = "Lightbloom",
drawtype = "plantlike",
waving = 1,
tiles = {"magic_lightbloom.png"},
inventory_image = "magic_lightbloom.png",
wield_image = "magic_lightbloom.png",
light_source = 15,
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
stack_max = 64,
groups = {snappy = 3, flower = 1, flora = 1, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16},
}
})

View File

@ -0,0 +1,49 @@
minetest.register_node("magic:magicalobsidian", {
description = "Magical Obsidian",
tiles = {
{
name = "magic_magicalobsidian_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
},
},
special_tiles = {
-- New-style water source material (mostly unused)
{
name = "magic_magicalobsidian_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 10.0,
},
--backface_culling = false,
},
},
after_dig_node = function(pos, oldnode, oldmetadata)
local meta = minetest.env:get_meta(pos)
meta:from_table(oldmetadata)
local s = meta:get_string("magic_referido")
local home = magic.checkHome(s)
if home ~= -1 then
if magic.playerHomes[home].token == meta:get_string("magic_token") then
table.remove(magic.playerHomes,home)
magic.saveHomes()
end
end
return
end,
drop = "default:obsidian",
light_source = 5,
paramtype = "light",
groups = {cracky = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
})

129
nodes/magical_water.lua Normal file
View File

@ -0,0 +1,129 @@
-----------------------------------------------------------------
-- MAGICAL WATER AND THE BUCKET ---------------------------------
-----------------------------------------------------------------
local function get_wand(pos, node, player, itemstack, pointed_thing)
local p = pos
p.y = p.y + 1
if itemstack:get_name() == "default:stick" then
minetest.env:add_item(p, "magic:wand")
itemstack:take_item()
player:set_wielded_item(itemstack)
elseif itemstack:get_name() == "stairs:slab_stone_block" then
minetest.env:add_item(p, "magic:magical_altar")
itemstack:take_item()
player:set_wielded_item(itemstack)
end
end
minetest.register_node("magic:magicalwater_source", {
description = "Magical Water Source",
drawtype = "liquid",
tiles = {
{
name = "magic_magicalwater_source_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
special_tiles = {
-- New-style water source material (mostly unused)
{
name = "magic_magicalwater_source_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
backface_culling = false,
},
},
light_source = 5,
alpha = 160,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "magic:magicalwater_flowing",
liquid_alternative_source = "magic:magicalwater_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_water_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
get_wand(pos, node, player, itemstack, pointed_thing)
end,
})
minetest.register_node("magic:magicalwater_flowing", {
description = "Flowing Magical Water",
drawtype = "flowingliquid",
tiles = {"magic_magicalwater.png"},
special_tiles = {
{
name = "magic_magicalwater_flowing_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
{
name = "magic_magicalwater_flowing_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8,
},
},
},
light_source = 5,
alpha = 160,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "magic:magicalwater_flowing",
liquid_alternative_source = "magic:magicalwater_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 3, liquid = 3, puts_out_fire = 1,
not_in_creative_inventory = 1, cools_lava = 1},
sounds = default.node_sound_water_defaults(),
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
get_wand(pos, node, player, itemstack, pointed_thing)
end,
})
bucket.register_liquid(
"magic:magicalwater_source",
"magic:magicalwater_flowing",
"magic:bucket_magicalwater",
"bucket_magicalwater.png",
"Magical Water Bucket",
{water_bucket = 1}
)

25
recipes/t0_begining.lua Normal file
View File

@ -0,0 +1,25 @@
-----------------------------------------------------------------
-- BEGINING RECIPE (Creates the Magical Water Source) -----------
-----------------------------------------------------------------
magic.register_recipe("begining",
{
{
{"", "", "", "default:cobble", "", "", "",},
{"", "", "default:cobble", "default:cobble", "default:cobble", "", "",},
{"", "default:cobble", "air", "default:cobble", "air", "default:cobble", "",},
{"default:cobble", "default:cobble", "default:cobble", "default:leaves", "default:cobble", "default:cobble", "default:cobble",},
{"", "default:cobble", "air", "default:cobble", "air", "default:cobble", "",},
{"", "", "default:cobble", "default:cobble", "default:cobble", "", "",},
{"", "", "", "default:cobble", "", "", "",},
},
},
function(node)
local posx = node.under.x - 3
local posy = node.under.y
local posz = node.under.z - 3
local sch = magic.path .. "/schems/magical_font.mts"
minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
end
)

72
recipes/t1_altar.lua Normal file
View File

@ -0,0 +1,72 @@
magic.register_recipe("altar",
{
{
{"", "", "", "", "", "tier1", "tier1", "tier1", "", "", "", "", ""},
{"", "", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", "", ""},
{"", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", ""},
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
{"", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", ""},
{"", "", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", "", ""},
{"", "", "", "", "", "tier1", "tier1", "tier1", "", "", "", "", ""},
},
{
{"", "", "", "", "", "default:stone_block", "air", "default:stone_block", "", "", "", "", ""},
{"", "", "", "air", "default:stone_block", "air", "air", "air", "default:stone_block", "air", "", "", ""},
{"", "", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", "", ""},
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
{"", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", ""},
{"default:stone_block", "air", "air", "air", "air", "stairs:slab_stone_block", "stairs:stair_stone_block", "stairs:slab_stone_block", "air", "air", "air", "air", "default:stone_block"},
{"air", "air", "air", "air", "air", "stairs:stair_stone_block", "default:stone_block", "stairs:stair_stone_block", "air", "air", "air", "air", "air"},
{"default:stone_block", "air", "air", "air", "air", "stairs:slab_stone_block", "stairs:stair_stone_block", "stairs:slab_stone_block", "air", "air", "air", "air", "default:stone_block"},
{"", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", ""},
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
{"", "", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", "", ""},
{"", "", "", "air", "default:stone_block", "air", "air", "air", "default:stone_block", "air", "", "", ""},
{"", "", "", "", "", "default:stone_block", "air", "default:stone_block", "", "", "", "", ""},
},
{
{"", "", "", "", "", "t_altar", "air", "t_altar", "", "", "", "", ""},
{"", "", "", "air", "t_altar", "air", "air", "air", "t_altar", "air", "", "", ""},
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
{"air", "air", "air", "air", "air", "air", "magic:magical_altar", "air", "air", "air", "air", "air", "air"},
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
{"", "", "", "air", "t_altar", "air", "air", "air", "t_altar", "air", "", "", ""},
{"", "", "", "", "", "t_altar", "air", "t_altar", "", "", "", "", ""},
},
{
{"", "", "", "", "", "t_altar", "t_altar", "t_altar", "", "", "", "", ""},
{"", "", "", "t_altar", "t_altar", "air", "air", "air", "t_altar", "t_altar", "", "", ""},
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
{"", "", "", "t_altar", "t_altar", "air", "air", "air", "t_altar", "t_altar", "", "", ""},
{"", "", "", "", "", "t_altar", "t_altar", "t_altar", "", "", "", "", ""},
},
},
function(node, player)
if not magic.is_near_to_magic(node.under, 10) then
minetest.chat_send_player(player:get_player_name(), "[Mod Magic] Needs to be near to a magic source")
return
end
magic.do_ritual(node, player)
end
)

29
recipes/t1_big_tree.lua Normal file
View File

@ -0,0 +1,29 @@
-----------------------------------------------------------------
-- BIG TREE RECIPE ----------------------------------------------
-----------------------------------------------------------------
-- ToDo: Spawn different trees for different randomly and
-- different type of tree for different type of sappling
magic.register_recipe("big_tree",
{
{
{"default:dirt_with_grass", "field", "default:dirt_with_grass",},
{"field", "", "field",},
{"field", "default:dirt_with_grass", "field",},
},
{
{"air", "air", "air",},
{"air", "default:sapling", "air",},
{"air", "air", "air",},
},
},
function(node)
local posx = node.under.x - 5
local posy = node.under.y
local posz = node.under.z - 7
local sch = magic.path .. "/schems/magical_big_tree.mts"
minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
end
)

33
recipes/t1_compass.lua Normal file
View File

@ -0,0 +1,33 @@
-----------------------------------------------------------------
-- COMPASS RECIPE -----------------------------------------------
-----------------------------------------------------------------
magic.register_recipe("compass",
{
{
{"tier1", "air", "tier1",},
{"air", "tier1", "air",},
{"tier1", "air", "tier1",},
},
},
function(node)
local posx = node.under.x
local posy = node.under.y
local posz = node.under.z
local nod = minetest.get_node({x = posx - 1, y = posy, z = posz + 1})
minetest.set_node({x = posx - 1, y = posy, z = posz}, {name = nod.name})
minetest.set_node({x = posx - 1, y = posy, z = posz + 1}, {name = "air"})
nod = minetest.get_node({x = posx + 1, y = posy, z = posz + 1})
minetest.set_node({x = posx + 1, y = posy, z = posz}, {name = nod.name})
minetest.set_node({x = posx + 1, y = posy, z = posz + 1}, {name = "air"})
nod = minetest.get_node(node.under)
minetest.set_node({x = posx, y = posy, z = posz + 1}, {name = nod.name})
minetest.set_node({x = posx, y = posy, z = posz}, {name = "air"})
--local sch = magic.path .. "/schems/compass.mts"
--minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
end
)

63
recipes/t1_home_stone.lua Normal file
View File

@ -0,0 +1,63 @@
-----------------------------------------------------------------
-- HOME STONE RECIPE --------------------------------------------
-----------------------------------------------------------------
magic.register_recipe("home_stone",
{
{
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
},
{
{"","","","","","","default:cobble","","","","","",""},
{"","","","default:cobble","air","air","air","air","air","default:cobble","","",""},
{"","","air","air","air","air","air","air","air","air","air","",""},
{"","default:cobble","air","air","air","air","air","air","air","air","air","default:cobble",""},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"air","air","air","air","air","air","stairs:slab_cobble","air","air","air","air","air","air"},
{"default:cobble","air","air","air","air","stairs:slab_cobble","default:obsidian","stairs:slab_cobble","air","air","air","air","default:cobble"},
{"air","air","air","air","air","air","stairs:slab_cobble","air","air","air","air","air","air"},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"","default:cobble","air","air","air","air","air","air","air","air","air","default:cobble",""},
{"","","air","air","air","air","air","air","air","air","air","",""},
{"","","","default:cobble","air","air","air","air","air","default:cobble","","",""},
{"","","","","","","default:cobble","","","","","",""},
},
{
{"","","","","","","default:cobble","","","","","",""},
{"","","","air","air","air","air","air","air","air","","",""},
{"","","air","air","air","air","air","air","air","air","air","",""},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"air","air","air","air","air","air","air","air","air","air","air","air","air"},
{"default:cobble","air","air","air","air","air","air","air","air","air","air","air","default:cobble"},
{"air","air","air","air","air","air","air","air","air","air","air","air","air"},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"","air","air","air","air","air","air","air","air","air","air","air",""},
{"","","air","air","air","air","air","air","air","air","air","",""},
{"","","","air","air","air","air","air","air","air","","",""},
{"","","","","","","default:cobble","","","","","",""},
},
},
function(node, player)
if not magic.is_near_to_magic(node.under, 10) then
minetest.chat_send_player(player:get_player_name(), "[Mod Magic] Needs to be near to a magic source")
return
end
minetest.set_node(node.under, {name="magic:magicalobsidian"})
minetest.env:add_item({x = node.under.x, y = node.under.y + 1, z = node.under.z}, "magic:home_stone")
end
)

56
recipes/t1_home_warp.lua Normal file
View File

@ -0,0 +1,56 @@
-----------------------------------------------------------------
-- HOME WARP RECIPE ---------------------------------------------
-----------------------------------------------------------------
magic.register_recipe("home_warp",
{
{
{"","default:obsidian","default:obsidian","default:obsidian",""},
{"default:obsidian","","","","default:obsidian"},
{"","","default:obsidian","","default:obsidian"},
{"","default:obsidian","","","default:obsidian"},
{"","","default:obsidian","default:obsidian",""},
},
},
function(node, player)
local posx = node.under.x
local posy = node.under.y
local posz = node.under.z
local i = -2
local j = -2
local arrID = magic.checkHome(player:get_player_name())
local token = node.under.x .. node.under.y .. node.under.z
if arrID == -1 then
arrID = #magic.playerHomes + 1
end
magic.playerHomes[arrID] = {}
magic.playerHomes[arrID].player = player:get_player_name()
magic.playerHomes[arrID].homepos = {x = node.under.x, y = node.under.y + 1, z = node.under.z}
magic.playerHomes[arrID].token = token
magic.saveHomes()
while i <= 2 do
while j <= 2 do
if "default:obsidian" == minetest.get_node({x = posx + i, y = posy, z = posz + j}).name then
minetest.set_node({x = posx + i, y = posy, z = posz + j}, {name="magic:magicalobsidian"})
local meta = minetest.get_meta({x = posx + i, y = posy, z = posz + j})
meta:set_string("magic_referido",player:get_player_name())
meta:set_string("magic_token",token)
end
j = j + 1
end
j = -2
i = i + 1
end
end
)

10
recipes/t2_lightbloom.lua Normal file
View File

@ -0,0 +1,10 @@
magic.register_ritual("lightbloom",
{
{name = "flowers:geranium", val = 1}
},
function(node, player)
magic.clear_altar(node)
minetest.env:add_item(node.under, "magic:lightbloom")
end
)

BIN
schems/compass.mts Normal file

Binary file not shown.

BIN
schems/magical_big_tree.mts Normal file

Binary file not shown.

BIN
schems/magical_font.mts Normal file

Binary file not shown.

BIN
schems/sapling_rune.mts Normal file

Binary file not shown.

4
textures/.directory Normal file
View File

@ -0,0 +1,4 @@
[Dolphin]
PreviewsShown=true
Timestamp=2017,1,20,4,22,51
Version=3

BIN
textures/altar_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

BIN
textures/altar_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
textures/brewing_stand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

BIN
textures/home_stone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
textures/magic_wand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

9
tiers.lua Normal file
View File

@ -0,0 +1,9 @@
magic.add_group(
{tier1 = 1},
{"default:stone", "default:cobble", "default:stonebrick", "default:stone_block", "default:mossycobble", "default:desert_stone", "default:desert_cobble", "default:desert_stonebrick", "default:desert_stone_block", "default:sandstone", "default:sandstonebrick", "default:sandstone_block", "default:dirt", "default:dirt_with_grass", "default:dirt_with_grass_footsteps", "default:dirt_with_dry_grass", "default:sand", "default:desert_sand", "default:silver_sand", "default:gravel", "default:clay"}
)
magic.add_group(
{t_altar = 1},
{"default:stone", "default:cobble", "default:mossycobble"}
)