Closed Phazorknight closed 6 months ago
Ok, this has now been implemented in https://github.com/Phazorknight/Cogito/commit/d07d184f726943c6175acf7fc4c49fdb440ab1b0
In general, this cleaned up quite a bit of code and any dependencies. So why you might be forced to update/redo your own player attributes, you should be able to do so faster and easier now. Let me know if there are any questions, but here are some bullet points of the changes:
Player Attributes have been rebuilt from the ground up.
Player Attributes have a shared base class CogitoPlayerAttribute
Different attribute have added custom behaviours in their own scripts/component scenes.
Player.gd adds all child nodes that are CogitoPlayerAttribute automatically.
Player HUD instantiates HUD elements for attributes automatically based on a PackedScene, and hooks up all signals as needed.
PlayerAttributes are saved to player state dynamically, meaning even if you add or remove any attributes, the player state will save correctly.
Old/previous attribute components are still there (and partially in use, for example with the TargetDestructible), but I'm planning to deprecate these!
With the latest commits the old attribute components have been removed, so I'm closing this.
Wanted to give a heads-up that I'm currently reworking the (player) attributes. These are currently very entwined with the player script themselves and also how they're handled within the HUD.
New approach will look as follows:
With this approach, creating custom attributes should become way easier while also increasing flexibility like enabling/disabling attributes without touching code.