Cache output of function to variable then call it

This commit is contained in:
Your Name 2022-08-08 10:32:32 -05:00
parent 6ac082aff7
commit da81f0b5b4
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,8 @@ mobs.do_head_logic = function(self, dtime, player)
local head_offset = vector.multiply(body_dir, self.head_direction_offset)
pos = vector.add(pos, head_offset)
if minetest.settings:get_bool("mcl_debug_head_code", false) then
local debug_head = minetest.settings:get_bool("mcl_debug_head_code", false)
if debug_head then
minetest.add_particle({
pos = pos,
velocity = {x=0, y=0, z=0},