diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index c7b55b32a..8945c6e20 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -248,7 +248,7 @@ local set_velocity = function(self, v) end -- halt mob if it has been ordered to stay - if self.order == "stand" then + if self.order == "stand" or self.order == "sit" then self.object:set_velocity({x = 0, y = 0, z = 0}) return end @@ -1907,10 +1907,9 @@ end -- find someone to attack local monster_attack = function(self) - if not damage_enabled or minetest.is_creative_enabled("") - or self.passive + or self.passive ~= false or self.state == "attack" or day_docile(self) then return @@ -2393,9 +2392,13 @@ local do_states = function(self, dtime) yaw = set_yaw(self, yaw, 8) end - - set_velocity(self, 0) - set_animation(self, "stand") + if self.order == "sit" then + set_animation(self, "sit") + set_velocity(self, 0) + else + set_animation(self, "stand") + set_velocity(self, 0) + end -- npc's ordered to stand stay standing if self.type ~= "npc" @@ -3596,10 +3599,23 @@ local mob_activate = function(self, staticdata, def, dtime) end end +local function check_aggro(self,dtime) + if not self._aggro or not self.attack then return end + if not self._check_aggro_timer or self._check_aggro_timer > 5 then + self._check_aggro_timer = 0 + if not self.attack:get_pos() or vector.distance(self.attack:get_pos(),self.object:get_pos()) > 128 then + self._aggro = nil + self.attack = nil + self.state = "stand" + end + end + self._check_aggro_timer = self._check_aggro_timer + dtime +end -- main mob function local mob_step = function(self, dtime) check_item_pickup(self) + check_aggro(self,dtime) if not self.fire_resistant then mcl_burning.tick(self.object, dtime, self) end @@ -3930,7 +3946,7 @@ minetest.register_entity(name, { xp_max = def.xp_max or 0, xp_timestamp = 0, breath_max = def.breath_max or 15, - breathes_in_water = def.breathes_in_water or false, + breathes_in_water = def.breathes_in_water or false, physical = true, collisionbox = collisionbox, selectionbox = def.selectionbox or def.collisionbox, @@ -4018,6 +4034,7 @@ minetest.register_entity(name, { teleport = teleport, do_teleport = def.do_teleport, spawn_class = def.spawn_class, + can_spawn = def.can_spawn, ignores_nametag = def.ignores_nametag or false, rain_damage = def.rain_damage or 0, glow = def.glow, @@ -4365,73 +4382,69 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake) if not self.follow then return false end - -- can eat/tame with item in hand if self.nofollow or follow_holding(self, clicker) then + local consume_food = false - -- if not in creative then take item - if not minetest.is_creative_enabled(clicker:get_player_name()) then + -- tame if not still a baby - local item = clicker:get_wielded_item() - - if not notake then item:take_item() end - - clicker:set_wielded_item(item) + if tame and not self.child then + if not self.owner or self.owner == "" then + self.tamed = true + self.owner = clicker:get_player_name() + consume_food = true + end end - mob_sound(self, "eat", nil, true) - -- increase health - self.health = self.health + 4 - if self.health >= self.hp_max then - - self.health = self.hp_max + if self.health < self.hp_max and not consume_food then + consume_food = true + self.health = min(self.health + 4, self.hp_max) if self.htimer < 1 then self.htimer = 5 end + self.object:set_hp(self.health) end - self.object:set_hp(self.health) - - update_tag(self) - -- make children grow quicker - if self.child == true then + if not consume_food and self.child == true then + consume_food = true -- deduct 10% of the time to adulthood self.hornytimer = self.hornytimer + ((CHILD_GROW_TIME - self.hornytimer) * 0.1) - - return true end - -- feed and tame - self.food = (self.food or 0) + 1 - if self.food >= feed_count then + -- breed animals - self.food = 0 - - if breed and self.hornytimer == 0 then + if breed and not consume_food and self.hornytimer == 0 and not self.horny then + self.food = (self.food or 0) + 1 + consume_food = true + if self.food >= feed_count then + self.food = 0 self.horny = true end - - if tame then - - self.tamed = true - - if not self.owner or self.owner == "" then - self.owner = clicker:get_player_name() - end - end - - -- make sound when fed so many times - mob_sound(self, "random", true) end + update_tag(self) + -- play a sound if the animal used the item and take the item if not in creative + if consume_food then + -- don't consume food if clicker is in creative + if not minetest.is_creative_enabled(clicker:get_player_name()) and not notake then + local item = clicker:get_wielded_item() + item:take_item() + clicker:set_wielded_item(item) + end + -- always play the eat sound if food is used, even in creative + mob_sound(self, "eat", nil, true) + + else + -- make sound when the mob doesn't want food + mob_sound(self, "random", true) + end return true end - return false end @@ -4481,31 +4494,6 @@ function mcl_mobs:spawn_child(pos, mob_type) return child end - --- compatibility function for old entities to new modpack entities -function mcl_mobs:alias_mob(old_name, new_name) - - -- spawn egg - minetest.register_alias(old_name, new_name) - - -- entity - minetest.register_entity(":" .. old_name, { - - physical = false, - - on_step = function(self) - - if minetest.registered_entities[new_name] then - minetest.add_entity(self.object:get_pos(), new_name) - end - - self.object:remove() - end - }) - -end - - local timer = 0 minetest.register_globalstep(function(dtime) timer = timer + dtime diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 4e45a0045..bc1b73716 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -533,6 +533,9 @@ if mobs_spawn then return end end + if minetest.registered_entities[mob_def.name].can_spawn and not minetest.registered_entities[mob_def.name].can_spawn(pos) then + return + end --everything is correct, spawn mob local object if spawn_in_group then diff --git a/mods/ENTITIES/mcl_wither_spawning/init.lua b/mods/ENTITIES/mcl_wither_spawning/init.lua index a8f7f108d..74cd1e6e2 100644 --- a/mods/ENTITIES/mcl_wither_spawning/init.lua +++ b/mods/ENTITIES/mcl_wither_spawning/init.lua @@ -38,6 +38,12 @@ local function wither_spawn(pos) if check_schem(p, schem) then remove_schem(p, schem) minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither") + local objects = minetest.get_objects_inside_radius(pos, 20) + for _, players in ipairs(objects) do + if players:is_player() then + awards.unlock(players:get_player_name(), "mcl:witheringHeights") + end + end end end end diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 886a945b9..5dc417582 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -74,7 +74,7 @@ mcl_mobs:register_mob("mobs_mc:chicken", { fear_height = 4, on_rightclick = function(self, clicker) - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end end, diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index d72a6c0f9..fe04650cd 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -48,7 +48,7 @@ local cow_def = { run_end = 40, }, on_rightclick = function(self, clicker) - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end if self.child then @@ -87,7 +87,7 @@ mooshroom_def.spawn_in_group_min = 4 mooshroom_def.spawn_in_group = 8 mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } } mooshroom_def.on_rightclick = function(self, clicker) - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end if self.child then diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 8472f76e0..a57a82931 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -257,6 +257,9 @@ mcl_mobs:register_mob("mobs_mc:enderman", { }, animation = select_enderman_animation("normal"), _taken_node = "", + can_spawn = function(pos) + return #minetest.find_nodes_in_area(vector.offset(pos,0,1,0),vector.offset(pos,0,3,0),{"air"}) > 2 + end, do_custom = function(self, dtime) -- PARTICLE BEHAVIOUR HERE. local enderpos = self.object:get_pos() diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index c5172c4e5..35e9bcd01 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -65,6 +65,14 @@ mcl_mobs:register_mob("mobs_mc:ghast", { makes_footstep_sound = false, instant_death = true, fire_resistant = true, + can_spawn = function(pos) + if not minetest.get_item_group(minetest.get_node(pos).name,"solid") then return false end + local p1=vector.offset(pos,-2,1,-2) + local p2=vector.offset(pos,2,5,2) + local nn = minetest.find_nodes_in_area(p1,p2,{"air"}) + if #nn< 41 then return false end + return true + end, do_custom = function(self) if self.firing == true then self.base_texture = {"mobs_mc_ghast_firing.png"} diff --git a/mods/ENTITIES/mobs_mc/init.lua b/mods/ENTITIES/mobs_mc/init.lua index 5be1af71c..120d7be0d 100644 --- a/mods/ENTITIES/mobs_mc/init.lua +++ b/mods/ENTITIES/mobs_mc/init.lua @@ -145,4 +145,5 @@ dofile(path .. "/wither.lua") -- Mesh and animation by toby109tt / https://gith dofile(path .. "/cod.lua") dofile(path .. "/salmon.lua") +dofile(path .. "/tropical_fish.lua") dofile(path .. "/dolphin.lua") diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index e11566e3e..5d3ed7718 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -28,13 +28,17 @@ mcl_mobs:register_mob("mobs_mc:llama", { description = S("Llama"), type = "animal", spawn_class = "passive", + passive = false, + attack_type = "shoot", + shoot_interval = 5.5, + arrow = "mobs_mc:llamaspit", + shoot_offset = 1, --3.5 *would* be a good value visually but it somehow messes with the projectiles trajectory spawn_in_group_min = 4, spawn_in_group = 6, hp_min = 15, hp_max = 30, xp_min = 1, xp_max = 3, - passive = false, collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45}, visual = "mesh", mesh = "mobs_mc_llama.b3d", @@ -47,7 +51,7 @@ mcl_mobs:register_mob("mobs_mc:llama", { }, visual_size = {x=3, y=3}, makes_footstep_sound = true, - runaway = true, + runaway = false, walk_velocity = 1, run_velocity = 4.4, follow_velocity = 4.4, @@ -213,6 +217,30 @@ mcl_mobs:register_mob("mobs_mc:llama", { }) +-- spit arrow (weapon) +mcl_mobs:register_arrow("mobs_mc:llamaspit", { + visual = "sprite", + visual_size = {x = 0.10, y = 0.10}, + textures = {"mobs_mc_llama_spit.png"}, + velocity = 5, + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_mob = function(self, mob) + mob:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_node = function(self, pos, node) + end +}) + --spawn mcl_mobs:spawn_specific( "mobs_mc:llama", diff --git a/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_a.b3d b/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_a.b3d new file mode 100644 index 000000000..2131319fa Binary files /dev/null and b/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_a.b3d differ diff --git a/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_b.b3d b/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_b.b3d new file mode 100644 index 000000000..b97bfb228 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/models/extra_mobs_tropical_fish_b.b3d differ diff --git a/mods/ENTITIES/mobs_mc/models/mobs_mc_wolf.b3d b/mods/ENTITIES/mobs_mc/models/mobs_mc_wolf.b3d index 63db5e097..28bdb3b49 100644 Binary files a/mods/ENTITIES/mobs_mc/models/mobs_mc_wolf.b3d and b/mods/ENTITIES/mobs_mc/models/mobs_mc_wolf.b3d differ diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index b1958dc69..b88e88d49 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -99,7 +99,7 @@ mcl_mobs:register_mob("mobs_mc:pig", { local wielditem = clicker:get_wielded_item() -- Feed pig if wielditem:get_name() ~= "mcl_mobitems:carrot_on_a_stick" then - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end end if mcl_mobs:protect(self, clicker) then return end diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index c11167007..2d7bc5e7e 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -75,7 +75,7 @@ local rabbit = { }, on_rightclick = function(self, clicker) -- Feed, tame protect or capture - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end end, diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 412c0cbdb..7e2027c6c 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -70,6 +70,8 @@ mcl_mobs:register_mob("mobs_mc:sheep", { color = "unicolor_white", makes_footstep_sound = true, walk_velocity = 1, + runaway = true, + runaway_from = {"mobs_mc:wolf"}, drops = { {name = "mcl_mobitems:mutton", chance = 1, @@ -195,7 +197,7 @@ mcl_mobs:register_mob("mobs_mc:sheep", { on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() - if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end if mcl_mobs:protect(self, clicker) then return end if item:get_name() == "mcl_tools:shears" and not self.gotten and not self.child then diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_spawn_icon_tropical_fish.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_spawn_icon_tropical_fish.png new file mode 100644 index 000000000..48dd8f986 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_spawn_icon_tropical_fish.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_a.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_a.png new file mode 100644 index 000000000..7d90a3e33 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_a.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_b.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_b.png new file mode 100644 index 000000000..d6471addc Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_b.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_1.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_1.png new file mode 100644 index 000000000..be50aa837 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_1.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_2.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_2.png new file mode 100644 index 000000000..05a555836 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_2.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_3.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_3.png new file mode 100644 index 000000000..0894fc226 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_3.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_4.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_4.png new file mode 100644 index 000000000..c43b4c8fc Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_4.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_5.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_5.png new file mode 100644 index 000000000..0f81fbb72 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_5.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_6.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_6.png new file mode 100644 index 000000000..f0deaf7c2 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_a_6.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_1.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_1.png new file mode 100644 index 000000000..783f6b702 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_1.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_2.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_2.png new file mode 100644 index 000000000..913776284 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_2.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_3.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_3.png new file mode 100644 index 000000000..bd5f3f2e9 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_3.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_4.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_4.png new file mode 100644 index 000000000..cab054aac Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_4.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_5.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_5.png new file mode 100644 index 000000000..31789172f Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_5.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_6.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_6.png new file mode 100644 index 000000000..87afb666b Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/extra_mobs_tropical_fish_pattern_b_6.png differ diff --git a/mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png b/mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png new file mode 100644 index 000000000..9433d2f86 Binary files /dev/null and b/mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png differ diff --git a/mods/ENTITIES/mobs_mc/tropical_fish.lua b/mods/ENTITIES/mobs_mc/tropical_fish.lua new file mode 100644 index 000000000..7dcc2d5cd --- /dev/null +++ b/mods/ENTITIES/mobs_mc/tropical_fish.lua @@ -0,0 +1,186 @@ +--Tropical Fish by cora +local S = minetest.get_translator(minetest.get_current_modname()) + +local base_colors = { + "#FF3855", + "#FFF700", + "#A7F432", + "#FF5470", + "#5DADEC", + "#A83731", + "#87FF2A", + "#E936A7", + "#FF007C", + "#9C51B6", + "#66FF66", + "#AAF0D1", + "#50BFE6", + "#FFFF66", + "#FF9966", + "#FF00CC", +} +local pattern_colors = { + "#FF3855", + "#FFF700", + "#A7F432", + "#FF5470", + "#5DADEC", + "#A83731", + "#87FF2A", + "#E936A7", + "#FF007C", + "#9C51B6", + "#66FF66", + "#AAF0D1", + "#50BFE6", + "#FFFF66", + "#FF9966", + "#FF00CC", +} + +local function set_textures(self) + if not self._type then + self._type = "a" + if math.random(2) == 1 then + self.object:set_properties({}) + self._type="b" + end + self._base_color = base_colors[math.random(#base_colors)] + self._pattern_color = pattern_colors[math.random(#pattern_colors)] + self._pattern = "extra_mobs_tropical_fish_pattern_"..self._type.."_"..math.random(6)..".png" + end + self.object:set_properties({ + textures = { + "(extra_mobs_tropical_fish_"..self._type..".png^[colorize:"..self._base_color..":127)^("..self._pattern.."^[colorize:"..self._pattern_color..")", + }, + mesh="extra_mobs_tropical_fish_"..self._type..".b3d" + }) +end + +local tropical_fish = { + type = "animal", + spawn_class = "water", + can_despawn = true, + passive = true, + hp_min = 3, + hp_max = 3, + xp_min = 1, + xp_max = 3, + armor = 100, + spawn_in_group = 9, + tilt_swim = true, + collisionbox = {-0.2, 0.0, -0.2, 0.2, 0.1, 0.2}, + visual = "mesh", + mesh = "extra_mobs_tropical_fish_a.b3d", + textures = {}, -- to be populated on_spawn + sounds = {}, + animation = { + stand_start = 0, + stand_end = 20, + walk_start = 20, + walk_end = 40, + run_start = 20, + run_end = 40, + }, + drops = { + {name = "mcl_fishing:clownfish_raw", + chance = 1, + min = 1, + max = 1,}, + {name = "mcl_dye:white", + chance = 20, + min = 1, + max = 1,}, + }, + visual_size = {x=3, y=3}, + makes_footstep_sound = false, + swim = true, + fly = true, + fly_in = "mcl_core:water_source", + breathes_in_water = true, + jump = false, + view_range = 16, + runaway = true, + fear_height = 4, + on_rightclick = function(self, clicker) + if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then + self.object:remove() + clicker:set_wielded_item("mcl_fishing:bucket_tropical_fish") + awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") + end + end, + on_spawn = set_textures, +} + +mcl_mobs:register_mob("mobs_mc:tropical_fish", tropical_fish) + +local water = 0 +mcl_mobs:spawn_specific( +"mobs_mc:tropical_fish", +"overworld", +"water", +{ +"Mesa", +"Jungle", +"Savanna", +"Desert", +"MesaPlateauFM_grasstop", +"JungleEdgeM", +"JungleM", +"MesaPlateauF", +"MesaPlateauFM", +"MesaPlateauF_grasstop", +"MesaBryce", +"JungleEdge", +"SavannaM", +"Savanna_beach", +"JungleM_shore", +"Jungle_shore", +"MesaPlateauFM_sandlevel", +"MesaPlateauF_sandlevel", +"MesaBryce_sandlevel", +"Mesa_sandlevel", +"JungleEdgeM_ocean", +"Jungle_deep_ocean", +"Savanna_ocean", +"MesaPlateauF_ocean", +"Savanna_deep_ocean", +"JungleEdgeM_deep_ocean", +"SunflowerPlains_deep_ocean", +"Mesa_ocean", +"JungleEdge_deep_ocean", +"SavannaM_deep_ocean", +"Desert_deep_ocean", +"Mesa_deep_ocean", +"MesaPlateauFM_ocean", +"JungleM_deep_ocean", +"SavannaM_ocean", +"MesaPlateauF_deep_ocean", +"MesaBryce_deep_ocean", +"JungleEdge_ocean", +"MesaBryce_ocean", +"Jungle_ocean", +"MesaPlateauFM_deep_ocean", +"Desert_ocean", +"JungleM_ocean", +"MesaBryce_underground", +"Mesa_underground", +"Jungle_underground", +"MesaPlateauF_underground", +"SavannaM_underground", +"MesaPlateauFM_underground", +"Desert_underground", +"Savanna_underground", +"JungleM_underground", +"JungleEdgeM_underground", +}, +0, +minetest.LIGHT_MAX+1, +30, +4000, +3, +water-16, +water+1) + +--spawn egg +mcl_mobs:register_egg("mobs_mc:tropical_fish", S("Tropical fish"), "extra_mobs_spawn_icon_tropical_fish.png", 0) diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index a1606836d..87b21eeb7 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -65,6 +65,11 @@ local wolf = { dog:set_yaw(yaw) ent = dog:get_luaentity() ent.owner = clicker:get_player_name() + ent.tamed = true + mcl_mobs:set_animation(ent, "sit") + ent.walk_chance = 0 + ent.jump = false + ent.health = self.health -- cornfirm taming minetest.sound_play("mobs_mc_wolf_bark", {object=dog, max_hear_distance=16}, true) -- Replace wolf @@ -74,9 +79,10 @@ local wolf = { end, animation = { speed_normal = 50, speed_run = 100, - stand_start = 40, stand_end = 45, - walk_start = 0, walk_end = 40, - run_start = 0, run_end = 40, + stand_start = 0, stand_end = 40, + walk_start = 40, walk_end = 80, + run_start = 80, run_end = 120, + sit_start = 121, sit_end = 140, }, jump = true, attacks_monsters = true, @@ -127,7 +133,8 @@ dog.hp_max = 20 dog.textures = get_dog_textures("unicolor_red") dog.owner = "" -- TODO: Start sitting by default -dog.order = "roam" +dog.order = "sit" +dog.state = "stand" dog.owner_loyal = true dog.follow_velocity = 3.2 -- Automatically teleport dog to owner @@ -150,33 +157,12 @@ end dog.on_rightclick = function(self, clicker) local item = clicker:get_wielded_item() - if mcl_mobs:protect(self, clicker) then + if mcl_mobs:feed_tame(self, clicker, 1, true, false) then + return + elseif mcl_mobs:protect(self, clicker) then return elseif item:get_name() ~= "" and mcl_mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then return - elseif is_food(item:get_name()) then - -- Feed to increase health - local hp = self.health - local hp_add = 0 - -- Use eatable group to determine health boost - local eatable = minetest.get_item_group(item, "eatable") - if eatable > 0 then - hp_add = eatable - elseif item:get_name() == "mcl_mobitems:rotten_flesh" then - hp_add = 4 - else - hp_add = 4 - end - local new_hp = hp + hp_add - if new_hp > self.hp_max then - new_hp = self.hp_max - end - if not minetest.is_creative_enabled(clicker:get_player_name()) then - item:take_item() - clicker:set_wielded_item(item) - end - self.health = new_hp - return elseif minetest.get_item_group(item:get_name(), "dye") == 1 then -- Dye (if possible) for group, _ in pairs(colors) do @@ -210,14 +196,18 @@ dog.on_rightclick = function(self, clicker) if not self.order or self.order == "" or self.order == "sit" then particle = "mobs_mc_wolf_icon_roam.png" self.order = "roam" + self.state = "stand" self.walk_chance = default_walk_chance self.jump = true + mcl_mobs:set_animation(self, "stand") -- TODO: Add sitting model else particle = "mobs_mc_wolf_icon_sit.png" self.order = "sit" + self.state = "stand" self.walk_chance = 0 self.jump = false + mcl_mobs:set_animation(self, "sit") end -- Display icon to show current order (sit or roam) minetest.add_particle({ diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 55e64b9b7..a70ee5b40 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -231,6 +231,12 @@ awards.register_achievement("mcl:tacticalFishing", { icon = "pufferfish_bucket.png", }) +awards.register_achievement("mcl:witheringHeights", { + title = S("Withering Heights"), + description = S("Summon the wither from the dead."), + icon = "mcl_mobitems_nether_star.png", +}) + -- Triggered in mcl_fishing awards.register_achievement("mcl:fishyBusiness", { title = S("Fishy Business"), diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt index cb97e5d00..4bbe5db3e 100644 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -63,6 +63,8 @@ Not Quite "Nine" Lives= Charge a Respawn Anchor to the maximum.= What A Deal!= Successfully trade with a Villager.= +Withering Heights= +Summon the wither from the dead.= Fishy Business= Catch a fish.@nHint: Catch a fish, salmon, clownfish, or pufferfish.= Country Lode,@nTake Me Home= diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 96d045710..773aa92a9 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -63,11 +63,12 @@ minetest.register_node("mcl_core:stone_with_iron", { is_ground_content = true, stack_max = 64, groups = {pickaxey=3, building_block=1, material_stone=1, blast_furnace_smeltable=1}, - drop = "mcl_core:stone_with_iron", + drop = "mcl_raw_ores:raw_iron", sounds = mcl_sounds.node_sound_stone_defaults(), _mcl_blast_resistance = 3, _mcl_hardness = 3, _mcl_silk_touch_drop = true, + _mcl_fortune_drop = mcl_core.fortune_drop_ore, }) @@ -78,11 +79,12 @@ minetest.register_node("mcl_core:stone_with_gold", { is_ground_content = true, stack_max = 64, groups = {pickaxey=4, building_block=1, material_stone=1, blast_furnace_smeltable=1}, - drop = "mcl_core:stone_with_gold", + drop = "mcl_raw_ores:raw_gold", sounds = mcl_sounds.node_sound_stone_defaults(), _mcl_blast_resistance = 3, _mcl_hardness = 3, _mcl_silk_touch_drop = true, + _mcl_fortune_drop = mcl_core.fortune_drop_ore, }) local redstone_timer = 68.28 diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 08c039bc3..6182b0471 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -520,9 +520,9 @@ end ) -- Fish Buckets fish_names = { { techname = "cod", name = "Cod" }, - { techname = "salmon", name = "Salmon" } + { techname = "salmon", name = "Salmon" }, --{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. - --{ techname = "tropical_fish", name = "Tropical Fish" } FIXME: Uncomment when pufferfish mobs are added. + { techname = "tropical_fish", name = "Tropical Fish" } } for _, fish in pairs(fish_names) do diff --git a/mods/ITEMS/mcl_fishing/locale/template.txt b/mods/ITEMS/mcl_fishing/locale/template.txt index 32e3d8740..a0d3c9d21 100644 --- a/mods/ITEMS/mcl_fishing/locale/template.txt +++ b/mods/ITEMS/mcl_fishing/locale/template.txt @@ -18,7 +18,8 @@ Catches fish in water= Very poisonous= Cod= Salmon= +Tropical Fish= Bucket of @1= This bucket is filled with water and @1.= Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.= -Places a water source and a @1 fish.= \ No newline at end of file +Places a water source and a @1 fish.= diff --git a/mods/ITEMS/mcl_raw_ores/init.lua b/mods/ITEMS/mcl_raw_ores/init.lua index 12ca8d222..679425067 100644 --- a/mods/ITEMS/mcl_raw_ores/init.lua +++ b/mods/ITEMS/mcl_raw_ores/init.lua @@ -1,49 +1,56 @@ local function register_raw_ore(description, n) - local ore = description:lower() - local n = n or "" - local raw_ingot = "mcl_raw_ores:raw_"..ore - local texture = "mcl_raw_ores_raw_"..ore + local ore = description:lower() + local n = n or "" + local raw_ingot = "mcl_raw_ores:raw_"..ore + local texture = "mcl_raw_ores_raw_"..ore - minetest.register_craftitem(raw_ingot, { + minetest.register_craftitem(raw_ingot, { description = ("Raw "..description), _doc_items_longdesc = ("Raw "..ore..". Mine a"..n.." "..ore.." ore to get it."), inventory_image = texture..".png", - groups = { craftitem = 1 }, - }) + groups = { craftitem = 1, blast_furnace_smeltable = 1 }, + }) - minetest.register_node(raw_ingot.."_block", { - description = ("Block of Raw "..description), - _doc_items_longdesc = ("A block of raw "..ore.." is mostly a decorative block but also useful as a compact storage of raw "..ore.."."), - tiles = { texture.."_block.png" }, - is_ground_content = false, - groups = { pickaxey = 2, building_block = 1 }, - sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6, - _mcl_hardness = 5, - }) + minetest.register_node(raw_ingot.."_block", { + description = ("Block of Raw "..description), + _doc_items_longdesc = ("A block of raw "..ore.." is mostly a decorative block but also useful as a compact storage of raw "..ore.."."), + tiles = { texture.."_block.png" }, + is_ground_content = false, + groups = { pickaxey = 2, building_block = 1, blast_furnace_smeltable = 1 }, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + }) - minetest.register_craft({ - output = raw_ingot.."_block", - recipe = { - { raw_ingot, raw_ingot, raw_ingot }, - { raw_ingot, raw_ingot, raw_ingot }, - { raw_ingot, raw_ingot, raw_ingot }, - }, - }) + minetest.register_craft({ + output = raw_ingot.."_block", + recipe = { + { raw_ingot, raw_ingot, raw_ingot }, + { raw_ingot, raw_ingot, raw_ingot }, + { raw_ingot, raw_ingot, raw_ingot }, + }, + }) - minetest.register_craft({ - type = "cooking", - output = "mcl_core:"..ore.."_ingot", - recipe = raw_ingot, - cooktime = 10, - }) + minetest.register_craft({ + type = "cooking", + output = "mcl_core:"..ore.."_ingot", + recipe = raw_ingot, + cooktime = 10, + }) - minetest.register_craft({ - output = raw_ingot.." 9", - recipe = { - { raw_ingot.."_block" }, - }, - }) + minetest.register_craft({ + type = "cooking", + output = "mcl_core:"..ore.."block", + recipe = raw_ingot.."_block", + cooktime = 90, + }) + + minetest.register_craft({ + output = raw_ingot.." 9", + recipe = { + { raw_ingot.."_block" }, + }, + }) end register_raw_ore("Iron", "n") diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 0ba02c1bb..eb7d45ff9 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -219,12 +219,11 @@ end local shield_hud = {} local function remove_shield_hud(player) - if shield_hud[player] then - player:hud_remove(shield_hud[player]) - shield_hud[player] = nil - set_shield(player, false, 1) - set_shield(player, false, 2) - end + if not shield_hud[player] then return end --this function takes a long time. only run it when necessary + player:hud_remove(shield_hud[player]) + shield_hud[player] = nil + set_shield(player, false, 1) + set_shield(player, false, 2) local hf = player:hud_get_flags() if not hf.wielditem then diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 0cae89a7d..9f25c5eda 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -85,6 +85,9 @@ function mcl_hunger.update_saturation_hud(player, saturation, hunger) end function mcl_hunger.update_exhaustion_hud(player, exhaustion) if mcl_hunger.debug then + if not exhaustion then + exhaustion = mcl_hunger.get_exhaustion(player) + end hb.change_hudbar(player, "exhaustion", exhaustion) end end @@ -151,14 +154,14 @@ minetest.register_globalstep(function(dtime) -- let hunger work always if player_health > 0 and player_health <= 20 then --mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_HUNGER) -- later for hunger status effect - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + mcl_hunger.update_exhaustion_hud(player) end if food_level >= 18 then -- slow regeneration if player_health > 0 and player_health < 20 then player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + mcl_hunger.update_exhaustion_hud(player) end elseif food_level == 0 then -- starvation @@ -176,7 +179,7 @@ minetest.register_globalstep(function(dtime) food_tick_timer = 0 player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + mcl_hunger.update_exhaustion_hud(player) end end diff --git a/mods/PLAYER/mcl_sprint/init.lua b/mods/PLAYER/mcl_sprint/init.lua index 4c0d609c9..7449ad18c 100644 --- a/mods/PLAYER/mcl_sprint/init.lua +++ b/mods/PLAYER/mcl_sprint/init.lua @@ -65,6 +65,7 @@ local function cancelClientSprinting(name) end local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting) + if not sprinting and not mcl_sprint.is_sprinting(playerName) then return end local player = minetest.get_player_by_name(playerName) local controls = player:get_player_control() if players[playerName] then