Added Mod [Nyan Cats] by Jeija and Traxie21 which add wild nyan cats that poop rainbows to craft juju.

Also fixed juju recipes to make eggs.
master
npmaier 2015-04-06 03:03:31 -04:00
parent 4d2f313f6f
commit 10fd50c1a1
26 changed files with 218 additions and 19 deletions

View File

@ -149,6 +149,7 @@ minetest.register_abm({
end
})
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
interval = 2,

View File

@ -67,6 +67,6 @@ minetest.register_craft({
minetest.register_craft({
output = '"juju:greenjuju"',
recipe = {
{'"default:jungle_saplling"','"default:sapling"','"default:pine_sapling"'},
{'"default:jungle_sapling"','"default:sapling"','"default:pine_sapling"'},
},
})

BIN
mods/nyan_cats.zip Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
default

185
mods/nyan_cats/init.lua Normal file
View File

@ -0,0 +1,185 @@
CAT_SIZE = 1
CAT_BOX = math.sqrt(2*math.pow(CAT_SIZE, 2))/2
GRAVITY = 9.8
minetest.register_entity("nyan_cats:small",{
initial_properties = {
hp_max = 4,
visual_size = {x = CAT_SIZE, y = CAT_SIZE, z = CAT_SIZE},
visual = "cube",
textures = {
"cat_top.png",
"cat_bottom.png",
"cat_front.png",
"cat_back.png",
"cat_sides.png",
"cat_sides.png",
},
collisionbox = {-CAT_BOX, -CAT_SIZE/2, -CAT_BOX, CAT_BOX, CAT_SIZE/2, CAT_BOX},
physical = true,
},
timer = 6,
timer2 = 1,
timer3 = 0, --regularly check if nyan_cat touches ground and possibly set x/z velocity/acceleration to 0
yaw = 0,
direction = {},
status = 2, --1 = jump, 2 = rotate
attracts_nyan_cat = true,
found_friend = false,
on_activate = function(self)
self.object:setacceleration({x = 0, y = -GRAVITY, z = 0})
end,
on_punch = function(self)
if self.object:get_hp() <= 0 then
minetest.env:add_item(self.object:getpos(), "nyan_cats:rainbow 1")
self.object:remove()
end
end,
on_step = function(self, dtime)
self.timer2 = self.timer2 + dtime
if self.status == 2 and (self.timer2 >= 0.5) then
self.timer2 = 1.2
self.status = 1
local pos = self.object:getpos()
if nyan_cat_lonely(pos) and not minetest.env:find_node_near(pos, 16, "default:mese") then
self.object:remove()
end
self.yaw = nyan_cat_getyaw(pos)
if self.yaw == false then
self.yaw = math.random() * 360
self.found_friend = false
else
self.found_friend = true
end
self.object:setyaw(self.yaw)
self.object:set_properties({automatic_rotate = 0})
self.direction = {x = math.cos(self.yaw)*2, y = 6, z = math.sin(self.yaw)*2}
end
self.timer = self.timer + dtime
self.timer3 = self.timer3 + dtime
if self.timer2 > 1.3 and self.object:getvelocity().y == 0 then
self.object:setvelocity(self.direction)
self.object:setacceleration({x = self.direction.x/5, y = -GRAVITY, z = self.direction.z/5})
self.timer2 = 0
end
if (self.timer >= 6 or (self.timer >= 1 and self.found_friend == true)) and self.object:getvelocity().y == 0 then
self.timer = 0
self.timer2 = 0
self.status = 2
if not self.found_friend then
self.object:set_properties({automatic_rotate = math.pi * 8})
end
end
if self.timer3 > 0.07 then
vel = self.object:getvelocity()
if vel.y == 0 and (vel.x ~= 0 or vel.z ~= 0) then
self.object:setvelocity({x = 0, y = 0, z = 0})
self.object:setacceleration({x = 0, y = -GRAVITY, z = 0})
end
self.timer3 = 0
end
end,
})
function nyan_cat_lonely (pos)
objs = minetest.env:get_objects_inside_radius(pos, 32)
for i, obj in pairs(objs) do
if obj:is_player() then return false end
end
return true
end
function approx(val1, val2, deviation)
if val1 + deviation > val2
and val1 - deviation < val2 then
return true
end
return false
end
function nyan_cat_getyaw (pos) -- get yaw, only if objects to follow nearby
objs = minetest.env:get_objects_inside_radius(pos, 7)
for i, obj in ipairs(objs) do
if obj:is_player() or obj:get_luaentity().name == "nyan_cats:small" then
local ppos = {x = obj:getpos().x - pos.x,
z = obj:getpos().z - pos.z}
if ppos.x ~= 0 and ppos.z ~= 0 then --found itself as an object
local yaw = math.abs(math.atan(ppos.x/ppos.z) - math.pi / 2)
if ppos.z < 0 then yaw = yaw + math.pi end
return yaw
end
end
end
return false
end
minetest.register_abm({
nodenames = {"default:leaves"},
interval = 10.0,
chance = 8000,
action = function(pos, node)
minetest.env:add_entity({x=pos.x, y=pos.y + 1, z=pos.z}, "nyan_cats:small")
end,
})
minetest.register_craftitem("nyan_cats:rainbow", {
description = "A Nyan Cats Poop",
inventory_image = "nyan_cats_rainbow.png",
on_drop = function(itemstack, dropper, pos)
name = dropper:get_player_name()
minetest.chat_send_all(name.." KILLED A NYAN CAT!!!")
end,
})
minetest.register_node("nyan_cats:ncsb", {
description = "ncsb",
image = "ncsb.png",
inventory_image = "ncsb.png",
wield_image = "ncsb.png",
paramtype = "light",
tiles = {"ncsb"},
is_ground_content = true,
drawtype = "glasslike",
groups = {crumbly=3},
selection_box = {
type = "fixed",
fixed = {0,0,0,0,0,0}
},
sounds = default.node_sound_dirt_defaults(),
on_place = function(itemstack, placer, pointed)
pos = pointed.above
pos.y = pos.y + 1
minetest.env:add_entity(pointed.above,"nyan_cats:small")
end,
})
minetest.register_craft({
output = "nyan_cats:ncsb",
recipe = {
{"default:mese_crystal_fragment","default:mese_crystal_fragment","default:mese_crystal_fragment"},
{"default:mese_crystal_fragment","default:nyancat_rainbow","default:mese_crystal_fragment"},
{"default:mese_crystal_fragment","default:mese_crystal_fragment","default:mese_crystal_fragment"}
}
})
minetest.register_craft({
output = "default:nyancat_rainbow",
recipe = {
{"","nyan_cats:rainbow",""},
{"nyan_cats:rainbow","","nyan_cats:rainbow"},
{"","",""}
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

View File

@ -1,15 +1,16 @@
local shaman_manifesting_eggs_list = {
{ "Red Dragon", "red_dragon", "default:lava"},
{ "White Rhino", "white_rhino", "farming:wheat_harvested"},
{ "Black Spider", "black_spider", "default:bones"},
{ "Pink Swarm", "pink_swarm", "default:water"},
{ "Green Saproling", "green_saproling", "default:sapling"},
{ "Red Dragon", "red_dragon", "juju:redjuju"},
{ "White Rhino", "white_rhino", "juju:whitejuju"},
{ "Black Spider", "black_spider", "juju:blackjuju"},
{ "Pink Swarm", "pink_swarm", "juju:pinkjuju"},
{ "Green Saproling", "green_saproling", "juju:greenjuju"},
}
for i in ipairs (shaman_manifesting_eggs_list) do
local manifesting_egg_desc = shaman_manifesting_eggs_list[i][1]
local manifesting_eggtype = shaman_manifesting_eggs_list[i][2]
local ingredient = shaman_manifesting_eggs_list[i][3]
local juju = shaman_manifesting_eggs_list[i][3]
minetest.register_craftitem("shamanmanifestingeggs:"..manifesting_eggtype, {
description = manifesting_egg_desc,
@ -39,8 +40,8 @@ for i in ipairs (shaman_manifesting_eggs_list) do
minetest.register_craft({
output = "shamanmanifestingeggs:"..manifesting_eggtype,
recipe = {
{"shamanmanifestingeggs:egg", ingredient, ""},
{"", "", ""},
{"shamanmanifestingeggs:egg", juju,juju},
{juju,juju,juju},
{"", "", ""},
},
})

View File

@ -1,4 +1,5 @@
shamanmobs:register_mob("shamanmobs:black_spider", {
juju = Black,
type = "monster",
view_range = 14,
hp_max = 2,

View File

@ -2,6 +2,7 @@
--CHICKEN
--
shamanmobs:register_mob("shamanmobs:chicken", {
juju = Pink,
type = "monster",
attack_type = "dogfight",
hp_max = 1,

View File

@ -2,6 +2,7 @@
--COW
--
shamanmobs:register_mob("shamanmobs:cow", {
juju = Pink,
type = "monster",
jump = true,
damage = 1,

View File

@ -1,4 +1,5 @@
shamanmobs:register_mob("shamanmobs:green_saproling", {
juju = Green,
type = "monster",
follow = true,
hp_max = 5,
@ -45,9 +46,3 @@ shamanmobs:register_mob("shamanmobs:green_saproling", {
})
shamanmobs:register_spawn{"shamanmobs:green_saproling", {"default:leaves", "default:jungleleaves"}, 3, -1, 7000, 3, 31000}
--minetest.register_craft({
-- output = "shamanmobs:green_saproling",
-- recipe = ({
-- i-- {'"shamanmobs:greenjuju"','"shamanmobs:greenjuju"','"shamanmobs:greenjuju"'},
-- },
-- })

View File

@ -2,6 +2,7 @@
--NYAN CAT
--
shamanmobs:register_mob("shamanmobs:nyan_cat", {
juju = Pink,
jump = true,
follow = true,
attack_type = "dogfight",

View File

@ -2,6 +2,7 @@
--PIG
--
shamanmobs:register_mob("shamanmobs:pig", {
juju = Pink,
jump = true,
attack_type = "dogfight",
damage = 3,

View File

@ -2,6 +2,7 @@
--RABBIT
--
shamanmobs:register_mob("shamanmobs:rabbit", {
juju = Pink,
jump = true,
follow = true,
attack_type = "dogfight",

View File

@ -1,6 +1,7 @@
shamanmobs:register_mob("shamanmobs:rat", {
type = "animal",
hp_max = 1,
juju = Black,`
hp_max = 1,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
visual = "mesh",
mesh = "shamanmobs_rat.x",

View File

@ -1,4 +1,5 @@
shamanmobs:register_mob("shamanmobs:red_dragon", {
juju = Red,
name = "RedDragon",
type = "monster",
hp_max = 10,

View File

@ -2,6 +2,7 @@
--SHEEP
--
shamanmobs:register_mob("shamanmobs:sheep", {
juju = Pink,
jump = true,
attack_type = "dogfight",
damage = 2,

View File

@ -1,4 +1,5 @@
shamanmobs:register_mob("shamanmobs:white_rhino", {
juju = White,
type = "monster",
hp_max = 22,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},

View File

@ -1,6 +1,7 @@
shamanmobs = {}
function shamanmobs:register_mob(name, def)
minetest.register_entity(name, {
juju = def.juju,
hp_max = def.hp_max,
physical = true,
collisionbox = def.collisionbox,
@ -220,11 +221,13 @@ function shamanmobs:register_mob(name, def)
local s = self.object:getpos()
local p = player:get_player_name()
local c = self.object:get_entity_name()
-- --local c = self.object.juju
local l = ctf.player(p).team
local c = self.object:get_entity_name()
if l ~= "Pink" and c == "shamanmobs:chicken" or l ~= "Pink" and c == "shamanmobs:cow" or l ~= "Pink" and c == "shamanmobs:pig" or l ~= "Pink" and c == "shamanmobs:nyan_cat" or l ~= "Pink" and c == "shamanmobs:rabbit" or l ~= "Pink" and c == "shamanmobs:sheep" or l ~= "Black" and c == "shamanmobs:black_spider" or l ~= "Green" and c == "shamanmobs:green_saproling" or l ~= "Red" and c == "shamanmobs:red_dragon" or l ~= "White" and c == "shamanmobs:white_rhino" then
-- if l ~= c then
local s = self.object:getpos()
local p = player:getpos()
local p = player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist < self.view_range then
if self.attack.dist then
@ -239,9 +242,12 @@ function shamanmobs:register_mob(name, def)
self.attack.dist = dist
end
end
--elseif
-- l == c then
-- return
end
end
end
end
if self.follow ~= "" and not self.following then
for _,player in pairs(minetest.get_connected_players()) do
local s = self.object:getpos()