]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in prototype of mob "pig"
authoroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 30 Mar 2020 01:19:50 +0000 (21:19 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 30 Mar 2020 01:19:50 +0000 (21:19 -0400)
mods/mob/init.lua
mods/mob/models/body.png [new file with mode: 0644]
mods/mob/models/head.png [new file with mode: 0644]
mods/mob/models/leg.png [new file with mode: 0644]
mods/mob/models/nose.png [new file with mode: 0644]
mods/mob/models/pig.blend [new file with mode: 0644]
mods/mob/models/pig.blend1 [new file with mode: 0644]
mods/mob/models/pig.x [new file with mode: 0644]
mods/mob/models/pig_head.x [new file with mode: 0644]
mods/mob/oldcode.txt [new file with mode: 0644]

index b0f23a3154433d62e20049ed04b2f298390f8805..212445d6016c3a5ff7b31e6c69978105345c3915 100644 (file)
@@ -15,16 +15,16 @@ mob.initial_properties = {
        hp_max = 1,
        physical = true,
        collide_with_objects = false,
-       collisionbox = {-0.37, -0.01, -0.37, 0.37, 0.865, 0.37},
+       collisionbox = {-0.37, -0.37, -0.37, 0.37, 0.865, 0.37},
        visual = "mesh",
        visual_size = {x = 3, y = 3},
-       mesh = "pig.b3d",
+       mesh = "pig.x",
        textures = {
-               "pig.png","pig.png","pig.png","pig.png","pig.png","pig.png","pig.png","pig.png","pig.png","pig.png"
+               "body.png","leg.png","leg.png","leg.png","leg.png"
        },
        is_visible = true,
        pointable = true,
-       automatic_face_movement_dir = -90.0,
+       automatic_face_movement_dir = 0.0,
        automatic_face_movement_max_rotation_per_sec = 600,
 }
 mob.hp = 5
@@ -50,9 +50,17 @@ mob.on_activate = function(self, staticdata, dtime_s)
                        self.hp = data.hp
                end
        end
-       self.object:set_animation({x=0,y=40}, 20, 0, true)
+       self.object:set_animation({x=5,y=15}, 1, 0, true)
        self.object:set_hp(self.hp)
        self.direction = vector.new(math.random()*math.random(-1,1),0,math.random()*math.random(-1,1))
+       
+       local head = minetest.add_entity(self.object:get_pos(), "mob:head")
+       if head then
+               head:set_attach(self.object, "", vector.new(2.4,1.2,0),vector.new(180,0,180))
+               self.child = head
+       end
+       
+       --self.object:set_yaw(math.pi*math.random(-1,1)*math.random())
 end
 mob.on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)           
        local hurt = tool_capabilities.damage_groups.fleshy
@@ -121,13 +129,19 @@ mob.move = function(self,dtime)
        if self.timer <= 0 then
                self.timer = math.random(1,3)
                self.direction = vector.new(math.random()*math.random(-1,1),0,math.random()*math.random(-1,1))
+               --local yaw = self.object:get_yaw() + dtime
+               
+               --self.object:set_yaw(yaw)
        end
+       
        local pos1 = self.object:getpos()
+       pos1.y = pos1.y + 0.37
        local currentvel = self.object:getvelocity()
        local goal = vector.multiply(self.direction,5)
        local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z)
-       acceleration = vector.multiply(acceleration, 0.5)
+       acceleration = vector.multiply(acceleration, 0.05)
        self.object:add_velocity(acceleration)
+
        --try to jump
        if currentvel.y <= 0 then
                local in_front = minetest.raycast(pos1, vector.add(pos1,vector.multiply(self.direction,3)), false, false):next()
@@ -162,10 +176,104 @@ end
 --sets the mob animation and speed
 mob.set_animation = function(self)
        local distance = vector.distance(vector.new(0,0,0), self.object:getvelocity())
-       self.object:set_animation_frame_speed(distance*20)
+       self.object:set_animation_frame_speed(distance*5)
+end
+
+--converts yaw to degrees
+local degrees = function(yaw)
+       yaw = yaw + math.pi
+       return(yaw*180.0/math.pi)
 end
+
+local degree_round = function(degree)
+       return(degree + 0.5 - (degree + 0.5) % 1)
+end
+
+local radians_to_degrees = function(radians)
+       return(radians*180.0/math.pi)
+end
+
+--a movement test to move the head
+mob.move_head = function(self)
+       if self.child then
+               local pos = self.object:get_pos()
+               local body_yaw = self.object:get_yaw() - (math.pi/2)
+               local dir = vector.multiply(minetest.yaw_to_dir(body_yaw),0.72)
+               local real_dir = minetest.yaw_to_dir(body_yaw)
+               local body_yaw = degree_round(degrees(minetest.dir_to_yaw(dir)))
+               
+               pos = vector.add(pos,dir)
+               pos.y = pos.y + 0.36
+               
+               --pos is where the head actually is
+               --STARE O_O
+               for _,object in ipairs(minetest.get_objects_inside_radius(pos, 6)) do
+                       if object:is_player() then
+                               local pos2 = object:get_pos()
+                               pos2.y = pos2.y + 1.625
+                               
+                               local head_yaw  = degree_round(degrees(minetest.dir_to_yaw(vector.direction(pos,pos2))))                        
+                               
+                               local new_yaw = (head_yaw-body_yaw)
+
+                               local pitch = 0                         
+                               if math.abs(new_yaw) <= 90 or math.abs(new_yaw) >= 270 then
+                                       --do other calculations on pitch and roll
+                                       
+                                       local triangle = vector.new(vector.distance(pos,pos2),0,pos2.y-pos.y)
+                                       
+                                       local tri_yaw = minetest.dir_to_yaw(triangle)+(math.pi/2)
+                                       
+                                       pitch = radians_to_degrees(tri_yaw)
+                                                                       
+                                       modifier = 0    
+                                       if new_yaw > 0 then
+                                               modifier = 1
+                                       else
+                                               modifier = -1
+                                       end
+                               else
+                                       new_yaw = 0
+                               end
+                               --                                                                      roll        newyaw      pitch
+                               self.child:set_attach(self.object, "", vector.new(2.4,1.2,0), vector.new(180,     new_yaw,    180+pitch))                               
+                               --self.head_rotation = vector.new(180,new_yaw,180)
+                       end
+               end
+       end
+end
+
 mob.on_step = function(self, dtime)
        self.move(self,dtime)
        self.set_animation(self)
+       self.move_head(self)
 end
+
 minetest.register_entity("mob:pig", mob)
+
+
+local head = {}
+head.initial_properties = {
+       hp_max = 1,
+       physical = false,
+       collide_with_objects = false,
+       collisionbox = {0, 0, 0, 0, 0, 0},
+       visual = "mesh",
+       visual_size = {x = 1.1, y = 1.1},
+       mesh = "pig_head.x",
+       textures = {
+               "head.png","nose.png"
+       },
+       is_visible = true,
+       pointable = false,
+       --automatic_face_movement_dir = 0.0,
+       --automatic_face_movement_max_rotation_per_sec = 600,
+}
+
+--remove the head if no body
+head.on_step = function(self, dtime)
+       if not self.object:get_attach() then
+               self.object:remove()
+       end
+end
+minetest.register_entity("mob:head", head)
diff --git a/mods/mob/models/body.png b/mods/mob/models/body.png
new file mode 100644 (file)
index 0000000..41be0e3
Binary files /dev/null and b/mods/mob/models/body.png differ
diff --git a/mods/mob/models/head.png b/mods/mob/models/head.png
new file mode 100644 (file)
index 0000000..918460e
Binary files /dev/null and b/mods/mob/models/head.png differ
diff --git a/mods/mob/models/leg.png b/mods/mob/models/leg.png
new file mode 100644 (file)
index 0000000..8c9280e
Binary files /dev/null and b/mods/mob/models/leg.png differ
diff --git a/mods/mob/models/nose.png b/mods/mob/models/nose.png
new file mode 100644 (file)
index 0000000..7e18d8a
Binary files /dev/null and b/mods/mob/models/nose.png differ
diff --git a/mods/mob/models/pig.blend b/mods/mob/models/pig.blend
new file mode 100644 (file)
index 0000000..ac8c995
Binary files /dev/null and b/mods/mob/models/pig.blend differ
diff --git a/mods/mob/models/pig.blend1 b/mods/mob/models/pig.blend1
new file mode 100644 (file)
index 0000000..ea7ceaa
Binary files /dev/null and b/mods/mob/models/pig.blend1 differ
diff --git a/mods/mob/models/pig.x b/mods/mob/models/pig.x
new file mode 100644 (file)
index 0000000..9d1c0e9
--- /dev/null
@@ -0,0 +1,832 @@
+xof 0303txt 0032
+
+Frame Root {
+  FrameTransformMatrix {
+     1.000000, 0.000000, 0.000000, 0.000000,
+     0.000000,-0.000000, 1.000000, 0.000000,
+     0.000000, 1.000000, 0.000000, 0.000000,
+     0.000000, 0.000000, 0.000000, 1.000000;;
+  }
+  Frame Cube {
+    FrameTransformMatrix {
+       1.944000, 0.000000, 0.000000, 0.000000,
+       0.000000, 1.000000, 0.000000, 0.000000,
+       0.000000, 0.000000, 0.800000, 0.000000,
+       0.000000, 0.000000, 0.799075, 1.000000;;
+    }
+    Mesh { // Cube mesh
+      24;
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       0.999999;-1.000001; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube normals
+        6;
+         0.000000;-0.000000; 1.000000;,
+         0.000000; 0.000000;-1.000000;,
+        -1.000000; 0.000000;-0.000000;,
+         0.000000; 1.000000; 0.000000;,
+         1.000000;-0.000000; 0.000000;,
+        -0.000000;-1.000000;-0.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube normals
+      MeshTextureCoords { // Cube UV coordinates
+        24;
+         0.666667; 0.666667;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.666667;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.666666;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.666667; 1.000000;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         1.000000; 0.666667;,
+         1.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.000000; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;;
+      } // End of Cube UV coordinates
+      MeshMaterialList { // Cube material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material body {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube material list
+    } // End of Cube mesh
+  } // End of Cube
+  Frame Cube_001 {
+    FrameTransformMatrix {
+      -0.450749, 0.000000, 0.000000, 0.000000,
+       0.000000,-0.469530, 0.000000, 0.000000,
+       0.000000, 0.000000, 0.704295, 0.000000,
+       1.500000, 0.500000,-0.700000, 1.000000;;
+    }
+    Mesh { // Cube_001 mesh
+      24;
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       0.999999;-1.000001; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube_001 normals
+        6;
+         0.000000;-0.000000; 1.000000;,
+         0.000000; 0.000000;-1.000000;,
+        -1.000000; 0.000000;-0.000000;,
+         0.000000; 1.000000; 0.000000;,
+         1.000000;-0.000000; 0.000000;,
+        -0.000000;-1.000000;-0.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube_001 normals
+      MeshTextureCoords { // Cube_001 UV coordinates
+        24;
+         0.666667; 0.666667;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.666667;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.666666;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.666667; 1.000000;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         1.000000; 0.666667;,
+         1.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.000000; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;;
+      } // End of Cube_001 UV coordinates
+      MeshMaterialList { // Cube_001 material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material leg {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube_001 material list
+    } // End of Cube_001 mesh
+  } // End of Cube_001
+  Frame Cube_003 {
+    FrameTransformMatrix {
+      -0.450749, 0.000000, 0.000000, 0.000000,
+       0.000000,-0.469530, 0.000000, 0.000000,
+       0.000000, 0.000000, 0.704295, 0.000000,
+       1.500000,-0.500000,-0.700000, 1.000000;;
+    }
+    Mesh { // Cube_003 mesh
+      24;
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       0.999999;-1.000001; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube_003 normals
+        6;
+         0.000000;-0.000000; 1.000000;,
+         0.000000; 0.000000;-1.000000;,
+        -1.000000; 0.000000;-0.000000;,
+         0.000000; 1.000000; 0.000000;,
+         1.000000;-0.000000; 0.000000;,
+        -0.000000;-1.000000;-0.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube_003 normals
+      MeshTextureCoords { // Cube_003 UV coordinates
+        24;
+         0.666667; 0.666667;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.666667;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.666666;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.666667; 1.000000;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         1.000000; 0.666667;,
+         1.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.000000; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;;
+      } // End of Cube_003 UV coordinates
+      MeshMaterialList { // Cube_003 material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material leg {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube_003 material list
+    } // End of Cube_003 mesh
+  } // End of Cube_003
+  Frame Cube_005 {
+    FrameTransformMatrix {
+      -0.450749, 0.000000, 0.000000, 0.000000,
+       0.000000,-0.469530, 0.000000, 0.000000,
+       0.000000, 0.000000, 0.704295, 0.000000,
+      -1.500000,-0.500000,-0.700000, 1.000000;;
+    }
+    Mesh { // Cube_005 mesh
+      24;
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       0.999999;-1.000001; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube_005 normals
+        6;
+         0.000000;-0.000000; 1.000000;,
+         0.000000; 0.000000;-1.000000;,
+        -1.000000; 0.000000;-0.000000;,
+         0.000000; 1.000000; 0.000000;,
+         1.000000;-0.000000; 0.000000;,
+        -0.000000;-1.000000;-0.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube_005 normals
+      MeshTextureCoords { // Cube_005 UV coordinates
+        24;
+         0.666667; 0.666667;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.666667;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.666666;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.666667; 1.000000;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         1.000000; 0.666667;,
+         1.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.000000; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;;
+      } // End of Cube_005 UV coordinates
+      MeshMaterialList { // Cube_005 material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material leg {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube_005 material list
+    } // End of Cube_005 mesh
+  } // End of Cube_005
+  Frame Cube_006 {
+    FrameTransformMatrix {
+      -0.450749, 0.000000, 0.000000, 0.000000,
+       0.000000,-0.469530, 0.000000, 0.000000,
+       0.000000, 0.000000, 0.704295, 0.000000,
+      -1.500000, 0.500000,-0.700000, 1.000000;;
+    }
+    Mesh { // Cube_006 mesh
+      24;
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       0.999999;-1.000001; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       0.999999;-1.000001; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+       1.000000; 0.999999; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube_006 normals
+        6;
+         0.000000;-0.000000; 1.000000;,
+         0.000000; 0.000000;-1.000000;,
+        -1.000000; 0.000000;-0.000000;,
+         0.000000; 1.000000; 0.000000;,
+         1.000000;-0.000000; 0.000000;,
+        -0.000000;-1.000000;-0.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube_006 normals
+      MeshTextureCoords { // Cube_006 UV coordinates
+        24;
+         0.666667; 0.666667;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.666667;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.666666;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.666667; 1.000000;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         1.000000; 0.666667;,
+         1.000000; 1.000000;,
+         0.000000; 0.666667;,
+         0.000000; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;;
+      } // End of Cube_006 UV coordinates
+      MeshMaterialList { // Cube_006 material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material leg {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube_006 material list
+    } // End of Cube_006 mesh
+  } // End of Cube_006
+} // End of Root
+AnimationSet Global {
+  Animation {
+    {Cube}
+    AnimationKey { // Rotation
+      0;
+      16;
+      0;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      1;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      2;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      3;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      4;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      5;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      6;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      7;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      8;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      9;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      10;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      11;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      12;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      13;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      14;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      15;4;-1.000000, 0.000000, 0.000000, 0.000000;;;
+    }
+    AnimationKey { // Scale
+      1;
+      16;
+      0;3; 1.944000, 1.000000, 0.800000;;,
+      1;3; 1.944000, 1.000000, 0.800000;;,
+      2;3; 1.944000, 1.000000, 0.800000;;,
+      3;3; 1.944000, 1.000000, 0.800000;;,
+      4;3; 1.944000, 1.000000, 0.800000;;,
+      5;3; 1.944000, 1.000000, 0.800000;;,
+      6;3; 1.944000, 1.000000, 0.800000;;,
+      7;3; 1.944000, 1.000000, 0.800000;;,
+      8;3; 1.944000, 1.000000, 0.800000;;,
+      9;3; 1.944000, 1.000000, 0.800000;;,
+      10;3; 1.944000, 1.000000, 0.800000;;,
+      11;3; 1.944000, 1.000000, 0.800000;;,
+      12;3; 1.944000, 1.000000, 0.800000;;,
+      13;3; 1.944000, 1.000000, 0.800000;;,
+      14;3; 1.944000, 1.000000, 0.800000;;,
+      15;3; 1.944000, 1.000000, 0.800000;;;
+    }
+    AnimationKey { // Position
+      2;
+      16;
+      0;3; 0.000000, 0.000000, 0.799075;;,
+      1;3; 0.000000, 0.000000, 0.799075;;,
+      2;3; 0.000000, 0.000000, 0.799075;;,
+      3;3; 0.000000, 0.000000, 0.799075;;,
+      4;3; 0.000000, 0.000000, 0.799075;;,
+      5;3; 0.000000, 0.000000, 0.799075;;,
+      6;3; 0.000000, 0.000000, 0.799075;;,
+      7;3; 0.000000, 0.000000, 0.799075;;,
+      8;3; 0.000000, 0.000000, 0.799075;;,
+      9;3; 0.000000, 0.000000, 0.799075;;,
+      10;3; 0.000000, 0.000000, 0.799075;;,
+      11;3; 0.000000, 0.000000, 0.799075;;,
+      12;3; 0.000000, 0.000000, 0.799075;;,
+      13;3; 0.000000, 0.000000, 0.799075;;,
+      14;3; 0.000000, 0.000000, 0.799075;;,
+      15;3; 0.000000, 0.000000, 0.799075;;;
+    }
+  }
+  Animation {
+    {Cube_001}
+    AnimationKey { // Rotation
+      0;
+      16;
+      0;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      1;4;-0.999391, 0.000000,-0.034899, 0.000000;;,
+      2;4;-0.991138, 0.000000,-0.132834, 0.000000;;,
+      3;4;-0.966526, 0.000000,-0.256570, 0.000000;;,
+      4;4;-0.936672, 0.000000,-0.350207, 0.000000;;,
+      5;4;-0.923880, 0.000000,-0.382683, 0.000000;;,
+      6;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      7;4;-0.992042, 0.000000,-0.125908, 0.000000;;,
+      8;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      9;4;-0.948323, 0.000000, 0.317305, 0.000000;;,
+      10;4;-0.923879, 0.000000, 0.382684, 0.000000;;,
+      11;4;-0.948324, 0.000000, 0.317305, 0.000000;;,
+      12;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      13;4;-0.992042, 0.000000,-0.125908, 0.000000;;,
+      14;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      15;4;-0.923880, 0.000000,-0.382683, 0.000000;;;
+    }
+    AnimationKey { // Scale
+      1;
+      16;
+      0;3; 0.450749, 0.469530, 0.704295;;,
+      1;3; 0.450749, 0.469530, 0.704295;;,
+      2;3; 0.450749, 0.469530, 0.704295;;,
+      3;3; 0.450749, 0.469530, 0.704295;;,
+      4;3; 0.450749, 0.469530, 0.704295;;,
+      5;3; 0.450749, 0.469530, 0.704295;;,
+      6;3; 0.450749, 0.469530, 0.704295;;,
+      7;3; 0.450749, 0.469530, 0.704295;;,
+      8;3; 0.450749, 0.469530, 0.704295;;,
+      9;3; 0.450749, 0.469530, 0.704295;;,
+      10;3; 0.450749, 0.469530, 0.704295;;,
+      11;3; 0.450749, 0.469530, 0.704295;;,
+      12;3; 0.450749, 0.469530, 0.704295;;,
+      13;3; 0.450749, 0.469530, 0.704295;;,
+      14;3; 0.450749, 0.469530, 0.704295;;,
+      15;3; 0.450749, 0.469530, 0.704295;;;
+    }
+    AnimationKey { // Position
+      2;
+      16;
+      0;3; 1.500000, 0.500000,-0.700000;;,
+      1;3; 1.535556, 0.500000,-0.700000;;,
+      2;3; 1.635705, 0.500000,-0.700000;;,
+      3;3; 1.764295, 0.500000,-0.700000;;,
+      4;3; 1.864444, 0.500000,-0.700000;;,
+      5;3; 1.900000, 0.500000,-0.700000;;,
+      6;3; 1.820000, 0.500000,-0.700000;;,
+      7;3; 1.594664, 0.500000,-0.700000;;,
+      8;3; 1.305335, 0.500000,-0.700000;;,
+      9;3; 1.080000, 0.500000,-0.700000;;,
+      10;3; 1.000000, 0.500000,-0.700000;;,
+      11;3; 1.080000, 0.500000,-0.700000;;,
+      12;3; 1.305335, 0.500000,-0.700000;;,
+      13;3; 1.594665, 0.500000,-0.700000;;,
+      14;3; 1.820000, 0.500000,-0.700000;;,
+      15;3; 1.900000, 0.500000,-0.700000;;;
+    }
+  }
+  Animation {
+    {Cube_003}
+    AnimationKey { // Rotation
+      0;
+      16;
+      0;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      1;4;-0.999391, 0.000000, 0.034900, 0.000000;;,
+      2;4;-0.991138, 0.000000, 0.132834, 0.000000;;,
+      3;4;-0.966526, 0.000000, 0.256570, 0.000000;;,
+      4;4;-0.936672, 0.000000, 0.350208, 0.000000;;,
+      5;4;-0.923879, 0.000000, 0.382684, 0.000000;;,
+      6;4;-0.948324, 0.000000, 0.317305, 0.000000;;,
+      7;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      8;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      9;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      10;4;-0.923880, 0.000000,-0.382683, 0.000000;;,
+      11;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      12;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      13;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      14;4;-0.948323, 0.000000, 0.317305, 0.000000;;,
+      15;4;-0.923879, 0.000000, 0.382684, 0.000000;;;
+    }
+    AnimationKey { // Scale
+      1;
+      16;
+      0;3; 0.450749, 0.469530, 0.704295;;,
+      1;3; 0.450749, 0.469530, 0.704295;;,
+      2;3; 0.450749, 0.469530, 0.704295;;,
+      3;3; 0.450749, 0.469530, 0.704295;;,
+      4;3; 0.450749, 0.469530, 0.704295;;,
+      5;3; 0.450749, 0.469530, 0.704295;;,
+      6;3; 0.450749, 0.469530, 0.704295;;,
+      7;3; 0.450749, 0.469530, 0.704295;;,
+      8;3; 0.450749, 0.469530, 0.704295;;,
+      9;3; 0.450749, 0.469530, 0.704295;;,
+      10;3; 0.450749, 0.469530, 0.704295;;,
+      11;3; 0.450749, 0.469530, 0.704295;;,
+      12;3; 0.450749, 0.469530, 0.704295;;,
+      13;3; 0.450749, 0.469530, 0.704295;;,
+      14;3; 0.450749, 0.469530, 0.704295;;,
+      15;3; 0.450749, 0.469530, 0.704295;;;
+    }
+    AnimationKey { // Position
+      2;
+      16;
+      0;3; 1.500000,-0.500000,-0.700000;;,
+      1;3; 1.455556,-0.500000,-0.700000;;,
+      2;3; 1.330369,-0.500000,-0.700000;;,
+      3;3; 1.169631,-0.500000,-0.700000;;,
+      4;3; 1.044445,-0.500000,-0.700000;;,
+      5;3; 1.000000,-0.500000,-0.700000;;,
+      6;3; 1.080000,-0.500000,-0.700000;;,
+      7;3; 1.305336,-0.500000,-0.700000;;,
+      8;3; 1.594665,-0.500000,-0.700000;;,
+      9;3; 1.820000,-0.500000,-0.700000;;,
+      10;3; 1.900000,-0.500000,-0.700000;;,
+      11;3; 1.820000,-0.500000,-0.700000;;,
+      12;3; 1.594665,-0.500000,-0.700000;;,
+      13;3; 1.305336,-0.500000,-0.700000;;,
+      14;3; 1.080000,-0.500000,-0.700000;;,
+      15;3; 1.000000,-0.500000,-0.700000;;;
+    }
+  }
+  Animation {
+    {Cube_005}
+    AnimationKey { // Rotation
+      0;
+      16;
+      0;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      1;4;-0.999391, 0.000000,-0.034899, 0.000000;;,
+      2;4;-0.991138, 0.000000,-0.132834, 0.000000;;,
+      3;4;-0.966526, 0.000000,-0.256570, 0.000000;;,
+      4;4;-0.936672, 0.000000,-0.350207, 0.000000;;,
+      5;4;-0.923880, 0.000000,-0.382683, 0.000000;;,
+      6;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      7;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      8;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      9;4;-0.948324, 0.000000, 0.317305, 0.000000;;,
+      10;4;-0.923879, 0.000000, 0.382684, 0.000000;;,
+      11;4;-0.948324, 0.000000, 0.317305, 0.000000;;,
+      12;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      13;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      14;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      15;4;-0.923880, 0.000000,-0.382683, 0.000000;;;
+    }
+    AnimationKey { // Scale
+      1;
+      16;
+      0;3; 0.450749, 0.469530, 0.704295;;,
+      1;3; 0.450749, 0.469530, 0.704295;;,
+      2;3; 0.450749, 0.469530, 0.704295;;,
+      3;3; 0.450749, 0.469530, 0.704295;;,
+      4;3; 0.450749, 0.469530, 0.704295;;,
+      5;3; 0.450749, 0.469530, 0.704295;;,
+      6;3; 0.450749, 0.469530, 0.704295;;,
+      7;3; 0.450749, 0.469530, 0.704295;;,
+      8;3; 0.450749, 0.469530, 0.704295;;,
+      9;3; 0.450749, 0.469530, 0.704295;;,
+      10;3; 0.450749, 0.469530, 0.704295;;,
+      11;3; 0.450749, 0.469530, 0.704295;;,
+      12;3; 0.450749, 0.469530, 0.704295;;,
+      13;3; 0.450749, 0.469530, 0.704295;;,
+      14;3; 0.450749, 0.469530, 0.704295;;,
+      15;3; 0.450749, 0.469530, 0.704295;;;
+    }
+    AnimationKey { // Position
+      2;
+      16;
+      0;3;-1.500000,-0.500000,-0.700000;;,
+      1;3;-1.464444,-0.500000,-0.700000;;,
+      2;3;-1.364295,-0.500000,-0.700000;;,
+      3;3;-1.235705,-0.500000,-0.700000;;,
+      4;3;-1.135556,-0.500000,-0.700000;;,
+      5;3;-1.100000,-0.500000,-0.700000;;,
+      6;3;-1.180000,-0.500000,-0.700000;;,
+      7;3;-1.405335,-0.500000,-0.700000;;,
+      8;3;-1.694665,-0.500000,-0.700000;;,
+      9;3;-1.920000,-0.500000,-0.700000;;,
+      10;3;-2.000000,-0.500000,-0.700000;;,
+      11;3;-1.920000,-0.500000,-0.700000;;,
+      12;3;-1.694664,-0.500000,-0.700000;;,
+      13;3;-1.405335,-0.500000,-0.700000;;,
+      14;3;-1.180000,-0.500000,-0.700000;;,
+      15;3;-1.100000,-0.500000,-0.700000;;;
+    }
+  }
+  Animation {
+    {Cube_006}
+    AnimationKey { // Rotation
+      0;
+      16;
+      0;4;-1.000000, 0.000000, 0.000000, 0.000000;;,
+      1;4;-0.999391, 0.000000, 0.034900, 0.000000;;,
+      2;4;-0.991138, 0.000000, 0.132834, 0.000000;;,
+      3;4;-0.966526, 0.000000, 0.256570, 0.000000;;,
+      4;4;-0.936672, 0.000000, 0.350208, 0.000000;;,
+      5;4;-0.923879, 0.000000, 0.382684, 0.000000;;,
+      6;4;-0.948324, 0.000000, 0.317305, 0.000000;;,
+      7;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      8;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      9;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      10;4;-0.923880, 0.000000,-0.382683, 0.000000;;,
+      11;4;-0.948324, 0.000000,-0.317305, 0.000000;;,
+      12;4;-0.992042, 0.000000,-0.125909, 0.000000;;,
+      13;4;-0.992042, 0.000000, 0.125909, 0.000000;;,
+      14;4;-0.948323, 0.000000, 0.317305, 0.000000;;,
+      15;4;-0.923879, 0.000000, 0.382684, 0.000000;;;
+    }
+    AnimationKey { // Scale
+      1;
+      16;
+      0;3; 0.450749, 0.469530, 0.704295;;,
+      1;3; 0.450749, 0.469530, 0.704295;;,
+      2;3; 0.450749, 0.469530, 0.704295;;,
+      3;3; 0.450749, 0.469530, 0.704295;;,
+      4;3; 0.450749, 0.469530, 0.704295;;,
+      5;3; 0.450749, 0.469530, 0.704295;;,
+      6;3; 0.450749, 0.469530, 0.704295;;,
+      7;3; 0.450749, 0.469530, 0.704295;;,
+      8;3; 0.450749, 0.469530, 0.704295;;,
+      9;3; 0.450749, 0.469530, 0.704295;;,
+      10;3; 0.450749, 0.469530, 0.704295;;,
+      11;3; 0.450749, 0.469530, 0.704295;;,
+      12;3; 0.450749, 0.469530, 0.704295;;,
+      13;3; 0.450749, 0.469530, 0.704295;;,
+      14;3; 0.450749, 0.469530, 0.704295;;,
+      15;3; 0.450749, 0.469530, 0.704295;;;
+    }
+    AnimationKey { // Position
+      2;
+      16;
+      0;3;-1.500000, 0.500000,-0.700000;;,
+      1;3;-1.544444, 0.500000,-0.700000;;,
+      2;3;-1.669631, 0.500000,-0.700000;;,
+      3;3;-1.830369, 0.500000,-0.700000;;,
+      4;3;-1.955556, 0.500000,-0.700000;;,
+      5;3;-2.000000, 0.500000,-0.700000;;,
+      6;3;-1.920000, 0.500000,-0.700000;;,
+      7;3;-1.694664, 0.500000,-0.700000;;,
+      8;3;-1.405335, 0.500000,-0.700000;;,
+      9;3;-1.180000, 0.500000,-0.700000;;,
+      10;3;-1.100000, 0.500000,-0.700000;;,
+      11;3;-1.180000, 0.500000,-0.700000;;,
+      12;3;-1.405335, 0.500000,-0.700000;;,
+      13;3;-1.694664, 0.500000,-0.700000;;,
+      14;3;-1.920000, 0.500000,-0.700000;;,
+      15;3;-2.000000, 0.500000,-0.700000;;;
+    }
+  }
+} // End of AnimationSet Global
diff --git a/mods/mob/models/pig_head.x b/mods/mob/models/pig_head.x
new file mode 100644 (file)
index 0000000..8fafff2
--- /dev/null
@@ -0,0 +1,212 @@
+xof 0303txt 0032
+
+Frame Root {
+  FrameTransformMatrix {
+     1.000000, 0.000000, 0.000000, 0.000000,
+     0.000000,-0.000000, 1.000000, 0.000000,
+     0.000000, 1.000000, 0.000000, 0.000000,
+     0.000000, 0.000000, 0.000000, 1.000000;;
+  }
+  Frame Cube_002 {
+    FrameTransformMatrix {
+      -0.600000,-0.000000, 0.000000, 0.000000,
+       0.000000,-0.600000, 0.000000, 0.000000,
+       0.000000,-0.000000,-0.600000, 0.000000,
+       0.000000, 0.000000, 0.000000, 1.000000;;
+    }
+    Mesh { // Cube_002 mesh
+      24;
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000; 1.000000;,
+       1.000000; 1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000; 1.000000;,
+       1.000000;-1.000000; 1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+      -1.000000;-1.000000;-1.000000;,
+      -1.000000; 1.000000;-1.000000;,
+       1.000000; 1.000000;-1.000000;,
+       1.000000;-1.000000;-1.000000;,
+       1.000000;-1.000000; 1.000000;,
+       1.000000; 1.000000; 1.000000;,
+      -1.000000; 1.000000; 1.000000;,
+      -1.000000;-1.000000; 1.000000;;
+      6;
+      4;0,1,2,3;,
+      4;4,5,6,7;,
+      4;8,9,10,11;,
+      4;12,13,14,15;,
+      4;16,17,18,19;,
+      4;20,21,22,23;;
+      MeshNormals { // Cube_002 normals
+        6;
+        -1.000000; 0.000000; 0.000000;,
+         0.000000; 1.000000;-0.000000;,
+         1.000000; 0.000000;-0.000000;,
+         0.000000;-1.000000; 0.000000;,
+        -0.000000; 0.000000;-1.000000;,
+        -0.000000; 0.000000; 1.000000;;
+        6;
+        4;0,0,0,0;,
+        4;1,1,1,1;,
+        4;2,2,2,2;,
+        4;3,3,3,3;,
+        4;4,4,4,4;,
+        4;5,5,5,5;;
+      } // End of Cube_002 normals
+      MeshTextureCoords { // Cube_002 UV coordinates
+        24;
+         0.666667; 0.333333;,
+         0.333333; 0.333333;,
+         0.333333; 0.666667;,
+         0.666667; 0.666667;,
+         0.000000; 0.333333;,
+         0.000000; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 0.333333;,
+         0.000000; 0.666667;,
+         0.000000; 1.000000;,
+         0.333333; 1.000000;,
+         0.333333; 0.666667;,
+         0.333333; 0.666667;,
+         0.333333; 1.000000;,
+         0.666667; 1.000000;,
+         0.666667; 0.666667;,
+         0.666667; 0.000000;,
+         0.333333; 0.000000;,
+         0.333333; 0.333333;,
+         0.666667; 0.333333;,
+         0.666667; 0.333333;,
+         1.000000; 0.333333;,
+         1.000000; 0.000000;,
+         0.666667; 0.000000;;
+      } // End of Cube_002 UV coordinates
+      MeshMaterialList { // Cube_002 material list
+        1;
+        6;
+        0,
+        0,
+        0,
+        0,
+        0,
+        0;;
+        Material head {
+           0.640000; 0.640000; 0.640000; 1.000000;;
+           96.078431;
+           0.500000; 0.500000; 0.500000;;
+           0.000000; 0.000000; 0.000000;;
+        }
+      } // End of Cube_002 material list
+    } // End of Cube_002 mesh
+    Frame Cube_004 {
+      FrameTransformMatrix {
+         0.385573,-0.000000,-0.000000, 0.000000,
+         0.000000, 0.385573, 0.000000, 0.000000,
+        -0.000000, 0.000000, 0.212643, 0.000000,
+         1.060439, 0.000000, 0.000000, 1.000000;;
+      }
+      Mesh { // Cube_004 mesh
+        24;
+        -1.000000;-1.000000; 1.000000;,
+        -1.000000; 1.000000; 1.000000;,
+        -1.000000; 1.000000;-1.000000;,
+        -1.000000;-1.000000;-1.000000;,
+        -1.000000; 1.000000; 1.000000;,
+         1.000000; 1.000000; 1.000000;,
+         1.000000; 1.000000;-1.000000;,
+        -1.000000; 1.000000;-1.000000;,
+         1.000000; 1.000000; 1.000000;,
+         1.000000;-1.000000; 1.000000;,
+         1.000000;-1.000000;-1.000000;,
+         1.000000; 1.000000;-1.000000;,
+         1.000000;-1.000000; 1.000000;,
+        -1.000000;-1.000000; 1.000000;,
+        -1.000000;-1.000000;-1.000000;,
+         1.000000;-1.000000;-1.000000;,
+        -1.000000;-1.000000;-1.000000;,
+        -1.000000; 1.000000;-1.000000;,
+         1.000000; 1.000000;-1.000000;,
+         1.000000;-1.000000;-1.000000;,
+         1.000000;-1.000000; 1.000000;,
+         1.000000; 1.000000; 1.000000;,
+        -1.000000; 1.000000; 1.000000;,
+        -1.000000;-1.000000; 1.000000;;
+        6;
+        4;0,1,2,3;,
+        4;4,5,6,7;,
+        4;8,9,10,11;,
+        4;12,13,14,15;,
+        4;16,17,18,19;,
+        4;20,21,22,23;;
+        MeshNormals { // Cube_004 normals
+          6;
+          -1.000000; 0.000000; 0.000000;,
+           0.000000; 1.000000;-0.000000;,
+           1.000000; 0.000000;-0.000000;,
+           0.000000;-1.000000; 0.000000;,
+          -0.000000; 0.000000;-1.000000;,
+          -0.000000; 0.000000; 1.000000;;
+          6;
+          4;0,0,0,0;,
+          4;1,1,1,1;,
+          4;2,2,2,2;,
+          4;3,3,3,3;,
+          4;4,4,4,4;,
+          4;5,5,5,5;;
+        } // End of Cube_004 normals
+        MeshTextureCoords { // Cube_004 UV coordinates
+          24;
+           0.666667; 0.333333;,
+           0.333333; 0.333333;,
+           0.333333; 0.666667;,
+           0.666667; 0.666667;,
+           0.000000; 0.333333;,
+           0.000000; 0.666667;,
+           0.333333; 0.666667;,
+           0.333333; 0.333333;,
+           0.000000; 0.666667;,
+           0.000000; 1.000000;,
+           0.333333; 1.000000;,
+           0.333333; 0.666667;,
+           0.333333; 0.666667;,
+           0.333333; 1.000000;,
+           0.666667; 1.000000;,
+           0.666667; 0.666667;,
+           0.666667; 0.000000;,
+           0.333333; 0.000000;,
+           0.333333; 0.333333;,
+           0.666667; 0.333333;,
+           0.666667; 0.333333;,
+           1.000000; 0.333333;,
+           1.000000; 0.000000;,
+           0.666667; 0.000000;;
+        } // End of Cube_004 UV coordinates
+        MeshMaterialList { // Cube_004 material list
+          1;
+          6;
+          0,
+          0,
+          0,
+          0,
+          0,
+          0;;
+          Material nose {
+             0.640000; 0.640000; 0.640000; 1.000000;;
+             96.078431;
+             0.500000; 0.500000; 0.500000;;
+             0.000000; 0.000000; 0.000000;;
+          }
+        } // End of Cube_004 material list
+      } // End of Cube_004 mesh
+    } // End of Cube_004
+  } // End of Cube_002
+} // End of Root
diff --git a/mods/mob/oldcode.txt b/mods/mob/oldcode.txt
new file mode 100644 (file)
index 0000000..b4777f3
--- /dev/null
@@ -0,0 +1,155 @@
+--converts yaw to degrees
+local degrees = function(yaw)
+       yaw = yaw + math.pi
+       return(yaw*180.0/math.pi)
+end
+
+local degree_round = function(degree)
+       return(degree + 0.5 - (degree + 0.5) % 1)
+end
+
+local radians_to_degrees = function(radians)
+       return(radians*180.0/math.pi)
+end
+
+local dir_to_degrees = function(dir)
+       return({
+               x = radians_to_degrees(dir.x),
+               y = radians_to_degrees(dir.y),
+               z = radians_to_degrees(dir.z)
+       })
+end
+
+--[[
+local test_function(dir) { --q
+    --EulerAngles angles;
+
+    -- roll (x-axis rotation)
+    local sinr_cosp = 2 * (dir.w * dir.x + dir.y * dir.z)
+    local cosr_cosp = 1 - 2 * (dir.x * dir.x + dir.y * dir.y)
+    angles.roll = atan2(sinr_cosp, cosr_cosp)
+
+    -- pitch (y-axis rotation)
+    local sinp = 2 * (dir.w * dir.y - dir.z * dir.x)
+    if (abs(sinp) >= 1)
+        angles.pitch = std::copysign(M_PI / 2, sinp); -- use 90 degrees if out of range
+    else
+        angles.pitch = std::asin(sinp);
+
+    -- yaw (z-axis rotation)
+    double siny_cosp = 2 * (q.w * q.z + q.x * q.y);
+    double cosy_cosp = 1 - 2 * (q.y * q.y + q.z * q.z);
+    angles.yaw = std::atan2(siny_cosp, cosy_cosp);
+
+    return angles;
+}
+
+]]--
+--a movement test to move the head
+mob.move_head = function(self)
+       if self.child then
+               --we're multiplying this to set the x and z where the head is
+               local pos = self.object:get_pos()
+               local body_yaw = self.object:get_yaw() - (math.pi/2)
+               local dir = vector.multiply(minetest.yaw_to_dir(body_yaw),0.72)
+               local real_dir = minetest.yaw_to_dir(body_yaw)
+               local body_yaw = degree_round(degrees(minetest.dir_to_yaw(dir)))
+               
+               
+               
+               
+               pos = vector.add(pos,dir)
+               pos.y = pos.y + 0.36
+               
+               --pos is where the head actually is
+               --STARE O_O
+               for _,object in ipairs(minetest.get_objects_inside_radius(pos, 6)) do
+                       if object:is_player() then
+                               local pos2 = object:get_pos()
+                               pos2.y = pos2.y + 1.625
+                               
+                               local head_yaw  = degree_round(degrees(minetest.dir_to_yaw(vector.direction(pos,pos2))))
+                               
+                               --print("body yaw: ",math.abs(body_yaw),"head yaw:",math.abs(head_yaw))
+                               
+                               
+                               
+                               local new_yaw = (head_yaw-body_yaw)
+
+
+
+
+                               local pitch = 0
+                               local roll = 0
+                               
+                               if math.abs(new_yaw) <= 90 or math.abs(new_yaw) >= 270 then
+                                       --do other calculations on pitch and roll
+                                       
+                                       local triangle = vector.new(vector.distance(pos,pos2),0,pos2.y-pos.y)
+
+                                       local tri_yaw = minetest.dir_to_yaw(triangle)+(math.pi/2)
+                                       
+                                       pitch = radians_to_degrees(tri_yaw)
+                                       
+                                       local pitch_adjustment = 0
+                                       
+                                       if new_yaw >= 270 then
+                                               pitch_adjustment = new_yaw - 180
+                                       elseif new_yaw <= -270 then
+                                               pitch_adjustment = new_yaw + 180
+                                       else
+                                               pitch_adjustment = new_yaw
+                                       end
+                                       
+                                       local roll_adjustment = pitch_adjustment
+                                       
+                                       pitch_adjustment = 1-(math.abs(pitch_adjustment)/90)
+                                       pitch = pitch-- * pitch_adjustment
+                                       
+                                       --print(pitch_adjustment)
+                                       
+                                       ------
+                                       
+                                       roll = radians_to_degrees(tri_yaw)
+                                       
+                                       local roll_adjustment = 0
+                                       
+                                       if new_yaw >= 270 then
+                                               roll_adjustment = new_yaw - 180
+                                       elseif new_yaw <= -270 then
+                                               roll_adjustment = new_yaw + 180
+                                       else
+                                               roll_adjustment = new_yaw
+                                       end
+                                       
+                                       local secondary_roll_adjustment = 0
+                                       
+                                       if new_yaw > 0 then
+                                               secondary_roll_adjustment = 1
+                                       else
+                                               secondary_roll_adjustment = -1
+                                       end
+                                       
+                                       --print(roll_adjustment)
+                                       
+                                       roll_adjustment = math.abs(roll_adjustment)/90
+                                       roll = roll * roll_adjustment * secondary_roll_adjustment
+                                       
+                                       print(roll)
+                                       
+                               else
+                                       new_yaw = 0
+                               end
+                               
+                               
+                               
+                               --                                                                      roll        newyaw      pitch
+                               self.child:set_attach(self.object, "", vector.new(2.4,1.2,0), vector.new(180+roll,     new_yaw,    180+pitch))
+
+                               
+                               
+                               --self.head_rotation = vector.new(180,new_yaw,180)
+                       end
+               end
+       end
+end