]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/mob/api/data_handling.lua
Add in sheep
[Crafter.git] / mods / mob / api / data_handling.lua
index af424c75ab46454a3d955d765fb459f29f0bb5d7..9afa35b9750d384f856ca028bce74b80905d30a4 100644 (file)
@@ -8,14 +8,22 @@ mobs.create_data_handling_functions = function(def,mob_register)
                        hostile = self.hostile,
                        hostile_timer = self.hostile_timer,
                        death_animation_timer = self.death_animation_timer,
-                       dead = self.dead
+                       dead = self.dead,
+                       tnt_timer = self.tnt_timer,
+                       tnt_tick_timer = self.tnt_tick_timer,
+                       tnt_mod_state = self.tnt_mod_state,
+                       punch_timer = self.punch_timer,
+                       projectile_timer = self.projectile_timer,
+                       scared = self.scared,
+                       scared_timer = self.scared_timer,
+                       c_mob_data = self.c_mob_data,
                })
        end
 
 
        mob_register.on_activate = function(self, staticdata, dtime_s)
                global_mob_amount = global_mob_amount + 1
-               print("Mobs Spawned. Current Mobs: "..global_mob_amount)
+               --print("Mobs Spawned. Current Mobs: "..global_mob_amount)
                self.object:set_armor_groups({immortal = 1})
                --self.object:set_velocity({x = math.random(-5,5), y = 5, z = math.random(-5,5)})
                self.object:set_acceleration(def.gravity)
@@ -29,6 +37,14 @@ mobs.create_data_handling_functions = function(def,mob_register)
                                self.hostile_timer = data.hostile_timer
                                self.death_animation_timer = data.death_animation_timer
                                self.dead = data.dead
+                               self.tnt_timer = data.tnt_timer
+                               self.tnt_tick_timer = data.tnt_tick_timer
+                               self.tnt_mod_state = data.tnt_mod_state
+                               self.punch_timer = data.punch_timer
+                               self.projectile_timer = data.projectile_timer
+                               self.scared = data.scared
+                               self.scared_timer = data.scared_timer                           
+                               self.c_mob_data = data.c_mob_data
                        end
                end
                
@@ -45,6 +61,10 @@ mobs.create_data_handling_functions = function(def,mob_register)
                end
                self.is_mob = true
                self.object:set_armor_groups({immortal = 1})
+
+               if self.custom_on_activate then
+                       self.custom_on_activate(self)
+               end
                --self.object:set_yaw(math.pi*math.random(-1,1)*math.random())
        end
 
@@ -54,14 +74,14 @@ mobs.create_data_handling_functions = function(def,mob_register)
                --animation on the mob's body
                
                --we add in items we want to see in this list
-               local debug_items = {"hostile_timer","hostile"}
+               local debug_items = {"hostile","hostile_timer"}
                local text = ""
                for _,item in pairs(debug_items) do
                        if self[item] ~= nil then
                                text = text..item..": "..tostring(self[item]).."\n"
                        end
                end
-               self.child:set_nametag_attributes({
+               self.object:set_nametag_attributes({
                color = "white",
                text = text
                })