dont duplicate perks

This commit is contained in:
bgkillas 2024-09-01 18:13:51 -04:00
parent 0e103b3d80
commit ac426dcd50
2 changed files with 5 additions and 3 deletions

View file

@ -42,16 +42,18 @@ local function give_one_perk(entity_who_picked, perk_info, count)
lazyload()
-- add game effect
if perk_info.game_effect ~= nil then
local game_effect_comp = GetGameEffectLoadTo( entity_who_picked, perk_info.game_effect, true )
local game_effect_comp, ent = GetGameEffectLoadTo( entity_who_picked, perk_info.game_effect, true )
if game_effect_comp ~= nil then
ComponentSetValue( game_effect_comp, "frames", "-1" )
EntityAddTag( ent, "perk_entity" )
end
end
if perk_info.game_effect2 ~= nil then
local game_effect_comp = GetGameEffectLoadTo( entity_who_picked, perk_info.game_effect2, true )
local game_effect_comp, ent = GetGameEffectLoadTo( entity_who_picked, perk_info.game_effect2, true )
if game_effect_comp ~= nil then
ComponentSetValue( game_effect_comp, "frames", "-1" )
EntityAddTag( ent, "perk_entity" )
end
end

View file

@ -19,7 +19,7 @@ function effect_sync.get_ent_effects(entity)
local com = EntityGetFirstComponent(ent, "GameEffectComponent")
if com ~= nil then
local name = ComponentGetValue2(com, "effect")
if not IGNORE_EFFECTS[name] and filename ~= EntityGetFilename(ent) then
if not IGNORE_EFFECTS[name] and filename ~= EntityGetFilename(ent) and not EntityHasTag(ent, "perk_entity") then
table.insert(list, ent)
end
end