summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actPhysicsUserTag.cpp
blob: 7e46a767707d2b061a0a1de544289a0a333b05d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "KingSystem/ActorSystem/actPhysicsUserTag.h"
#include "KingSystem/ActorSystem/actActor.h"
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
#include "KingSystem/ActorSystem/actBaseProcMgr.h"

namespace ksys::act {

PhysicsUserTag::PhysicsUserTag(Actor* actor) : mActor(actor) {}

PhysicsUserTag::~PhysicsUserTag() = default;

Actor* PhysicsUserTag::getActor(ActorLinkConstDataAccess* accessor, Actor* other_actor) const {
    if (mActor != nullptr) {
        if (mActor != other_actor && !BaseProcMgr::instance()->isAccessingProcSafe(mActor, nullptr))
            return mActor;
        if (!acquireProc(accessor, mActor, "act::PhysicsUserTag"))
            return nullptr;
    }
    return mActor;
}

bool PhysicsUserTag::acquireActor(ActorLinkConstDataAccess* accessor) const {
    return accessor->acquire(mActor);
}

const sead::SafeString& PhysicsUserTag::getName() const {
    return mActor->getName();
}

const sead::SafeString& PhysicsUserTag::getName(phys::RigidBody* rigid_body) const {
    return getName();
}

}  // namespace ksys::act