Skip to content

Commit

Permalink
chore: only server's authority can change attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoD committed Feb 6, 2023
1 parent e905e96 commit 7480a18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Godot 4+ specific ignores
.godot/
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func _update_attribute(index: int, key: String, value: float) -> void:

## Applies an effect on current GameplayAttributeMap
func apply_effect(effect: GameplayEffect) -> void:
if multiplayer and not multiplayer.is_server():
return

if effect == null:
return

Expand Down Expand Up @@ -182,7 +185,7 @@ func get_attribute_by_name(attribute_name: String) -> AttributeSpec:


## Represents an attribute as a class
class AttributeSpec extends Object:
class AttributeSpec extends Node:
## Emitted when the instance has changed one of it's values
signal changed(spec: AttributeSpec)
## Emitted when the instance has changed it's minimum value
Expand All @@ -200,7 +203,7 @@ class AttributeSpec extends Object:
return current_value
set(value):
var previous_value = current_value

if previous_value == value:
return

Expand Down

0 comments on commit 7480a18

Please sign in to comment.