]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/init.lua
remove server debug
[Crafter.git] / mods / mob / init.lua
index 934f65a882e66a29fd09392bed36b56bb3cf2441..5906f9632e384f7030d3bd4b68412ea53e03b771 100644 (file)
@@ -1,9 +1,6 @@
 local minetest,math,vector = minetest,math,vector
 --this is where mobs are defined
 
---this is going to be used to set an active mob limit
-global_mob_amount = 0
-
 local path = minetest.get_modpath(minetest.get_current_modname())
 
 dofile(path.."/spawning.lua")
@@ -231,6 +228,17 @@ mobs.register_mob(
        }
 )
 
+
+local acceptable_drawtypes = {
+       ["normal"] = true,
+       ["glasslike"] = true,
+       ["glasslike_framed"] = true,
+       ["glasslike_framed_optional"] = true,
+       ["allfaces"] = true,
+       ["allfaces_optional"] = true,
+}
+local node
+local def
 mobs.register_mob(
        {
         mobname = "snowman",
@@ -284,7 +292,8 @@ mobs.register_mob(
         die_sound = "wool",
         
         
-        hostile = true,
+        hostile = false,
+        attacked_hostile = true,
         attack_type = "projectile",
         projectile_type = "weather:snowball",
         projectile_timer_cooldown = 1,
@@ -292,10 +301,18 @@ mobs.register_mob(
         custom_function = function(self,dtime,moveresult)
                if moveresult and moveresult.touching_ground then
                        local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
-
                        if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
-                               if minetest.get_nodedef(minetest.get_node(pos).name,"buildable_to") == true and minetest.get_nodedef(minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name,"buildable_to") == false then
-                                       minetest.set_node(pos,{name="weather:snow"})
+                               node = minetest.get_node(pos).name
+                               if node == "air" then
+                                       node = minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name
+                                       def = minetest.registered_nodes[node]
+
+                                       drawtype = acceptable_drawtypes[def.drawtype]
+                                       walkable = def.walkable
+                                       liquid = (def.liquidtype ~= "none")
+                                       if not liquid and walkable and drawtype and node ~= "main:ice" then
+                                               minetest.set_node(pos,{name="weather:snow"})
+                                       end
                                end
                        end
                        self.custom_old_pos = pos
@@ -413,7 +430,7 @@ mobs.register_mob(
        gravity = {x = 0, y = -9.81, z = 0},
        movement_type = "jump",
        make_jump_noise = true,
-       max_speed = 5,
+       max_speed = 4,
        hostile = true,
        state = 0,
        view_distance = 20,
@@ -422,6 +439,7 @@ mobs.register_mob(
        die_sound = "slime_die",
        attack_type = "punch",
        attack_damage = 6,
+       die_in_light = true,
        custom_on_death = function(self)
                local pos = self.object:get_pos()
                for i = 1,4 do
@@ -460,7 +478,7 @@ mobs.register_mob(
        gravity = {x = 0, y = -9.81, z = 0},
        movement_type = "jump",
        make_jump_noise = true,
-       max_speed = 5,
+       max_speed = 4,
        hostile = true,
        state = 0,
        view_distance = 20,
@@ -469,6 +487,7 @@ mobs.register_mob(
        die_sound = "slime_die",
        attack_damage = 2,
        attack_type = "punch",
+       die_in_light = true,
        custom_on_death = function(self)
                local pos = self.object:get_pos()
                pos.y = pos.y + 0.2
@@ -507,7 +526,7 @@ mobs.register_mob(
        gravity = {x = 0, y = -9.81, z = 0},
        movement_type = "jump",
        make_jump_noise = true,
-       max_speed = 5,
+       max_speed = 4,
        hostile = true,
        state = 0,
        view_distance = 20,
@@ -517,6 +536,7 @@ mobs.register_mob(
        attack_damage = 1,
        attack_type = "punch",
        item_drop = "mob:slimeball",
+       die_in_light = true,
        fire_table = {
                visual_size = vector.new(1/5.8,1/3.3,1/5.8),
                position = vector.new(0,1.5,0),
@@ -579,12 +599,79 @@ mobs.register_mob(
         explosion_time = 5, -- how long it takes for a mob to explode
         
         die_in_light = true,
-        die_in_light_level = 12,
        }
 )
 
 ]]--
 
+
+mobs.register_mob(
+       {
+        mobname = "zombie",
+        physical = true,
+        collide_with_objects = false,
+        collisionbox = {-0.23,0, -0.23, 0.23, 1.7, 0.23},
+        visual = "mesh",
+        visual_size = {x = 3.2, y = 3.2},
+        mesh = "zombie.b3d",
+        textures = {
+               "zombie.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 = 3,
+        hostile = true,
+        hostile_cooldown = false,
+        state = 0,
+        view_distance = 32,
+        item_drop = "mob:cooked_porkchop",
+         
+        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.55, --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",
+        -----
+         
+        
+        death_rotation = "x",
+        
+        hurt_sound = "hurt",
+        die_sound = "hurt",
+        sound_pitch_mod_min = 60,
+        sound_pitch_mod_max = 80,
+        sound_pitch_mod_min_die = 50,
+        sound_pitch_mod_max_die = 70,
+        attack_type = "punch",
+        attack_damage = 3,
+        
+        die_in_light = true,
+
+        fire_table = {
+               visual_size = vector.new(1/4,2/3,1/4),
+               position = vector.new(0,3.3,0),
+       }
+       }
+)
+
+
 mobs.register_mob(
        {
         mobname = "creeper",
@@ -604,7 +691,7 @@ mobs.register_mob(
         hp = 27,
         gravity = {x = 0, y = -9.81, z = 0},
         movement_type = "walk",
-        max_speed = 5.5,
+        max_speed = 4,
         hostile = true,
         hostile_cooldown = false,
         state = 0,
@@ -645,7 +732,6 @@ mobs.register_mob(
         explosion_time = 3, -- how long it takes for a mob to explode
         
         die_in_light = false,
-        --die_in_light_level = 12,
         fire_table = {
                visual_size = vector.new(1/4,2/3,1/4),
                position = vector.new(0,3.3,0),
@@ -672,7 +758,7 @@ mobs.register_mob(
         hp = 27,
         gravity = {x = 0, y = -9.81, z = 0},
         movement_type = "walk",
-        max_speed = 5.5,
+        max_speed = 4,
         hostile = true,
         hostile_cooldown = false,
         state = 0,
@@ -715,7 +801,6 @@ mobs.register_mob(
         explosion_time = 3, -- how long it takes for a mob to explode
         
         die_in_light = false,
-        --die_in_light_level = 12,
         fire_table = {
                visual_size = vector.new(1/4,2/3,1/4),
                position = vector.new(0,3.3,0),
@@ -743,7 +828,7 @@ mobs.register_mob(
         hp = 40,
         gravity = {x = 0, y = -9.81, z = 0},
         movement_type = "walk",
-        max_speed = 9,
+        max_speed = 6,
         hostile = true,
         hostile_cooldown = false,
         state = 0,
@@ -782,12 +867,11 @@ mobs.register_mob(
         --projectile_type = "tnt:tnt",
         
         explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
-        explosion_power = 14, -- how big the explosion is (radius)
+        explosion_power = 6, -- how big the explosion is (radius)
         explosion_time = 3, -- how long it takes for a mob to explode
         explosion_blink_timer = 0.1, -- how fast the blinking happens
         
         die_in_light = false,
-        --die_in_light_level = 12,
         fire_table = {
                visual_size = vector.new(1/4,2/3,1/4),
                position = vector.new(0,3.3,0),
@@ -850,7 +934,7 @@ mobs.register_mob(
         hp = 30,
         gravity = {x = 0, y = -9.81, z = 0},
         movement_type = "walk",
-        max_speed = 6,
+        max_speed = 4,
         state = 0,
         view_distance = 32,
         
@@ -940,7 +1024,7 @@ mobs.register_mob(
         hp = 30,
         gravity = {x = 0, y = -9.81, z = 0},
         movement_type = "walk",
-        max_speed = 6,
+        max_speed = 4,
         state = 0,
         view_distance = 32,