From 8d45d416befc119690d9ace0b237d2d82bd34100 Mon Sep 17 00:00:00 2001 From: Ombridride Date: Wed, 25 Mar 2015 17:25:54 +0100 Subject: [PATCH] Begin the mobs update --- mods/mobs/api.lua | 2 +- mods/mobs/bee.lua | 2 +- mods/mobs/bunny.lua | 2 +- mods/mobs/chicken.lua | 4 +- mods/mobs/cow.lua | 7 +++ mods/mobs/init.lua | 44 ++++++++---------- mods/mobs/kitten.lua | 2 +- .../mobs/models/{chicken.x => mobs_chicken.x} | 0 mods/mobs/rat.lua | 2 +- mods/mobs/sheep.lua | 17 +++++-- mods/mobs/textures/mobs_leather.png | Bin 0 -> 196 bytes 11 files changed, 47 insertions(+), 35 deletions(-) rename mods/mobs/models/{chicken.x => mobs_chicken.x} (100%) create mode 100644 mods/mobs/textures/mobs_leather.png diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 406af2c3..af043b22 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -446,7 +446,7 @@ function mobs:register_mob(name, def) --print ("spawned baby:",self.name) local mob = minetest.add_entity(pos, self.name) local ent2 = mob:get_luaentity() - local texture = self.base_texture + local textures = self.base_texture if def.child_texture then print ("child texture detected") textures = def.child_texture[1] diff --git a/mods/mobs/bee.lua b/mods/mobs/bee.lua index 28a05096..58096945 100755 --- a/mods/mobs/bee.lua +++ b/mods/mobs/bee.lua @@ -46,7 +46,7 @@ mobs:register_mob("mobs:bee", { }, -- right click to pick up bee on_rightclick = function(self, clicker) - if clicker:is_player() and clicker:get_inventory() then + if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bee") then clicker:get_inventory():add_item("main", "mobs:bee") self.object:remove() end diff --git a/mods/mobs/bunny.lua b/mods/mobs/bunny.lua index 642f4d94..6ca9396c 100755 --- a/mods/mobs/bunny.lua +++ b/mods/mobs/bunny.lua @@ -63,7 +63,7 @@ mobs:register_mob("mobs:bunny", { end return end - if clicker:is_player() and clicker:get_inventory() then + if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:bunny") then clicker:get_inventory():add_item("main", "mobs:bunny") self.object:remove() end diff --git a/mods/mobs/chicken.lua b/mods/mobs/chicken.lua index 0e9ad10c..7a04568b 100755 --- a/mods/mobs/chicken.lua +++ b/mods/mobs/chicken.lua @@ -10,7 +10,7 @@ mobs:register_mob("mobs:chicken", { -- textures and model collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3}, visual = "mesh", - mesh = "chicken.x", + mesh = "mobs_chicken.x", drawtype = "front", available_textures = { total = 2, @@ -78,7 +78,7 @@ mobs:register_mob("mobs:chicken", { end return tool else - if clicker:is_player() and clicker:get_inventory() then + if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:chicken") then clicker:get_inventory():add_item("main", "mobs:chicken") self.object:remove() end diff --git a/mods/mobs/cow.lua b/mods/mobs/cow.lua index da87b2f3..e0303b2c 100755 --- a/mods/mobs/cow.lua +++ b/mods/mobs/cow.lua @@ -35,6 +35,8 @@ mobs:register_mob("mobs:cow", { drops = { {name = "mobs:meat_raw", chance = 1, min = 5, max = 10}, + {name = "mobs:leather", + chance = 1, min = 0, max = 3}, }, -- damaged by water_damage = 1, @@ -86,6 +88,11 @@ mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 10000, 1, 31 -- register spawn egg mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1) +-- Leather +minetest.register_craftitem("mobs:leather", { + description = "Leather", + inventory_image = "mobs_leather.png", +}) -- Bucket of Milk minetest.register_craftitem("mobs:bucket_milk", { description = "Bucket of Milk", diff --git a/mods/mobs/init.lua b/mods/mobs/init.lua index de3966e2..f7aedcd0 100755 --- a/mods/mobs/init.lua +++ b/mods/mobs/init.lua @@ -2,35 +2,29 @@ dofile(minetest.get_modpath("mobs").."/api.lua") --- Animals inc. Krupnovpavel's warthog/bee, JKmurray's chicken, ExeterDad's bunny, Jordach/BFD's kitten +-- Animals -dofile(minetest.get_modpath("mobs").."/chicken.lua") -dofile(minetest.get_modpath("mobs").."/cow.lua") -dofile(minetest.get_modpath("mobs").."/rat.lua") -dofile(minetest.get_modpath("mobs").."/sheep.lua") -dofile(minetest.get_modpath("mobs").."/warthog.lua") -dofile(minetest.get_modpath("mobs").."/bee.lua") -dofile(minetest.get_modpath("mobs").."/bunny.lua") -dofile(minetest.get_modpath("mobs").."/kitten.lua") +dofile(minetest.get_modpath("mobs").."/chicken.lua") -- JKmurray +dofile(minetest.get_modpath("mobs").."/cow.lua") -- KrupnoPavel +dofile(minetest.get_modpath("mobs").."/rat.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/sheep.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/warthog.lua") -- KrupnoPavel +dofile(minetest.get_modpath("mobs").."/bee.lua") -- KrupnoPavel +dofile(minetest.get_modpath("mobs").."/bunny.lua") -- ExeterDad +dofile(minetest.get_modpath("mobs").."/kitten.lua") -- Jordach/BFD -- Monsters -dofile(minetest.get_modpath("mobs").."/dirtmonster.lua") -dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua") -dofile(minetest.get_modpath("mobs").."/oerkki.lua") -dofile(minetest.get_modpath("mobs").."/sandmonster.lua") -dofile(minetest.get_modpath("mobs").."/stonemonster.lua") -dofile(minetest.get_modpath("mobs").."/treemonster.lua") -dofile(minetest.get_modpath("mobs").."/wolf.lua") - --- Zmobs by Zeg9 - -dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -dofile(minetest.get_modpath("mobs").."/mese_monster.lua") - --- Spider from Lord of the Test - https://forum.minetest.net/viewtopic.php?pid=127538 - -dofile(minetest.get_modpath("mobs").."/spider.lua") +dofile(minetest.get_modpath("mobs").."/dirtmonster.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/dungeonmaster.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/oerkki.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/sandmonster.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/stonemonster.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam +dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- Zeg9 +dofile(minetest.get_modpath("mobs").."/mese_monster.lua") -- Zeg9 +dofile(minetest.get_modpath("mobs").."/spider.lua") -- https://forum.minetest.net/viewtopic.php?pid=127538 -- NPC dofile(minetest.get_modpath("mobs").."/npc.lua") diff --git a/mods/mobs/kitten.lua b/mods/mobs/kitten.lua index d5b63746..7984463b 100755 --- a/mods/mobs/kitten.lua +++ b/mods/mobs/kitten.lua @@ -64,7 +64,7 @@ mobs:register_mob("mobs:kitten", { end return end - if clicker:is_player() and clicker:get_inventory() then + if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:kitten") then clicker:get_inventory():add_item("main", "mobs:kitten") self.object:remove() end diff --git a/mods/mobs/models/chicken.x b/mods/mobs/models/mobs_chicken.x similarity index 100% rename from mods/mobs/models/chicken.x rename to mods/mobs/models/mobs_chicken.x diff --git a/mods/mobs/rat.lua b/mods/mobs/rat.lua index bda48e69..c7cff831 100755 --- a/mods/mobs/rat.lua +++ b/mods/mobs/rat.lua @@ -35,7 +35,7 @@ mobs:register_mob("mobs:rat", { light_damage = 0, -- right click to pick up rat on_rightclick = function(self, clicker) - if clicker:is_player() and clicker:get_inventory() then + if clicker:is_player() and clicker:get_inventory() and clicker:get_inventory():room_for_item("main", "mobs:rat") then clicker:get_inventory():add_item("main", "mobs:rat") self.object:remove() end diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index 0e9fd509..0c519d67 100755 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -33,7 +33,9 @@ mobs:register_mob("mobs:sheep", { -- drops raw meat when dead drops = { {name = "mobs:meat_raw", - chance = 1, min = 2, max = 3,}, + chance = 1, min = 2, max = 3}, + {name = "wool:white", + chance = 1, min = 1, max = 1}, }, -- damaged by water_damage = 1, @@ -61,6 +63,9 @@ mobs:register_mob("mobs:sheep", { clicker:set_wielded_item(item) end self.food = (self.food or 0) + 1 + if self.child == true then + self.hornytimer = self.hornytimer + 10 + end if self.food >= 8 then self.food = 0 if self.child == false then self.horny = true end @@ -75,10 +80,16 @@ mobs:register_mob("mobs:sheep", { return end -- need shears to get wool from sheep - if clicker:get_inventory() and item:get_name() == "mobs:shears" and not self.gotten and self.child == false then + local inv = clicker:get_inventory() + if inv and item:get_name() == "mobs:shears" and not self.gotten and self.child == false then self.gotten = true -- shaved if minetest.registered_items["wool:white"] then - clicker:get_inventory():add_item("main", ItemStack("wool:white "..math.random(1,3))) + local pos = self.object:getpos() + pos.y = pos.y + 0.5 + local obj = minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3))) + if obj then + obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)}) + end item:add_wear(65535/100) clicker:set_wielded_item(item) end diff --git a/mods/mobs/textures/mobs_leather.png b/mods/mobs/textures/mobs_leather.png new file mode 100644 index 0000000000000000000000000000000000000000..3205e5d63019297d727a5758ae0a07c36e5296c8 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZWnd6gQ&KQ9)brMt&vDVI z^EYY>F;n~&J`1RTu_VYZn8D%MjWi%9*3-o?gyVX0f&)Xc#9Px3blo()qRMfG!R$5q6 oNomWAq=2A+(1u&5j~rlNxTec@{eZvcT%bh^p00i_>zopr04TRP?f?J) literal 0 HcmV?d00001