Add files via upload
This commit is contained in:
parent
e2a51e9718
commit
7cfa20d65f
406
crafting.lua
406
crafting.lua
@ -2,387 +2,83 @@
|
||||
minetest.register_craft({
|
||||
output = "default:apple",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:p", "phonics_tsalagi:0p"},
|
||||
{"phonics_tsalagi:l", "phonics_tsalagi:0e",""},
|
||||
{"phonics_tsalagi:sv", "phonics_tsalagi:ga", "phonics_tsalagi:ta"},
|
||||
{"","",""},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:stick",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:ga", "phonics_tsalagi:na", "phonics_tsalagi:s"},
|
||||
{"phonics_tsalagi:da", "",""},
|
||||
{"","",""},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:stone",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:nv", "phonics_tsalagi:ya", ""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:axe_steel",
|
||||
output = "default:axe_wood",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:x", "phonics_tsalagi:0e"},
|
||||
{"", "",""},
|
||||
{"default:stick","" ,""},
|
||||
{"phonics_tsalagi:ga", "phonics_tsalagi:lu", "phonics_tsalagi:ya"},
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:di", ""},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:torch",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:tsv", "phonics_tsalagi:s"},
|
||||
{"phonics_tsalagi:da", "phonics_tsalagi:do", "phonics_tsalagi:di"},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "beds:bed_bottom 4",
|
||||
output = "boats:boat",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:e", "phonics_tsalagi:d"},
|
||||
{"", "",""},
|
||||
{"phonics_tsalagi:tsi", "phonics_tsalagi:yu", ""},
|
||||
{"","" ,""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "beds:fancy_bed_bottom 4",
|
||||
output = "default:dirt",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:f","phonics_tsalagi:a" ,"phonics_tsalagi:n"},
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:_e",""},
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:e", "phonics_tsalagi:d"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "boats:boat 2",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:_o", "phonics_tsalagi:0a"},
|
||||
{"phonics_tsalagi:t", "",""},
|
||||
{"phonics_tsalagi:ga", "phonics_tsalagi:da", ""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "bucket:bucket_empty 2",
|
||||
output = "doors:door_wood",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:u", "phonics_tsalagi:c"},
|
||||
{"phonics_tsalagi:0k", "phonics_tsalagi:e","phonics_tsalagi:t"},
|
||||
{"","" ,""},
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:s", "phonics_tsalagi:du"},
|
||||
{"phonics_tsalagi:di", "",""},
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:da", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:cart 3",
|
||||
output = "default:glass",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:c", "phonics_tsalagi:ar", "phonics_tsalagi:t"},
|
||||
{"", "",""},
|
||||
{"","" ,""},
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:da", "phonics_tsalagi:ge"},
|
||||
{"phonics_tsalagi:di", "",""},
|
||||
{"","",""},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:pine_tree",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:no", "phonics_tsalagi:tsi", ""},
|
||||
{"","",""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:chest 3",
|
||||
output = "default:ladder",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:ch", "phonics_tsalagi:e", "phonics_tsalagi:s"},
|
||||
{"phonics_tsalagi:t", "",""},
|
||||
{"","" ,""},
|
||||
{"phonics_tsalagi:a", "phonics_tsalagi:yv", "phonics_tsalagi:tlo"},
|
||||
{"","",""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:coal_lump 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:c", "phonics_tsalagi:_o", "phonics_tsalagi:0a"},
|
||||
{"phonics_tsalagi:l", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:dirt 49",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:d", "phonics_tsalagi:er", "phonics_tsalagi:t"},
|
||||
{"", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:door_wood 15",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:d", "phonics_tsalagi:_o", "phonics_tsalagi:0o"},
|
||||
{"phonics_tsalagi:r", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:door_steel 15",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:t", "phonics_tsalagi:_e"},
|
||||
{"phonics_tsalagi:0e", "phonics_tsalagi:l", "phonics_tsalagi:d"},
|
||||
{"phonics_tsalagi:_o", "phonics_tsalagi:0o","phonics_tsalagi:r"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:door_glass 15",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:g", "phonics_tsalagi:l", "phonics_tsalagi:a"},
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:0s", "phonics_tsalagi:d"},
|
||||
{"phonics_tsalagi:_o", "phonics_tsalagi:0o","phonics_tsalagi:r"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:black 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:l", "phonics_tsalagi:a"},
|
||||
{"phonics_tsalagi:c", "phonics_tsalagi:0k",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:blue 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:l", "phonics_tsalagi:_oo"},
|
||||
{"", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:brown 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:b", "phonics_tsalagi:r", "phonics_tsalagi:ou"},
|
||||
{"phonics_tsalagi:n", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:cyan 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:_i", "phonics_tsalagi:a"},
|
||||
{"phonics_tsalagi:n", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:dark_green 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:d", "phonics_tsalagi:ar", "phonics_tsalagi:k"},
|
||||
{"", "phonics_tsalagi:g","phonics_tsalagi:r"},
|
||||
{"phonics_tsalagi:_e","phonics_tsalagi:0e" ,"phonics_tsalagi:n"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:dark_grey 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:d", "phonics_tsalagi:ar", "phonics_tsalagi:k"},
|
||||
{"", "phonics_tsalagi:g","phonics_tsalagi:r"},
|
||||
{"phonics_tsalagi:_a","phonics_tsalagi:0y" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:green 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:g", "phonics_tsalagi:r", "phonics_tsalagi:_e"},
|
||||
{"phonics_tsalagi:0e", "phonics_tsalagi:n",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:grey 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:g", "phonics_tsalagi:r", "phonics_tsalagi:_a"},
|
||||
{"phonics_tsalagi:0y", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:magenta 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:m", "phonics_tsalagi:u", "phonics_tsalagi:j"},
|
||||
{"phonics_tsalagi:e", "phonics_tsalagi:n","phonics_tsalagi:t"},
|
||||
{"phonics_tsalagi:u","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:orange 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:_o", "phonics_tsalagi:r", "phonics_tsalagi:a"},
|
||||
{"phonics_tsalagi:n", "phonics_tsalagi:j","phonics_tsalagi:0e"},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:pink 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:p", "phonics_tsalagi:i", "phonics_tsalagi:n"},
|
||||
{"phonics_tsalagi:k", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:red 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:r", "phonics_tsalagi:e", "phonics_tsalagi:d"},
|
||||
{"", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:violet 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:v", "phonics_tsalagi:_i", "phonics_tsalagi:_o"},
|
||||
{"phonics_tsalagi:l", "phonics_tsalagi:e","phonics_tsalagi:t"},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:white 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:w", "phonics_tsalagi:0h", "phonics_tsalagi:_i"},
|
||||
{"phonics_tsalagi:t", "phonics_tsalagi:0e",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:yellow 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:y", "phonics_tsalagi:e", "phonics_tsalagi:l"},
|
||||
{"phonics_tsalagi:0l", "phonics_tsalagi:_o","phonics_tsalagi:0w"},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
--There are more fence types to make
|
||||
minetest.register_craft({
|
||||
output = "default:fence_wood 33",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:f", "phonics_tsalagi:e", "phonics_tsalagi:n"},
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:0e",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "doors:gate_wood 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:g", "phonics_tsalagi:_a", "phonics_tsalagi:t"},
|
||||
{"phonics_tsalagi:0e", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:glass 33",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:g", "phonics_tsalagi:l", "phonics_tsalagi:a"},
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:0s",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:ladder 9",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:l", "phonics_tsalagi:a", "phonics_tsalagi:d"},
|
||||
{"phonics_tsalagi:0d", "phonics_tsalagi:er",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:pick_steel",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:p", "phonics_tsalagi:i", "phonics_tsalagi:c"},
|
||||
{"phonics_tsalagi:0k", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:pine_tree 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:p", "phonics_tsalagi:_i", "phonics_tsalagi:n"},
|
||||
{"phonics_tsalagi:0e", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:rail 20",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:r", "phonics_tsalagi:_a", "phonics_tsalagi:0i"},
|
||||
{"phonics_tsalagi:l", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:shovel_steel",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:sh", "phonics_tsalagi:u", "phonics_tsalagi:v"},
|
||||
{"phonics_tsalagi:0e", "phonics_tsalagi:l",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:stick 49",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:t", "phonics_tsalagi:i"},
|
||||
{"phonics_tsalagi:c", "phonics_tsalagi:0k",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:stone 49",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:t", "phonics_tsalagi:_o"},
|
||||
{"phonics_tsalagi:n", "phonics_tsalagi:0e",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:sword_steel",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:s", "phonics_tsalagi:0w", "phonics_tsalagi:_o"},
|
||||
{"phonics_tsalagi:r", "phonics_tsalagi:d",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:apple_tree 10",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:t", "phonics_tsalagi:r", "phonics_tsalagi:_e"},
|
||||
{"phonics_tsalagi:0e", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:torch 20",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:t", "phonics_tsalagi:_o", "phonics_tsalagi:r"},
|
||||
{"phonics_tsalagi:ch", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "wool:white 30",
|
||||
recipe = {
|
||||
{"phonics_tsalagi:w", "phonics_tsalagi:oo", "phonics_tsalagi:l"},
|
||||
{"", "",""},
|
||||
{"","" ,""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
747
init.lua
747
init.lua
@ -1,26 +1,17 @@
|
||||
|
||||
|
||||
local page_start
|
||||
local page_end
|
||||
local message_index
|
||||
|
||||
phonics_tsalagi = {
|
||||
a={name="a", length=.4, gain=1, is_letter=1},
|
||||
_a={name="_a", length=.5, gain=1, is_letter=0},
|
||||
e={name="e", length=.65, gain=1, is_letter=1},
|
||||
_e={name="_e", length=.64, gain=1, is_letter=0},
|
||||
i={name="i", length=.65, gain=1, is_letter=1},
|
||||
_i={name="_i", length=.45, gain=1, is_letter=0},
|
||||
language = "phonics_tsalagi"
|
||||
write_command ="gowelodi"
|
||||
phonics = {
|
||||
a={name="a", length=.4, gain=1, is_letter=0},
|
||||
e={name="e", length=.65, gain=1, is_letter=0},
|
||||
i={name="i", length=.65, gain=1, is_letter=0},
|
||||
o={name="o", length=.65, gain=1, is_letter=0},
|
||||
_o={name="_o", length=.65, gain=1, is_letter=0},
|
||||
u={name="u", length=.65, gain=1, is_letter=1},
|
||||
_u={name="_u", length=.92, gain=1, is_letter=0},
|
||||
v={name="v", length=.65, gain=1, is_letter=1},
|
||||
s={name="s", length=.92, gain=1, is_letter=1},
|
||||
u={name="u", length=.65, gain=1, is_letter=0},
|
||||
v={name="v", length=.65, gain=1, is_letter=0},
|
||||
s={name="s", length=.92, gain=1, is_letter=0},
|
||||
ga={name="ga", length=.90, gain=1, is_letter=0},
|
||||
ka={name="ka", length=.90, gain=1, is_letter=0},
|
||||
ge={name="ge", length=.90, gain=1, is_letter=0},
|
||||
gi={name="gi", length=.90, gain=1, is_letter=1},
|
||||
gi={name="gi", length=.90, gain=1, is_letter=0},
|
||||
go={name="go", length=.90, gain=1, is_letter=0},
|
||||
gu={name="gu", length=.90, gain=1, is_letter=0},
|
||||
gv={name="gv", length=.90, gain=1, is_letter=0},
|
||||
@ -97,7 +88,7 @@ phonics_tsalagi = {
|
||||
yv={name="yv", length=.90, gain=1, is_letter=0},
|
||||
}
|
||||
|
||||
two_char_phonics_tsalagi = {
|
||||
two_char_phonics = {
|
||||
ga= {name="ga"},
|
||||
ka= {name="ka"},
|
||||
ge= {name="ge"},
|
||||
@ -158,7 +149,7 @@ two_char_phonics_tsalagi = {
|
||||
--wh= {name="wh"}
|
||||
}
|
||||
|
||||
three_char_phonics_tsalagi = {
|
||||
three_char_phonics = {
|
||||
hna= {name="hna"},
|
||||
nah= {name="nah"},
|
||||
qua= {name="qua"},
|
||||
@ -182,717 +173,9 @@ three_char_phonics_tsalagi = {
|
||||
tsv= {name="tsv"},
|
||||
}
|
||||
|
||||
local words = {
|
||||
cat={spellings={ {c},{a},{t} } }
|
||||
}
|
||||
|
||||
|
||||
for key,value in pairs(phonics_tsalagi) do
|
||||
minetest.register_node("phonics_tsalagi:"..key, {
|
||||
description = key,
|
||||
tiles = {"phonics_tsalagi_"..key..".jpg"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3, choppy=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = function(pos, node, puncher)
|
||||
-- minetest.chat_send_all("phonic.on_punch:" .. pos.x ..">" )
|
||||
hit_with = puncher:get_wielded_item()
|
||||
wear=hit_with:get_wear()
|
||||
if wear == 0 then
|
||||
activate_node({pos, key, phonics_tsalagi[key].length})
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_node("phonics_tsalagi:"..key.."_active", {
|
||||
description = key.."_active",
|
||||
tiles = {"phonics_tsalagi_"..key.."_active.png"},
|
||||
light_source = 20,
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3, choppy=3, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
if phonics_tsalagi[key].is_letter ==1 then
|
||||
minetest.register_node("phonics_tsalagi:0"..key, {
|
||||
description = "Silent "..key,
|
||||
tiles = {"phonics_tsalagi_0"..key..".png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3, choppy=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("phonics_tsalagi:question_mark", {
|
||||
description = "Question Mark",
|
||||
tiles = {
|
||||
"question_mark.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
-- on_punch = function(pos, node, puncher)
|
||||
-- end
|
||||
})
|
||||
minetest.register_node("phonics_tsalagi:exclamation_point", {
|
||||
description = "Exclamation Point",
|
||||
tiles = {
|
||||
"exclamation_point.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
-- on_punch = function(pos, node, puncher)
|
||||
-- end
|
||||
})
|
||||
minetest.register_node("phonics_tsalagi:period", {
|
||||
description = "Period",
|
||||
tiles = {
|
||||
"period.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
-- on_punch = function(pos, node, puncher)
|
||||
-- end
|
||||
})
|
||||
|
||||
minetest.register_node("phonics_tsalagi:SayWord", {
|
||||
description = "say word",
|
||||
tiles = {
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"SpeakingMouth64.png",
|
||||
"SpeakingMouth64.png",
|
||||
"SpeakingMouth64.png",
|
||||
"SpeakingMouth64.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = function(pos, node, puncher)
|
||||
sound_out_word(pos, "x", 1)
|
||||
sound_out_word(pos, "x", -1)
|
||||
sound_out_word(pos, "z", 1)
|
||||
sound_out_word(pos, "z", -1)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_node("phonics_tsalagi:PaperStart", {
|
||||
description = "Paper Start",
|
||||
tiles = {
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"nicubunu_Scroll.png",
|
||||
"nicubunu_Scroll.png",
|
||||
"nicubunu_Scroll.png",
|
||||
"nicubunu_Scroll.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
after_place_node = function(pos)
|
||||
get_page_start_loc(pos)
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
clear_page(pos)
|
||||
end--[[,
|
||||
on_dig = function(pos_dig,node)
|
||||
replace_page(pos_dig, "x", 1, "air")
|
||||
replace_page(pos_dig, "x", -1, "air")
|
||||
replace_page(pos_dig, "z", 1, "air")
|
||||
replace_page(pos_dig, "z", -1, "air")
|
||||
replace_column(pos_dig, "air")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local player = digger:get_player_name()
|
||||
local itemstack = ItemStack("phonics_tsalagi:PaperStart")
|
||||
local inv = minetest.get_inventory({type = "player", name = player})
|
||||
|
||||
if inv and inv:room_for_item("main", itemstack) then
|
||||
inv:add_item("main", itemstack)
|
||||
else
|
||||
-- If the player's inventory is full, spawn the item on the ground
|
||||
minetest.add_item(pos, itemstack)
|
||||
end
|
||||
end]]
|
||||
})
|
||||
|
||||
function clear_page(pos)
|
||||
local clear_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
clear_pos.x = pos.x
|
||||
clear_pos.y = pos.y
|
||||
clear_pos.z = pos.z
|
||||
|
||||
replace_page(clear_pos, "x", 1, "phonics_tsalagi:BlankPaper")
|
||||
replace_page(clear_pos, "x", -1, "phonics_tsalagi:BlankPaper")
|
||||
replace_page(clear_pos, "z", 1, "phonics_tsalagi:BlankPaper")
|
||||
replace_page(clear_pos, "z", -1, "phonics_tsalagi:BlankPaper")
|
||||
replace_column(clear_pos, "phonics_tsalagi:BlankPaper")
|
||||
page_start = pos
|
||||
page_end = pos
|
||||
end
|
||||
|
||||
minetest.register_node("phonics_tsalagi:PaperFinish", {
|
||||
description = "Paper Finish",
|
||||
tiles = {
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"finish_line_flag_pin_th.png",
|
||||
"finish_line_flag_pin_th.png",
|
||||
"finish_line_flag_pin_th.png",
|
||||
"finish_line_flag_pin_th.png",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
after_place_node = function(pos)
|
||||
blank_page(pos)
|
||||
end
|
||||
})
|
||||
minetest.register_node("phonics_tsalagi:BlankPaper", {
|
||||
description = "Blank Paper",
|
||||
tiles = {
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"white.jpg",
|
||||
"white.jpg",},
|
||||
is_ground_content = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
||||
function split(str, pat)
|
||||
local t = {} -- NOTE: use {n = 0} in Lua-5.0
|
||||
local fpat = "(.-)" .. pat
|
||||
local last_end = 1
|
||||
local s, e, cap = str:find(fpat, 1)
|
||||
while s do
|
||||
if s ~= 1 or cap ~= "" then
|
||||
table.insert(t,cap)
|
||||
end
|
||||
last_end = e+1
|
||||
s, e, cap = str:find(fpat, last_end)
|
||||
end
|
||||
if last_end <= #str then
|
||||
cap = str:sub(last_end)
|
||||
table.insert(t, cap)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local play_sound = function(list, soundname)
|
||||
local gain = 1.0
|
||||
local handler = minetest.sound_play("phonics_tsalagi_"..soundname, {gain=gain})
|
||||
end
|
||||
|
||||
function revertnode(parms)
|
||||
local pos3 = parms[1]
|
||||
local node3= parms[2]
|
||||
minetest.env:remove_node(pos3,{name="phonics_tsalagi:"..node3.."_active"})
|
||||
minetest.env:place_node(pos3,{name="phonics_tsalagi:"..node3})
|
||||
end
|
||||
|
||||
function activate_node(anparms)
|
||||
local pos2 = anparms[1]
|
||||
local nodename = anparms[2]
|
||||
local duration = anparms[3]
|
||||
minetest.env:remove_node(pos2,{name="phonics_tsalagi:"..nodename})
|
||||
minetest.env:place_node(pos2,{name="phonics_tsalagi:"..nodename.."_active"})
|
||||
play_sound(phonics_tsalagi, nodename)
|
||||
local np = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
np.x = pos2.x
|
||||
np.y = pos2.y
|
||||
np.z = pos2.z
|
||||
minetest.after(duration, revertnode, {np, nodename})
|
||||
end
|
||||
|
||||
function sound_out_word(pos1, axis, direction)
|
||||
local cumulative_delay = 0
|
||||
local mpos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
mpos.x = pos1.x
|
||||
mpos.y = pos1.y
|
||||
mpos.z = pos1.z
|
||||
--see if there are any sounds next to mouth on this axis. (or if there is a BlankPage before it.) If not, do nothing.
|
||||
local test_pos = {}
|
||||
test_pos.x = pos1.x
|
||||
test_pos.y = pos1.y
|
||||
test_pos.z = pos1.z
|
||||
if axis == "x" then
|
||||
test_pos.x=test_pos.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
test_pos.z=test_pos.z+direction
|
||||
end
|
||||
local test_nodename = minetest.env:get_node(test_pos).name
|
||||
local test_nodenamearray = split(test_nodename, ":")
|
||||
local test_nodename_prefix = test_nodenamearray[1]
|
||||
local test_nodename_suffix = test_nodenamearray[2]
|
||||
--see if blank page before it
|
||||
if axis == "x" then
|
||||
test_pos.x=test_pos.x-(direction*2)
|
||||
end
|
||||
if axis == "z" then
|
||||
test_pos.z=test_pos.z-(direction*2)
|
||||
end
|
||||
local b4_nodename = minetest.env:get_node(test_pos).name
|
||||
if b4_nodename ~="phonics_tsalagi:BlankPaper" then
|
||||
if test_nodename_prefix ~="phonics_tsalagi" or test_nodename_suffix == "BlankPaper" or test_nodename_suffix =="PaperStart" then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local row_count = 1
|
||||
repeat --go to next row 1 time
|
||||
repeat --continue sounding on this row until you reach blank paper or a non phonics_tsalagi node
|
||||
if axis == "x" then
|
||||
mpos.x=mpos.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
mpos.z=mpos.z+direction
|
||||
end
|
||||
local nodename = minetest.env:get_node(mpos).name
|
||||
local nodenamearray = split(nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
local delay = phonics_tsalagi[nodename_suffix]
|
||||
if delay ~=nil and nodename_prefix =="phonics_tsalagi" then
|
||||
local lpos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
lpos.x = mpos.x
|
||||
lpos.y = mpos.y
|
||||
lpos.z = mpos.z
|
||||
minetest.after(cumulative_delay, activate_node, {lpos, nodename_suffix, phonics_tsalagi[nodename_suffix].length})
|
||||
cumulative_delay = cumulative_delay + phonics_tsalagi[nodename_suffix].length
|
||||
end
|
||||
until nodename_prefix ~="phonics_tsalagi" or nodename_suffix == "BlankPaper"
|
||||
--if I will find a BlankPaper in this row, then dont look in next row
|
||||
local find_blank_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
find_blank_pos.x = mpos.x
|
||||
find_blank_pos.y = mpos.y
|
||||
find_blank_pos.z = mpos.z
|
||||
repeat
|
||||
--is this node BlankPaper?
|
||||
local find_blank_nodename = minetest.env:get_node(find_blank_pos).name
|
||||
local find_blank_nodenamearray = split(find_blank_nodename, ":")
|
||||
local find_blank_nodename_prefix = find_blank_nodenamearray[1]
|
||||
local find_blank_nodename_suffix = find_blank_nodenamearray[2]
|
||||
if find_blank_nodename_suffix == "BlankPaper" then
|
||||
return
|
||||
end
|
||||
--if not, increment pointer and repeat search
|
||||
if axis == "x" then
|
||||
find_blank_pos.x=find_blank_pos.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
find_blank_pos.z=find_blank_pos.z+direction
|
||||
end
|
||||
until find_blank_nodename_prefix ~="phonics_tsalagi"--prefix not phonics_tsalagi
|
||||
|
||||
--we're not done, so search next row for more phonics_tsalagi to sound out
|
||||
local new_row_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
new_row_pos.x = mpos.x
|
||||
new_row_pos.y = mpos.y
|
||||
new_row_pos.z = mpos.z
|
||||
new_row_pos.y=new_row_pos.y-1
|
||||
if nodename_suffix == "BlankPaper" then
|
||||
return
|
||||
end
|
||||
repeat --go to the beginning of the new row
|
||||
if axis == "x" then
|
||||
new_row_pos.x=new_row_pos.x-direction
|
||||
end
|
||||
if axis == "z" then
|
||||
new_row_pos.z=new_row_pos.z-direction
|
||||
end
|
||||
local new_row_nodename = minetest.env:get_node(new_row_pos).name
|
||||
local new_row_nodenamearray = split(new_row_nodename, ":")
|
||||
local new_row_nodename_prefix = new_row_nodenamearray[1]
|
||||
local new_row_nodename_suffix = new_row_nodenamearray[2]
|
||||
mpos.x = new_row_pos.x
|
||||
mpos.y = new_row_pos.y
|
||||
mpos.z = new_row_pos.z
|
||||
until new_row_nodename_prefix ~="phonics_tsalagi"
|
||||
row_count= row_count +1
|
||||
until row_count >2 or nodename_suffix == "BlankPaper"
|
||||
end
|
||||
|
||||
function write_message_to_page(message)
|
||||
local start_page_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
start_page_pos.x = page_start.x
|
||||
start_page_pos.y = page_start.y
|
||||
start_page_pos.z = page_start.z
|
||||
local start_message_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
start_message_pos.x = page_start.x
|
||||
start_message_pos.y = page_start.y
|
||||
start_message_pos.z = page_start.z
|
||||
write_message_to_page_on_axis(start_message_pos, "x", 1, message)
|
||||
write_message_to_page_on_axis(start_message_pos, "x", -1, message)
|
||||
write_message_to_page_on_axis(start_message_pos, "z", 1, message)
|
||||
write_message_to_page_on_axis(start_message_pos, "z", -1, message)
|
||||
end
|
||||
|
||||
function write_message_to_page_on_axis(pos, axis, direction,message)
|
||||
local page_position = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
page_position.x = pos.x
|
||||
page_position.y = pos.y
|
||||
page_position.z = pos.z
|
||||
message_index = 1
|
||||
--if the first node after the PageStart node is not a phonic, skip everything.
|
||||
local first_position = {}
|
||||
first_position.x = pos.x
|
||||
first_position.y = pos.y
|
||||
first_position.z = pos.z
|
||||
if axis=="x" then
|
||||
first_position.x = first_position.x +direction
|
||||
end
|
||||
if axis=="z" then
|
||||
first_position.z = first_position.z +direction
|
||||
end
|
||||
local first_nodename = minetest.env:get_node(first_position).name
|
||||
local firstnamearray = split(first_nodename, ":")
|
||||
local firstname_prefix = firstnamearray[1]
|
||||
if firstname_prefix == "phonics_tsalagi" then --we have phonics_tsalagi on this axis
|
||||
repeat
|
||||
local current_nodename = minetest.env:get_node(page_position).name
|
||||
local nodenamearray = split(current_nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
write_page_row(page_position, axis, direction,message)
|
||||
page_position.y = page_position.y-1
|
||||
until nodename_prefix ~="phonics_tsalagi" or message_index > string.len(message)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function write_page_row(pos, axis, direction, message)
|
||||
local replace_pointer = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
replace_pointer.x = pos.x
|
||||
replace_pointer.y = pos.y
|
||||
replace_pointer.z = pos.z
|
||||
local nodename = minetest.env:get_node(replace_pointer).name
|
||||
if nodename=="phonics_tsalagi:PaperStart" then
|
||||
if axis == "x" then
|
||||
replace_pointer.x=replace_pointer.x+direction
|
||||
new_nodename ="phonics_tsalagi:SayWord"
|
||||
minetest.env:add_node(replace_pointer, {name=new_nodename})
|
||||
replace_pointer.x=replace_pointer.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
replace_pointer.z=replace_pointer.z+direction
|
||||
new_nodename ="phonics_tsalagi:SayWord"
|
||||
minetest.env:add_node(replace_pointer, {name=new_nodename})
|
||||
replace_pointer.z=replace_pointer.z+direction
|
||||
end
|
||||
end
|
||||
--1get me node at current location
|
||||
--2if node prefix is phonics_tsalagi then replace node with next phonic in the message
|
||||
--3(and have some code behind the scenes automatically bump the message_index)
|
||||
--4increment the replace pointer
|
||||
--5repeat 1-4 until node prefix at current location is not phonics_tsalagi
|
||||
repeat
|
||||
local nodename = minetest.env:get_node(replace_pointer).name
|
||||
local nodenamearray = split(nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
if nodename_prefix =="phonics_tsalagi" then
|
||||
if new_nodename =="phonics_tsalagi:BlankPaper" then
|
||||
--if we had a space between words then inject sayword block into stream
|
||||
new_nodename ="phonics_tsalagi:SayWord"
|
||||
minetest.env:add_node(replace_pointer, {name=new_nodename})
|
||||
else
|
||||
new_nodename = get_next_phonic_in_message(message)
|
||||
if minetest.registered_nodes[new_nodename] then
|
||||
minetest.env:add_node(replace_pointer, {name=new_nodename}) --*******************************************
|
||||
end
|
||||
end
|
||||
if minetest.registered_nodes[new_nodename] then
|
||||
if axis == "x" then
|
||||
replace_pointer.x=replace_pointer.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
replace_pointer.z=replace_pointer.z+direction
|
||||
end
|
||||
end
|
||||
end
|
||||
until nodename_prefix ~="phonics_tsalagi" or message_index > string.len(message)
|
||||
end
|
||||
|
||||
function get_next_phonic_in_message(message)
|
||||
--and have some code behind the scenes automatically bump the message_index
|
||||
string.len(message)
|
||||
if message_index <= string.len(message) then
|
||||
local current_char_in_message = string.sub(message,message_index,message_index)
|
||||
phonics_tsalagi = current_char_in_message
|
||||
--if currentchar=" " then just set cpim to blankPaper and skip all the char business"
|
||||
if current_char_in_message==" " then
|
||||
current_phonic_in_message = "phonics_tsalagi:BlankPaper"
|
||||
elseif current_char_in_message=="." then
|
||||
current_phonic_in_message = "phonics_tsalagi:period"
|
||||
elseif current_char_in_message=="?" then
|
||||
current_phonic_in_message = "phonics_tsalagi:question_mark"
|
||||
elseif current_char_in_message=="!" then
|
||||
current_phonic_in_message = "phonics_tsalagi:exclamation_point"
|
||||
else
|
||||
if current_char_in_message == "0" or current_char_in_message == "_" then
|
||||
message_index = message_index +1
|
||||
current_char_in_message = string.sub(message,message_index,message_index)
|
||||
phonics_tsalagi = phonics_tsalagi..current_char_in_message
|
||||
end
|
||||
char_after_current_char = string.sub(message,message_index+1,message_index+1)
|
||||
third_char = string.sub(message,message_index+2,message_index+2)
|
||||
two_chars = current_char_in_message..char_after_current_char
|
||||
three_chars = two_chars..third_char
|
||||
--minetest.log("x", "phonics_tsalagi: "..phonics_tsalagi)
|
||||
--minetest.log("x", "phonics_tsalagi 1st char: "..string.sub(phonics_tsalagi,1,1))
|
||||
--minetest.log("x", "two_chars: "..two_chars)
|
||||
--check to see if this is a 2 character phonic. But only if it doesn't begin with an "_" or if it is _oo.
|
||||
--this is because the only two character phonic that can use the "_" prefix is the "_oo" phonic.
|
||||
if (two_char_phonics_tsalagi[two_chars] ~= nil and string.sub(phonics_tsalagi,1,1) ~= "_" and string.sub(phonics_tsalagi,1,1) ~= "0") or (two_chars == "oo" and string.sub(phonics_tsalagi,1,1) ~= "0") then
|
||||
phonics_tsalagi = phonics_tsalagi..char_after_current_char
|
||||
message_index = message_index +1
|
||||
end
|
||||
if (three_char_phonics_tsalagi[three_chars] ~= nil and string.sub(phonics_tsalagi,1,1) ~= "_" and string.sub(phonics_tsalagi,1,1) ~= "0")then
|
||||
phonics_tsalagi = phonics_tsalagi..string.sub(message,message_index+1,message_index+2)
|
||||
message_index = message_index +2
|
||||
end
|
||||
current_phonic_in_message = "phonics_tsalagi:"..phonics_tsalagi
|
||||
end
|
||||
message_index = message_index +1
|
||||
else
|
||||
current_phonic_in_message = "phonics_tsalagi:BlankPaper"
|
||||
end
|
||||
return current_phonic_in_message
|
||||
end
|
||||
|
||||
function replace_page(pos, axis, direction,new_nodename)
|
||||
local replace_row_pos = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
replace_row_pos.x = pos.x
|
||||
replace_row_pos.y = pos.y
|
||||
replace_row_pos.z = pos.z
|
||||
repeat
|
||||
local current_nodename = minetest.env:get_node(replace_row_pos).name
|
||||
local nodenamearray = split(current_nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
replace_page_row(replace_row_pos, axis, direction,new_nodename)
|
||||
replace_row_pos.y = replace_row_pos.y-1
|
||||
until nodename_prefix ~="phonics_tsalagi"
|
||||
end
|
||||
|
||||
function replace_column(pos, new_nodename)
|
||||
replace_column_pos= pos
|
||||
repeat
|
||||
local current_nodename = minetest.env:get_node(replace_column_pos).name
|
||||
local nodenamearray = split(current_nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
if nodename_prefix =="phonics_tsalagi" then
|
||||
if new_nodename =="air" then
|
||||
minetest.env:add_node(replace_column_pos, {name=new_nodename})
|
||||
end
|
||||
if new_nodename =="phonics_tsalagi:BlankPaper" and current_nodename ~="phonics_tsalagi:PaperStart" then
|
||||
minetest.env:add_node(replace_column_pos, {name=new_nodename})
|
||||
end
|
||||
end
|
||||
replace_column_pos.y = replace_column_pos.y-1
|
||||
until nodename_prefix ~="phonics_tsalagi"
|
||||
end
|
||||
|
||||
function replace_page_row(pos, axis, direction, new_nodename)
|
||||
local replace_pointer = {} --needed this because the node being passed to revertnode was incremented (must have been by reference
|
||||
replace_pointer.x = pos.x
|
||||
replace_pointer.y = pos.y
|
||||
replace_pointer.z = pos.z
|
||||
repeat
|
||||
if axis == "x" then
|
||||
replace_pointer.x=replace_pointer.x+direction
|
||||
end
|
||||
if axis == "z" then
|
||||
replace_pointer.z=replace_pointer.z+direction
|
||||
end
|
||||
local nodename = minetest.env:get_node(replace_pointer).name
|
||||
local nodenamearray = split(nodename, ":")
|
||||
local nodename_prefix = nodenamearray[1]
|
||||
local nodename_suffix = nodenamearray[2]
|
||||
if nodename_prefix =="phonics_tsalagi" then
|
||||
minetest.env:add_node(replace_pointer, {name=new_nodename})
|
||||
end
|
||||
until nodename_prefix ~="phonics_tsalagi"
|
||||
end
|
||||
|
||||
function get_page_start_loc(pos)
|
||||
page_start = pos
|
||||
end
|
||||
|
||||
function blank_page(pos)
|
||||
page_end = pos
|
||||
if page_start ~= nil and math.abs(page_start.x-page_end.x) <20 and math.abs(page_start.y-page_end.y) <20 and math.abs(page_start.z-page_end.z) <20 then
|
||||
if page_end.y <= page_start.y then --if the page end block was placed at or below page start block
|
||||
if page_end.x == page_start.x then
|
||||
buildwall(page_start.z, pos.z, page_start.y, pos.y, "x", pos.x, "phonics_tsalagi:BlankPaper")
|
||||
end
|
||||
if page_end.z == page_start.z then
|
||||
buildwall(page_start.x, pos.x, page_start.y, pos.y, "z", pos.z, "phonics_tsalagi:BlankPaper")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function buildwall(hstart, hend, ystart, yend, haxis, haxis_fixed, nodename)
|
||||
repeat
|
||||
buildrow(hstart, hend, ystart, haxis, haxis_fixed, nodename)
|
||||
ystart = ystart -1
|
||||
until ystart < yend
|
||||
end
|
||||
|
||||
function buildrow(hstart, hend, y, haxis, haxis_fixed, nodename)
|
||||
local hpos = math.min(hstart, hend)
|
||||
local hmax = math.max(hstart, hend)
|
||||
local current_pos={}
|
||||
current_pos.y = y
|
||||
repeat
|
||||
if haxis =="x" then
|
||||
current_pos.z = hpos
|
||||
current_pos.x = haxis_fixed
|
||||
end
|
||||
if haxis =="z" then
|
||||
current_pos.x = hpos
|
||||
current_pos.z = haxis_fixed
|
||||
end
|
||||
if minetest.env:get_node(current_pos).name ~= "phonics_tsalagi:PaperStart" then --leave paperstart node there.
|
||||
minetest.env:add_node(current_pos, {name=nodename})
|
||||
end
|
||||
hpos = hpos +1
|
||||
until hpos> hmax
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("w", {
|
||||
params = "<message>",
|
||||
description = "Write phonics_tsalagi message on a page",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
if page_start == nil or page_end == nil then minetest.chat_send_player(name, "You need to create a page first") return end
|
||||
write_message(string.lower(param))
|
||||
end, })
|
||||
|
||||
function write_message(param)
|
||||
write_message_to_page(param)
|
||||
end
|
||||
|
||||
--turn the phonics_tsalagi nodes into ores:
|
||||
|
||||
-- Function to generate the phonics_tsalagi nodes underground
|
||||
|
||||
phonics_tsalagi_scarcity = tonumber(minetest.settings:get("phonics_tsalagi_scarcity")) or 350
|
||||
|
||||
if phonics_tsalagi_scarcity >0 then
|
||||
-- Register nodes based on the phonics_tsalagi data
|
||||
for key, value in pairs(phonics_tsalagi) do
|
||||
-- Generate the nodes underground using the register_ore function
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:" .. key,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
|
||||
if phonics_tsalagi[key].is_letter ==1 then
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:0" .. key,
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
end
|
||||
end
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:SayWord",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:PaperStart",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:PaperFinish",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:period",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:exclamation_point",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "phonics_tsalagi:question_mark",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = phonics_tsalagi_scarcity,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
y_min = -31000, -- Adjust these values for your desired depth range
|
||||
y_max = 100,
|
||||
})
|
||||
end
|
||||
|
||||
phonics_scarcity = tonumber(minetest.settings:get("phonics_scarcity")) or 350
|
||||
register_nodes(phonics, language, write_command)
|
||||
register_ores(phonics, language,phonics_scarcity)
|
||||
|
||||
local dpath = minetest.get_modpath("phonics_tsalagi") .. "/"
|
||||
dofile(dpath .. "crafting.lua")
|
||||
|
Loading…
x
Reference in New Issue
Block a user