Skip to content

Commit

Permalink
feat: adds AddedToAttributeMap activation event
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoD committed May 9, 2022
1 parent c900b7a commit ff92321
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ circumstances:

- Immediate activation (`EffectActivationEvent.ImmediateActivation`)
- Attribute changed activation (`EffectActivationEvent.AttributeChanged`)
- When added to a GameplayAttributeMap (`EffectActivationEvent.AddedToAttributeMap`)

There are two main effect categories: instants and timed-based.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ func _ready():
func apply_effect(effect: GameplayEffect) -> void:
add_child(effect)

if effect.should_activate(GameplayEffect.EffectActivationEvent.AddedToAttributeMap):
effect.apply_effect()

if effect.should_deactivate():
effect.queue_free()


func connect_child_signals() -> void:
if not Engine.editor_hint:
Expand Down
3 changes: 2 additions & 1 deletion addons/godot-gameplay-attributes/nodes/GameplayEffect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class_name GameplayEffect

enum EffectActivationEvent {
AttributeChanged,
ImmediateActivation
AddedToAttributeMap,
ImmediateActivation,
}


Expand Down

0 comments on commit ff92321

Please sign in to comment.