diff --git a/chicken/LICENSE.txt b/chicken/LICENSE.txt index d3eb5aa..95910aa 100644 --- a/chicken/LICENSE.txt +++ b/chicken/LICENSE.txt @@ -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. \ No newline at end of file +3. This notice may not be removed or altered from any source distribution. diff --git a/chicken/README.txt b/chicken/README.txt index 970b9ba..5bc05b0 100644 --- a/chicken/README.txt +++ b/chicken/README.txt @@ -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: diff --git a/chicken/init.lua b/chicken/init.lua index 953586f..7cf9577 100644 --- a/chicken/init.lua +++ b/chicken/init.lua @@ -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) diff --git a/chicken/textures/creatures_egg.png b/chicken/textures/creatures_egg.png new file mode 100644 index 0000000..9f7f11d Binary files /dev/null and b/chicken/textures/creatures_egg.png differ diff --git a/creatures/register.lua b/creatures/register.lua index 960659c..95d0f2a 100644 --- a/creatures/register.lua +++ b/creatures/register.lua @@ -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,