Chicken drop eggs

master
BlockMen 2015-11-09 20:18:30 +01:00
parent 9b0a03ada5
commit 298293d290
5 changed files with 37 additions and 9 deletions

View File

@ -17,4 +17,4 @@ product, an acknowledgment in the product documentation is required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
3. This notice may not be removed or altered from any source distribution.

View File

@ -6,8 +6,9 @@ Version: 2.0 Beta
Adds chicken to Minetest (requires Creatures MOB-Engine).
Chicken spawn on dirt and grass blocks, have 5 HP and friendly. When killed they
drop raw meat.
Chicken spawn on dirt and grass blocks, have 5 HP and are friendly. When killed they
drop meat, which can be eaten or cooked. Also they drop randomly eggs (which have
no real use yet.)
License:
@ -17,6 +18,9 @@ Code:
see "LICENSE.txt" for details.
Media(textures and meshes/models):
Gamit(WTFPL):
creatures_egg.png
everything else:
(c) Copyright (2014-2015) BlockMen; CC-BY-SA 3.0
Sounds:

View File

@ -21,6 +21,19 @@
core.register_craftitem(":creatures:egg", {
description = "Egg",
inventory_image = "creatures_egg.png"
})
local function dropEgg(obj)
local pos = obj:getpos()
if pos then
creatures.dropItems(pos, {{"creatures:egg"}})
end
end
local def = {
-- general
name = "creatures:chicken",
@ -30,17 +43,18 @@ local def = {
can_jump = 1,
can_swim = true,
can_burn = true,
can_panic = true,
can_panic = true,
has_kockback = true,
sneaky = true,
},
modes = {
idle = {chance = 0.25, duration = 5, update_yaw = 3},
idle2 = {chance = 0.3, duration = 1},
pick = {chance = 0.25, duration = 2},
idle2 = {chance = 0.69, duration = 0.8},
pick = {chance = 0.2, duration = 2},
walk = {chance = 0.2, duration = 5.5, moving_speed = 0.7, update_yaw = 2},
panic = {moving_speed = 2.1}
panic = {moving_speed = 2.1},
lay_egg = {chance = 0.01, duration = 1},
},
model = {
@ -48,6 +62,7 @@ local def = {
textures = {"creatures_chicken.png"},
collisionbox = {-0.25, -0.01, -0.3, 0.25, 0.45, 0.3},
rotation = -90.0,
collide_with_objects = false,
animations = {
idle = {start = 0, stop = 1, speed = 10},
idle2 = {start = 41, stop = 61, speed = 70},
@ -82,11 +97,19 @@ local def = {
spawn_egg = {
description = "Chicken Spawn-Egg",
-- texture = "creatures_spawn_egg.png",
},
},
drops = {
{"creatures:flesh"},
},
on_step = function(self, dtime)
if self.mode == "lay_egg" then
dropEgg(self.object)
self.modetimer = 2
end
end
}
creatures.register_mob(def)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -34,6 +34,7 @@ local function translate_def(def)
collisionbox = def.model.collisionbox or {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual_size = def.model.scale or {x = 1, y = 1},
backface_culling = def.model.backface_culling or false,
collide_with_objects = def.model.collide_with_objects or true,
stats = def.stats,
model = def.model,