add the first portal and change clone block
This commit is contained in:
parent
c5b828a474
commit
9a07fea9bd
@ -5,6 +5,7 @@ Sound sources:
|
|||||||
— http://www.freesound.org/people/Kyster/sounds/79114/
|
— http://www.freesound.org/people/Kyster/sounds/79114/
|
||||||
— http://www.freesound.org/people/oliver%20eye/sounds/56380/
|
— http://www.freesound.org/people/oliver%20eye/sounds/56380/
|
||||||
— http://www.freesound.org/people/Kyster/sounds/82275/
|
— http://www.freesound.org/people/Kyster/sounds/82275/
|
||||||
|
— irc(freenode.net)
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
— add portal from [portal] with nyan sound
|
— add portal (and finish it at first) from [portal] to get back
|
||||||
|
57
init.lua
57
init.lua
@ -7,7 +7,6 @@ local nyanland={}
|
|||||||
|
|
||||||
--Cloudstone
|
--Cloudstone
|
||||||
minetest.register_node("nyanland:cloudstone", {
|
minetest.register_node("nyanland:cloudstone", {
|
||||||
description = "nyanland:cloudstone",
|
|
||||||
tiles = {"nyanland_cloudstone.png"},
|
tiles = {"nyanland_cloudstone.png"},
|
||||||
inventory_image = minetest.inventorycube("nyanland_cloudstone.png"),
|
inventory_image = minetest.inventorycube("nyanland_cloudstone.png"),
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
@ -18,7 +17,6 @@ minetest.register_node("nyanland:cloudstone", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("nyanland:cloudstone_var", {
|
minetest.register_node("nyanland:cloudstone_var", {
|
||||||
description = "nyanland:cloudstone_var",
|
|
||||||
tiles = {"nyanland_cloudstone_var.png", "nyanland_cloudstone_var.png", "nyanland_cloudstone.png"},
|
tiles = {"nyanland_cloudstone_var.png", "nyanland_cloudstone_var.png", "nyanland_cloudstone.png"},
|
||||||
inventory_image = minetest.inventorycube("nyanland_cloudstone_var.png"),
|
inventory_image = minetest.inventorycube("nyanland_cloudstone_var.png"),
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
@ -37,7 +35,6 @@ minetest.register_node("nyanland:mesetree", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("nyanland:meseleaves", {
|
minetest.register_node("nyanland:meseleaves", {
|
||||||
description = "nyanland:meseleaves",
|
|
||||||
drawtype = "allfaces_optional",
|
drawtype = "allfaces_optional",
|
||||||
visual_scale = 2,
|
visual_scale = 2,
|
||||||
tiles = {"nyanland_meseleaves.png"},
|
tiles = {"nyanland_meseleaves.png"},
|
||||||
@ -83,28 +80,28 @@ minetest.register_node("nyanland:mese_shrub_fruits", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Clonestone
|
-- Clonestone
|
||||||
|
local function clone_node(pos)
|
||||||
|
local node_over = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
||||||
|
if node_over ~= "air"
|
||||||
|
and node_over ~= "nyanland:clonestone" then
|
||||||
|
minetest.add_node(pos, {name=node_over})
|
||||||
|
end
|
||||||
|
-- nodeupdate(pos)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("nyanland:clonestone", {
|
minetest.register_node("nyanland:clonestone", {
|
||||||
description = "nyanland:clonestone",
|
|
||||||
tiles = {"nyanland_clonestone.png"},
|
tiles = {"nyanland_clonestone.png"},
|
||||||
inventory_image = minetest.inventorycube("nyanland_clonestone.png"),
|
inventory_image = minetest.inventorycube("nyanland_clonestone.png"),
|
||||||
furnace_burntime = 100,
|
furnace_burntime = 100,
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Clone items
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"nyanland:clonestone"},
|
nodenames = {"nyanland:clonestone"},
|
||||||
interval = 1,
|
interval = 5,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local pos_under = {x=pos.x, y=pos.y-1, z=pos.z}
|
clone_node(pos)
|
||||||
local node_over = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
|
||||||
if minetest.env:get_node(pos_under).name == "air"
|
|
||||||
and node_over ~= "air"
|
|
||||||
and node_over ~= "nyanland:clonestone" then
|
|
||||||
minetest.env:add_node(pos_under, {name=node_over})
|
|
||||||
end
|
|
||||||
-- nodeupdate(pos_under)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -122,7 +119,7 @@ minetest.register_abm(
|
|||||||
interval = 1.0,
|
interval = 1.0,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local objs = minetest.env:get_objects_inside_radius(pos, 3)
|
local objs = minetest.get_objects_inside_radius(pos, 3)
|
||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
local hp = obj:get_hp()
|
local hp = obj:get_hp()
|
||||||
if hp >= 20 then return end
|
if hp >= 20 then return end
|
||||||
@ -215,11 +212,11 @@ end)
|
|||||||
|
|
||||||
function nyanland:add_nyancat(nyan_headpos)
|
function nyanland:add_nyancat(nyan_headpos)
|
||||||
local nyan_tailpos={}
|
local nyan_tailpos={}
|
||||||
minetest.env:add_node(nyan_headpos, {name="default:nyancat"})
|
minetest.add_node(nyan_headpos, {name="default:nyancat"})
|
||||||
local length=math.random(4,15)
|
local length=math.random(4,15)
|
||||||
for z=nyan_headpos.z+1, nyan_headpos.z+length, 1 do
|
for z=nyan_headpos.z+1, nyan_headpos.z+length, 1 do
|
||||||
nyan_tailpos={x=nyan_headpos.x, y=nyan_headpos.y, z=z}
|
nyan_tailpos={x=nyan_headpos.x, y=nyan_headpos.y, z=z}
|
||||||
minetest.env:add_node(nyan_tailpos, {name="default:nyancat_rainbow"})
|
minetest.add_node(nyan_tailpos, {name="default:nyancat_rainbow"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -270,7 +267,7 @@ function nyanland:grow_mesetree(pos)
|
|||||||
if (x-trunkpos.x)^2+(y-trunkpos.y)^2+(z-trunkpos.z)^2<= NYANLAND_TREESIZE^2 + NYANLAND_TREESIZE then
|
if (x-trunkpos.x)^2+(y-trunkpos.y)^2+(z-trunkpos.z)^2<= NYANLAND_TREESIZE^2 + NYANLAND_TREESIZE then
|
||||||
leafpos={x=x, y=y, z=z}
|
leafpos={x=x, y=y, z=z}
|
||||||
p_leafpos=area:index(leafpos.x, leafpos.y, leafpos.z)
|
p_leafpos=area:index(leafpos.x, leafpos.y, leafpos.z)
|
||||||
if minetest.env:get_node(leafpos).name=="air"
|
if minetest.get_node(leafpos).name=="air"
|
||||||
and nodes[p_leafpos]==ignore then
|
and nodes[p_leafpos]==ignore then
|
||||||
if pr:next(1,5)==1 then
|
if pr:next(1,5)==1 then
|
||||||
if pr:next(1,2)==1 then
|
if pr:next(1,2)==1 then
|
||||||
@ -299,8 +296,8 @@ minetest.register_abm(
|
|||||||
chance = 100,
|
chance = 100,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if pos.y>NYANLAND_HEIGHT then
|
if pos.y>NYANLAND_HEIGHT then
|
||||||
minetest.env:remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.env:add_entity(pos, "nyanland:head_entity")
|
minetest.add_entity(pos, "nyanland:head_entity")
|
||||||
minetest.sound_play("nyanland_cat", {pos = pos, gain = 0.9, max_hear_distance = 35})
|
minetest.sound_play("nyanland_cat", {pos = pos, gain = 0.9, max_hear_distance = 35})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -321,7 +318,7 @@ minetest.register_entity("nyanland:head_entity", {
|
|||||||
on_punch = function(self, hitter)
|
on_punch = function(self, hitter)
|
||||||
local mesepos=self.object:getpos()
|
local mesepos=self.object:getpos()
|
||||||
mesepos.y=mesepos.y-1
|
mesepos.y=mesepos.y-1
|
||||||
minetest.env:add_entity(mesepos, "nyanland:mese")
|
minetest.add_entity(mesepos, "nyanland:mese")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
@ -329,24 +326,24 @@ minetest.register_entity("nyanland:head_entity", {
|
|||||||
local pos = {x=math.floor(pos.x+0.5), y=math.floor(pos.y+0.5), z=math.floor(pos.z+0.5)}
|
local pos = {x=math.floor(pos.x+0.5), y=math.floor(pos.y+0.5), z=math.floor(pos.z+0.5)}
|
||||||
self.timer=self.timer+dtime
|
self.timer=self.timer+dtime
|
||||||
if self.timer>=16 then
|
if self.timer>=16 then
|
||||||
minetest.env:add_node(pos, {name="default:nyancat"})
|
minetest.add_node(pos, {name="default:nyancat"})
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if minetest.env:get_node(pos).name == "default:nyancat_rainbow" then
|
if minetest.get_node(pos).name == "default:nyancat_rainbow" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i = math.random(6)+18,30,1 do
|
for i = math.random(6)+18,30,1 do
|
||||||
local p = {x=pos.x, y=pos.y, z=pos.z+i}
|
local p = {x=pos.x, y=pos.y, z=pos.z+i}
|
||||||
if minetest.env:get_node(p).name == "default:nyancat_rainbow" then
|
if minetest.get_node(p).name == "default:nyancat_rainbow" then
|
||||||
minetest.env:remove_node(p)
|
minetest.remove_node(p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = 1,5,1 do
|
for i = 1,5,1 do
|
||||||
local p = {x=pos.x, y=pos.y, z=pos.z+i}
|
local p = {x=pos.x, y=pos.y, z=pos.z+i}
|
||||||
if minetest.env:get_node(p).name == "air" then
|
if minetest.get_node(p).name == "air" then
|
||||||
minetest.env:add_node(p, {name="default:nyancat_rainbow"})
|
minetest.add_node(p, {name="default:nyancat_rainbow"})
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -377,14 +374,16 @@ minetest.register_entity("nyanland:mese", {
|
|||||||
self.object:setacceleration({x=0, y=-10, z=0})
|
self.object:setacceleration({x=0, y=-10, z=0})
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z}
|
local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z}
|
||||||
local bcn = minetest.env:get_node(bcp)
|
local bcn = minetest.get_node(bcp)
|
||||||
--if bcn.name ~= "air" then
|
--if bcn.name ~= "air" then
|
||||||
-- local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
|
-- local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
|
||||||
if self.object:getvelocity().y == 0 then
|
if self.object:getvelocity().y == 0 then
|
||||||
minetest.env:add_node(self.object:getpos(), {name="default:mese_block"})
|
minetest.add_node(self.object:getpos(), {name="default:mese_block"})
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath("nyanland").."/portal.lua")
|
||||||
|
70
portal.lua
Normal file
70
portal.lua
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
local function sandport(pos)
|
||||||
|
for i = -1,1,2 do
|
||||||
|
for j = -1,1,2 do
|
||||||
|
if minetest.get_node({x=pos.x+i, y=pos.y+2, z=pos.z+j}).name ~= "default:torch"
|
||||||
|
or minetest.get_node({x=pos.x+i, y=pos.y+2, z=pos.z+j}).param2 ~= 1
|
||||||
|
or minetest.get_node({x=pos.x+i, y=pos.y+1, z=pos.z+j}).name ~= "default:sand"
|
||||||
|
or minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name ~= "default:sand" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=pos.x+i, y=pos.y-2, z=pos.z+i*2}).name ~= "default:mese"
|
||||||
|
or minetest.get_node({x=pos.x+i*2, y=pos.y-2, z=pos.z+i}).name ~= "default:mese"
|
||||||
|
or (not minetest.registered_nodes[minetest.get_node({x=pos.x+i*2, y=pos.y-1, z=pos.z}).name].walkable)
|
||||||
|
or (not minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z+i*2}).name].walkable)
|
||||||
|
or minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name ~= "default:sand"
|
||||||
|
or minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name ~= "default:sand"
|
||||||
|
or minetest.get_node({x=pos.x+i*2, y=pos.y, z=pos.z}).name ~= "default:water_source"
|
||||||
|
or minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i*2}).name ~= "default:water_source" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for k = 3,4,1 do
|
||||||
|
for i = -k,k,2*k do
|
||||||
|
for j = -k,k,2*k do
|
||||||
|
if minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name ~= "default:torch"
|
||||||
|
or minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).param2 ~= 1 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=pos.x, y=pos.y+k-3, z=pos.z}).name ~= "default:mese" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function use_sand_portal(pos)
|
||||||
|
minetest.sound_play("nyanland_portal", {pos = pos, gain = 0.5, max_hear_distance = 5})
|
||||||
|
minetest.add_particlespawner(
|
||||||
|
300, --amount
|
||||||
|
17, --time
|
||||||
|
{x=pos.x-0.2, y=pos.y+0.5, z=pos.z-0.2}, --minpos
|
||||||
|
{x=pos.x+0.2, y=pos.y+0.4, z=pos.z+0.2}, --maxpos
|
||||||
|
{x=-0.2, y=-0, z=-0.2}, --minvel
|
||||||
|
{x=0.2, y=0, z=0.2}, --maxvel
|
||||||
|
{x=-0.5,y=4,z=-0.5}, --minacc
|
||||||
|
{x=0.5,y=5,z=0.5}, --maxacc
|
||||||
|
1, 10, --min&maxexptime
|
||||||
|
1, 9, --min&maxsize
|
||||||
|
true, --collisiondetection
|
||||||
|
"smoke_puff.png" --texture
|
||||||
|
)
|
||||||
|
local target_pos = {x=pos.x, y=pos.y+NYANLAND_HEIGHT+10, z=pos.z}
|
||||||
|
minetest.after(math.random(16), function(pos)
|
||||||
|
local objs = minetest.get_objects_inside_radius({x=pos.x, y=pos.y+0.5, z=pos.z}, 0.5)
|
||||||
|
for _, obj in pairs(objs) do
|
||||||
|
obj:setpos(target_pos)
|
||||||
|
end
|
||||||
|
minetest.sound_play("nyanland_cat", {pos = target_pos, gain = 0.9, max_hear_distance = 35})
|
||||||
|
end, pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||||
|
if puncher:get_wielded_item():get_name() == "default:stick"
|
||||||
|
and node.name == "default:mese" --actually not necesary
|
||||||
|
and sandport({x=pos.x, y=pos.y-1, z=pos.z}) then
|
||||||
|
use_sand_portal(pos)
|
||||||
|
end
|
||||||
|
end)
|
BIN
sounds/nyanland_portal.0.ogg
Normal file
BIN
sounds/nyanland_portal.0.ogg
Normal file
Binary file not shown.
BIN
sounds/nyanland_portal.1.ogg
Normal file
BIN
sounds/nyanland_portal.1.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user