Skip to content

Commit

Permalink
chore: allows only multiplayer_authority to perform changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoD committed Jan 12, 2024
1 parent f7c3129 commit 6b42b98
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/system/attribute/attribute_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ void AttributeContainer::_bind_methods()

void AttributeContainer::apply_attribute_effect(AttributeEffect *attribute_effect, Ref<Attribute> &attribute)
{
if (get_multiplayer_authority() != 1)
{
return;
}

float affected_amount = attribute_effect->_calculate_affected_amount(this);

switch (attribute_effect->get_application_type())
Expand Down Expand Up @@ -280,6 +285,11 @@ void AttributeContainer::_ready()

void AttributeContainer::apply_effect(GameplayEffect *p_game_effect)
{
if (get_multiplayer_authority() != 1)
{
return;
}

TypedArray<AttributeEffect> effects = p_game_effect->get_attribute_effects_applied();

for (int i = 0; i < effects.size(); i++)
Expand Down Expand Up @@ -385,7 +395,7 @@ TypedArray<AttributeEffect> AttributeContainer::get_ongoing_effects() const
return ongoing_effects.duplicate(true);
}

Dictionary AttributeContainer::get_attributes_as_dictionary() const
Dictionary AttributeContainer::get_attributes_as_dictionary() const
{
Dictionary attributes_dictionary;

Expand Down

0 comments on commit 6b42b98

Please sign in to comment.