From 298293d29022aa3e2a340da821472e86e4b268a7 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Mon, 9 Nov 2015 20:18:30 +0100 Subject: [PATCH] Chicken drop eggs --- chicken/LICENSE.txt | 2 +- chicken/README.txt | 8 +++++-- chicken/init.lua | 35 ++++++++++++++++++++++++----- chicken/textures/creatures_egg.png | Bin 0 -> 2996 bytes creatures/register.lua | 1 + 5 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 chicken/textures/creatures_egg.png 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 0000000000000000000000000000000000000000..9f7f11d6413691f9949673e84fafa4cd2022df52 GIT binary patch literal 2996 zcmV;l3rqBgP)uJ@VVD_U zC<6{NG_fI~0ue<-1QkJoA_k0xBC#Thg@9ne9*`iQ#9$OrQF$}6R&?d%y_c8YA7_1Q zpS|}zXYYO1x&V;8{kgn!SPFnNo`4_X z6{c}T{8k*B#$jdxfFg<9uYy1K45IaYvHg`_dOZM)Sy63ve6hvv1)yUy0P^?0*fb9UASvow z`@mQCp^4`uNg&9uGcn1|&Nk+9SjOUl{-OWr@Hh0;_l(8q{wNRKos+;6rV8ldy0Owz z(}jF`W(JeRp&R{qi2rfmU!TJ;gp(Kmm5I1s5m_f-n#TRsj}B0%?E` zvOzxB2#P=n*a3EfYETOrKoe*ICqM@{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