]> git.lizzy.rs Git - Crafter.git/commitdiff
Improve mob jumping, finalize spider, add string, add attributes
authoroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 20 May 2020 18:01:50 +0000 (14:01 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 20 May 2020 18:01:50 +0000 (14:01 -0400)
mods/mob/api/interaction.lua
mods/mob/api/movement.lua
mods/mob/init.lua
mods/mob/items.lua
mods/mob/models/22i's blends/slime.blend1 [deleted file]
mods/mob/models/22i's blends/spider.blend [new file with mode: 0644]
mods/mob/spawning.lua
mods/mob/textures/attributes.txt [new file with mode: 0644]
mods/mob/textures/string.png [new file with mode: 0644]

index 6cc828ed0e5021d7a5a78127f8c03e9bdf33d385..334191734fd25f41e2caf1270436263332852f32 100644 (file)
@@ -262,7 +262,7 @@ mobs.create_interaction_functions = function(def,mob_register)
                                --print(self.hostile)
                                if self.hostile == true then
                                        local distance = vector.distance(pos,pos2)
-                                       
+                                       self.following_pos = vector.new(pos.x,pos.y-1.625,pos.z)
                                        --punch the player
                                        if self.attack_type == "punch" then
                                                if distance < 2.5 and self.punch_timer <= 0 and object:get_hp() > 0 then
@@ -316,6 +316,9 @@ mobs.create_interaction_functions = function(def,mob_register)
                        if self.move_head then
                                self.move_head(self,nil,dtime)
                        end
+                       if self.following_pos then
+                               self.following_pos = nil
+                       end
                        if self.manage_hostile_timer then
                                self.manage_hostile_timer(self,dtime)
                        end
index 9b2b6b84433ad7316693266d280a375c565eda08..86fb26895bb48c0859834506e335818b1c94e96f 100644 (file)
@@ -81,16 +81,32 @@ mobs.create_movement_functions = function(def,mob_register)
                                local pos2 = vector.add(vector.multiply(self.direction,modifier),pos)
 
                                local ray = minetest.raycast(pos, pos2, false, false)
+                               
+                               local pointed_thing
 
                                if ray then
-                                       local pointed_thing = ray:next()
-                                       if pointed_thing then
-                                               if minetest.get_nodedef(minetest.get_node(pointed_thing.under).name, "walkable") then
-                                                       local vel = self.object:get_velocity()
-                                                       self.jump_timer = 1+math.random()
+                                       pointed_thing = ray:next()
+                               end
+                                       
+                               if pointed_thing then
+                                       if minetest.get_nodedef(minetest.get_node(pointed_thing.under).name, "walkable") then
+                                               --print("jump")
+                                               local vel = self.object:get_velocity()
+                                               --self.jump_timer = 1+math.random()
+                                               self.object:set_velocity(vector.new(vel.x,5,vel.z))
+                                       else
+                                               --print("velocity check")
+                                               local vel = self.object:get_velocity()
+                                               if (vel.x == 0 and self.direction.x ~= 0) or (vel.z == 0 and self.direction.z ~= 0) then
                                                        self.object:set_velocity(vector.new(vel.x,5,vel.z))
                                                end
                                        end
+                               else
+                                       --print("velcheck 2")
+                                       local vel = self.object:get_velocity()
+                                       if (vel.x == 0 and self.direction.x ~= 0) or (vel.z == 0 and self.direction.z ~= 0) then
+                                               self.object:set_velocity(vector.new(vel.x,5,vel.z))
+                                       end
                                end
                        end
                end
index 35eebc7de6b510f86e767ff26c10ca47d674ddf3..02ac50fd99a47394895416fe4842630a8b8ac849 100644 (file)
@@ -565,7 +565,6 @@ mobs.register_mob(
         visual_size = {x = 3, y = 3},
         mesh = "spider.b3d",
         textures = {
-                --blank out the first two to create adult pig
                "spider.png"
         },
         
@@ -596,19 +595,19 @@ mobs.register_mob(
         state = 0,
         view_distance = 15,
         
-        item_drop = "mob:raw_porkchop", 
+        item_drop = "mob:string", 
         standing_frame = {x=21,y=21},
         moving_frame = {x=0,y=20},
         animation_multiplier = 20,
         ----
         ----
-        death_rotation = "x",
+        death_rotation = "z",
         
         hurt_sound = "pig",
         die_sound = "pig_die",
         
         
-        hostile = false,
+        hostile = true,
         attacked_hostile = false,
         attack_type = "punch",
         group_attack = true,
index 663eee4b68ab11fbf537c3d8031141c5fffc50cc..f6d743fa52465ae089bbc0d935b26e3d2a6ba2fe 100644 (file)
@@ -18,6 +18,10 @@ minetest.register_craftitem("mob:gunpowder", {
        description = "Gunpowder",
        inventory_image = "gunpowder.png",
 })
+minetest.register_craftitem("mob:string", {
+       description = "String",
+       inventory_image = "string.png",
+})
 --cooking
 minetest.register_craft({
        type = "cooking",
diff --git a/mods/mob/models/22i's blends/slime.blend1 b/mods/mob/models/22i's blends/slime.blend1
deleted file mode 100644 (file)
index 8f90152..0000000
Binary files a/mods/mob/models/22i's blends/slime.blend1 and /dev/null differ
diff --git a/mods/mob/models/22i's blends/spider.blend b/mods/mob/models/22i's blends/spider.blend
new file mode 100644 (file)
index 0000000..1b081fd
Binary files /dev/null and b/mods/mob/models/22i's blends/spider.blend differ
index 0e1d57552378eac8e35b1e2c1832c7267ec57eab..73fb58c586b9e0f013256ee185afb42ce5f90e5f 100644 (file)
@@ -12,7 +12,7 @@ local find_node_height = 32
 local spawn = true
 
 local spawn_table = {"pig"}
-local dark_spawn_table = {"creeper"}
+local dark_spawn_table = {"creeper","spider"}
 local nether_spawn_table = {"nitro_creeper"}
 local aether_spawn_table = {"phyg"}
 
diff --git a/mods/mob/textures/attributes.txt b/mods/mob/textures/attributes.txt
new file mode 100644 (file)
index 0000000..9ee428e
--- /dev/null
@@ -0,0 +1,3 @@
+mob skins - 22i https://github.com/22i
+gunpowder, porkchop - https://github.com/minetest-texture-packs/Pixel-Perfection
+string, slimeball - oil_boi
\ No newline at end of file
diff --git a/mods/mob/textures/string.png b/mods/mob/textures/string.png
new file mode 100644 (file)
index 0000000..3c45a03
Binary files /dev/null and b/mods/mob/textures/string.png differ