]> git.lizzy.rs Git - Crafter.git/commitdiff
Tweak mob direct chase AI
authoroilboi <47129783+oilboi@users.noreply.github.com>
Fri, 17 Apr 2020 06:48:02 +0000 (02:48 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Fri, 17 Apr 2020 06:48:02 +0000 (02:48 -0400)
README.md
mods/mob/pig/interaction_code.lua
mods/mob/slime/interaction_code.lua

index 2e72ed5cf87af78138bfad45c913fbdd27a059d4..a475d6c4fa897ba062e8c568ee523a3bc915cf64 100644 (file)
--- a/README.md
+++ b/README.md
@@ -77,6 +77,8 @@
 - Moved underground cave noises to client
 - Add line_of_sight so mobs can't hit you through walls
 - Add nether prototype
+- Fix water animation and add default Minetest water texture
+- Tweak mob direct chase AI
 ---
 
 
index a9f95e0f42d775ebf5a263bf2102a225e3ba998e..03142781a8c7d787b53c7564372703d5d5db5359 100644 (file)
@@ -196,7 +196,10 @@ pig.look_around = function(self,dtime)
                                                },vector.direction(pos,pos2))
                                        end
                                end
-                               self.speed = distance * 3
+                               self.speed = distance * 4
+                               if self.speed > 6 then
+                                       self.speed = 6
+                               end
                                self.following = true
                        end
                        --only look at one player
index 90a1c22b4829814be93595a6cadb9983b20ed108..92e30114e51c60bbd0b0492d7298a0823f6e965c 100644 (file)
@@ -160,7 +160,7 @@ slime.look_around = function(self,dtime)
 
        self.following = false
        local player_found = false
-       for _,object in ipairs(minetest.get_objects_inside_radius(pos, 6)) do
+       for _,object in ipairs(minetest.get_objects_inside_radius(pos, 12)) do
                if object:is_player() and player_found == false and object:get_hp() > 0 then
                        --look at player's camera
                        local pos2 = object:get_pos()
@@ -178,7 +178,7 @@ slime.look_around = function(self,dtime)
                                
                                local vel = self.object:get_velocity()
                                --punch the player
-                               if vel.y ~= 0 and distance < 1 and self.punch_timer <= 0 and object:get_hp() > 0 then
+                               if vel.y ~= 0 and distance <= 0 and self.punch_timer <= 0 and object:get_hp() > 0 then
                                        local line_of_sight = minetest.line_of_sight(pos, pos2)
                                        if line_of_sight == true then
                                                self.punch_timer = 1
@@ -189,7 +189,10 @@ slime.look_around = function(self,dtime)
                                                },vector.direction(pos,pos2))
                                        end
                                end
-                               self.speed = distance * 3
+                               self.speed = distance * 4
+                               if self.speed > 6 then
+                                       self.speed = 6
+                               end
                                self.following = true
                        end
                        --only look at one player