Fix a bunch of mob stuff
This commit is contained in:
parent
7ccaf6da60
commit
a86f750cdc
@ -8,7 +8,13 @@ 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
|
||||
})
|
||||
end
|
||||
|
||||
@ -29,6 +35,12 @@ 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
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -107,15 +107,16 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
|
||||
local hp = hp-hurt
|
||||
|
||||
self.object:set_texture_mod("^[colorize:red:130")
|
||||
self.hurt_color_timer = 0.25
|
||||
print(self.punched_timer)
|
||||
|
||||
if (self.punched_timer <= 0 and hp > 1) and not self.dead then
|
||||
self.object:set_texture_mod("^[colorize:red:130")
|
||||
self.hurt_color_timer = 0.25
|
||||
if puncher ~= self.object then
|
||||
self.punched_timer = 0.8
|
||||
if self.attacked_hostile then
|
||||
self.hostile = true
|
||||
self.hostile_timer = 20
|
||||
self.punched_timer = 0.8
|
||||
if self.group_attack == true then
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, self.view_distance)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().mobname == self.mobname then
|
||||
@ -148,11 +149,13 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
self.object:add_velocity(dir)
|
||||
self.add_sword_wear(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
elseif (self.punched_timer <= 0 and self.death_animation_timer == 0) then
|
||||
self.object:set_texture_mod("^[colorize:red:130")
|
||||
self.hurt_color_timer = 0.25
|
||||
if puncher ~= self.object then
|
||||
self.punched_timer = 0.8
|
||||
if self.attacked_hostile then
|
||||
self.hostile = true
|
||||
self.hostile_timer = 20
|
||||
self.punched_timer = 0.8
|
||||
if self.group_attack == true then
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, self.view_distance)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().mobname == self.mobname then
|
||||
@ -214,9 +217,6 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
|
||||
global_mob_amount = global_mob_amount - 1
|
||||
print("Mobs Died. Current Mobs: "..global_mob_amount)
|
||||
if self.child and self.child:get_luaentity() then
|
||||
self.child:get_luaentity().parent = nil
|
||||
end
|
||||
|
||||
self.object:remove()
|
||||
end
|
||||
@ -257,11 +257,8 @@ mobs.create_interaction_functions = function(def,mob_register)
|
||||
|
||||
|
||||
if self.hostile == true then
|
||||
|
||||
|
||||
local distance = vector.distance(pos,pos2)
|
||||
|
||||
|
||||
--punch the player
|
||||
if self.attack_type == "punch" then
|
||||
if distance < 2.5 and self.punch_timer <= 0 and object:get_hp() > 0 then
|
||||
|
@ -86,7 +86,7 @@ mobs.create_movement_functions = function(def,mob_register)
|
||||
if nodey then
|
||||
local walkable = nodey.walkable
|
||||
if walkable then
|
||||
local distance = vector.subtract(collision_point,pos).y-self.object:get_properties().collisionbox[2]+0.4
|
||||
local distance = vector.subtract(collision_point,pos).y
|
||||
if distance >= -0.11 then
|
||||
local vel = self.object:get_velocity()
|
||||
self.jump_timer = 0.5
|
||||
|
Loading…
x
Reference in New Issue
Block a user