]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/init.lua
Add in capes
[Crafter.git] / mods / mob / init.lua
index cf7cc636cb961d800fa228d36d575fa79bd94e7a..73df7a3399e573f2f47dd0c1d5d99ad4eeee8adc 100644 (file)
@@ -74,6 +74,83 @@ mobs.register_mob(
        }
 )
 
+mobs.register_mob(
+       {
+        mobname = "sheep",
+        physical = true,
+        collide_with_objects = false,
+        collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
+        visual = "mesh",
+        visual_size = {x = 3, y = 3},
+        mesh = "sheep.b3d",
+        textures = {
+               "sheep_head_wool.png","sheep_wool.png","sheep.png"
+               --"sheep_head_shaved.png","nothing.png","sheep.png"
+        },
+        
+        --these are used to anchor a point to the head position
+
+
+        -----
+        head_bone = "head",
+        debug_head_pos = false,
+        head_directional_offset = 0.571, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
+        head_height_offset = 1.15, --added to the base y position
+        --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
+        head_position_correction = vector.new(0,4.1,-0.86),
+        --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
+        head_coord = "horizontal",
+        -----
+        
+        is_visible = true,
+        pointable = true,
+        automatic_face_movement_dir = 0,
+        automatic_face_movement_max_rotation_per_sec = 300,
+        makes_footstep_sound = false,
+        hp = 10,
+        gravity = {x = 0, y = -9.81, z = 0},
+        movement_type = "walk",
+        max_speed = 5,
+        state = 0,
+        view_distance = 15,
+        
+        item_drop = "mob:raw_porkchop", 
+        standing_frame = {x=0,y=0},
+        moving_frame = {x=0,y=40},
+        animation_multiplier = 20,
+        ----
+        ----
+        death_rotation = "x",
+        
+        hurt_sound = "sheep",
+        die_sound = "sheep",
+        
+        
+        hostile = false,
+        attacked_hostile = false,
+        attack_type = "punch",
+        group_attack = true,
+
+        c_mob_data = {sheared = false},
+
+        custom_on_activate = function(self)
+               --print(dump(self.c_mob_data))
+               if self.c_mob_data.sheared == true then
+                       self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
+               end
+        end,
+
+        custom_on_punch = function(self)
+               if self.c_mob_data.sheared == false then
+                       self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
+                       self.c_mob_data = {sheared=true}
+                       local pos = self.object:get_pos()
+                       pos.y = pos.y + 0.5
+                       minetest.throw_item(pos,{name="weather:snow_block"})
+               end
+       end
+       }
+)
 
 mobs.register_mob(
        {
@@ -320,7 +397,7 @@ mobs.register_mob(
        hurt_sound = "slime_die",
        die_sound = "slime_die",
        attack_type = "punch",
-       attack_damage = 10,
+       attack_damage = 6,
        custom_on_death = function(self)
                local pos = self.object:get_pos()
                for i = 1,4 do
@@ -358,7 +435,7 @@ mobs.register_mob(
        death_rotation = "z",
        hurt_sound = "slime_die",
        die_sound = "slime_die",
-       attack_damage = 5,
+       attack_damage = 2,
        attack_type = "punch",
        custom_on_death = function(self)
                local pos = self.object:get_pos()
@@ -398,7 +475,7 @@ mobs.register_mob(
        death_rotation = "z",
        hurt_sound = "slime_die",
        die_sound = "slime_die",
-       attack_damage = 2,
+       attack_damage = 1,
        attack_type = "punch",
        item_drop = "mob:slimeball"
        }
@@ -529,6 +606,71 @@ mobs.register_mob(
        }
 )
 
+mobs.register_mob(
+       {
+        mobname = "sneeper",
+        physical = true,
+        collide_with_objects = false,
+        collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
+        visual = "mesh",
+        visual_size = {x = 3.2, y = 3.2},
+        mesh = "creeper.b3d",
+        textures = {
+               "sneeper.png"
+       },
+        is_visible = true,
+        pointable = true,
+        automatic_face_movement_max_rotation_per_sec = 300,
+        makes_footstep_sound = false,
+        hp = 27,
+        gravity = {x = 0, y = -9.81, z = 0},
+        movement_type = "walk",
+        max_speed = 5.5,
+        hostile = true,
+        hostile_cooldown = false,
+        state = 0,
+        view_distance = 32,
+        item_drop = "mob:gunpowder",
+         
+        standing_frame = {x=0,y=0},
+        moving_frame = {x=0,y=40},
+        animation_multiplier = 20,
+        ----
+        pathfinds = true,
+        
+        --these are used to anchor a point to the head position
+        -----
+        automatic_face_movement_dir = 0,
+        head_bone = "head",
+        debug_head_pos = false,
+        --this always has to be slightly positive
+        head_directional_offset = 0.01,
+        head_height_offset = 1.45, --added to the base y position
+        --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
+        head_position_correction = vector.new(0,2.4,0),
+        head_coord = "vertical",
+        -----
+        
+        damage_color = "blue",
+        
+        death_rotation = "x",
+        
+        hurt_sound = "creeper_hurt",
+        die_sound = "creeper_hurt",
+        
+        attack_type = "explode",
+        explosion_type = "weather:snow_block",
+        --projectile_timer_cooldown = 5,
+        --projectile_type = "tnt:tnt",
+        
+        explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
+        explosion_power = 4, -- how big the explosion has to be
+        explosion_time = 3, -- how long it takes for a mob to explode
+        
+        die_in_light = false,
+        --die_in_light_level = 12,
+       }
+)
 
 
 mobs.register_mob(
@@ -598,6 +740,26 @@ mobs.register_mob(
        }
 )
 
+local spider_eyes = {}
+
+spider_eyes.initial_properties = {
+       visual = "mesh",
+       mesh = "spider_eyes.b3d",
+       textures = {"spider_eyes.png"},
+       pointable = false,
+       collisionbox = {0, 0, 0, 0, 0, 0}
+}
+spider_eyes.glow = -1
+spider_eyes.on_step = function(self)
+       if not self.owner or not self.owner:get_luaentity() then
+               self.object:remove()
+       else
+               local owner_head_bone = self.owner:get_luaentity().head_bone
+               local position,rotation = self.owner:get_bone_position(owner_head_bone)
+               self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
+       end
+end
+minetest.register_entity("mob:spider_eyes",spider_eyes)
 
 mobs.register_mob(
        {
@@ -654,11 +816,14 @@ mobs.register_mob(
         hostile = true,
         friendly_in_daylight = true,
         attacked_hostile = true,
-        attack_damage = 8,
+        attack_damage = 3,
         attack_type = "punch",
         group_attack = true,
 
         custom_on_activate = function(self)
+               local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
+               eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
+               eyes:get_luaentity().owner = self.object
                if math.random() > 0.998 then
                        local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
                        local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
@@ -680,3 +845,68 @@ mobs.register_mob(
         --explosion_time = 3, -- how long it takes for a mob to explode
        }
 )
+
+mobs.register_mob(
+       {
+        mobname = "snoider",
+        physical = true,
+        collide_with_objects = false,
+        collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
+        visual = "mesh",
+        visual_size = {x = 3, y = 3},
+        mesh = "spider.b3d",
+        textures = {
+               "snoider.png"
+        },
+        
+        --these are used to anchor a point to the head position
+        -----
+        head_bone = "body.head",
+        debug_head_pos = false,
+        rotational_correction = -math.pi/2,
+        head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
+        head_height_offset = 0.63, --added to the base y position
+        --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
+        head_position_correction = vector.new(0,1.24,0),
+        --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
+        head_coord = "horizontal",
+        -----
+        
+        is_visible = true,
+        pointable = true,
+        automatic_face_movement_dir = 90,
+        automatic_face_movement_max_rotation_per_sec = 300,
+        makes_footstep_sound = false,
+        hp = 30,
+        gravity = {x = 0, y = -9.81, z = 0},
+        movement_type = "walk",
+        max_speed = 6,
+        state = 0,
+        view_distance = 32,
+        
+        item_drop = "mob:string", 
+        standing_frame = {x=21,y=21},
+        moving_frame = {x=0,y=20},
+        animation_multiplier = 20,
+        ----
+        ----
+        death_rotation = "z",
+        
+        hurt_sound = "spider",
+        die_sound = "spider_die",
+        
+        
+        pathfinds = true,
+
+        hostile = true,
+        friendly_in_daylight = true,
+        attacked_hostile = true,
+        attack_damage = 3,
+        attack_type = "punch",
+        group_attack = true,
+
+        --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
+        --explosion_power = 7, -- how big the explosion has to be
+        --explosion_time = 3, -- how long it takes for a mob to explode
+       }
+)