Fix farm mobs following players slowly, adjust animations to follow suit, increase pig view range slightly, and change the runaway animation from walk to run.

This commit is contained in:
MysticTempest 2020-08-03 08:37:58 -05:00
parent 4c05c2e70c
commit 460d6e837a
11 changed files with 29 additions and 16 deletions

View File

@ -1931,16 +1931,16 @@ local follow_flop = function(self)
if p.x > s.x then yaw = yaw + pi end
set_yaw(self, yaw, 6)
set_yaw(self, yaw, 2.35)
-- anyone but standing npc's can move along
if dist > self.reach
if dist > 3
and self.order ~= "stand" then
set_velocity(self, self.walk_velocity)
set_velocity(self, self.follow_velocity)
if self.walk_chance ~= 0 then
set_animation(self, "walk")
set_animation(self, "run")
end
else
set_velocity(self, 0)
@ -2179,7 +2179,7 @@ local do_states = function(self, dtime)
set_animation(self, "stand")
else
set_velocity(self, self.run_velocity)
set_animation(self, "walk")
set_animation(self, "run")
end
-- attack routines (explode, dogfight, shoot, dogshoot)
@ -3472,6 +3472,7 @@ minetest.register_entity(name, {
sounds_child = def.sounds_child,
explosion_strength = def.explosion_strength,
suffocation_timer = 0,
follow_velocity = def.follow_velocity or 2.4,
-- End of MCL2 extensions
on_spawn = def.on_spawn,

View File

@ -241,6 +241,7 @@ functions needed for the mob to work properly which contains the following:
dir is mob's aiming direction
'sounds_child' same as sounds, but for childs. If not defined, childs will use same
sound as adults but with higher pitch
'follow_velocity' The speed at which a mob moves toward the player when they're holding the appropriate follow item.
Node Replacement

View File

@ -35,10 +35,11 @@ local cow_def = {
distance = 16,
},
animation = {
stand_speed = 25, walk_speed = 25, run_speed = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
stand_speed = 25, walk_speed = 40,
run_speed = 60, stand_start = 0,
stand_end = 0, walk_start = 0,
walk_end = 40, run_start = 0,
run_end = 40,
},
follow = mobs_mc.follow.cow,
on_rightclick = function(self, clicker)

View File

@ -96,7 +96,7 @@ local horse = {
walk_speed = 25,
walk_start = 0,
walk_end = 40,
run_speed = 50,
run_speed = 60,
run_start = 0,
run_end = 40,
},

View File

@ -46,6 +46,7 @@ mobs:register_mob("mobs_mc:llama", {
runaway = true,
walk_velocity = 1,
run_velocity = 4.4,
follow_velocity = 4.4,
floats = 1,
drops = {
{name = mobs_mc.items.leather,
@ -61,6 +62,9 @@ mobs:register_mob("mobs_mc:llama", {
},
animation = {
speed_normal = 24,
run_speed = 60,
run_start = 0,
run_end = 40,
stand_start = 0,
stand_end = 0,
walk_start = 0,

View File

@ -41,6 +41,7 @@ local ocelot = {
walk_chance = default_walk_chance,
walk_velocity = 1,
run_velocity = 3,
follow_velocity = 1,
floats = 1,
runaway = true,
fall_damage = 0,
@ -52,7 +53,7 @@ local ocelot = {
},
animation = {
speed_normal = 25,
speed_run = 50,
run_speed = 50,
stand_start = 0,
stand_end = 0,
walk_start = 0,
@ -105,6 +106,7 @@ cat.order = "roam" -- "sit" or "roam"
cat.owner_loyal = true
cat.tamed = true
cat.runaway = false
cat.follow_velocity = 2.4
-- Automatically teleport cat to owner
cat.do_custom = mobs_mc.make_owner_teleport_function(12)
cat.sounds = {

View File

@ -20,6 +20,7 @@ mobs:register_mob("mobs_mc:pig", {
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 3,
follow_velocity = 3.4,
drops = {
{name = mobs_mc.items.porkchop_raw,
chance = 1,
@ -36,7 +37,7 @@ mobs:register_mob("mobs_mc:pig", {
animation = {
stand_speed = 40,
walk_speed = 40,
run_speed = 50,
run_speed = 90,
stand_start = 0,
stand_end = 0,
walk_start = 0,
@ -45,7 +46,7 @@ mobs:register_mob("mobs_mc:pig", {
run_end = 40,
},
follow = mobs_mc.follow.pig,
view_range = 5,
view_range = 8,
do_custom = function(self, dtime)
-- set needed values if not already present

View File

@ -27,6 +27,7 @@ local rabbit = {
makes_footstep_sound = false,
walk_velocity = 1,
run_velocity = 3.7,
follow_velocity = 1.1,
floats = 1,
runaway = true,
jump = true,

View File

@ -76,8 +76,8 @@ mobs:register_mob("mobs_mc:sheep", {
distance = 16,
},
animation = {
speed_normal = 25, speed_run = 50,
stand_start = 40, stand_end = 80,
speed_normal = 25, run_speed = 65,
stand_start = 40, stand_end = 80,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},

View File

@ -125,6 +125,7 @@ dog.owner = ""
-- TODO: Start sitting by default
dog.order = "roam"
dog.owner_loyal = true
dog.follow_velocity = 3.2
-- Automatically teleport dog to owner
dog.do_custom = mobs_mc.make_owner_teleport_function(12)
dog.follow = mobs_mc.follow.dog

View File

@ -129,9 +129,10 @@ mobs_mc.override.items = {
},
}
--Horses, Llamas, and Wolves shouldn't follow, but leaving this alone until leads are implemented.
mobs_mc.override.follow = {
chicken = { "mcl_farming:wheat_seeds", "mcl_farming:melon_seeds", "mcl_farming:pumpkin_seeds", "mcl_farming:beetroot_seeds", },
parrot = { "mcl_farming:seed_wheat", "mcl_farming:seed_beetroot", "mcl_farming:seed_pumpkin", "mcl_farming:seed_melon" }, -- seeds in general
parrot = { "mcl_farming:wheat_seeds", "mcl_farming:melon_seeds", "mcl_farming:pumpkin_seeds", "mcl_farming:beetroot_seeds", },
pig = { mobs_mc.override.items.potato, mobs_mc.override.items.carrot, "mcl_farming:beetroot_item", mobs_mc.override.items.carrot_on_a_stick},
ocelot = { mobs_mc.override.items.fish_raw, mobs_mc.override.items.salmon_raw, mobs_mc.override.items.clownfish_raw, mobs_mc.override.items.pufferfish_raw, },
sheep = { mobs_mc.override.items.wheat },