update code and readme

This commit is contained in:
HybridDog 2015-05-20 21:02:04 +02:00 committed by HybridDog
parent f9775525a4
commit 0f4a2ea808
2 changed files with 37 additions and 25 deletions

View File

@ -6,7 +6,7 @@ look [here](https://github.com/HybridDog/nyanland/compare/0.3...master#files) fo
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/nyanland/master/LICENSE.txt) **License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/nyanland/master/LICENSE.txt)
**Download:** [zip](https://github.com/HybridDog/nyanland/archive/master.zip), [tar.gz](https://github.com/HybridDog/nyanland/archive/master.tar.gz) **Download:** [zip](https://github.com/HybridDog/nyanland/archive/master.zip), [tar.gz](https://github.com/HybridDog/nyanland/archive/master.tar.gz)
![I'm a screenshot!](http://bit.ly/1wOCWpq) ![I'm a screenshot!](https://cloud.githubusercontent.com/assets/3192173/7671607/00b51678-fcd8-11e4-8a2b-4e6bce19620a.png)
If you got ideas or found bugs, please tell them to me. If you got ideas or found bugs, please tell them to me.

View File

@ -90,13 +90,17 @@ minetest.register_node("nyanland:mese_shrub_fruits", {
-- Clonestone -- Clonestone
local function clone_node(pos) local function clone_node(pos)
local nd = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) pos.y = pos.y+1
local nd = minetest.get_node(pos)
local node_over = nd.name local node_over = nd.name
if node_over ~= "air" if node_over ~= "air"
and node_over ~= "ignore" and node_over ~= "ignore"
and node_over ~= "nyanland:clonestone" and node_over ~= "nyanland:clonestone"
and minetest.registered_nodes[node_over] then and minetest.registered_nodes[node_over] then
local metacontent = minetest.get_meta(pos):to_table()
pos.y = pos.y-1
minetest.add_node(pos, nd) minetest.add_node(pos, nd)
minetest.get_meta(pos):from_table(metacontent)
end end
-- nodeupdate(pos) -- nodeupdate(pos)
end end
@ -106,6 +110,7 @@ minetest.register_node("nyanland:clonestone", {
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},
on_construct = clone_node,
}) })
minetest.register_abm({ minetest.register_abm({
@ -300,13 +305,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end) end)
function nyanland:add_nyancat(nyan_headpos) function nyanland:add_nyancat(pos)
local nyan_tailpos={} minetest.add_node(pos, {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 _ = 1, length do
nyan_tailpos={x=nyan_headpos.x, y=nyan_headpos.y, z=z} pos.z = pos.z+1
minetest.add_node(nyan_tailpos, {name="default:nyancat_rainbow"}) minetest.add_node(pos, {name="default:nyancat_rainbow"})
end end
end end
@ -381,8 +385,8 @@ end
end]] end]]
--MOVING NYAN CATS --MOVING NYAN CATS
minetest.register_abm( minetest.register_abm({
{nodenames = {"default:nyancat"}, nodenames = {"default:nyancat"},
interval = 10, interval = 10,
chance = 100, chance = 100,
action = function(pos) action = function(pos)
@ -395,15 +399,17 @@ minetest.register_abm(
}) })
minetest.register_entity("nyanland:head_entity", { minetest.register_entity("nyanland:head_entity", {
physical = false, physical = true,
visual = "sprite", visual = "sprite",
timer=0, timer=0,
lastpos = {x=0, y=0, z=0},
textures = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png", textures = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
"default_nc_side.png", "default_nc_back.png", "default_nc_front.png"}, "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "cube", visual = "cube",
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
self.object:setvelocity({x=0, y=0, z=-2}) self.object:setvelocity({x=0, y=0, z=-2})
self.lastpos = vector.round(self.object:getpos())
end, end,
on_punch = function(self, hitter) on_punch = function(self, hitter)
@ -413,26 +419,32 @@ minetest.register_entity("nyanland:head_entity", {
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
local pos = self.object:getpos()
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.add_node(pos, {name="default:nyancat"}) minetest.add_node(self.lastpos, {name="default:nyancat"})
self.object:remove() self.object:remove()
return return
end end
local pos = vector.round(self.object:getpos())
if vector.equals(self.lastpos, pos) then
return
end
self.lastpos = pos
if minetest.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 local p = vector.new(pos)
local p = {x=pos.x, y=pos.y, z=pos.z+i} for i = math.random(6)+18,300 do
p.z = pos.z+i
if minetest.get_node(p).name == "default:nyancat_rainbow" then if minetest.get_node(p).name == "default:nyancat_rainbow" then
minetest.remove_node(p) minetest.remove_node(p)
else
break
end end
end end
for i = 1,5,1 do for i = 1,6 do
local p = {x=pos.x, y=pos.y, z=pos.z+i} p.z = pos.z+i
if minetest.get_node(p).name == "air" then if minetest.get_node(p).name == "air" then
minetest.add_node(p, {name="default:nyancat_rainbow"}) minetest.add_node(p, {name="default:nyancat_rainbow"})
else else
@ -460,14 +472,14 @@ minetest.register_entity("nyanland:mese", {
textures = {"default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png"}, textures = {"default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png", "default_mese_block.png"},
on_activate = function(self) on_activate = function(self)
self.object:setvelocity({x=0, y=-.1, z =0}) self.object:setvelocity({x=0, y=-.1, z =0})
self.object:setacceleration({x=0, y=-9, z=0})
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
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.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.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()