chore: Simplify and move Player functionality to relevant component (#1408)

* Moving and organizing Player code

- Move code to CharacterComponent
- Remove extraneous interfaces
- Simplify some code greatly
- Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.)
- Update code to use CharacterComponent for sending to zone instead of Player*.

* Moving and organizing Player code

- Move code to CharacterComponent
- Remove extraneous interfaces
- Simplify some code greatly
- Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.)
- Update code to use CharacterComponent for sending to zone instead of Player*.
- Remove static storage container (static containers can be destroyed before exit/terminate handler executes)

* remove player cast

* Remove extra includes
This commit is contained in:
David Markowitz
2024-01-12 09:39:51 -08:00
committed by GitHub
parent 66cc582a9a
commit 929d029f12
15 changed files with 200 additions and 305 deletions

View File

@@ -1879,7 +1879,7 @@ const NiQuaternion& Entity::GetRotation() const {
return NiQuaternion::IDENTITY;
}
void Entity::SetPosition(NiPoint3 position) {
void Entity::SetPosition(const NiPoint3& position) {
auto* controllable = GetComponent<ControllablePhysicsComponent>();
if (controllable != nullptr) {
@@ -1907,7 +1907,7 @@ void Entity::SetPosition(NiPoint3 position) {
Game::entityManager->SerializeEntity(this);
}
void Entity::SetRotation(NiQuaternion rotation) {
void Entity::SetRotation(const NiQuaternion& rotation) {
auto* controllable = GetComponent<ControllablePhysicsComponent>();
if (controllable != nullptr) {