diff --git a/mods/mobs/README.txt b/mods/mobs/README.txt index 39723ed2..68bc5b5c 100755 --- a/mods/mobs/README.txt +++ b/mods/mobs/README.txt @@ -28,7 +28,7 @@ This mod contains the following additions: Changelog: -1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) +1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :) 1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak. 1.24- Added feature where certain animals run away when punched (runaway = true in mob definition) 1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index a58415d9..336a874b 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -1,4 +1,4 @@ --- Mobs Api (16th February 2016) +-- Mobs Api (17th February 2016) mobs = {} mobs.mod = "redo" @@ -917,6 +917,7 @@ minetest.register_entity(name, { fear_height = def.fear_height or 0, runaway = def.runaway, runaway_timer = 0, + pathfinding = def.pathfinding, on_step = function(self, dtime) @@ -1669,7 +1670,9 @@ minetest.register_entity(name, { if dist > self.reach then -- path finding by rnd - if enable_pathfinding then + if self.pathfinding -- only if mob has pathfinding enabled + and enable_pathfinding then + smart_mobs(self, s, p, dist, dtime) end diff --git a/mods/mobs/bee.lua b/mods/mobs/bee.lua index fbebaf0c..da4b69b0 100755 --- a/mods/mobs/bee.lua +++ b/mods/mobs/bee.lua @@ -73,6 +73,20 @@ minetest.register_node("mobs:beehive", { on_use = minetest.item_eat(4), sounds = default.node_sound_defaults(), + on_construct = function(pos) + + local meta = minetest.get_meta(pos) + + meta:set_string("formspec", "size[8,6]" + ..default.gui_bg..default.gui_bg_img..default.gui_slots + .. "image[3,0.8;0.8,0.8;mobs_bee_inv.png]" + .. "list[current_name;beehive;4,0.5;1,1;]" + .. "list[current_player;main;0,2.35;8,4;]" + .. "listring[]") + + meta:get_inventory():set_size("beehive", 1) + end, + after_place_node = function(pos, placer, itemstack) if placer:is_player() then @@ -84,7 +98,30 @@ minetest.register_node("mobs:beehive", { end end end, - + + on_punch = function(pos, node, puncher) + + -- yep, bee's don't like having their home punched by players + puncher:set_hp(puncher:get_hp() - 4) + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + + if listname == "beehive" then + return 0 + end + + return stack:get_count() + end, + + can_dig = function(pos,player) + + local meta = minetest.get_meta(pos) + + -- only dig beehive if no honey inside + return meta:get_inventory():is_empty("beehive") + end, + }) minetest.register_craft({ @@ -117,3 +154,37 @@ minetest.register_craft({ {"mobs:honey_block"}, } }) + +-- beehive workings +minetest.register_abm({ + nodenames = {"mobs:beehive"}, + interval = 6, + chance = 5, + catch_up = false, + action = function(pos, node) + + -- bee's only make honey during the day + local tod = (minetest.get_timeofday() or 0) * 24000 + + if tod < 4500 or tod > 19500 then + return + end + + -- find flowers in area around hive + local flowers = minetest.find_nodes_in_area_under_air( + {x = pos.x - 10, y = pos.y - 5, z = pos.z - 10}, + {x = pos.x + 10, y = pos.y + 5, z = pos.z + 10}, + "group:flower") + + -- no flowers no honey, nuff said! + if #flowers > 3 then + + local meta = minetest.get_meta(pos) + + -- error check just incase it's an old beehive + if meta then + meta:get_inventory():add_item("beehive", "mobs:honey") + end + end + end +}) diff --git a/mods/mobs/dirtmonster.lua b/mods/mobs/dirtmonster.lua index 9c0ba1c6..97c63425 100755 --- a/mods/mobs/dirtmonster.lua +++ b/mods/mobs/dirtmonster.lua @@ -7,6 +7,7 @@ mobs:register_mob("mobs:dirt_monster", { -- aggressive, deals 6 damage to player when hit passive = false, attack_type = "dogfight", + pathfinding = true, reach = 2, damage = 5, -- health & armor diff --git a/mods/mobs/npc.lua b/mods/mobs/npc.lua index b4993b93..dee7e382 100755 --- a/mods/mobs/npc.lua +++ b/mods/mobs/npc.lua @@ -18,6 +18,7 @@ mobs:register_mob("mobs:npc", { damage = 5, -- 3 damages if tamed attack_type = "dogfight", attacks_monsters = true, + pathfinding = true, -- health & armor hp_min = 20, hp_max = 20, diff --git a/mods/mobs/npc_female.lua b/mods/mobs/npc_female.lua index f4378863..b3648d9f 100755 --- a/mods/mobs/npc_female.lua +++ b/mods/mobs/npc_female.lua @@ -18,6 +18,7 @@ mobs:register_mob("mobs:npc_female", { damage = 5, -- 3 damages if tamed attack_type = "dogfight", attacks_monsters = true, + pathfinding = true, -- health & armor hp_min = 20, hp_max = 20, diff --git a/mods/mobs/oerkki.lua b/mods/mobs/oerkki.lua index 959f93b7..249b488c 100755 --- a/mods/mobs/oerkki.lua +++ b/mods/mobs/oerkki.lua @@ -7,6 +7,7 @@ mobs:register_mob("mobs:oerkki", { -- aggressive, deals 7 damage when player hit passive = false, attack_type = "dogfight", + pathfinding = true, reach = 2, damage = 6, -- health & armor diff --git a/mods/mobs/sandmonster.lua b/mods/mobs/sandmonster.lua index 3b6e364b..928888e2 100755 --- a/mods/mobs/sandmonster.lua +++ b/mods/mobs/sandmonster.lua @@ -7,6 +7,7 @@ mobs:register_mob("mobs:sand_monster", { -- aggressive, deals 5 damage to player when hit passive = false, attack_type = "dogfight", + pathfinding = true, reach = 2, damage = 4, -- health & armor diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index eb8d0d34..45e1104e 100755 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -1,14 +1,28 @@ local all_colours = { - "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta", - "white", "orange", "violet", "brown", "pink", "dark_grey", "dark_green" + {"black", "Black", "#000000b0"}, + {"blue", "Blue", "#015dbb70"}, + {"brown", "Brown", "#663300a0"}, + {"cyan", "Cyan", "#01ffd870"}, + {"dark_green", "Dark Green", "#005b0770"}, + {"dark_grey", "Dark Grey", "#303030b0"}, + {"green", "Green", "#61ff0170"}, + {"grey", "Grey", "#5b5b5bb0"}, + {"magenta", "Magenta", "#ff05bb70"}, + {"orange", "Orange", "#ff840170"}, + {"pink", "Pink", "#ff65b570"}, + {"red", "Red", "#ff0000a0"}, + {"violet", "Violet", "#2000c970"}, + {"white", "White", "#abababc0"}, + {"yellow", "Yellow", "#e3ff0070"}, } --- Sheep by PilzAdam +-- Sheep by PilzAdam, texture converted to minetest by AMMOnym from Summerfield pack for _, col in pairs(all_colours) do - mobs:register_mob("mobs:sheep_"..col, { + mobs:register_mob("mobs:sheep_"..col[1], { + -- animal, monster, npc, barbarian type = "animal", -- not aggressive @@ -22,7 +36,7 @@ for _, col in pairs(all_colours) do visual = "mesh", mesh = "mobs_sheep.b3d", textures = { - {"mobs_sheep_"..col..".png"}, + {"mobs_sheep_wool.png^[colorize:" .. col[3] .. "^mobs_sheep_base.png"}, }, -- specific texture and mesh for gotten gotten_texture = {"mobs_sheep_shaved.png"}, @@ -40,7 +54,7 @@ for _, col in pairs(all_colours) do -- 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 = "wool:"..col[1], chance = 1, min = 1, max = 1}, }, -- damaged by water_damage = 1, @@ -65,7 +79,9 @@ for _, col in pairs(all_colours) do replace_offset = -1, fear_height = 3, on_rightclick = function(self, clicker) + local shpcolor = string.split(self.name,"_")[2] + if shpcolor =="dark" then shpcolor = shpcolor.."_"..string.split(self.name,"_")[3] end @@ -76,7 +92,7 @@ for _, col in pairs(all_colours) do --if full grow fuzz if self.gotten == false then self.object:set_properties({ - textures = {"mobs_sheep_"..shpcolor..".png"}, + textures = {"mobs_sheep_wool.png^[colorize:" .. col[3] .. "^mobs_sheep_base.png"}, mesh = "mobs_sheep.b3d", }) end @@ -133,17 +149,17 @@ for _, col in pairs(all_colours) do and self.tamed == true and name == self.owner then - local col = string.split(itemname,":")[2] + local colr = string.split(itemname,":")[2] for _,c in pairs(all_colours) do - if c == col then + if c[1] == colr then local pos = self.object:getpos() self.object:remove() - local mob = minetest.add_entity(pos, "mobs:sheep_"..col) + local mob = minetest.add_entity(pos, "mobs:sheep_"..colr) local ent = mob:get_luaentity() ent.owner = name @@ -168,7 +184,7 @@ for _, col in pairs(all_colours) do end }) - mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "mobs_sheep_"..col.."_inv.png", 1) + mobs:register_egg("mobs:sheep_"..col[1], col[2] .. "Sheep", "mobs_sheep_white_inv.png^[colorize:" .. col[3], 1) end diff --git a/mods/mobs/stonemonster.lua b/mods/mobs/stonemonster.lua index 31ec8f8c..d8b764f0 100755 --- a/mods/mobs/stonemonster.lua +++ b/mods/mobs/stonemonster.lua @@ -7,6 +7,7 @@ mobs:register_mob("mobs:stone_monster", { -- aggressive, deals 8 damage to player when hit passive = false, attack_type = "dogfight", + pathfinding = true, reach = 2, damage = 6, -- health & armor @@ -19,6 +20,7 @@ mobs:register_mob("mobs:stone_monster", { mesh = "mobs_stone_monster.b3d", textures = { {"mobs_stone_monster.png"}, + {"mobs_stone_monster2.png"}, -- by AMMOnym }, blood_texture = "default_stone.png", -- sounds @@ -61,7 +63,7 @@ mobs:register_mob("mobs:stone_monster", { }) -- 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) +mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:desert_stone"}, {"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/textures/mobs_sheep_base.png b/mods/mobs/textures/mobs_sheep_base.png new file mode 100755 index 00000000..1d9c171b Binary files /dev/null and b/mods/mobs/textures/mobs_sheep_base.png differ diff --git a/mods/mobs/textures/mobs_sheep_black.png b/mods/mobs/textures/mobs_sheep_black.png deleted file mode 100755 index ee397312..00000000 Binary files a/mods/mobs/textures/mobs_sheep_black.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_black_inv.png b/mods/mobs/textures/mobs_sheep_black_inv.png deleted file mode 100755 index 716b8550..00000000 Binary files a/mods/mobs/textures/mobs_sheep_black_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_blue.png b/mods/mobs/textures/mobs_sheep_blue.png deleted file mode 100755 index 5cc82b09..00000000 Binary files a/mods/mobs/textures/mobs_sheep_blue.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_blue_inv.png b/mods/mobs/textures/mobs_sheep_blue_inv.png deleted file mode 100755 index 9a3b843e..00000000 Binary files a/mods/mobs/textures/mobs_sheep_blue_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_brown.png b/mods/mobs/textures/mobs_sheep_brown.png deleted file mode 100755 index 1c6211d5..00000000 Binary files a/mods/mobs/textures/mobs_sheep_brown.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_brown_inv.png b/mods/mobs/textures/mobs_sheep_brown_inv.png deleted file mode 100755 index efaaa6d3..00000000 Binary files a/mods/mobs/textures/mobs_sheep_brown_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_cyan.png b/mods/mobs/textures/mobs_sheep_cyan.png deleted file mode 100755 index 02f296c9..00000000 Binary files a/mods/mobs/textures/mobs_sheep_cyan.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_cyan_inv.png b/mods/mobs/textures/mobs_sheep_cyan_inv.png deleted file mode 100755 index 4e03149c..00000000 Binary files a/mods/mobs/textures/mobs_sheep_cyan_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_dark_green.png b/mods/mobs/textures/mobs_sheep_dark_green.png deleted file mode 100755 index 3b7a2b08..00000000 Binary files a/mods/mobs/textures/mobs_sheep_dark_green.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_dark_green_inv.png b/mods/mobs/textures/mobs_sheep_dark_green_inv.png deleted file mode 100755 index 51fee9b2..00000000 Binary files a/mods/mobs/textures/mobs_sheep_dark_green_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_dark_grey.png b/mods/mobs/textures/mobs_sheep_dark_grey.png deleted file mode 100755 index 6d569f9b..00000000 Binary files a/mods/mobs/textures/mobs_sheep_dark_grey.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_dark_grey_inv.png b/mods/mobs/textures/mobs_sheep_dark_grey_inv.png deleted file mode 100755 index 8785e29e..00000000 Binary files a/mods/mobs/textures/mobs_sheep_dark_grey_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_green.png b/mods/mobs/textures/mobs_sheep_green.png deleted file mode 100755 index ac52d9b7..00000000 Binary files a/mods/mobs/textures/mobs_sheep_green.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_green_inv.png b/mods/mobs/textures/mobs_sheep_green_inv.png deleted file mode 100755 index ba3596b7..00000000 Binary files a/mods/mobs/textures/mobs_sheep_green_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_grey.png b/mods/mobs/textures/mobs_sheep_grey.png deleted file mode 100755 index 3750d2fa..00000000 Binary files a/mods/mobs/textures/mobs_sheep_grey.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_grey_inv.png b/mods/mobs/textures/mobs_sheep_grey_inv.png deleted file mode 100755 index 6259ba80..00000000 Binary files a/mods/mobs/textures/mobs_sheep_grey_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_magenta.png b/mods/mobs/textures/mobs_sheep_magenta.png deleted file mode 100755 index b03a210c..00000000 Binary files a/mods/mobs/textures/mobs_sheep_magenta.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_magenta_inv.png b/mods/mobs/textures/mobs_sheep_magenta_inv.png deleted file mode 100755 index db8f3e0b..00000000 Binary files a/mods/mobs/textures/mobs_sheep_magenta_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_orange.png b/mods/mobs/textures/mobs_sheep_orange.png deleted file mode 100755 index 6ddedebf..00000000 Binary files a/mods/mobs/textures/mobs_sheep_orange.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_orange_inv.png b/mods/mobs/textures/mobs_sheep_orange_inv.png deleted file mode 100755 index 7e533e00..00000000 Binary files a/mods/mobs/textures/mobs_sheep_orange_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_pink.png b/mods/mobs/textures/mobs_sheep_pink.png deleted file mode 100755 index 2b534cd3..00000000 Binary files a/mods/mobs/textures/mobs_sheep_pink.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_pink_inv.png b/mods/mobs/textures/mobs_sheep_pink_inv.png deleted file mode 100755 index b04a7b07..00000000 Binary files a/mods/mobs/textures/mobs_sheep_pink_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_red.png b/mods/mobs/textures/mobs_sheep_red.png deleted file mode 100755 index 7110b7fc..00000000 Binary files a/mods/mobs/textures/mobs_sheep_red.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_red_inv.png b/mods/mobs/textures/mobs_sheep_red_inv.png deleted file mode 100755 index c785465d..00000000 Binary files a/mods/mobs/textures/mobs_sheep_red_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_shaved.png b/mods/mobs/textures/mobs_sheep_shaved.png index e667aa4c..8414806e 100755 Binary files a/mods/mobs/textures/mobs_sheep_shaved.png and b/mods/mobs/textures/mobs_sheep_shaved.png differ diff --git a/mods/mobs/textures/mobs_sheep_shaved_inv.png b/mods/mobs/textures/mobs_sheep_shaved_inv.png deleted file mode 100755 index 40101b91..00000000 Binary files a/mods/mobs/textures/mobs_sheep_shaved_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_violet.png b/mods/mobs/textures/mobs_sheep_violet.png deleted file mode 100755 index a43d0fbc..00000000 Binary files a/mods/mobs/textures/mobs_sheep_violet.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_violet_inv.png b/mods/mobs/textures/mobs_sheep_violet_inv.png deleted file mode 100755 index 6b400cf8..00000000 Binary files a/mods/mobs/textures/mobs_sheep_violet_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_white.png b/mods/mobs/textures/mobs_sheep_white.png deleted file mode 100755 index 6844413e..00000000 Binary files a/mods/mobs/textures/mobs_sheep_white.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_wool.png b/mods/mobs/textures/mobs_sheep_wool.png new file mode 100755 index 00000000..1c3e0be8 Binary files /dev/null and b/mods/mobs/textures/mobs_sheep_wool.png differ diff --git a/mods/mobs/textures/mobs_sheep_yellow.png b/mods/mobs/textures/mobs_sheep_yellow.png deleted file mode 100755 index 49e616b5..00000000 Binary files a/mods/mobs/textures/mobs_sheep_yellow.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_sheep_yellow_inv.png b/mods/mobs/textures/mobs_sheep_yellow_inv.png deleted file mode 100755 index 67ed1a33..00000000 Binary files a/mods/mobs/textures/mobs_sheep_yellow_inv.png and /dev/null differ diff --git a/mods/mobs/textures/mobs_stone_monster2.png b/mods/mobs/textures/mobs_stone_monster2.png new file mode 100755 index 00000000..70bfc6ec Binary files /dev/null and b/mods/mobs/textures/mobs_stone_monster2.png differ