1
0
Fork 0

Merge branch 'master' into item_floating

wood_api
SumianVoice 2022-07-26 10:21:17 +00:00
commit c93461ee0a
42 changed files with 395 additions and 159 deletions

View File

@ -248,7 +248,7 @@ local set_velocity = function(self, v)
end end
-- halt mob if it has been ordered to stay -- 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}) self.object:set_velocity({x = 0, y = 0, z = 0})
return return
end end
@ -1907,10 +1907,9 @@ end
-- find someone to attack -- find someone to attack
local monster_attack = function(self) local monster_attack = function(self)
if not damage_enabled if not damage_enabled
or minetest.is_creative_enabled("") or minetest.is_creative_enabled("")
or self.passive or self.passive ~= false
or self.state == "attack" or self.state == "attack"
or day_docile(self) then or day_docile(self) then
return return
@ -2393,9 +2392,13 @@ local do_states = function(self, dtime)
yaw = set_yaw(self, yaw, 8) yaw = set_yaw(self, yaw, 8)
end end
if self.order == "sit" then
set_velocity(self, 0) set_animation(self, "sit")
set_animation(self, "stand") set_velocity(self, 0)
else
set_animation(self, "stand")
set_velocity(self, 0)
end
-- npc's ordered to stand stay standing -- npc's ordered to stand stay standing
if self.type ~= "npc" if self.type ~= "npc"
@ -3596,10 +3599,23 @@ local mob_activate = function(self, staticdata, def, dtime)
end end
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 -- main mob function
local mob_step = function(self, dtime) local mob_step = function(self, dtime)
check_item_pickup(self) check_item_pickup(self)
check_aggro(self,dtime)
if not self.fire_resistant then if not self.fire_resistant then
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
end end
@ -3930,7 +3946,7 @@ minetest.register_entity(name, {
xp_max = def.xp_max or 0, xp_max = def.xp_max or 0,
xp_timestamp = 0, xp_timestamp = 0,
breath_max = def.breath_max or 15, 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, physical = true,
collisionbox = collisionbox, collisionbox = collisionbox,
selectionbox = def.selectionbox or def.collisionbox, selectionbox = def.selectionbox or def.collisionbox,
@ -4018,6 +4034,7 @@ minetest.register_entity(name, {
teleport = teleport, teleport = teleport,
do_teleport = def.do_teleport, do_teleport = def.do_teleport,
spawn_class = def.spawn_class, spawn_class = def.spawn_class,
can_spawn = def.can_spawn,
ignores_nametag = def.ignores_nametag or false, ignores_nametag = def.ignores_nametag or false,
rain_damage = def.rain_damage or 0, rain_damage = def.rain_damage or 0,
glow = def.glow, glow = def.glow,
@ -4365,73 +4382,69 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
if not self.follow then if not self.follow then
return false return false
end end
-- can eat/tame with item in hand -- can eat/tame with item in hand
if self.nofollow or follow_holding(self, clicker) then if self.nofollow or follow_holding(self, clicker) then
local consume_food = false
-- if not in creative then take item -- tame if not still a baby
if not minetest.is_creative_enabled(clicker:get_player_name()) then
local item = clicker:get_wielded_item() if tame and not self.child then
if not self.owner or self.owner == "" then
if not notake then item:take_item() end self.tamed = true
self.owner = clicker:get_player_name()
clicker:set_wielded_item(item) consume_food = true
end
end end
mob_sound(self, "eat", nil, true)
-- increase health -- increase health
self.health = self.health + 4
if self.health >= self.hp_max then if self.health < self.hp_max and not consume_food then
consume_food = true
self.health = self.hp_max self.health = min(self.health + 4, self.hp_max)
if self.htimer < 1 then if self.htimer < 1 then
self.htimer = 5 self.htimer = 5
end end
self.object:set_hp(self.health)
end end
self.object:set_hp(self.health)
update_tag(self)
-- make children grow quicker -- 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 -- deduct 10% of the time to adulthood
self.hornytimer = self.hornytimer + ((CHILD_GROW_TIME - self.hornytimer) * 0.1) self.hornytimer = self.hornytimer + ((CHILD_GROW_TIME - self.hornytimer) * 0.1)
return true
end end
-- feed and tame -- breed animals
self.food = (self.food or 0) + 1
if self.food >= feed_count then
self.food = 0 if breed and not consume_food and self.hornytimer == 0 and not self.horny then
self.food = (self.food or 0) + 1
if breed and self.hornytimer == 0 then consume_food = true
if self.food >= feed_count then
self.food = 0
self.horny = true self.horny = true
end 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 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 return true
end end
return false return false
end end
@ -4481,31 +4494,6 @@ function mcl_mobs:spawn_child(pos, mob_type)
return child return child
end 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 local timer = 0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
timer = timer + dtime timer = timer + dtime

View File

@ -533,6 +533,9 @@ if mobs_spawn then
return return
end end
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 --everything is correct, spawn mob
local object local object
if spawn_in_group then if spawn_in_group then

View File

@ -38,6 +38,12 @@ local function wither_spawn(pos)
if check_schem(p, schem) then if check_schem(p, schem) then
remove_schem(p, schem) remove_schem(p, schem)
minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither") 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 end
end end

View File

@ -74,7 +74,7 @@ mcl_mobs:register_mob("mobs_mc:chicken", {
fear_height = 4, fear_height = 4,
on_rightclick = function(self, clicker) 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:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
end, end,

View File

@ -48,7 +48,7 @@ local cow_def = {
run_end = 40, run_end = 40,
}, },
on_rightclick = function(self, clicker) 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:protect(self, clicker) then return end
if self.child then if self.child then
@ -87,7 +87,7 @@ mooshroom_def.spawn_in_group_min = 4
mooshroom_def.spawn_in_group = 8 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.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) 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 mcl_mobs:protect(self, clicker) then return end
if self.child then if self.child then

View File

@ -257,6 +257,9 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
}, },
animation = select_enderman_animation("normal"), animation = select_enderman_animation("normal"),
_taken_node = "", _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) do_custom = function(self, dtime)
-- PARTICLE BEHAVIOUR HERE. -- PARTICLE BEHAVIOUR HERE.
local enderpos = self.object:get_pos() local enderpos = self.object:get_pos()

View File

@ -65,6 +65,14 @@ mcl_mobs:register_mob("mobs_mc:ghast", {
makes_footstep_sound = false, makes_footstep_sound = false,
instant_death = true, instant_death = true,
fire_resistant = 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) do_custom = function(self)
if self.firing == true then if self.firing == true then
self.base_texture = {"mobs_mc_ghast_firing.png"} self.base_texture = {"mobs_mc_ghast_firing.png"}

View File

@ -145,4 +145,5 @@ dofile(path .. "/wither.lua") -- Mesh and animation by toby109tt / https://gith
dofile(path .. "/cod.lua") dofile(path .. "/cod.lua")
dofile(path .. "/salmon.lua") dofile(path .. "/salmon.lua")
dofile(path .. "/tropical_fish.lua")
dofile(path .. "/dolphin.lua") dofile(path .. "/dolphin.lua")

View File

@ -28,13 +28,17 @@ mcl_mobs:register_mob("mobs_mc:llama", {
description = S("Llama"), description = S("Llama"),
type = "animal", type = "animal",
spawn_class = "passive", 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_min = 4,
spawn_in_group = 6, spawn_in_group = 6,
hp_min = 15, hp_min = 15,
hp_max = 30, hp_max = 30,
xp_min = 1, xp_min = 1,
xp_max = 3, xp_max = 3,
passive = false,
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45}, collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45},
visual = "mesh", visual = "mesh",
mesh = "mobs_mc_llama.b3d", mesh = "mobs_mc_llama.b3d",
@ -47,7 +51,7 @@ mcl_mobs:register_mob("mobs_mc:llama", {
}, },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
makes_footstep_sound = true, makes_footstep_sound = true,
runaway = true, runaway = false,
walk_velocity = 1, walk_velocity = 1,
run_velocity = 4.4, run_velocity = 4.4,
follow_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 --spawn
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
"mobs_mc:llama", "mobs_mc:llama",

View File

@ -99,7 +99,7 @@ mcl_mobs:register_mob("mobs_mc:pig", {
local wielditem = clicker:get_wielded_item() local wielditem = clicker:get_wielded_item()
-- Feed pig -- Feed pig
if wielditem:get_name() ~= "mcl_mobitems:carrot_on_a_stick" then 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 end
if mcl_mobs:protect(self, clicker) then return end if mcl_mobs:protect(self, clicker) then return end

View File

@ -75,7 +75,7 @@ local rabbit = {
}, },
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
-- Feed, tame protect or capture -- 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:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
end, end,

View File

@ -70,6 +70,8 @@ mcl_mobs:register_mob("mobs_mc:sheep", {
color = "unicolor_white", color = "unicolor_white",
makes_footstep_sound = true, makes_footstep_sound = true,
walk_velocity = 1, walk_velocity = 1,
runaway = true,
runaway_from = {"mobs_mc:wolf"},
drops = { drops = {
{name = "mcl_mobitems:mutton", {name = "mcl_mobitems:mutton",
chance = 1, chance = 1,
@ -195,7 +197,7 @@ mcl_mobs:register_mob("mobs_mc:sheep", {
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() 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 mcl_mobs:protect(self, clicker) then return end
if item:get_name() == "mcl_tools:shears" and not self.gotten and not self.child then if item:get_name() == "mcl_tools:shears" and not self.gotten and not self.child then

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

View File

@ -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)

View File

@ -65,6 +65,11 @@ local wolf = {
dog:set_yaw(yaw) dog:set_yaw(yaw)
ent = dog:get_luaentity() ent = dog:get_luaentity()
ent.owner = clicker:get_player_name() 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 -- cornfirm taming
minetest.sound_play("mobs_mc_wolf_bark", {object=dog, max_hear_distance=16}, true) minetest.sound_play("mobs_mc_wolf_bark", {object=dog, max_hear_distance=16}, true)
-- Replace wolf -- Replace wolf
@ -74,9 +79,10 @@ local wolf = {
end, end,
animation = { animation = {
speed_normal = 50, speed_run = 100, speed_normal = 50, speed_run = 100,
stand_start = 40, stand_end = 45, stand_start = 0, stand_end = 40,
walk_start = 0, walk_end = 40, walk_start = 40, walk_end = 80,
run_start = 0, run_end = 40, run_start = 80, run_end = 120,
sit_start = 121, sit_end = 140,
}, },
jump = true, jump = true,
attacks_monsters = true, attacks_monsters = true,
@ -127,7 +133,8 @@ dog.hp_max = 20
dog.textures = get_dog_textures("unicolor_red") dog.textures = get_dog_textures("unicolor_red")
dog.owner = "" dog.owner = ""
-- TODO: Start sitting by default -- TODO: Start sitting by default
dog.order = "roam" dog.order = "sit"
dog.state = "stand"
dog.owner_loyal = true dog.owner_loyal = true
dog.follow_velocity = 3.2 dog.follow_velocity = 3.2
-- Automatically teleport dog to owner -- Automatically teleport dog to owner
@ -150,33 +157,12 @@ end
dog.on_rightclick = function(self, clicker) dog.on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() 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 return
elseif item:get_name() ~= "" and mcl_mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then elseif item:get_name() ~= "" and mcl_mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then
return 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 elseif minetest.get_item_group(item:get_name(), "dye") == 1 then
-- Dye (if possible) -- Dye (if possible)
for group, _ in pairs(colors) do 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 if not self.order or self.order == "" or self.order == "sit" then
particle = "mobs_mc_wolf_icon_roam.png" particle = "mobs_mc_wolf_icon_roam.png"
self.order = "roam" self.order = "roam"
self.state = "stand"
self.walk_chance = default_walk_chance self.walk_chance = default_walk_chance
self.jump = true self.jump = true
mcl_mobs:set_animation(self, "stand")
-- TODO: Add sitting model -- TODO: Add sitting model
else else
particle = "mobs_mc_wolf_icon_sit.png" particle = "mobs_mc_wolf_icon_sit.png"
self.order = "sit" self.order = "sit"
self.state = "stand"
self.walk_chance = 0 self.walk_chance = 0
self.jump = false self.jump = false
mcl_mobs:set_animation(self, "sit")
end end
-- Display icon to show current order (sit or roam) -- Display icon to show current order (sit or roam)
minetest.add_particle({ minetest.add_particle({

View File

@ -231,6 +231,12 @@ awards.register_achievement("mcl:tacticalFishing", {
icon = "pufferfish_bucket.png", 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 -- Triggered in mcl_fishing
awards.register_achievement("mcl:fishyBusiness", { awards.register_achievement("mcl:fishyBusiness", {
title = S("Fishy Business"), title = S("Fishy Business"),

View File

@ -63,6 +63,8 @@ Not Quite "Nine" Lives=
Charge a Respawn Anchor to the maximum.= Charge a Respawn Anchor to the maximum.=
What A Deal!= What A Deal!=
Successfully trade with a Villager.= Successfully trade with a Villager.=
Withering Heights=
Summon the wither from the dead.=
Fishy Business= Fishy Business=
Catch a fish.@nHint: Catch a fish, salmon, clownfish, or pufferfish.= Catch a fish.@nHint: Catch a fish, salmon, clownfish, or pufferfish.=
Country Lode,@nTake Me Home= Country Lode,@nTake Me Home=

View File

@ -63,11 +63,12 @@ minetest.register_node("mcl_core:stone_with_iron", {
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {pickaxey=3, building_block=1, material_stone=1, blast_furnace_smeltable=1}, 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(), sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_silk_touch_drop = true, _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, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {pickaxey=4, building_block=1, material_stone=1, blast_furnace_smeltable=1}, 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(), sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
}) })
local redstone_timer = 68.28 local redstone_timer = 68.28

View File

@ -520,9 +520,9 @@ end )
-- Fish Buckets -- Fish Buckets
fish_names = { fish_names = {
{ techname = "cod", name = "Cod" }, { techname = "cod", name = "Cod" },
{ techname = "salmon", name = "Salmon" } { techname = "salmon", name = "Salmon" },
--{ techname = "pufferfish", name = "Pufferfish" } FIXME: Uncomment when pufferfish mobs are added. --{ 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 for _, fish in pairs(fish_names) do

View File

@ -18,6 +18,7 @@ Catches fish in water=
Very poisonous= Very poisonous=
Cod= Cod=
Salmon= Salmon=
Tropical Fish=
Bucket of @1= Bucket of @1=
This bucket is filled with water and @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.= Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.=

View File

@ -1,49 +1,56 @@
local function register_raw_ore(description, n) local function register_raw_ore(description, n)
local ore = description:lower() local ore = description:lower()
local n = n or "" local n = n or ""
local raw_ingot = "mcl_raw_ores:raw_"..ore local raw_ingot = "mcl_raw_ores:raw_"..ore
local texture = "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), description = ("Raw "..description),
_doc_items_longdesc = ("Raw "..ore..". Mine a"..n.." "..ore.." ore to get it."), _doc_items_longdesc = ("Raw "..ore..". Mine a"..n.." "..ore.." ore to get it."),
inventory_image = texture..".png", inventory_image = texture..".png",
groups = { craftitem = 1 }, groups = { craftitem = 1, blast_furnace_smeltable = 1 },
}) })
minetest.register_node(raw_ingot.."_block", { minetest.register_node(raw_ingot.."_block", {
description = ("Block of Raw "..description), 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.."."), _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" }, tiles = { texture.."_block.png" },
is_ground_content = false, is_ground_content = false,
groups = { pickaxey = 2, building_block = 1 }, groups = { pickaxey = 2, building_block = 1, blast_furnace_smeltable = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(), sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 5, _mcl_hardness = 5,
}) })
minetest.register_craft({ minetest.register_craft({
output = raw_ingot.."_block", output = raw_ingot.."_block",
recipe = { recipe = {
{ raw_ingot, raw_ingot, raw_ingot }, { raw_ingot, raw_ingot, raw_ingot },
{ raw_ingot, raw_ingot, raw_ingot }, { raw_ingot, raw_ingot, raw_ingot },
{ raw_ingot, raw_ingot, raw_ingot }, { raw_ingot, raw_ingot, raw_ingot },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "mcl_core:"..ore.."_ingot", output = "mcl_core:"..ore.."_ingot",
recipe = raw_ingot, recipe = raw_ingot,
cooktime = 10, cooktime = 10,
}) })
minetest.register_craft({ minetest.register_craft({
output = raw_ingot.." 9", type = "cooking",
recipe = { output = "mcl_core:"..ore.."block",
{ raw_ingot.."_block" }, recipe = raw_ingot.."_block",
}, cooktime = 90,
}) })
minetest.register_craft({
output = raw_ingot.." 9",
recipe = {
{ raw_ingot.."_block" },
},
})
end end
register_raw_ore("Iron", "n") register_raw_ore("Iron", "n")

View File

@ -219,12 +219,11 @@ end
local shield_hud = {} local shield_hud = {}
local function remove_shield_hud(player) local function remove_shield_hud(player)
if shield_hud[player] then 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]) player:hud_remove(shield_hud[player])
shield_hud[player] = nil shield_hud[player] = nil
set_shield(player, false, 1) set_shield(player, false, 1)
set_shield(player, false, 2) set_shield(player, false, 2)
end
local hf = player:hud_get_flags() local hf = player:hud_get_flags()
if not hf.wielditem then if not hf.wielditem then

View File

@ -85,6 +85,9 @@ function mcl_hunger.update_saturation_hud(player, saturation, hunger)
end end
function mcl_hunger.update_exhaustion_hud(player, exhaustion) function mcl_hunger.update_exhaustion_hud(player, exhaustion)
if mcl_hunger.debug then if mcl_hunger.debug then
if not exhaustion then
exhaustion = mcl_hunger.get_exhaustion(player)
end
hb.change_hudbar(player, "exhaustion", exhaustion) hb.change_hudbar(player, "exhaustion", exhaustion)
end end
end end
@ -151,14 +154,14 @@ minetest.register_globalstep(function(dtime)
-- let hunger work always -- let hunger work always
if player_health > 0 and player_health <= 20 then 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.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 end
if food_level >= 18 then -- slow regeneration if food_level >= 18 then -- slow regeneration
if player_health > 0 and player_health < 20 then if player_health > 0 and player_health < 20 then
player:set_hp(player_health+1) player:set_hp(player_health+1)
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) 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
elseif food_level == 0 then -- starvation elseif food_level == 0 then -- starvation
@ -176,7 +179,7 @@ minetest.register_globalstep(function(dtime)
food_tick_timer = 0 food_tick_timer = 0
player:set_hp(player_health+1) player:set_hp(player_health+1)
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) 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
end end

View File

@ -65,6 +65,7 @@ local function cancelClientSprinting(name)
end end
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting) 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 player = minetest.get_player_by_name(playerName)
local controls = player:get_player_control() local controls = player:get_player_control()
if players[playerName] then if players[playerName] then