summaryrefslogtreecommitdiff
path: root/mods
diff options
context:
space:
mode:
Diffstat (limited to 'mods')
-rw-r--r--mods/alasa_pan/damage.lua141
-rw-r--r--mods/alasa_pan/init.lua111
-rw-r--r--mods/alasa_pan/inv.lua35
-rw-r--r--mods/alasa_pan/mod.conf3
-rw-r--r--mods/alasa_pan/monsuta.lua115
-rw-r--r--mods/alasa_pan/nasin.lua88
-rw-r--r--mods/alasa_pan/textures/pakala.pngbin0 -> 6628 bytes
-rw-r--r--mods/alasa_pan/textures/pona.pngbin0 -> 6598 bytes
-rw-r--r--mods/alasa_pan/toki.lua0
-rw-r--r--mods/leko_pan/init.lua118
-rw-r--r--mods/leko_pan/mod.conf2
-rw-r--r--mods/leko_pan/textures/anpa_nasin.pngbin0 -> 573 bytes
-rw-r--r--mods/leko_pan/textures/ilo_pona.pngbin0 -> 6243 bytes
-rw-r--r--mods/leko_pan/textures/ilo_seli.pngbin0 -> 6190 bytes
-rw-r--r--mods/leko_pan/textures/ko_pan.pngbin0 -> 6271 bytes
-rw-r--r--mods/leko_pan/textures/ko_suli.pngbin0 -> 598 bytes
-rw-r--r--mods/leko_pan/textures/leko.pngbin0 -> 588 bytes
-rw-r--r--mods/leko_pan/textures/leko_anpa.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/leko_jelo.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/leko_laso.pngbin0 -> 558 bytes
-rw-r--r--mods/leko_pan/textures/leko_laso2.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/leko_laso3.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/leko_loje.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/leko_loje2.pngbin0 -> 558 bytes
-rw-r--r--mods/leko_pan/textures/leko_pimeja.pngbin0 -> 559 bytes
-rw-r--r--mods/leko_pan/textures/leko_unu.pngbin0 -> 560 bytes
-rw-r--r--mods/leko_pan/textures/monsuta.pngbin0 -> 614 bytes
-rw-r--r--mods/leko_pan/textures/pan_s.pngbin0 -> 603 bytes
-rw-r--r--mods/leko_pan/textures/pan_s2.pngbin0 -> 562 bytes
-rw-r--r--mods/leko_pan/textures/pan_t.pngbin0 -> 570 bytes
-rw-r--r--mods/leko_pan/textures/telo.pngbin0 -> 6269 bytes
-rw-r--r--mods/ma_pan/init.lua116
-rw-r--r--mods/ma_pan/mod.conf3
33 files changed, 732 insertions, 0 deletions
diff --git a/mods/alasa_pan/damage.lua b/mods/alasa_pan/damage.lua
new file mode 100644
index 0000000..70483d0
--- /dev/null
+++ b/mods/alasa_pan/damage.lua
@@ -0,0 +1,141 @@
+local damage = {}
+
+function damage.set_respawn_pos(player, pos)
+ local meta = player:get_meta()
+ meta:set_float("openx", pos.x)
+ meta:set_float("openy", pos.y)
+ meta:set_float("openz", pos.z)
+end
+
+function damage.get_respawn_pos(player)
+ local meta = player:get_meta()
+ local x = meta:get_float("openx") or 0
+ local y = meta:get_float("openy") or 0
+ local z = meta:get_float("openz") or 0
+ return vector.new(x, y, z)
+end
+
+alasa_pan.player_stuff = {}
+function damage.update_health_hud(player)
+ local name = player:get_player_name()
+ local hp = player:get_meta():get_int("nanpa pona")
+ if alasa_pan.player_stuff[name] and alasa_pan.player_stuff[name].health_hud then
+ player:hud_change(alasa_pan.player_stuff[name].health_hud, "number", hp * 2)
+ player:hud_change(alasa_pan.player_stuff[name].health_hud, "item", 10)
+ end
+end
+
+function damage.joinplayer(player, last_login)
+ local meta = player:get_meta()
+ local hp = meta:get_int("nanpa pona") or 5
+ meta:set_int("nanpa pona", hp)
+ local name = player:get_player_name()
+ alasa_pan.player_stuff[name] = {}
+ alasa_pan.player_stuff[name].health_hud = player:hud_add {
+ position = {x=0.1, y=0.9},
+ alignment = {x=1, y=0},
+ direction = 0,
+ hud_elem_type = "statbar",
+ text = "pona.png",
+ text2 = "pakala.png",
+ number = hp * 2,
+ item = 10,
+ size = {x=32, y=32},
+ }
+ meta:set_string("tenpo pakala", "0")
+end
+
+local cooldown_time = 6 * 1000 * 1000
+local function is_invincible(player)
+ local meta = player:get_meta()
+ local time = minetest.get_us_time()
+ local last_hit = meta:get_string("tenpo pakala")
+ if last_hit == "" then last_hit = 0 meta:set_string("tenpo_pakala", "0") end
+ return time - tonumber(last_hit) < cooldown_time
+end
+
+local ingredients = {"alasa_pan:ko_pan", "alasa_pan:telo", "alasa_pan:ko_suli"}
+local function drain_ingredient(player, pos)
+ local node = minetest.get_node(pos)
+ if node.name ~= "air" then return false end
+ for i, v in ipairs(ingredients) do
+ local count = alasa_pan.inv.get_count(player, v)
+ if count > 0 then
+ alasa_pan.inv.bestow(player, v, -1)
+ minetest.set_node(pos, {name=v})
+ return (i==3 and count <= 1)
+ end
+ end
+ return true
+end
+
+local function drop_items(player)
+ local p_pos = player:get_pos()
+ p_pos.x = math.floor(p_pos.x+0.5)
+ p_pos.y = 0
+ p_pos.z = math.floor(p_pos.z+0.5)
+ local temp_radius = 0
+ while true do
+ local exhausted = false
+ local temp_offset = vector.new(-temp_radius, 0, -temp_radius)
+ while temp_offset.z <= temp_radius do
+ local temp_pos = p_pos + temp_offset
+ if drain_ingredient(player, temp_pos) then
+ exhausted = true
+ break
+ end
+ temp_offset.x = temp_offset.x + 1
+ if temp_offset.x > temp_radius then
+ temp_offset.x = -temp_radius
+ temp_offset.z = temp_offset.z + 1
+ end
+ end
+ temp_radius = temp_radius + 1
+ if exhausted then break end
+ end
+end
+
+function damage.damage_player(player, dmg, respect_cooldown)
+ local meta = player:get_meta()
+ local invincible = is_invincible(player)
+ if respect_cooldown and invincible then return end
+ local hp = meta:get_int("nanpa pona") or 5
+ hp = hp - dmg
+ local time = minetest.get_us_time()
+ meta:set_string("tenpo pakala", tostring(time))
+ meta:set_int("nanpa pona", hp)
+ if hp <= 0 then
+ local name = player:get_player_name()
+ minetest.chat_send_all(name.." li moli.")
+ meta:set_int("nanpa pona", 5)
+ drop_items(player)
+ player:set_pos(damage.get_respawn_pos(player))
+ end
+ damage.update_health_hud(player)
+ if not respect_cooldown then return end
+end
+
+local last_blink_state = false
+minetest.register_globalstep(function(dtime)
+ local players = minetest.get_connected_players()
+ for _, v in pairs(players) do
+ local name = v:get_player_name()
+ local meta = v:get_meta()
+ local last_hit = meta:get_string("tenpo pakala")
+ if last_hit == "" then last_hit = "0" end
+ last_hit = minetest.get_us_time() - tonumber(last_hit)
+ local hud = alasa_pan.player_stuff[name].health_hud
+ local x = v:hud_get(hud).position.x
+ local y = v:hud_get(hud).position.y
+ local blink_state = ((last_hit/1000000)%0.5) < 0.25
+ if not is_invincible(v) then blink_state = false end
+ if last_blink_state and not blink_state then
+ v:hud_change(hud, "position", {x=x, y=y-1})
+ elseif blink_state and not last_blink_state then
+ v:hud_change(hud, "position", {x=x, y=y+1})
+ end
+ last_blink_state = blink_state
+ end
+end)
+
+return damage \ No newline at end of file
diff --git a/mods/alasa_pan/init.lua b/mods/alasa_pan/init.lua
new file mode 100644
index 0000000..150bb12
--- /dev/null
+++ b/mods/alasa_pan/init.lua
@@ -0,0 +1,111 @@
+_G.alasa_pan = {}
+
+local modpath = minetest.get_modpath("alasa_pan")
+local inv = dofile(modpath.."/inv.lua")
+alasa_pan.inv = inv
+local nasin = dofile(modpath.."/nasin.lua")
+local damage = dofile(modpath.."/damage.lua")
+alasa_pan.damage = damage
+dofile(modpath.."/monsuta.lua")
+
+function alasa_pan.update_nametag(player)
+ local bread = inv.get_count(player, "alasa_pan:pan")
+ local pcol = player:get_meta():get_string("kule")
+ if pcol == "" then pcol = "loje" end
+ local rgb = leko_pan.colors_map[pcol]
+ player:set_nametag_attributes {
+ text = player:get_player_name().." ("..bread..")",
+ color = {a=255, r=rgb[1], g=rgb[2], b=rgb[3]},
+ bgcolor = {a=128, r=0, g=0, b=0}
+ }
+end
+
+minetest.register_on_joinplayer(function(player, last_login)
+ player:set_physics_override {
+ jump = 0,
+ speed_climb = 0,
+ speed = 1.3 -- suli tawa pi musi BreadQuest la ni li sama lili.
+ }
+ player:set_sky {
+ base_color = "#AAAAAA",
+ type = "plain",
+ clouds = false
+ }
+ player:set_sun {
+ visible = false
+ }
+ player:set_moon {
+ visible = false
+ }
+ player:set_stars {
+ visible = false
+ }
+ player:override_day_night_ratio(1)
+ damage.joinplayer(player, last_login)
+ inv.joinplayer(player, last_login)
+ nasin.joinplayer(player, last_login)
+ alasa_pan.update_nametag(player)
+ player:set_armor_groups {immortal = 1}
+end)
+
+minetest.register_on_newplayer(function(player)
+ local meta = player:get_meta()
+ meta:set_int("nanpa pona", 5)
+ damage.set_respawn_pos(player, {x=0, y=0, z=0})
+ damage.update_health_hud(player)
+end)
+
+minetest.override_item("", {
+ tool_capabilities = {
+ groupcaps = {
+ oddly_breakable_by_hand = {maxlevel=2, times={[1]=0, [2]=2.3}}
+ }
+ }
+})
+
+function minetest.node_dig(pos, node, digger)
+ for y=pos.y-2, pos.y+2 do
+ local node = minetest.get_node({x=pos.x, y=y, z=pos.z})
+ local handiness = minetest.get_item_group(node.name, "oddly_breakable_by_hand")
+ if handiness == 2 then
+ minetest.remove_node({x=pos.x, y=y, z=pos.z})
+ end
+ end
+ minetest.remove_node(pos)
+ local name = node.name
+ inv.bestow(digger, name, 1)
+end
+
+minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
+ local handiness = minetest.get_item_group(newnode.name, "oddly_breakable_by_hand")
+ if handiness == 2 then
+ local target = minetest.get_node({x=pos.x, y=0, z=pos.z})
+ if pos.y ~= 0 and target.name ~= "air" then minetest.set_node(pos, oldnode) return 1 end
+ for y=0, 2 do minetest.set_node({x=pos.x, y=y, z=pos.z}, newnode) end
+ minetest.set_node({x=pos.x, y=-1, z=pos.z}, {name="alasa_pan:anpa"})
+ elseif handiness == 1 then
+ if pos.y ~= 0 then minetest.set_node(pos, oldnode) return 1 end
+ minetest.set_node({x=pos.x, y=-1, z=pos.z}, {name="alasa_pan:anpa"})
+ end
+end)
+
+local function ilo_seli(player)
+ local i1c, i2c, i3c = inv.get_count(player, "alasa_pan:telo"), inv.get_count(player, "alasa_pan:ko_suli"), inv.get_count(player, "alasa_pan:ko_pan")
+ local min = math.min(i1c, i2c, i3c)
+ inv.bestow(player, "alasa_pan:telo", -min)
+ inv.bestow(player, "alasa_pan:ko_suli", -min)
+ inv.bestow(player, "alasa_pan:ko_pan", -min)
+ inv.bestow(player, "alasa_pan:pan", min)
+end
+
+local function ilo_pona(player)
+ local ppos = player:get_pos()
+ damage.set_respawn_pos(player, ppos)
+ player:get_meta():set_int("nanpa pona", 5)
+ damage.update_health_hud(player)
+end
+
+minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
+ if node.name == "alasa_pan:ilo_seli" then ilo_seli(puncher) end
+ if node.name == "alasa_pan:ilo_pona" then ilo_pona(puncher) end
+end) \ No newline at end of file
diff --git a/mods/alasa_pan/inv.lua b/mods/alasa_pan/inv.lua
new file mode 100644
index 0000000..bafb061
--- /dev/null
+++ b/mods/alasa_pan/inv.lua
@@ -0,0 +1,35 @@
+local inv = {}
+
+local slots = {"alasa_pan:pan", "alasa_pan:telo", "alasa_pan:ko_suli", "alasa_pan:ko_pan", "alasa_pan:leko_loje", "alasa_pan:leko_loje2", "alasa_pan:leko_jelo", "alasa_pan:leko_laso", "alasa_pan:leko_laso2", "alasa_pan:leko_laso3", "alasa_pan:leko_unu", "alasa_pan:leko_pimeja"}
+local inv_slots = {}
+for i, v in ipairs(slots) do inv_slots[v] = i end
+
+inv.joinplayer = function(player, last_login)
+ player:set_inventory_formspec("") -- ni li weka e lipu poki jan
+ local inventory = player:get_inventory()
+ inventory:set_size("main", #slots)
+ player:hud_set_hotbar_itemcount(#slots)
+end
+
+function inv.bestow(player, item, count)
+ if item == "air" then return end
+ if not inv_slots[item] then print("what? no, you can't have that.") return end
+ local inventory = player:get_inventory()
+ if not inventory then print("couldn't get the inventory...") return end
+ local stack = inventory:get_stack("main", inv_slots[item])
+ stack:set_count(stack:get_count()+count)
+ stack:set_name(item)
+ inventory:set_stack("main", inv_slots[item], stack)
+ alasa_pan.update_nametag(player)
+end
+
+function inv.get_count(player, item)
+ local inventory = player:get_inventory()
+ if not inventory then return end
+ local stack = inventory:get_stack("main", inv_slots[item])
+ return stack:get_count()
+end
+
+function minetest.item_drop() end
+
+return inv \ No newline at end of file
diff --git a/mods/alasa_pan/mod.conf b/mods/alasa_pan/mod.conf
new file mode 100644
index 0000000..a08a8cf
--- /dev/null
+++ b/mods/alasa_pan/mod.conf
@@ -0,0 +1,3 @@
+name = alasa_pan
+description = ijo mute pi musi "alasa pan". o kepeken ala e ni lon musi ante.
+depends = leko_pan \ No newline at end of file
diff --git a/mods/alasa_pan/monsuta.lua b/mods/alasa_pan/monsuta.lua
new file mode 100644
index 0000000..7c98869
--- /dev/null
+++ b/mods/alasa_pan/monsuta.lua
@@ -0,0 +1,115 @@
+local queued_movements = {}
+minetest.register_abm {
+ nodenames = {"alasa_pan:monsuta"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ local player
+ for _, v in pairs(minetest.get_objects_inside_radius(pos, 15)) do
+ if v:is_player() then player=v break end
+ end
+ local offset = {x=0, z=0}
+ if player then
+ local ppos = player:get_pos()
+ if math.floor(ppos.x+0.5) < pos.x then offset.x = -1 end
+ if math.floor(ppos.x+0.5) > pos.x then offset.x = 1 end
+ if math.floor(ppos.z+0.5) < pos.z then offset.z = -1 end
+ if math.floor(ppos.z+0.5) > pos.z then offset.z = 1 end
+ else
+ offset = {x=math.random(-1, 1), z=math.random(-1, 1)}
+ end
+ local npos = {x=pos.x+offset.x, y=pos.y, z=pos.z+offset.z}
+ if minetest.get_node(npos).name ~= "air" then
+ offset = {x=math.random(-1, 1), z=math.random(-1, 1)}
+ npos = {x=pos.x+offset.x, y=pos.y, z=pos.z+offset.z}
+ if minetest.get_node(npos).name ~= "air" then return end
+ end
+ table.insert(queued_movements, {from = pos, to = npos})
+ end
+}
+
+minetest.register_lbm {
+ label = "weka e monsuta majuna",
+ name = "alasa_pan:weka_e_monsuta_majuna",
+ nodenames = {"alasa_pan:monsuta"},
+ run_at_every_load = true,
+ action = function(pos, node, dtime_s)
+ minetest.set_node(pos, {name="air"})
+ end
+}
+
+local spawn_interval = 10
+local time = 0
+local spawn_distance = 30
+local check_radius = 40
+local spawn_cap = 8
+
+local function make_spawn_offset()
+ if math.random(1,2) == 1 then
+ if math.random(1,2) == 1 then
+ return {x = math.random(-spawn_distance, spawn_distance), y = 1, z = spawn_distance}
+ else
+ return {x = math.random(-spawn_distance, spawn_distance), y = 1, z = -spawn_distance}
+ end
+ else
+ if math.random(1,2) == 1 then
+ return {x = spawn_distance, y = 1, z = math.random(-spawn_distance, spawn_distance)}
+ else
+ return {x = -spawn_distance, y = 1, z = math.random(-spawn_distance, spawn_distance)}
+ end
+ end
+end
+
+local function try_spawn_enemy(pos)
+ local _, nodes = minetest.find_nodes_in_area({x=pos.x-check_radius, y=1, z=pos.z-check_radius}, {x=pos.x+check_radius, y=1, z=pos.z+check_radius}, {"alasa_pan:monsuta", "alasa_pan:ilo_pona"})
+ local hospitals = nodes["alasa_pan:ilo_pona"] or 0
+ if hospitals > 0 then return end
+ local enemies_in_spawndist = nodes["alasa_pan:monsuta"] or 0
+ local remainder = spawn_cap - enemies_in_spawndist
+ if remainder <= 0 then return end
+ local attempts_left = 10
+ while attempts_left > 0 do
+ attempts_left = attempts_left - 1
+ local spawn_pos = make_spawn_offset()
+ spawn_pos.x = spawn_pos.x + pos.x
+ spawn_pos.z = spawn_pos.z + pos.z
+ if minetest.get_node(spawn_pos).name == "air" then
+ local floor_pos = {x = spawn_pos.x, y = -1, z = spawn_pos.z}
+ if minetest.get_node(floor_pos).name == "alasa_pan:anpa" then
+ minetest.set_node(spawn_pos, {name="alasa_pan:monsuta"})
+ break
+ end
+ end
+ end
+end
+
+local function handle_damage(player)
+ alasa_pan.damage.damage_player(player, 1, true)
+end
+
+minetest.register_globalstep(function(dtime)
+ time = time + dtime
+ if time > spawn_interval then
+ time = time - spawn_interval
+ local players = minetest.get_connected_players()
+ for _, v in pairs(players) do
+ local pos = v:get_pos()
+ try_spawn_enemy(pos)
+ end
+ end
+ for _, v in ipairs(queued_movements) do
+ local target = minetest.get_node(v.to)
+ if target.name == "air" then
+ local node = minetest.get_node(v.from)
+ minetest.set_node(v.from, {name="air"})
+ minetest.set_node(v.to, node)
+ end
+ end
+ queued_movements = {}
+ local players = minetest.get_connected_players()
+ for _, v in pairs(players) do
+ local pos = v:get_pos()
+ local npos = vector.new(math.floor(pos.x+0.5), 1, math.floor(pos.z+0.5))
+ if minetest.get_node(npos).name == "alasa_pan:monsuta" then handle_damage(v) end
+ end
+end)
diff --git a/mods/alasa_pan/nasin.lua b/mods/alasa_pan/nasin.lua
new file mode 100644
index 0000000..ffaabf1
--- /dev/null
+++ b/mods/alasa_pan/nasin.lua
@@ -0,0 +1,88 @@
+local nasin = {}
+
+nasin.joinplayer = function(player, last_login)
+ local meta = player:get_meta()
+ local col = meta:get_string("kule")
+ if col == "" then
+ meta:set_string("kule", leko_pan.colors[math.random(1, #leko_pan.colors)])
+ print("gave player "..player:get_player_name().." color "..meta:get_string("kule"))
+ else
+ print("player "..player:get_player_name().." is already "..meta:get_string("kule"))
+ end
+end
+
+local function try_put_path(x, z, block)
+ local target = minetest.get_node({x=x, y=0, z=z})
+ local target2 = minetest.get_node({x=x, y=-1, z=z})
+ if target.name == "air" and (target2.name == "alasa_pan:anpa" or target2.name:sub(1, #("alasa_pan:nasin_"))=="alasa_pan:nasin_") then
+ minetest.set_node({x=x, y=-1, z=z}, {name=block})
+ end
+end
+
+local function bresenham_low(x0, z0, x1, z1, block)
+ local dx = x1 - x0
+ local dz = z1 - z0
+ local D = 2*dz - dx
+ local z = z0
+ for x=x0, x1 do
+ try_put_path(x, z, block)
+ if D > 0 then
+ z = z + 1
+ D = D - 2*dx
+ else
+ D = D + 2*dz
+ end
+ end
+end
+
+local function bresenham_high(x0, z0, x1, z1, block)
+ local dx = x1 - x0
+ local dz = z1 - z0
+ local xi = 1
+ if dx < 0 then
+ xi = -1
+ dx = -dx
+ end
+ local D = 2*dx - dz
+ local x = x0
+ for z=z0, z1 do
+ try_put_path(x, z, block)
+ if D > 0 then
+ x = x + xi
+ D = D + (2*(dx-dz))
+ else
+ D = D + 2*dx
+ end
+ end
+end
+
+local function bresenham(x0, z0, x1, z1, block)
+ if math.abs(z1 - z0) < math.abs(x1 - x0) then
+ if x0 > x1 then
+ bresenham_low(x1, z1, x0, z0, block)
+ else
+ bresenham_low(x0, z0, x1, z1, block)
+ end
+ else
+ if z0 > z1 then
+ bresenham_high(x1, z1, x0, z0, block)
+ else
+ bresenham_high(x0, z0, x1, z1, block)
+ end
+ end
+end
+
+local last_positions = {}
+minetest.register_globalstep(function(dtime)
+ local players = minetest.get_connected_players()
+ for _, v in pairs(players) do
+ local name = v:get_player_name()
+ local pos = v:get_pos()
+ local last_pos = last_positions[name] or pos
+ local block = "alasa_pan:nasin_"..v:get_meta():get_string("kule")
+ if pos.y < 1 then bresenham(pos.x, pos.z, last_pos.x, last_pos.z, block) end
+ last_positions[name] = pos
+ end
+end)
+
+return nasin \ No newline at end of file
diff --git a/mods/alasa_pan/textures/pakala.png b/mods/alasa_pan/textures/pakala.png
new file mode 100644
index 0000000..ee4a3dd
--- /dev/null
+++ b/mods/alasa_pan/textures/pakala.png
Binary files differ
diff --git a/mods/alasa_pan/textures/pona.png b/mods/alasa_pan/textures/pona.png
new file mode 100644
index 0000000..1580001
--- /dev/null
+++ b/mods/alasa_pan/textures/pona.png
Binary files differ
diff --git a/mods/alasa_pan/toki.lua b/mods/alasa_pan/toki.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mods/alasa_pan/toki.lua
diff --git a/mods/leko_pan/init.lua b/mods/leko_pan/init.lua
new file mode 100644
index 0000000..d8c28a7
--- /dev/null
+++ b/mods/leko_pan/init.lua
@@ -0,0 +1,118 @@
+_G.leko_pan = {}
+leko_pan.colors = {"loje", "loje2", "jelo", "laso", "laso2", "laso3", "unu", "pimeja"}
+leko_pan.colors_rgb = {{255, 64, 64},{255, 128, 0},{192, 192, 64},{0, 192, 0},{0, 192, 192},{64, 64, 255},{192, 0, 192},{128, 128, 128}}
+leko_pan.colors_map = {}
+for i, v in ipairs(leko_pan.colors) do
+ leko_pan.colors_map[v] = leko_pan.colors_rgb[i]
+end
+
+minetest.register_node(":alasa_pan:leko", {
+ description = "leko",
+ tiles = {"leko.png"},
+ groups = {}
+})
+minetest.register_node(":alasa_pan:anpa", {
+ description = "anpa",
+ tiles = {"leko_anpa.png"},
+ groups = {}
+})
+
+for _, v in pairs(leko_pan.colors) do
+ local name = v
+ if v:sub(#v, #v) == "2" or v:sub(#v, #v) == "3" then name = name:sub(1, #v-1) end
+ minetest.register_node(":alasa_pan:leko_"..v, {
+ description = "leko "..v,
+ tiles = {"leko_"..v..".png"},
+ groups = {oddly_breakable_by_hand = 2}
+ })
+end
+
+local function hex_string(r, g, b)
+ return ("%02X%02X%02X"):format(r, g, b)
+end
+for i, v in ipairs(leko_pan.colors) do
+ local r, g, b = 255-leko_pan.colors_rgb[i][1], 255-leko_pan.colors_rgb[i][2], 255-leko_pan.colors_rgb[i][3]
+ minetest.register_node(":alasa_pan:nasin_"..v, {
+ description = "nasin "..v,
+ tiles = {"anpa_nasin.png^[invert:rgb^[multiply:#"..hex_string(r, g, b).."^[invert:rgb"},
+ groups = {}
+ })
+end
+
+local ingredient_box = {type="fixed", fixed={-0.375, -0.375, -0.375, 0.375, 0.375, 0.375}}
+minetest.register_node(":alasa_pan:ko_pan", {
+ description = "ko pan",
+ tiles = {"ko_pan.png"},
+ groups = {oddly_breakable_by_hand = 1},
+ drawtype = "nodebox",
+ walkable = false,
+ node_box = ingredient_box,
+ paramtype = "light",
+ sunlight_propagates = true,
+ use_texture_alpha = "clip"
+})
+minetest.register_node(":alasa_pan:ko_suli", {
+ description = "ko suli",
+ tiles = {"ko_suli.png"},
+ groups = {oddly_breakable_by_hand = 1},
+ drawtype = "nodebox",
+ walkable = false,
+ node_box = ingredient_box,
+ paramtype = "light",
+ sunlight_propagates = true,
+ use_texture_alpha = "clip"
+})
+minetest.register_node(":alasa_pan:telo", {
+ description = "telo",
+ tiles = {"telo.png"},
+ groups = {oddly_breakable_by_hand = 1},
+ drawtype = "nodebox",
+ walkable = false,
+ node_box = ingredient_box,
+ paramtype = "light",
+ sunlight_propagates = true,
+ use_texture_alpha = "clip"
+})
+minetest.register_node(":alasa_pan:pan", {
+ description = "pan",
+ tiles = {
+ "pan_t.png", -- +Y
+ "pan_s2.png", -- -Y
+ "pan_s.png", -- +X
+ "pan_s.png", -- -X
+ "pan_s2.png", -- +Z
+ "pan_s2.png", -- -Z
+ },
+ groups = {oddly_breakable_by_hand = 1},
+ drawtype = "nodebox",
+ walkable = false,
+ node_box = {
+ type="fixed",
+ fixed={
+ {-0.375, -0.5, -0.25, 0.375, 0, 0.25},
+ {-0.375, 0, -0.375, 0.375, 0.25, 0.375},
+ }
+ },
+ paramtype = "light",
+ sunlight_propagates = true,
+ use_texture_alpha = "clip"
+})
+
+minetest.register_node(":alasa_pan:ilo_pona", {
+ description = "ilo pona",
+ tiles = {"ilo_pona.png"},
+ groups = {}
+})
+minetest.register_node(":alasa_pan:ilo_seli", {
+ description = "ilo seli",
+ tiles = {"ilo_seli.png"},
+ groups = {}
+})
+minetest.register_node(":alasa_pan:monsuta", {
+ description = "monsuta",
+ tiles = {"monsuta.png"},
+ drawtype = "glasslike",
+ groups = {},
+ walkable = false,
+ use_texture_alpha = "clip"
+}) \ No newline at end of file
diff --git a/mods/leko_pan/mod.conf b/mods/leko_pan/mod.conf
new file mode 100644
index 0000000..881a4e5
--- /dev/null
+++ b/mods/leko_pan/mod.conf
@@ -0,0 +1,2 @@
+name = leko_pan
+description = leko ale tan musi "alasa pan". \ No newline at end of file
diff --git a/mods/leko_pan/textures/anpa_nasin.png b/mods/leko_pan/textures/anpa_nasin.png
new file mode 100644
index 0000000..3f0ee17
--- /dev/null
+++ b/mods/leko_pan/textures/anpa_nasin.png
Binary files differ
diff --git a/mods/leko_pan/textures/ilo_pona.png b/mods/leko_pan/textures/ilo_pona.png
new file mode 100644
index 0000000..38311b2
--- /dev/null
+++ b/mods/leko_pan/textures/ilo_pona.png
Binary files differ
diff --git a/mods/leko_pan/textures/ilo_seli.png b/mods/leko_pan/textures/ilo_seli.png
new file mode 100644
index 0000000..11f7e7c
--- /dev/null
+++ b/mods/leko_pan/textures/ilo_seli.png
Binary files differ
diff --git a/mods/leko_pan/textures/ko_pan.png b/mods/leko_pan/textures/ko_pan.png
new file mode 100644
index 0000000..17fd7a0
--- /dev/null
+++ b/mods/leko_pan/textures/ko_pan.png
Binary files differ
diff --git a/mods/leko_pan/textures/ko_suli.png b/mods/leko_pan/textures/ko_suli.png
new file mode 100644
index 0000000..fe037c9
--- /dev/null
+++ b/mods/leko_pan/textures/ko_suli.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko.png b/mods/leko_pan/textures/leko.png
new file mode 100644
index 0000000..f537445
--- /dev/null
+++ b/mods/leko_pan/textures/leko.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_anpa.png b/mods/leko_pan/textures/leko_anpa.png
new file mode 100644
index 0000000..342625e
--- /dev/null
+++ b/mods/leko_pan/textures/leko_anpa.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_jelo.png b/mods/leko_pan/textures/leko_jelo.png
new file mode 100644
index 0000000..f2e2b5e
--- /dev/null
+++ b/mods/leko_pan/textures/leko_jelo.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_laso.png b/mods/leko_pan/textures/leko_laso.png
new file mode 100644
index 0000000..6ed5787
--- /dev/null
+++ b/mods/leko_pan/textures/leko_laso.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_laso2.png b/mods/leko_pan/textures/leko_laso2.png
new file mode 100644
index 0000000..b84f96f
--- /dev/null
+++ b/mods/leko_pan/textures/leko_laso2.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_laso3.png b/mods/leko_pan/textures/leko_laso3.png
new file mode 100644
index 0000000..96f6cec
--- /dev/null
+++ b/mods/leko_pan/textures/leko_laso3.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_loje.png b/mods/leko_pan/textures/leko_loje.png
new file mode 100644
index 0000000..fbe7cf6
--- /dev/null
+++ b/mods/leko_pan/textures/leko_loje.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_loje2.png b/mods/leko_pan/textures/leko_loje2.png
new file mode 100644
index 0000000..543d570
--- /dev/null
+++ b/mods/leko_pan/textures/leko_loje2.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_pimeja.png b/mods/leko_pan/textures/leko_pimeja.png
new file mode 100644
index 0000000..aa07ac4
--- /dev/null
+++ b/mods/leko_pan/textures/leko_pimeja.png
Binary files differ
diff --git a/mods/leko_pan/textures/leko_unu.png b/mods/leko_pan/textures/leko_unu.png
new file mode 100644
index 0000000..5fb392a
--- /dev/null
+++ b/mods/leko_pan/textures/leko_unu.png
Binary files differ
diff --git a/mods/leko_pan/textures/monsuta.png b/mods/leko_pan/textures/monsuta.png
new file mode 100644
index 0000000..5182173
--- /dev/null
+++ b/mods/leko_pan/textures/monsuta.png
Binary files differ
diff --git a/mods/leko_pan/textures/pan_s.png b/mods/leko_pan/textures/pan_s.png
new file mode 100644
index 0000000..3ece22f
--- /dev/null
+++ b/mods/leko_pan/textures/pan_s.png
Binary files differ
diff --git a/mods/leko_pan/textures/pan_s2.png b/mods/leko_pan/textures/pan_s2.png
new file mode 100644
index 0000000..9785d0f
--- /dev/null
+++ b/mods/leko_pan/textures/pan_s2.png
Binary files differ
diff --git a/mods/leko_pan/textures/pan_t.png b/mods/leko_pan/textures/pan_t.png
new file mode 100644
index 0000000..4ebaa91
--- /dev/null
+++ b/mods/leko_pan/textures/pan_t.png
Binary files differ
diff --git a/mods/leko_pan/textures/telo.png b/mods/leko_pan/textures/telo.png
new file mode 100644
index 0000000..e058155
--- /dev/null
+++ b/mods/leko_pan/textures/telo.png
Binary files differ
diff --git a/mods/ma_pan/init.lua b/mods/ma_pan/init.lua
new file mode 100644
index 0000000..de0d586
--- /dev/null
+++ b/mods/ma_pan/init.lua
@@ -0,0 +1,116 @@
+local chunkgen = {}
+chunkgen.__index = chunkgen
+
+function chunkgen.new(minp, maxp, blockseed)
+ local new = {}
+ setmetatable(new, chunkgen)
+ new.minp, new.maxp, new.blockseed = minp, maxp, blockseed
+ return new
+end
+
+local perlin_noise_params = {
+ offset = 0,
+ scale = 1,
+ spread = {x=10, y=10, z=10},
+ seed = 0xBEE,
+ octaves = 2,
+ persistence = 0.5,
+ lacunarity = 2,
+ flags = {"noeased", "absvalue"}
+}
+
+local perlin_noise_params_2 = {
+ offset = 0,
+ scale = 1,
+ spread = {x=32, y=32, z=32},
+ seed = 0xBEE5,
+ octaves = 2,
+ persistence = 0.5,
+ lacunarity = 2,
+ flags = {"noeased", "absvalue"}
+}
+
+local ingredients = {"alasa_pan:telo", "alasa_pan:ko_pan", "alasa_pan:ko_suli"}
+local blocks = {"alasa_pan:leko_loje", "alasa_pan:leko_loje2", "alasa_pan:leko_jelo", "alasa_pan:leko_laso", "alasa_pan:leko_laso2", "alasa_pan:leko_laso3", "alasa_pan:leko_unu", "alasa_pan:leko_pimeja"}
+local min_height = -1.3
+local max_height = 1.3
+local function get_color(height)
+ height = (height - min_height) / (max_height - min_height)
+ height = height * #blocks
+ height = math.floor(height)+1
+ if height < 1 then height = 1 end
+ if height > #blocks then height = #blocks end
+ return blocks[height]
+end
+
+function chunkgen:block_at_pos(x, y, z)
+ if y < 0 then
+ return "alasa_pan:anpa"
+ end
+ if y > 2 then return "air" end
+ local height = self.heightmap and self.heightmap[x-self.minp.x+1][z-self.minp.z+1] or 0
+ local height2 = self.heightmap_2 and self.heightmap_2[x-self.minp.x+1][z-self.minp.z+1] or 0
+ if height > 0 and x*x + z*z > 70 then return get_color(height2) end
+
+ if y == 0 and math.random(1, 100) == 1 then
+ return ingredients[math.random(1, 3)]
+ end
+
+ return "air"
+end
+
+local oven_structure = {"alasa_pan:ilo_seli", nil, nil, nil, "alasa_pan:ilo_pona"}
+local oven_w = 5
+local oven_h = 1
+function chunkgen:oven_override(block, x, y, z, ox, oz)
+ if y < 0 or y > 1 then return block end
+ local in_oven = x >= ox and x <= ox + oven_w - 1 and z >= oz and z <= oz + oven_h - 1
+ if not in_oven then return block end
+ local oven_block = oven_structure[x-ox + (z-oz)*oven_w + 1]
+ if not oven_block then return block end
+ if y == 0 then return "alasa_pan:leko" end
+ return oven_block
+end
+
+
+function chunkgen:generate()
+ local minp, maxp = self.minp, self.maxp
+ if minp.y > 1 then return end
+ math.randomseed(self.blockseed, 34802398420983428)
+
+ local has_oven = math.random(1, 25) == 1 -- ni li suli tan ni: leko li lon la jan li ken ala lukin e ilo seli.
+ local oven_x = math.random(minp.x, maxp.x - oven_w + 1)
+ local oven_z = math.random(minp.z, maxp.z - oven_h + 1)
+ if minp.x == -32 and minp.z == -32 then
+ has_oven = true
+ oven_x = -2
+ oven_z = 0
+ end
+
+ local nontrivial_chunk = (minp.y <= 0 and maxp.y >= 2)
+ if nontrivial_chunk then
+ local noise_map = minetest.get_perlin_map(perlin_noise_params, {x=80, y=80})
+ local noise_map_2 = minetest.get_perlin_map(perlin_noise_params_2, {x=80, y=80})
+ self.heightmap = noise_map:get_2d_map({x=minp.x, y=minp.z})
+ self.heightmap_2 = noise_map_2:get_2d_map({x=minp.x, y=minp.z})
+ end
+
+ local voxel_manip = minetest.get_voxel_manip(minp, maxp)
+ local data = {}
+ for x=minp.x, maxp.x do
+ for y=minp.y, maxp.y do
+ for z=minp.z, maxp.z do
+ local block = self:block_at_pos(x, y, z)
+ if has_oven then block = self:oven_override(block, x, y, z, oven_x, oven_z) end
+ table.insert(data, minetest.get_content_id(block))
+ end
+ end
+ end
+ voxel_manip:set_data(data)
+ voxel_manip:write_to_map(true)
+end
+
+minetest.register_on_generated(function(minp, maxp, blockseed)
+ local cg = chunkgen.new(minp, maxp, blockseed)
+ cg:generate()
+end) \ No newline at end of file
diff --git a/mods/ma_pan/mod.conf b/mods/ma_pan/mod.conf
new file mode 100644
index 0000000..c61d4d5
--- /dev/null
+++ b/mods/ma_pan/mod.conf
@@ -0,0 +1,3 @@
+name = ma_pan
+description = ilo pi pali ma tan musi "alasa pan".
+depends = leko_pan \ No newline at end of file