1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-11-12 05:20:41 +01:00

Fix movement and level bugs

This commit is contained in:
stujones11 2017-03-29 17:44:40 +01:00
parent fe9664589a
commit 3aac5c98f4

View File

@ -157,13 +157,12 @@ armor.set_player_armor = function(self, player)
local groups = {} local groups = {}
local change = {} local change = {}
for _, phys in pairs(self.physics) do for _, phys in pairs(self.physics) do
physics[phys] = 0 physics[phys] = 1
end end
for _, attr in pairs(self.attributes) do for _, attr in pairs(self.attributes) do
attributes[attr] = 0 attributes[attr] = 0
end end
for group, base in pairs(self.registered_groups) do for group, _ in pairs(self.registered_groups) do
groups[group] = base
change[group] = 1 change[group] = 1
levels[group] = 0 levels[group] = 0
end end
@ -218,7 +217,6 @@ armor.set_player_armor = function(self, player)
end end
for group, level in pairs(levels) do for group, level in pairs(levels) do
if level > 0 then if level > 0 then
local base = self.registered_groups[group]
if minetest.get_modpath("shields") then if minetest.get_modpath("shields") then
level = level * 0.9 level = level * 0.9
end end
@ -226,6 +224,8 @@ armor.set_player_armor = function(self, player)
level = level * 1.1 level = level * 1.1
end end
level = level * armor.config.level_multiplier level = level * armor.config.level_multiplier
end
local base = self.registered_groups[group]
self.def[name].groups[group] = level self.def[name].groups[group] = level
if level > base then if level > base then
level = base level = base
@ -233,7 +233,6 @@ armor.set_player_armor = function(self, player)
groups[group] = base - level groups[group] = base - level
change[group] = groups[group] / base change[group] = groups[group] / base
end end
end
for _, attr in pairs(self.attributes) do for _, attr in pairs(self.attributes) do
self.def[name][attr] = attributes[attr] self.def[name][attr] = attributes[attr]
end end