fix discrepancy in HUD display
This commit is contained in:
parent
2f3bd90204
commit
593ce17fab
28
init.lua
28
init.lua
@ -82,10 +82,14 @@ local function calculate_monoid_value(p_name, m_name)
|
|||||||
local eff_type = rec.effect_type
|
local eff_type = rec.effect_type
|
||||||
local type_def = types[eff_type]
|
local type_def = types[eff_type]
|
||||||
|
|
||||||
if type_def ~= nil then
|
if rec.dynamic then
|
||||||
if type_def.values[m_name] ~= nil then
|
p_m_effects[k] = rec.values[m_name]
|
||||||
|
elseif type_def ~= nil and type_def.values[m_name] ~= nil then
|
||||||
p_m_effects[k] = type_def.values[m_name]
|
p_m_effects[k] = type_def.values[m_name]
|
||||||
end
|
else
|
||||||
|
p_m_effects[k] = nil
|
||||||
|
minetest.log("error",
|
||||||
|
"Unknown effect type " .. eff_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -366,6 +370,14 @@ monoidal_effects.apply_effect = function(effect_type, dur, player_name, values)
|
|||||||
|
|
||||||
local dyn = type_def.dynamic
|
local dyn = type_def.dynamic
|
||||||
|
|
||||||
|
local eff_values
|
||||||
|
|
||||||
|
if dyn and values ~= nil then
|
||||||
|
eff_values = values
|
||||||
|
else
|
||||||
|
eff_values = type_def.values
|
||||||
|
end
|
||||||
|
|
||||||
local players = {[player_name] = "true"}
|
local players = {[player_name] = "true"}
|
||||||
|
|
||||||
local tags = type_def.tags
|
local tags = type_def.tags
|
||||||
@ -373,7 +385,7 @@ monoidal_effects.apply_effect = function(effect_type, dur, player_name, values)
|
|||||||
local t_monoids = type_def.monoids
|
local t_monoids = type_def.monoids
|
||||||
|
|
||||||
local record =
|
local record =
|
||||||
effectset.record(dyn, effect_type, players, tags, t_monoids, dur, values)
|
effectset.record(dyn, effect_type, players, tags, t_monoids, dur, eff_values)
|
||||||
|
|
||||||
local p_cache = monoid_cache[player_name]
|
local p_cache = monoid_cache[player_name]
|
||||||
|
|
||||||
@ -382,14 +394,6 @@ monoidal_effects.apply_effect = function(effect_type, dur, player_name, values)
|
|||||||
monoid_cache[player_name] = p_cache
|
monoid_cache[player_name] = p_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
local eff_values
|
|
||||||
|
|
||||||
if (dyn) then
|
|
||||||
eff_values = values
|
|
||||||
else
|
|
||||||
eff_values = type_def.values
|
|
||||||
end
|
|
||||||
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
local player = minetest.get_player_by_name(player_name)
|
||||||
|
|
||||||
if (player ~= nil) then
|
if (player ~= nil) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user