diff --git a/mods/mobs/README.txt b/mods/mobs/README.txt index 42548b18..444f4ec5 100755 --- a/mods/mobs/README.txt +++ b/mods/mobs/README.txt @@ -29,6 +29,7 @@ This mod contains the following additions: Changelog: beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop +1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus 1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :) 1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc. 1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 5eb1f356..05cc9666 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -59,7 +59,7 @@ function mobs:register_mob(name, def) replace_what = def.replace_what, replace_with = def.replace_with, replace_offset = def.replace_offset or 0, - + stimer = 0, timer = 0, env_damage_timer = 0, -- only if state = "attack" @@ -74,6 +74,7 @@ function mobs:register_mob(name, def) horny = false, hornytimer = 0, child = false, + gotten = false, do_attack = function(self, player, dist) if self.state ~= "attack" then @@ -184,7 +185,7 @@ function mobs:register_mob(name, def) end -- check for mob drop/replace (used for chicken egg and sheep eating grass/wheat) - if self.replace_rate and math.random(1,self.replace_rate) == 1 then + if self.replace_rate and math.random(1,self.replace_rate) == 1 and self.child == false then local pos = self.object:getpos() ; pos.y = pos.y + self.replace_offset if #minetest.find_nodes_in_area(pos,pos,self.replace_what) > 0 and self.object:getvelocity().y == 0 and self.state == "stand" then @@ -413,6 +414,8 @@ function mobs:register_mob(name, def) self.child = false self.hornytimer = 0 self.object:set_properties({ + textures = self.base_texture, + mesh = self.base_mesh, visual_size = {x=self.visual_size.x,y=self.visual_size.y}, }) end @@ -443,8 +446,13 @@ 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 + if def.child_texture then + print ("child texture detected") + textures = def.child_texture[1] + end mob:set_properties({ + textures = textures, visual_size = {x=self.visual_size.x/2,y=self.visual_size.y/2}, }) ent2.child = true @@ -772,7 +780,7 @@ function mobs:register_mob(name, def) if tmp.tamed then self.tamed = tmp.tamed end - if tmp.gotten then -- using this variable for obtaining something from mob (milk/wool) + if tmp.gotten then self.gotten = tmp.gotten end if tmp.child then @@ -784,6 +792,18 @@ function mobs:register_mob(name, def) if tmp.hornytimer then self.hornytimer = tmp.hornytimer end + if tmp.textures then + self.textures = tmp.textures + end + if tmp.mesh then + self.mesh = tmp.mesh + end + if tmp.base_texture then + self.base_texture = tmp.base_texture + end + if tmp.base_mesh then + self.base_mesh = tmp.base_mesh + end end end @@ -797,20 +817,31 @@ function mobs:register_mob(name, def) end, get_staticdata = function(self) - -- set mob texture and model - local textures = def.available_textures["texture_"..math.random(1,def.available_textures["total"])] - local mesh = self.mesh + -- select random texture, set model + if not self.base_texture then + self.base_texture = def.textures[math.random(1,#def.textures)] + self.base_mesh = def.mesh + end + -- set texture, model and size + local textures = self.base_texture + local mesh = self.base_mesh local vis_size = self.visual_size - -- if object is a sheared sheep then set texture and model - if self.name == "mobs:sheep" and self.gotten == true then - textures = {"mobs_sheep_shaved.png"} - mesh = "mobs_sheep_shaved.x" + -- specific texture if gotten + if self.gotten == true and def.gotten_texture then + textures = def.gotten_texture + end + -- specific mesh if gotten + if self.gotten == true and def.gotten_mesh then + mesh = def.gotten_mesh end -- if object is child then set half size if self.child == true then vis_size = {x=self.visual_size.x/2,y=self.visual_size.y/2} + if def.child_texture then + textures = def.child_texture[1] + end end - + -- remember settings local tmp = { lifetimer = self.lifetimer, tamed = self.tamed, @@ -821,6 +852,7 @@ function mobs:register_mob(name, def) mesh = mesh, textures = textures, visual_size = vis_size, + base_texture = self.base_texture, } self.object:set_properties(tmp) return minetest.serialize(tmp) @@ -927,11 +959,6 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o pos.y = pos.y - 0.5 minetest.add_entity(pos, name) - -- set mob health (randomly between min and max) - if mob then - mob = mob:get_luaentity() - mob.object:set_hp( math.random(mob.hp_min, mob.hp_max) ) - end end }) end diff --git a/mods/mobs/bee.lua b/mods/mobs/bee.lua index 522274cd..1e784c24 100755 --- a/mods/mobs/bee.lua +++ b/mods/mobs/bee.lua @@ -45,9 +45,6 @@ mobs:register_mob("mobs:bee", { walk_start = 35, walk_end = 65, }, - sounds = { - random = "mobs_bee", - }, -- right click to pick up bee on_rightclick = function(self, clicker) if clicker:is_player() and clicker:get_inventory() then @@ -56,7 +53,6 @@ mobs:register_mob("mobs:bee", { end end, }) - -- spawn on group:flowers between 4 and 20 light, 1 in 5000 chance, 1 bee in area up to 31000 in height mobs:register_spawn("mobs:bee", {"default:dirt_with_grass"}, 20, 4, 7500, 1, 31000) diff --git a/mods/mobs/bunny.lua b/mods/mobs/bunny.lua new file mode 100755 index 00000000..bdb8ba5e --- /dev/null +++ b/mods/mobs/bunny.lua @@ -0,0 +1,69 @@ + +-- Bunny by ExeterDad + +mobs:register_mob("mobs:bunny", { + -- animal, monster, npc + type = "animal", + -- is it aggressive + passive = true, + -- health & armor + hp_min = 1, hp_max = 4, armor = 200, + -- textures and model + collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268}, + visual = "mesh", + mesh = "mobs_bunny.b3d", + drawtype = "front", + textures = { + {"mobs_bunny_grey.png"}, + {"mobs_bunny_brown.png"}, + {"mobs_bunny_white.png"}, + }, + -- sounds + sounds = {}, + makes_footstep_sound = false, + -- speed and jump + walk_velocity = 1, + jump = true, + -- drops meat when deat + drops = { + {name = "mobs:meat_raw", + chance = 1, min = 1, max = 2,}, + }, + -- damaged by + water_damage = 1, + lava_damage = 1, + light_damage = 0, + -- model animation + animation = { + speed_normal = 15, + stand_start = 1, stand_end = 15, + walk_start = 16, walk_end = 24, + }, + -- follows carrot from farming redo + follow = "farming:carrot", + view_range = 5, + -- right click to pick up rabbit + on_rightclick = function(self, clicker) + + local item = clicker:get_wielded_item() + if item:get_name() == "farming_plus:carrot_item" or item:get_name() == "farming:carrot" then + if not minetest.setting_getbool("creative_mode") then + item:take_item() + clicker:set_wielded_item(item) + end + self.food = (self.food or 0) + 1 + if self.food >= 4 then + self.food = 0 + self.tamed = true + end + return + end + if clicker:is_player() and clicker:get_inventory() then + clicker:get_inventory():add_item("main", "mobs:bunny") + self.object:remove() + end + end, +}) + +mobs:register_spawn("mobs:bunny", {"default:dirt_with_grass", "ethereal:green_dirt_top"}, 20, 8, 9000, 1, 31000) +mobs:register_egg("mobs:bunny", "bunny", "mobs_bunny_inv.png", 0) diff --git a/mods/mobs/chicken.lua b/mods/mobs/chicken.lua index 0fc0e217..4dc693eb 100755 --- a/mods/mobs/chicken.lua +++ b/mods/mobs/chicken.lua @@ -22,6 +22,10 @@ mobs:register_mob("mobs:chicken", { "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png"}, }, + child_texture = { + {"mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", + "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png"}, + }, blood_texture = "mobs_blood.png", -- sounds makes_footstep_sound = true, @@ -52,7 +56,7 @@ mobs:register_mob("mobs:chicken", { walk_end = 40, }, -- follows wheat - follow = "farming:wheat", view_range = 8, + follow = "farming:seed_wheat", view_range = 8, -- replace air with egg (lay) replace_rate = 1000, replace_what = {"air"}, @@ -60,7 +64,8 @@ mobs:register_mob("mobs:chicken", { -- right click to pick up chicken on_rightclick = function(self, clicker) local tool = clicker:get_wielded_item() - if tool:get_name() == "farming:wheat" then + + if tool:get_name() == "farming:seed_wheat" then -- and self.gotten then if not minetest.setting_getbool("creative_mode") then tool:take_item(1) clicker:set_wielded_item(tool) diff --git a/mods/mobs/cow.lua b/mods/mobs/cow.lua index ccf51699..bfc550a9 100755 --- a/mods/mobs/cow.lua +++ b/mods/mobs/cow.lua @@ -88,7 +88,6 @@ mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 10000, 1, 31 mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1) -- Bucket of Milk - minetest.register_craftitem("mobs:bucket_milk", { description = "Bucket of Milk", inventory_image = "mobs_bucket_milk.png", @@ -97,7 +96,6 @@ minetest.register_craftitem("mobs:bucket_milk", { }) -- Cheese Wedge - minetest.register_craftitem("mobs:cheese", { description = "Cheese", inventory_image = "mobs_cheese.png", @@ -113,7 +111,6 @@ minetest.register_craft({ }) -- Cheese Block - minetest.register_node("mobs:cheeseblock", { description = "Cheese Block", tiles = {"mobs_cheeseblock.png"}, diff --git a/mods/mobs/dirtmonster.lua b/mods/mobs/dirtmonster.lua index 6b9717f1..bb5a72b5 100755 --- a/mods/mobs/dirtmonster.lua +++ b/mods/mobs/dirtmonster.lua @@ -44,7 +44,6 @@ mobs:register_mob("mobs:dirt_monster", { max = 8,}, }, -- damaged by - light_resistant = false, water_damage = 1, lava_damage = 5, light_damage = 2, diff --git a/mods/mobs/init.lua b/mods/mobs/init.lua index 234c1d2b..2f44eafa 100755 --- a/mods/mobs/init.lua +++ b/mods/mobs/init.lua @@ -2,7 +2,7 @@ dofile(minetest.get_modpath("mobs").."/api.lua") --- Animals inc. Krupnovpavel's warthog/bee and JKmurray's chicken +-- Animals inc. Krupnovpavel's warthog/bee, JKmurray's chicken, ExeterDad's bunny dofile(minetest.get_modpath("mobs").."/chicken.lua") dofile(minetest.get_modpath("mobs").."/cow.lua") @@ -10,6 +10,7 @@ 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") -- Animals/Kittens from Jordach BFD subgame dofile(minetest.get_modpath("mobs").."/kitten.lua") diff --git a/mods/mobs/lava_flan.lua b/mods/mobs/lava_flan.lua index 3ace65fa..cc0a0dcf 100755 --- a/mods/mobs/lava_flan.lua +++ b/mods/mobs/lava_flan.lua @@ -41,7 +41,6 @@ mobs:register_mob("mobs:lava_flan", { chance = 15, min = 1, max = 1,}, }, -- damaged by - light_resistant = true, water_damage = 5, lava_damage = 0, light_damage = 0, diff --git a/mods/mobs/mese_monster.lua b/mods/mobs/mese_monster.lua index cf9664c4..1ad080ab 100755 --- a/mods/mobs/mese_monster.lua +++ b/mods/mobs/mese_monster.lua @@ -49,7 +49,6 @@ mobs:register_mob("mobs:mese_monster", { chance = 50, min = 1, max = 1,}, }, -- damaged by - light_resistant = true, water_damage = 0, lava_damage = 0, light_damage = 0, @@ -68,7 +67,6 @@ mobs:register_spawn("mobs:mese_monster", {"default:stone", }, 20, -1, 6000, 1, - mobs:register_egg("mobs:mese_monster", "Mese Monster", "default_mese_block.png", 1) -- Mese Monster Crystal Shards (weapon) - mobs:register_arrow("mobs:mese_arrow", { visual = "sprite", visual_size = {x=.5, y=.5}, diff --git a/mods/mobs/models/mobs_bunny.b3d b/mods/mobs/models/mobs_bunny.b3d new file mode 100755 index 00000000..ee053bd4 Binary files /dev/null and b/mods/mobs/models/mobs_bunny.b3d differ diff --git a/mods/mobs/oerkki.lua b/mods/mobs/oerkki.lua index 3826f727..1e50c747 100755 --- a/mods/mobs/oerkki.lua +++ b/mods/mobs/oerkki.lua @@ -42,7 +42,6 @@ mobs:register_mob("mobs:oerkki", { chance = 2, min = 2, max = 3,}, }, -- damaged by - light_resistant = true, water_damage = 1, lava_damage = 1, light_damage = 0, diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index 3a334609..b5ce0a3f 100755 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -19,6 +19,9 @@ mobs:register_mob("mobs:sheep", { }, blood_texture = "mobs_blood.png", visual_size = {x=1,y=1}, + -- specific texture and mesh for gotten + gotten_texture = {"mobs_sheep_shaved.png"}, + gotten_mesh = "mobs_sheep_shaved.x", -- sounds makes_footstep_sound = true, sounds = { diff --git a/mods/mobs/models/mobs_bee.png b/mods/mobs/textures/mobs_bee.png similarity index 100% rename from mods/mobs/models/mobs_bee.png rename to mods/mobs/textures/mobs_bee.png diff --git a/mods/mobs/textures/mobs_bunny_brown.png b/mods/mobs/textures/mobs_bunny_brown.png new file mode 100755 index 00000000..eb8a6828 Binary files /dev/null and b/mods/mobs/textures/mobs_bunny_brown.png differ diff --git a/mods/mobs/textures/mobs_bunny_grey.png b/mods/mobs/textures/mobs_bunny_grey.png new file mode 100755 index 00000000..f1f6e250 Binary files /dev/null and b/mods/mobs/textures/mobs_bunny_grey.png differ diff --git a/mods/mobs/textures/mobs_bunny_inv.png b/mods/mobs/textures/mobs_bunny_inv.png new file mode 100755 index 00000000..3d1b3954 Binary files /dev/null and b/mods/mobs/textures/mobs_bunny_inv.png differ diff --git a/mods/mobs/textures/mobs_bunny_white.png b/mods/mobs/textures/mobs_bunny_white.png new file mode 100755 index 00000000..752e3806 Binary files /dev/null and b/mods/mobs/textures/mobs_bunny_white.png differ diff --git a/mods/mobs/textures/mobs_chick.png b/mods/mobs/textures/mobs_chick.png new file mode 100755 index 00000000..b9c7764e Binary files /dev/null and b/mods/mobs/textures/mobs_chick.png differ diff --git a/mods/mobs/models/mobs_chicken.png b/mods/mobs/textures/mobs_chicken.png similarity index 100% rename from mods/mobs/models/mobs_chicken.png rename to mods/mobs/textures/mobs_chicken.png diff --git a/mods/mobs/models/mobs_chicken_black.png b/mods/mobs/textures/mobs_chicken_black.png similarity index 100% rename from mods/mobs/models/mobs_chicken_black.png rename to mods/mobs/textures/mobs_chicken_black.png diff --git a/mods/mobs/models/mobs_cow.png b/mods/mobs/textures/mobs_cow.png similarity index 100% rename from mods/mobs/models/mobs_cow.png rename to mods/mobs/textures/mobs_cow.png diff --git a/mods/mobs/models/mobs_cow_brown.png b/mods/mobs/textures/mobs_cow_brown.png similarity index 100% rename from mods/mobs/models/mobs_cow_brown.png rename to mods/mobs/textures/mobs_cow_brown.png diff --git a/mods/mobs/models/mobs_creeper.png b/mods/mobs/textures/mobs_creeper.png similarity index 100% rename from mods/mobs/models/mobs_creeper.png rename to mods/mobs/textures/mobs_creeper.png diff --git a/mods/mobs/models/mobs_dirt_monster.png b/mods/mobs/textures/mobs_dirt_monster.png similarity index 100% rename from mods/mobs/models/mobs_dirt_monster.png rename to mods/mobs/textures/mobs_dirt_monster.png diff --git a/mods/mobs/models/mobs_dungeon_master.png b/mods/mobs/textures/mobs_dungeon_master.png similarity index 100% rename from mods/mobs/models/mobs_dungeon_master.png rename to mods/mobs/textures/mobs_dungeon_master.png diff --git a/mods/mobs/models/mobs_dungeon_master_cobblestone.png b/mods/mobs/textures/mobs_dungeon_master_cobblestone.png similarity index 100% rename from mods/mobs/models/mobs_dungeon_master_cobblestone.png rename to mods/mobs/textures/mobs_dungeon_master_cobblestone.png diff --git a/mods/mobs/models/mobs_dungeon_master_strangewhite.png b/mods/mobs/textures/mobs_dungeon_master_strangewhite.png similarity index 100% rename from mods/mobs/models/mobs_dungeon_master_strangewhite.png rename to mods/mobs/textures/mobs_dungeon_master_strangewhite.png diff --git a/mods/mobs/models/mobs_kitten_ginger.png b/mods/mobs/textures/mobs_kitten_ginger.png similarity index 100% rename from mods/mobs/models/mobs_kitten_ginger.png rename to mods/mobs/textures/mobs_kitten_ginger.png diff --git a/mods/mobs/models/mobs_kitten_sandy.png b/mods/mobs/textures/mobs_kitten_sandy.png similarity index 100% rename from mods/mobs/models/mobs_kitten_sandy.png rename to mods/mobs/textures/mobs_kitten_sandy.png diff --git a/mods/mobs/models/mobs_kitten_splotchy.png b/mods/mobs/textures/mobs_kitten_splotchy.png similarity index 100% rename from mods/mobs/models/mobs_kitten_splotchy.png rename to mods/mobs/textures/mobs_kitten_splotchy.png diff --git a/mods/mobs/models/mobs_kitten_striped.png b/mods/mobs/textures/mobs_kitten_striped.png similarity index 100% rename from mods/mobs/models/mobs_kitten_striped.png rename to mods/mobs/textures/mobs_kitten_striped.png diff --git a/mods/mobs/models/mobs_npc.png b/mods/mobs/textures/mobs_npc.png similarity index 100% rename from mods/mobs/models/mobs_npc.png rename to mods/mobs/textures/mobs_npc.png diff --git a/mods/mobs/models/mobs_oerkki.png b/mods/mobs/textures/mobs_oerkki.png similarity index 100% rename from mods/mobs/models/mobs_oerkki.png rename to mods/mobs/textures/mobs_oerkki.png diff --git a/mods/mobs/models/mobs_oerkki2.png b/mods/mobs/textures/mobs_oerkki2.png similarity index 100% rename from mods/mobs/models/mobs_oerkki2.png rename to mods/mobs/textures/mobs_oerkki2.png diff --git a/mods/mobs/models/mobs_pumba.png b/mods/mobs/textures/mobs_pumba.png similarity index 100% rename from mods/mobs/models/mobs_pumba.png rename to mods/mobs/textures/mobs_pumba.png diff --git a/mods/mobs/models/mobs_rat.png b/mods/mobs/textures/mobs_rat.png similarity index 100% rename from mods/mobs/models/mobs_rat.png rename to mods/mobs/textures/mobs_rat.png diff --git a/mods/mobs/models/mobs_rat_brown.png b/mods/mobs/textures/mobs_rat_brown.png similarity index 100% rename from mods/mobs/models/mobs_rat_brown.png rename to mods/mobs/textures/mobs_rat_brown.png diff --git a/mods/mobs/models/mobs_sand_monster.png b/mods/mobs/textures/mobs_sand_monster.png similarity index 100% rename from mods/mobs/models/mobs_sand_monster.png rename to mods/mobs/textures/mobs_sand_monster.png diff --git a/mods/mobs/models/mobs_sheep.png b/mods/mobs/textures/mobs_sheep.png similarity index 100% rename from mods/mobs/models/mobs_sheep.png rename to mods/mobs/textures/mobs_sheep.png diff --git a/mods/mobs/models/mobs_sheep_shaved.png b/mods/mobs/textures/mobs_sheep_shaved.png similarity index 100% rename from mods/mobs/models/mobs_sheep_shaved.png rename to mods/mobs/textures/mobs_sheep_shaved.png diff --git a/mods/mobs/models/mobs_spider.png b/mods/mobs/textures/mobs_spider.png similarity index 100% rename from mods/mobs/models/mobs_spider.png rename to mods/mobs/textures/mobs_spider.png diff --git a/mods/mobs/models/mobs_stone_monster.png b/mods/mobs/textures/mobs_stone_monster.png similarity index 100% rename from mods/mobs/models/mobs_stone_monster.png rename to mods/mobs/textures/mobs_stone_monster.png diff --git a/mods/mobs/models/mobs_tree_monster.png b/mods/mobs/textures/mobs_tree_monster.png similarity index 100% rename from mods/mobs/models/mobs_tree_monster.png rename to mods/mobs/textures/mobs_tree_monster.png diff --git a/mods/mobs/models/mobs_wolf.png b/mods/mobs/textures/mobs_wolf.png similarity index 100% rename from mods/mobs/models/mobs_wolf.png rename to mods/mobs/textures/mobs_wolf.png diff --git a/mods/mobs/models/oerkki.png b/mods/mobs/textures/oerkki.png similarity index 100% rename from mods/mobs/models/oerkki.png rename to mods/mobs/textures/oerkki.png diff --git a/mods/mobs/models/zmobs_lava_flan.png b/mods/mobs/textures/zmobs_lava_flan.png similarity index 100% rename from mods/mobs/models/zmobs_lava_flan.png rename to mods/mobs/textures/zmobs_lava_flan.png diff --git a/mods/mobs/models/zmobs_mese_monster.png b/mods/mobs/textures/zmobs_mese_monster.png similarity index 100% rename from mods/mobs/models/zmobs_mese_monster.png rename to mods/mobs/textures/zmobs_mese_monster.png diff --git a/mods/mobs/warthog.lua b/mods/mobs/warthog.lua index d6da9b60..d5b181c7 100755 --- a/mods/mobs/warthog.lua +++ b/mods/mobs/warthog.lua @@ -69,7 +69,6 @@ mobs:register_mob("mobs:pumba", { return end end, - }) -- spawns on normal or shroom dirt, between 8 and 20 light, 1 in 10000 chance, 1 in area up to 31000 in height mobs:register_spawn("mobs:pumba", {"default:dirt_with_grass", "default:dirt"}, 20, 8, 10000, 1, 31000)