Use only 1 script component per Entity

Serialization won't make sense if we allow two of the same component like that
This commit is contained in:
David Markowitz
2023-06-12 04:13:06 -07:00
parent f9ac0a9dec
commit d224a86e93
3 changed files with 7 additions and 5 deletions

View File

@@ -269,11 +269,13 @@ void Entity::Initialize() {
AddComponent<PlayerForcedMovementComponent>();
break;
case eReplicaComponentType::SCRIPT: {
AddComponent<ScriptComponent>(ScriptComponent::GetScriptName(this, componentId));
std::string script;
if (m_TemplateID == LOT_ZONE_CONTROL) {
const auto zoneScript = ScriptComponent::GetZoneScriptName(componentId);
if (!zoneScript.empty()) AddComponent<ScriptComponent>(zoneScript);
script = ScriptComponent::GetZoneScriptName(componentId);
} else {
script = ScriptComponent::GetScriptName(this, componentId);
}
AddComponent<ScriptComponent>(script); // Technically this should check for if the script name is empty and not create a component if it is.
break;
}
case eReplicaComponentType::BOUNCER: