From 10a0bf418b5bf1bcad30d81b49f4509eaf2ccba2 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Wed, 10 Feb 2016 05:02:17 +0100 Subject: [PATCH] update mobs mod --- mods/mobs/api.lua | 28 ++++++++++++++--- mods/mobs/bee.lua | 11 ++++--- mods/mobs/bunny.lua | 5 ++- mods/mobs/chicken.lua | 30 +++++++++++++++--- mods/mobs/cow.lua | 11 +++---- mods/mobs/dirtmonster.lua | 8 ++--- mods/mobs/dungeonmaster.lua | 18 ++++------- mods/mobs/greenslimes.lua | 6 ++-- mods/mobs/kitten.lua | 7 +++-- mods/mobs/lava_flan.lua | 5 ++- mods/mobs/lavaslimes.lua | 13 ++++---- mods/mobs/mese_monster.lua | 12 +++----- mods/mobs/minotaur.lua | 12 +++----- mods/mobs/models/mobs_spider.x | 9 +----- mods/mobs/npc.lua | 14 +++------ mods/mobs/npc_female.lua | 27 ++++++++-------- mods/mobs/oerkki.lua | 6 ++-- mods/mobs/pig.lua | 27 ++++++++++------ mods/mobs/rat.lua | 2 ++ mods/mobs/sandmonster.lua | 8 ++--- mods/mobs/sheep.lua | 56 +++++++++++++++++++--------------- mods/mobs/spider.lua | 11 +++---- mods/mobs/stonemonster.lua | 11 +++---- mods/mobs/treemonster.lua | 19 +++++------- 24 files changed, 187 insertions(+), 169 deletions(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 0eaaca57..0a24c7f6 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -1,4 +1,4 @@ --- Mobs Api (8th February 2016) +-- Mobs Api (9th February 2016) mobs = {} mobs.mod = "redo" @@ -1986,7 +1986,7 @@ end -- END mobs:register_mob function mobs.spawning_mobs = {} function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, - interval, chance, active_object_count, min_height, max_height, spawn_in_area) --MFF crabman + interval, chance, active_object_count, min_height, max_height, spawn_in_area, day_toggle) --MFF crabman "spawn_in_area" mobs.spawning_mobs[name] = true @@ -1995,7 +1995,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, if new_chance ~= nil then - if chance == 0 then + if new_chance == 0 then --print("[Mobs Redo] " .. name .. " has spawning disabled") return end @@ -2022,6 +2022,24 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, return end + -- if toggle set to nil then ignore day/night check + if day_toggle ~= nil then + + local tod = (minetest.get_timeofday() or 0) * 24000 + + if tod > 4500 and tod < 19500 then + -- daylight, but mob wants night + if day_toggle == false then + return + end + else + -- night time but mob wants day + if day_toggle == true then + return + end + end + end + -- spawn above node pos.y = pos.y + 1 @@ -2082,10 +2100,10 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, end -- compatibility with older mob registration -function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height) +function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_in_area, day_toggle) mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, - chance, active_object_count, -31000, max_height) + chance, active_object_count, -31000, max_height, spawn_in_area, day_toggle) end -- set content id's diff --git a/mods/mobs/bee.lua b/mods/mobs/bee.lua index d4388dc3..fbebaf0c 100755 --- a/mods/mobs/bee.lua +++ b/mods/mobs/bee.lua @@ -26,8 +26,7 @@ mobs:register_mob("mobs:bee", { jump = true, -- drops honey when killed drops = { - {name = "mobs:honey", - chance = 1, min = 1, max = 2}, + {name = "mobs:honey", chance = 1, min = 1, max = 2}, }, -- damage water_damage = 1, @@ -49,7 +48,7 @@ mobs:register_mob("mobs:bee", { end, }) -- spawn on group:flowers between 4 and 20 light, 1 in 5000 chance, 1 bee in area up to 31000 in height -mobs:spawn_specific("mobs:bee", {"group:flower"}, {"air"}, 4, 20, 30, 5000, 2, -31000, 31000, true) +mobs:spawn_specific("mobs:bee", {"group:flower"}, {"air"}, 4, 20, 30, 5000, 2, -31000, 31000, true, true) -- register spawn egg mobs:register_egg("mobs:bee", "Bee", "mobs_bee_inv.png", 1) @@ -73,9 +72,13 @@ minetest.register_node("mobs:beehive", { groups = {fleshy=3,dig_immediate=3}, on_use = minetest.item_eat(4), sounds = default.node_sound_defaults(), + after_place_node = function(pos, placer, itemstack) + if placer:is_player() then + minetest.set_node(pos, {name = "mobs:beehive", param2 = 1}) + if math.random(1, 5) == 1 then minetest.add_entity(pos, "mobs:bee") end @@ -113,4 +116,4 @@ minetest.register_craft({ recipe = { {"mobs:honey_block"}, } -}) \ No newline at end of file +}) diff --git a/mods/mobs/bunny.lua b/mods/mobs/bunny.lua index aaadca9a..57e25075 100755 --- a/mods/mobs/bunny.lua +++ b/mods/mobs/bunny.lua @@ -31,8 +31,7 @@ mobs:register_mob("mobs:bunny", { jump = true, -- drops meat when dead drops = { - {name = "mobs:meat_raw", - chance = 1, min = 1, max = 2}, + {name = "mobs:meat_raw", chance = 1, min = 1, max = 2}, }, -- damaged by water_damage = 1, @@ -90,5 +89,5 @@ mobs:register_mob("mobs:bunny", { attack_type = "dogfight", damage = 5, }) -mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true) +mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true) mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 1) diff --git a/mods/mobs/chicken.lua b/mods/mobs/chicken.lua index ef671755..d1ca2415 100755 --- a/mods/mobs/chicken.lua +++ b/mods/mobs/chicken.lua @@ -38,8 +38,7 @@ mobs:register_mob("mobs:chicken", { jump = true, -- drops raw chicken when dead drops = { - {name = "mobs:chicken_raw", - chance = 1, min = 2, max = 2}, + {name = "mobs:chicken_raw", chance = 1, min = 2, max = 2}, }, -- damaged by water_damage = 1, @@ -61,17 +60,23 @@ mobs:register_mob("mobs:chicken", { view_range = 5, on_rightclick = function(self, clicker) + if mobs:feed_tame(self, clicker, 8, true, true) then return end + mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) end, do_custom = function(self) + if not self.child and math.random(1, 500) == 1 then + local pos = self.object:getpos() + minetest.add_item(pos, "mobs:egg") + minetest.sound_play("default_place_node_hard", { pos = pos, gain = 1.0, @@ -81,7 +86,7 @@ mobs:register_mob("mobs:chicken", { end, }) -- spawn on default or bamboo grass between 8 and 20 light, 1 in 10000 change, 1 chicken in area up to 31000 in height -mobs:spawn_specific("mobs:chicken", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true) +mobs:spawn_specific("mobs:chicken", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true) -- register spawn egg mobs:register_egg("mobs:chicken", "Chicken", "mobs_chicken_inv.png", 1) -- egg entity @@ -109,16 +114,22 @@ mobs:register_arrow("mobs:egg_entity", { hit_node = function(self, pos, node) local num = math.random(1, 10) + if num == 1 then + pos.y = pos.y + 1 + local nod = minetest.get_node_or_nil(pos) + if not nod or not minetest.registered_nodes[nod.name] or minetest.registered_nodes[nod.name].walkable == true then return end + local mob = minetest.add_entity(pos, "mobs:chicken") local ent2 = mob:get_luaentity() + mob:set_properties({ textures = ent2.child_texture[1], visual_size = { @@ -134,6 +145,7 @@ mobs:register_arrow("mobs:egg_entity", { ent2.base_colbox[6] / 2 }, }) + ent2.child = true ent2.tamed = true ent2.owner = self.playername @@ -148,35 +160,45 @@ local egg_VELOCITY = 19 -- shoot egg local mobs_shoot_egg = function (item, player, pointed_thing) + local playerpos = player:getpos() + minetest.sound_play("default_place_node_hard", { pos = playerpos, gain = 1.0, max_hear_distance = 5, }) + local obj = minetest.add_entity({ x = playerpos.x, y = playerpos.y +1.5, z = playerpos.z }, "mobs:egg_entity") + local ent = obj:get_luaentity() local dir = player:get_look_dir() + ent.velocity = egg_VELOCITY -- needed for api internal timing ent.switch = 1 -- needed so that egg doesn't despawn straight away + obj:setvelocity({ x = dir.x * egg_VELOCITY, y = dir.y * egg_VELOCITY, z = dir.z * egg_VELOCITY }) + obj:setacceleration({ x = dir.x * -3, y = -egg_GRAVITY, z = dir.z * -3 }) + -- pass player name to egg for chick ownership local ent2 = obj:get_luaentity() ent2.playername = player:get_player_name() + item:take_item() + return item end @@ -236,4 +258,4 @@ minetest.register_craft({ type = "cooking", recipe = "mobs:chicken_raw", output = "mobs:chicken_cooked", -}) \ No newline at end of file +}) diff --git a/mods/mobs/cow.lua b/mods/mobs/cow.lua index 6f289965..64f9fe2c 100755 --- a/mods/mobs/cow.lua +++ b/mods/mobs/cow.lua @@ -35,12 +35,9 @@ mobs:register_mob("mobs:cow", { jump = true, -- drops raw meat when dead drops = { - {name = "mobs:meat_raw", - chance = 1, min = 5, max = 10}, - {name = "mobs:leather", - chance = 1, min = 0, max = 3}, - {name = "maptools:silver_coin", - chance = 10, min = 1, max = 1,}, + {name = "mobs:meat_raw", chance = 1, min = 5, max = 10}, + {name = "mobs:leather", chance = 1, min = 0, max = 3}, + {name = "maptools:silver_coin", chance = 10, min = 1, max = 1,}, }, -- damaged by water_damage = 1, @@ -110,7 +107,7 @@ mobs:register_mob("mobs:cow", { }) -- spawn on default;green;prairie grass between 0 and 20 light, 1 in 11000 chance, 1 cow in area up to 31000 in height -mobs:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true) +mobs:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true) -- register spawn egg mobs:register_egg("mobs:cow", "Cow", "mobs_cow_inv.png", 1) diff --git a/mods/mobs/dirtmonster.lua b/mods/mobs/dirtmonster.lua index 4990a486..e2899e18 100755 --- a/mods/mobs/dirtmonster.lua +++ b/mods/mobs/dirtmonster.lua @@ -33,10 +33,8 @@ mobs:register_mob("mobs:dirt_monster", { jump = true, -- drops dirt and coins when dead drops = { - {name = "default:dirt", - chance = 1, min = 3, max = 5,}, - {name = "maptools:silver_coin", - chance = 2, min = 1, max = 1,}, + {name = "default:dirt", chance = 1, min = 3, max = 5,}, + {name = "maptools:silver_coin", chance = 2, min = 1, max = 1,}, }, -- damaged by water_damage = 1, @@ -59,7 +57,7 @@ mobs:register_mob("mobs:dirt_monster", { }) -- spawn on dirt_with_grass and drygrass between -1 and 5 light, 1 in 10000 change, 1 dirt monster in area up to 31000 in height -mobs:spawn_specific("mobs:dirt_monster", {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, {"air"}, -1, 5, 30, 10000, 1, -31000, 31000, false) +mobs:spawn_specific("mobs:dirt_monster", {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, {"air"}, -1, 5, 30, 10000, 1, -31000, 31000, false, false) -- register spawn egg mobs:register_egg("mobs:dirt_monster", "Dirt Monster", "mobs_dirt_monster_inv.png", 1) diff --git a/mods/mobs/dungeonmaster.lua b/mods/mobs/dungeonmaster.lua index f769a649..f4fd651b 100755 --- a/mods/mobs/dungeonmaster.lua +++ b/mods/mobs/dungeonmaster.lua @@ -40,18 +40,12 @@ mobs:register_mob("mobs:dungeon_master", { knock_back = 0.05, -- Very small knockback -- drops mese or diamond when dead drops = { - {name = "mobs:dungeon_master_blood", - chance = 2, min = 1, max = 2,}, - {name = "default:diamond", - chance = 4, min = 1, max = 3,}, - {name = "default:mese_crystal", - chance = 4, min = 3, max = 6,}, - {name = "mobs:dungeon_master_diamond", - chance = 6, min = 1, max = 1,}, - {name = "maptools:gold_coin", - chance = 20, min = 1, max = 1,}, - {name = "default:diamondblock", - chance = 33, min = 1, max = 1,}, + {name = "mobs:dungeon_master_blood", chance = 2, min = 1, max = 2,}, + {name = "default:diamond", chance = 4, min = 1, max = 3,}, + {name = "default:mese_crystal", chance = 4, min = 3, max = 6,}, + {name = "mobs:dungeon_master_diamond", chance = 6, min = 1, max = 1,}, + {name = "maptools:gold_coin", chance = 20, min = 1, max = 1,}, + {name = "default:diamondblock", chance = 33, min = 1, max = 1,}, }, -- damaged by water_damage = 1, diff --git a/mods/mobs/greenslimes.lua b/mods/mobs/greenslimes.lua index 160e3a44..8d866d14 100755 --- a/mods/mobs/greenslimes.lua +++ b/mods/mobs/greenslimes.lua @@ -44,10 +44,8 @@ mobs:register_mob("mobs:greensmall", { floats = 1, -- chance of dropping glue and coins drops = { - {name = "mesecons_materials:glue", - chance = 4, min = 1, max = 2}, - {name = "maptools:silver_coin", - chance = 4, min = 1, max = 1,}, + {name = "mesecons_materials:glue", chance = 4, min = 1, max = 2}, + {name = "maptools:silver_coin", chance = 4, min = 1, max = 1,}, }, -- damaged by water_damage = 0, diff --git a/mods/mobs/kitten.lua b/mods/mobs/kitten.lua index 81012972..873481cf 100755 --- a/mods/mobs/kitten.lua +++ b/mods/mobs/kitten.lua @@ -34,8 +34,7 @@ mobs:register_mob("mobs:kitten", { jump = false, -- drops string drops = { - {name = "farming:string", - chance = 2, min = 1, max = 1}, + {name = "farming:string", chance = 2, min = 1, max = 1}, }, -- damaged by water_damage = 1, @@ -54,11 +53,13 @@ mobs:register_mob("mobs:kitten", { view_range = 10, -- feed with raw fish to tame or right click to pick up on_rightclick = function(self, clicker) + if mobs:feed_tame(self, clicker, 4, true, true) then return end + mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) end }) -mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true) +mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true, true) mobs:register_egg("mobs:kitten", "Kitten", "mobs_kitten_inv.png", 0) diff --git a/mods/mobs/lava_flan.lua b/mods/mobs/lava_flan.lua index 83466150..93adb70d 100755 --- a/mods/mobs/lava_flan.lua +++ b/mods/mobs/lava_flan.lua @@ -36,8 +36,7 @@ mobs:register_mob("mobs:lava_flan", { floats = 1, -- chance of dropping lava orb when dead drops = { - {name = "mobs:lava_orb", - chance = 15, min = 1, max = 1}, + {name = "mobs:lava_orb", chance = 15, min = 1, max = 1}, }, -- damaged by water_damage = 5, @@ -72,4 +71,4 @@ minetest.register_craftitem("mobs:lava_orb", { inventory_image = "zmobs_lava_orb.png", }) -minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb") \ No newline at end of file +minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb") diff --git a/mods/mobs/lavaslimes.lua b/mods/mobs/lavaslimes.lua index 77e62e99..e79981ed 100755 --- a/mods/mobs/lavaslimes.lua +++ b/mods/mobs/lavaslimes.lua @@ -22,7 +22,8 @@ mobs:register_mob("mobs:lavasmall", { attack_type = "dogfight", attacks_monsters = true, -- health and armor - hp_min = 4, hp_max = 8, + hp_min = 4, + hp_max = 8, armor = 100, -- textures and model collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, @@ -46,10 +47,8 @@ mobs:register_mob("mobs:lavasmall", { floats = 1, -- chance of dropping lava orb and coins drops = { - {name = "mobs:lava_orb", - chance = 15, min = 1, max = 1,}, - {name = "maptools:silver_coin", - chance = 4, min = 1, max = 1,}, + {name = "mobs:lava_orb", chance = 15, min = 1, max = 1,}, + {name = "maptools:silver_coin", chance = 4, min = 1, max = 1,}, }, -- damaged by water_damage = 10, @@ -70,7 +69,8 @@ mobs:register_mob("mobs:lavamedium", { attack_type = "dogfight", attacks_monsters = true, -- health and armor - hp_min = 16, hp_max = 32, + hp_min = 16, + hp_max = 32, armor = 90, -- textures and model collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, @@ -162,6 +162,7 @@ mobs:register_mob("mobs:lavabig", { end end, }) + mobs:register_egg("mobs:lavabig", "Big Lava Slime", "mobs_lava_slime_big_inv.png", 1) --mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height) diff --git a/mods/mobs/mese_monster.lua b/mods/mobs/mese_monster.lua index 92ac8a20..b2fcc9da 100755 --- a/mods/mobs/mese_monster.lua +++ b/mods/mobs/mese_monster.lua @@ -40,14 +40,10 @@ mobs:register_mob("mobs:mese_monster", { stepheight = 2.1, -- drops mese when dead drops = { - {name = "default:mese_crystal", - chance = 9, min = 1, max = 3,}, - {name = "default:mese_crystal_fragment", - chance = 1, min = 1, max = 9,}, - {name = "maptools:silver_coin", - chance = 1, min = 1, max = 2,}, - {name = "returnmirror:mirror_inactive", - chance = 50, min = 1, max = 1,}, + {name = "default:mese_crystal", chance = 9, min = 1, max = 3,}, + {name = "default:mese_crystal_fragment", chance = 1, min = 1, max = 9,}, + {name = "maptools:silver_coin", chance = 1, min = 1, max = 2,}, + {name = "returnmirror:mirror_inactive", chance = 50, min = 1, max = 1,}, }, -- damaged by water_damage = 0, diff --git a/mods/mobs/minotaur.lua b/mods/mobs/minotaur.lua index d6222183..d960438b 100755 --- a/mods/mobs/minotaur.lua +++ b/mods/mobs/minotaur.lua @@ -38,14 +38,10 @@ mobs:register_mob("mobs:minotaur", { knock_back = 0.05, --this is a test -- drops desert_sand and coins when dead drops = { - {name = "maptools:gold_coin", - chance = 40, min = 1, max = 1,}, - {name = "mobs:minotaur_eye", - chance = 2, min = 1, max = 2,}, - {name = "mobs:minotaur_horn", - chance = 4, min = 1, max = 2,}, - {name = "mobs:minotaur_fur", - chance = 1, min = 1, max = 3,}, + {name = "maptools:gold_coin", chance = 40, min = 1, max = 1,}, + {name = "mobs:minotaur_eye", chance = 2, min = 1, max = 2,}, + {name = "mobs:minotaur_horn", chance = 4, min = 1, max = 2,}, + {name = "mobs:minotaur_fur", chance = 1, min = 1, max = 3,}, }, water_damage = 0, lava_damage = 5, diff --git a/mods/mobs/models/mobs_spider.x b/mods/mobs/models/mobs_spider.x index b0a95ca8..19f17871 100755 --- a/mods/mobs/models/mobs_spider.x +++ b/mods/mobs/models/mobs_spider.x @@ -1,10 +1,5 @@ xof 0303txt 0032 -template AnimTicksPerSecond { - <9E415A43-7BA6-4a73-8743-B73D47E88476> - DWORD AnimTicksPerSecond; -} - template XSkinMeshHeader { <3cf169ce-ff7c-44ab-93c0-f78f62d172e2> WORD nMaxSkinWeightsPerVertex; @@ -2359,9 +2354,7 @@ Frame Root { } // End of Group8 } // End of Armature } // End of Root -AnimTicksPerSecond { - 24; -} + AnimationSet Global { Animation { {Armature} diff --git a/mods/mobs/npc.lua b/mods/mobs/npc.lua index 062ec076..b4993b93 100755 --- a/mods/mobs/npc.lua +++ b/mods/mobs/npc.lua @@ -47,14 +47,10 @@ mobs:register_mob("mobs:npc", { jump = true, -- drops wood and chance of apples when dead drops = { - {name = "default:wood", - chance = 1, min = 1, max = 3}, - {name = "default:apple", - chance = 2, min = 1, max = 2}, - {name = "default:axe_stone", - chance = 3, min = 1, max = 1}, - {name = "maptools:silver_coin", - chance = 10, min = 1, max = 1,}, + {name = "default:wood", chance = 1, min = 1, max = 3}, + {name = "default:apple", chance = 2, min = 1, max = 2}, + {name = "default:axe_stone", chance = 3, min = 1, max = 1}, + {name = "maptools:silver_coin", chance = 10, min = 1, max = 1,}, }, -- damaged by water_damage = 0, @@ -129,6 +125,6 @@ mobs:register_mob("mobs:npc", { }) -- spawning enable for now -mobs:spawn_specific("mobs:npc", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true) +mobs:spawn_specific("mobs:npc", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 300000, 1, -31000, 31000, true, true) -- register spawn egg mobs:register_egg("mobs:npc", "Npc", "mobs_npc_male_inv.png", 1) diff --git a/mods/mobs/npc_female.lua b/mods/mobs/npc_female.lua index ab0318be..f4378863 100755 --- a/mods/mobs/npc_female.lua +++ b/mods/mobs/npc_female.lua @@ -8,7 +8,6 @@ mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:a "default:cobble", "default:gravel", "default:clay_lump", "default:sand", "default:dirt_with_grass", "default:dirt", "default:chest", "default:torch"} -mobs.npc_max_hp = 20 mobs:register_mob("mobs:npc_female", { -- animal, monster, npc @@ -20,7 +19,9 @@ mobs:register_mob("mobs:npc_female", { attack_type = "dogfight", attacks_monsters = true, -- health & armor - hp_min = 20, hp_max = 20, armor = 100, + hp_min = 20, + hp_max = 20, + armor = 100, -- textures and model collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35}, visual = "mesh", @@ -46,18 +47,12 @@ mobs:register_mob("mobs:npc_female", { jump = true, -- drops wood and chance of apples when dead drops = { - {name = "default:wood", - chance = 1, min = 1, max = 3}, - {name = "default:apple", - chance = 2, min = 1, max = 2}, - {name = "flowers:tulip", - chance = 4, min = 1, max = 2}, - {name = "flowers:rose", - chance = 4, min = 1, max = 2}, - {name = "default:axe_stone", - chance = 6, min = 1, max = 1}, - {name = "maptools:silver_coin", - chance = 10, min = 1, max = 1,}, + {name = "default:wood", chance = 1, min = 1, max = 3}, + {name = "default:apple", chance = 2, min = 1, max = 2}, + {name = "flowers:tulip", chance = 4, min = 1, max = 2}, + {name = "flowers:rose", chance = 4, min = 1, max = 2}, + {name = "default:axe_stone", chance = 6, min = 1, max = 1}, + {name = "maptools:silver_coin", chance = 10, min = 1, max = 1,}, }, -- damaged by water_damage = 0, @@ -110,6 +105,7 @@ mobs:register_mob("mobs:npc_female", { item:take_item() clicker:set_wielded_item(item) end + local pos = self.object:getpos() pos.y = pos.y + 0.5 minetest.add_item(pos, { @@ -126,10 +122,11 @@ mobs:register_mob("mobs:npc_female", { end mobs:capture_mob(self, clicker, 0, 5, 80, false, nil) end + end, }) -- spawning enable for now -mobs:spawn_specific("mobs:npc_female", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 100000, 1, -31000, 31000, true) +mobs:spawn_specific("mobs:npc_female", {"default:dirt_with_grass", "default:dirt", "default:junglegrass", "default:sand"}, {"air"}, -1, 20, 30, 100000, 1, -31000, 31000, true, true) -- register spawn egg mobs:register_egg("mobs:npc_female", "Npc", "mobs_npc_female_inv.png", 1) diff --git a/mods/mobs/oerkki.lua b/mods/mobs/oerkki.lua index 263f7878..9af3be78 100755 --- a/mods/mobs/oerkki.lua +++ b/mods/mobs/oerkki.lua @@ -35,10 +35,8 @@ mobs:register_mob("mobs:oerkki", { jump = true, -- chance of dropping obsidian and coins drops = { - {name = "default:obsidian", - chance = 3, min = 1, max = 2,}, - {name = "maptools:silver_coin", - chance = 1, min = 1, max = 1}, + {name = "default:obsidian", chance = 3, min = 1, max = 2,}, + {name = "maptools:silver_coin", chance = 1, min = 1, max = 1}, }, -- damaged by water_damage = 2, diff --git a/mods/mobs/pig.lua b/mods/mobs/pig.lua index 9086ba1b..39477dcd 100755 --- a/mods/mobs/pig.lua +++ b/mods/mobs/pig.lua @@ -6,8 +6,8 @@ mobs:register_mob("mobs:pig", { type = "animal", -- aggressive, does 5 damage to player when threatened passive = false, - group_attack = true, attack_type = "dogfight", + group_attack = true, reach = 2, damage = 4, -- health & armor @@ -39,10 +39,8 @@ mobs:register_mob("mobs:pig", { view_range = 10, -- drops raw pork when dead drops = { - {name = "mobs:pork_raw", - chance = 1, min = 2, max = 3,}, - {name = "maptools:silver_coin", - chance = 10, min = 1, max = 1,}, + {name = "mobs:pork_raw", chance = 1, min = 2, max = 3,}, + {name = "maptools:silver_coin", chance = 10, min = 1, max = 1,}, }, -- damaged by water_damage = 1, @@ -52,18 +50,27 @@ mobs:register_mob("mobs:pig", { -- model animation animation = { speed_normal = 15, - stand_start = 25, stand_end = 55, - walk_start = 60, walk_end = 100, - punch_start = 60, punch_end = 100, + stand_start = 25, + stand_end = 55, + walk_start = 60, + walk_end = 100, + punch_start = 60, + punch_end = 100, }, -- can be tamed by feeding 8 wheat (will not attack when tamed) on_rightclick = function(self, clicker) - mobs:feed_tame(self, clicker, 8, true, true) + + if mobs:feed_tame(self, clicker, 8, true, true) then + return + end + mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) end, }) + -- spawns on dirt or junglegrass, between 8 and 20 light, 1 in 15000 chance, 1 in area up to 31000 in height -mobs:spawn_specific("mobs:pig", {"default:dirt", "default:junglegrass", "default:dirt_with_dry_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true) +mobs:spawn_specific("mobs:pig", {"default:dirt", "default:junglegrass", "default:dirt_with_dry_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true, true) + -- register spawn egg mobs:register_egg("mobs:pig", "Pig", "mobs_pig_inv.png", 1) diff --git a/mods/mobs/rat.lua b/mods/mobs/rat.lua index 16066fb2..411a1592 100755 --- a/mods/mobs/rat.lua +++ b/mods/mobs/rat.lua @@ -47,8 +47,10 @@ mobs:register_mob("mobs:rat", { end, --]] }) + -- spawn on stone between 1 and 20 light, 1 in 7000 chance, 1 per area up to 31000 in height mobs:spawn_specific("mobs:rat", {"default:stone", "default:sandstone"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true) + -- register spawn egg mobs:register_egg("mobs:rat", "Rat", "mobs_rat_inv.png", 1) diff --git a/mods/mobs/sandmonster.lua b/mods/mobs/sandmonster.lua index 6f4763bb..eadaad95 100755 --- a/mods/mobs/sandmonster.lua +++ b/mods/mobs/sandmonster.lua @@ -34,10 +34,8 @@ mobs:register_mob("mobs:sand_monster", { floats = 0, -- drops desert sand when dead drops = { - {name = "default:desert_sand", - chance = 1, min = 3, max = 5,}, - {name = "maptools:silver_coin", - chance = 10, min = 1, max = 1,}, + {name = "default:desert_sand", chance = 1, min = 3, max = 5,}, + {name = "maptools:silver_coin", chance = 10, min = 1, max = 1,}, }, -- damaged by water_damage = 3, @@ -58,8 +56,10 @@ mobs:register_mob("mobs:sand_monster", { punch_end = 105, }, }) + -- spawns on desert sand between -1 and 20 light, 1 in 15000 chance, 1 sand monster in area up to 31000 in height mobs:spawn_specific("mobs:sand_monster", {"default:desert_sand", "default:sand"}, {"air"}, -1, 20, 30, 20000, 1, -31000, 31000, false) + -- register spawn egg mobs:register_egg("mobs:sand_monster", "Sand Monster", "mobs_sand_monster_inv.png", 1) diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index cd6f8b35..eb8d0d34 100755 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -18,7 +18,6 @@ for _, col in pairs(all_colours) do hp_max = 15, armor = 200, -- textures and model - --collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4}, collisionbox = {-0.5, -1, -0.5, 0.5, 0.3, 0.5}, visual = "mesh", mesh = "mobs_sheep.b3d", @@ -40,10 +39,8 @@ for _, col in pairs(all_colours) do jump = true, -- drops raw meat and woll of its color when dead drops = { - {name = "mobs:meat_raw", - chance = 1, min = 2, max = 3}, - {name = "wool:"..col, - chance = 1, min = 1, max = 1}, + {name = "mobs:meat_raw", chance = 1, min = 2, max = 3}, + {name = "wool:"..col, chance = 1, min = 1, max = 1}, }, -- damaged by water_damage = 1, @@ -75,6 +72,7 @@ for _, col in pairs(all_colours) do --are we feeding? if mobs:feed_tame(self, clicker, 8, true, true) then + --if full grow fuzz if self.gotten == false then self.object:set_properties({ @@ -82,6 +80,7 @@ for _, col in pairs(all_colours) do mesh = "mobs_sheep.b3d", }) end + return end @@ -90,12 +89,18 @@ for _, col in pairs(all_colours) do --are we giving a haircut> if itemname == "mobs:shears" then + if self.gotten == false and self.child == false then + self.gotten = true -- shaved + if minetest.get_modpath("wool") then + local pos = self.object:getpos() pos.y = pos.y + 0.5 + local obj = minetest.add_item(pos, ItemStack("wool:"..shpcolor.." "..math.random(1,3))) + if obj then obj:setvelocity({ x = math.random(-1,1), @@ -103,14 +108,18 @@ for _, col in pairs(all_colours) do z = math.random(-1,1) }) end + item:add_wear(650) -- 100 uses + clicker:set_wielded_item(item) end + self.object:set_properties({ textures = {"mobs_sheep_shaved.png"}, mesh = "mobs_sheep_shaved.b3d", }) end + return end @@ -118,28 +127,39 @@ for _, col in pairs(all_colours) do --are we coloring? if itemname:find("dye:") then + if self.gotten == false and self.child == false and self.tamed == true and name == self.owner then + local col = string.split(itemname,":")[2] + for _,c in pairs(all_colours) do + if c == col then + local pos = self.object:getpos() + self.object:remove() + local mob = minetest.add_entity(pos, "mobs:sheep_"..col) local ent = mob:get_luaentity() + ent.owner = name ent.tamed = true + -- take item if not minetest.setting_getbool("creative_mode") then item:take_item() clicker:set_wielded_item(item) end + break end end end + return end @@ -152,7 +172,7 @@ for _, col in pairs(all_colours) do end -mobs:spawn_specific("mobs:sheep_white", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true) +mobs:spawn_specific("mobs:sheep_white", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 2, -31000, 31000, true, true) -- compatibility (item and entity) minetest.register_alias("mobs:sheep", "mobs:sheep_white") @@ -168,25 +188,13 @@ minetest.register_entity("mobs:sheep", { velocity = {x = 0, y = 0, z = 0}, collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4}, is_visible = true, - speed = 0, - timer = 0, - on_rightclick = function(self, clicker) - clicker:get_inventory():add_item("main", "mobs:sheep_white") + on_activate = function(self, staticdata, dtime_s) + + local pos = self.object:getpos() + self.object:remove() - end, - - on_step = function(self, dtime) - - self.timer = self.timer + dtime - if self.timer >= 1 then - self.timer = 0 - self.object:setacceleration({ - x = 0, - y = -10, - z = 0 - }) - end - end, + minetest.add_entity(pos, "mobs:sheep_white") + end }) diff --git a/mods/mobs/spider.lua b/mods/mobs/spider.lua index 00f8fd07..f11f3768 100755 --- a/mods/mobs/spider.lua +++ b/mods/mobs/spider.lua @@ -38,12 +38,9 @@ mobs:register_mob("mobs:spider", { floats = 0, -- drops string with a chance of sandstone or crystal spike if Ethereal installed drops = { - {name = "farming:string", - chance = 2, min = 1, max = 3,}, - {name = "mobs:meat_raw", - chance = 4, min = 1, max = 2,}, - {name = "maptools:silver_coin", - chance = 3, min = 1, max = 1,}, + {name = "farming:string", chance = 2, min = 1, max = 3,}, + {name = "mobs:meat_raw", chance = 4, min = 1, max = 2,}, + {name = "maptools:silver_coin", chance = 3, min = 1, max = 1,}, }, -- damaged by water_damage = 5, @@ -63,8 +60,10 @@ mobs:register_mob("mobs:spider", { punch_end = 90, }, }) + -- spawn on jungleleaves/jungletree, between 0 and 5 light, 1 in 10000 chance, 1 in area up to 31000 in height mobs:spawn_specific("mobs:spider", {"default:jungleleaves", "default:jungletree"}, {"air"}, -1, 20, 30, 7500, 1, -31000, 31000, false) + -- register spawn egg mobs:register_egg("mobs:spider", "Spider", "mobs_spider_inv.png", 1) diff --git a/mods/mobs/stonemonster.lua b/mods/mobs/stonemonster.lua index 2d7ed66a..31ec8f8c 100755 --- a/mods/mobs/stonemonster.lua +++ b/mods/mobs/stonemonster.lua @@ -37,12 +37,9 @@ mobs:register_mob("mobs:stone_monster", { drops = { {name = "default:torch", chance = 10, min = 3, max = 5,}, - {name = "default:iron_lump", - chance = 5, min = 1, max = 2,}, - {name = "default:coal_lump", - chance = 3, min = 1, max = 3,}, - {name = "maptools:silver_coin", - chance = 1, min = 1, max = 1,}, + {name = "default:iron_lump", chance = 5, min = 1, max = 2,}, + {name = "default:coal_lump", chance = 3, min = 1, max = 3,}, + {name = "maptools:silver_coin", chance = 1, min = 1, max = 1,}, }, -- damaged by water_damage = 0, @@ -62,8 +59,10 @@ mobs:register_mob("mobs:stone_monster", { punch_end = 63, }, }) + -- spawns on stone between -1 and 5 light, 1 in 7000 chance, 1 in area below -25 mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:sandstone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, -25, false) + -- register spawn egg mobs:register_egg("mobs:stone_monster", "Stone Monster", "mobs_stone_monster_inv.png", 1) diff --git a/mods/mobs/treemonster.lua b/mods/mobs/treemonster.lua index fdccd645..1ea78dce 100755 --- a/mods/mobs/treemonster.lua +++ b/mods/mobs/treemonster.lua @@ -33,16 +33,11 @@ mobs:register_mob("mobs:tree_monster", { view_range = 16, -- drops saplings, junglesapling, apple and/or silver coin drops = { - {name = "default:sapling", - chance = 2, min = 1, max = 2}, - {name = "default:junglesapling", - chance = 2, min = 1, max = 2}, - {name = "default:apple", - chance = 2, min = 2, max = 3,}, - {name = "maptools:superapple", - chance = 4, min = 1, max = 1,}, - {name = "maptools:silver_coin", - chance = 3, min = 1, max = 1,}, + {name = "default:sapling", chance = 2, min = 1, max = 2}, + {name = "default:junglesapling", chance = 2, min = 1, max = 2}, + {name = "default:apple", chance = 2, min = 2, max = 3,}, + {name = "maptools:superapple", chance = 4, min = 1, max = 1,}, + {name = "maptools:silver_coin", chance = 3, min = 1, max = 1,}, }, -- damaged by water_damage = 1, @@ -63,8 +58,10 @@ mobs:register_mob("mobs:tree_monster", { punch_end = 62, }, }) + -- spawn on leaves and beech_leaves, between 0 and 5 light, 1 in 8000 chance, 1 in area up to 31000 in height -mobs:spawn_specific("mobs:tree_monster", {"default:leaves", "moretrees:beech_leaves"}, {"air"}, 0, 5, 30, 8000, 1, -31000, 31000, false) +mobs:spawn_specific("mobs:tree_monster", {"default:leaves", "moretrees:beech_leaves"}, {"air"}, 0, 5, 30, 8000, 1, -31000, 31000, false, false) + -- register spawn egg mobs:register_egg("mobs:tree_monster", "Tree Monster", "mobs_tree_monster_inv.png", 1)