/
System.cpp
103 lines (90 loc) · 3.36 KB
/
System.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "System.hpp"
#include "Module.hpp"
#include "Red/Entity.hpp"
Red::CString App::PuppetStateSystem::GetBodyTypeSuffix(Red::ItemID& aItemID,
const Red::WeakHandle<Red::GameObject>& aOwner,
const Red::Handle<Red::ItemsFactoryAppearanceSuffixBase_Record>&)
{
if (!aOwner)
{
return BaseBodyName;
}
const auto& bodyTags = PuppetStateModule::GetBodyTags();
if (bodyTags.empty())
{
return BaseBodyName;
}
const auto& entityTags = Raw::Entity::EntityTags::Ref(aOwner.instance);
const auto& visualTags = Raw::Entity::VisualTags::Ref(aOwner.instance);
if (!entityTags.IsEmpty() || !visualTags.IsEmpty())
{
for (const auto& [bodyTag, bodyType] : bodyTags)
{
if (entityTags.Contains(bodyTag))
{
return bodyType.ToString();
}
if (visualTags.Contains(bodyTag))
{
return bodyType.ToString();
}
}
}
const auto& components = Raw::Entity::ComponentsStorage::Ref(aOwner.instance).components;
for (const auto& component : components | std::views::reverse)
{
const auto& morphTarget = Red::Cast<Red::entMorphTargetSkinnedMeshComponent>(component);
for (const auto& [bodyTag, bodyType] : bodyTags)
{
if (component->name == bodyTag)
{
return bodyType.ToString();
}
if (morphTarget)
{
if (morphTarget->tags.Contains(bodyTag))
{
return bodyType.ToString();
}
}
}
}
return BaseBodyName;
}
Red::CString App::PuppetStateSystem::GetArmsStateSuffix(Red::ItemID& aItemID,
const Red::WeakHandle<Red::GameObject>& aOwner,
const Red::Handle<Red::ItemsFactoryAppearanceSuffixBase_Record>&)
{
switch (PuppetStateModule::GetArmsState(aOwner))
{
case PuppetArmsState::BaseArms:
return RTTI_ENUM_NAME_STR(PuppetArmsState::BaseArms);
case PuppetArmsState::MantisBlades:
return RTTI_ENUM_NAME_STR(PuppetArmsState::MantisBlades);
case PuppetArmsState::Monowire:
return RTTI_ENUM_NAME_STR(PuppetArmsState::Monowire);
case PuppetArmsState::ProjectileLauncher:
return RTTI_ENUM_NAME_STR(PuppetArmsState::ProjectileLauncher);
default:
return "";
}
}
Red::CString App::PuppetStateSystem::GetFeetStateSuffix(Red::ItemID& aItemID,
const Red::WeakHandle<Red::GameObject>& aOwner,
const Red::Handle<Red::ItemsFactoryAppearanceSuffixBase_Record>&)
{
switch (PuppetStateModule::GetFeetState(aOwner))
{
case PuppetFeetState::Flat:
return RTTI_ENUM_NAME_STR(PuppetFeetState::Flat);
case PuppetFeetState::Lifted:
return RTTI_ENUM_NAME_STR(PuppetFeetState::Lifted);
case PuppetFeetState::HighHeels:
return RTTI_ENUM_NAME_STR(PuppetFeetState::HighHeels);
case PuppetFeetState::FlatShoes:
return RTTI_ENUM_NAME_STR(PuppetFeetState::FlatShoes);
case PuppetFeetState::None:
default:
return "";
}
}