- mob_register.on_activate = function(self, staticdata, dtime_s)
- global_mob_amount = global_mob_amount + 1
- 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)
- if string.sub(staticdata, 1, string.len("return")) == "return" then
- local data = minetest.deserialize(staticdata)
- if data and type(data) == "table" then
- --self.range = data.range
- self.hp = data.hp
- self.hunger = data.hunger
- self.hostile = data.hostile
- self.hostile_timer = data.hostile_timer
- self.death_animation_timer = data.death_animation_timer
- self.dead = data.dead
- end
- end
-
- --set up mob
- self.object:set_animation(def.standing_frame, 0, 0, true)
- self.current_animation = 0
- self.object:set_hp(self.hp)
- self.direction = vector.new(math.random()*math.random(-1,1),0,math.random()*math.random(-1,1))
-
-
- --set the head up
- if def.has_head == true then
- local head = minetest.add_entity(self.object:get_pos(), "mob:head"..def.mobname)
- if head then
- self.child = head
- self.child:get_luaentity().parent = self.object
- self.child:set_attach(self.object, "", self.head_mount, vector.new(0,0,0))
- self.head_rotation = vector.new(0,0,0)
- self.child:set_animation({x=90,y=90}, 15, 0, true)
- end
- end
- self.is_mob = true
- self.object:set_armor_groups({immortal = 1})
- --self.object:set_yaw(math.pi*math.random(-1,1)*math.random())
- 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)
+ 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)
+ if string.sub(staticdata, 1, string.len("return")) == "return" then
+ local data = minetest.deserialize(staticdata)
+ if data and type(data) == "table" then
+ --self.range = data.range
+ self.hp = data.hp
+ self.hunger = data.hunger
+ self.hostile = data.hostile
+ 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
+ end
+ end
+
+ --set up mob
+ self.object:set_animation(def.standing_frame, 0, 0, true)
+ self.current_animation = 0
+ self.object:set_hp(self.hp)
+ self.direction = vector.new(math.random()*math.random(-1,1),0,math.random()*math.random(-1,1))
+
+
+ --set the head up
+ if self.head_bone then
+ self.object:set_bone_position(self.head_bone, self.head_position_correction, vector.new(0,0,0))
+ end
+ self.is_mob = true
+ self.object:set_armor_groups({immortal = 1})
+ --self.object:set_yaw(math.pi*math.random(-1,1)*math.random())
+ end