Fix more deprecated calls and locals not being local

This commit is contained in:
oilboi 2020-05-15 11:04:50 -04:00
parent a86f750cdc
commit 0929c2a1a3
2 changed files with 5 additions and 5 deletions

View File

@ -54,8 +54,8 @@ mobs.create_interaction_functions = function(def,mob_register)
local velocity = vector.multiply(dir,1.1) local velocity = vector.multiply(dir,1.1)
vel1 = vector.multiply(velocity, -1) local vel1 = vector.multiply(velocity, -1)
vel2 = velocity local vel2 = velocity
self.object:add_velocity(vel1) self.object:add_velocity(vel1)
if object:is_player() then if object:is_player() then

View File

@ -2,7 +2,7 @@
mobs.create_movement_functions = function(def,mob_register) mobs.create_movement_functions = function(def,mob_register)
--makes the mob swim --makes the mob swim
mob_register.swim = function(self,dtime) mob_register.swim = function(self,dtime)
local pos = self.object:getpos() local pos = self.object:get_pos()
pos.y = pos.y + 0.3 pos.y = pos.y + 0.3
local node = minetest.get_node(pos).name local node = minetest.get_node(pos).name
self.swimming = false self.swimming = false
@ -25,7 +25,7 @@ mobs.create_movement_functions = function(def,mob_register)
local get_node = minetest.get_node local get_node = minetest.get_node
mob_register.hurt_inside = function(self,dtime) mob_register.hurt_inside = function(self,dtime)
if self.hp > 0 and self.hurt_inside_timer <= 0 then if self.hp > 0 and self.hurt_inside_timer <= 0 then
local pos = self.object:getpos() local pos = self.object:get_pos()
local hurty = get_group(get_node(pos).name, "hurt_inside") local hurty = get_group(get_node(pos).name, "hurt_inside")
if hurty > 0 then if hurty > 0 then
self.object:punch(self.object, 2, self.object:punch(self.object, 2,
@ -64,7 +64,7 @@ mobs.create_movement_functions = function(def,mob_register)
self.hurt_inside(self,dtime) self.hurt_inside(self,dtime)
local currentvel = self.object:getvelocity() local currentvel = self.object:get_velocity()
local goal = vector.multiply(self.direction,self.speed) local goal = vector.multiply(self.direction,self.speed)
local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z) local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z)
acceleration = vector.multiply(acceleration, 0.05) acceleration = vector.multiply(acceleration, 0.05)