From 3aac5c98f4a95fac9136af63ab129ca4bb1246cf Mon Sep 17 00:00:00 2001 From: stujones11 Date: Wed, 29 Mar 2017 17:44:40 +0100 Subject: [PATCH] Fix movement and level bugs --- 3d_armor/api.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/3d_armor/api.lua b/3d_armor/api.lua index 31a8454..712ff84 100644 --- a/3d_armor/api.lua +++ b/3d_armor/api.lua @@ -157,13 +157,12 @@ armor.set_player_armor = function(self, player) local groups = {} local change = {} for _, phys in pairs(self.physics) do - physics[phys] = 0 + physics[phys] = 1 end for _, attr in pairs(self.attributes) do attributes[attr] = 0 end - for group, base in pairs(self.registered_groups) do - groups[group] = base + for group, _ in pairs(self.registered_groups) do change[group] = 1 levels[group] = 0 end @@ -218,7 +217,6 @@ armor.set_player_armor = function(self, player) end for group, level in pairs(levels) do if level > 0 then - local base = self.registered_groups[group] if minetest.get_modpath("shields") then level = level * 0.9 end @@ -226,13 +224,14 @@ armor.set_player_armor = function(self, player) level = level * 1.1 end level = level * armor.config.level_multiplier - self.def[name].groups[group] = level - if level > base then - level = base - end - groups[group] = base - level - change[group] = groups[group] / base end + local base = self.registered_groups[group] + self.def[name].groups[group] = level + if level > base then + level = base + end + groups[group] = base - level + change[group] = groups[group] / base end for _, attr in pairs(self.attributes) do self.def[name][attr] = attributes[attr]