9 protected ref SCR_AudioSourceConfiguration m_AudioSourceConfigurationSpawn;
23 [
RplProp(onRplName:
"OnCompositionSpawned")]
34 SetEventMask(owner, EntityEvent.INIT);
36 SCR_EditorLinkComponent linkComponent = SCR_EditorLinkComponent.Cast(owner.FindComponent(SCR_EditorLinkComponent));
37 if (!linkComponent || !linkComponent.IsSpawningIgnored())
46 BaseGameMode gameMode =
GetGame().GetGameMode();
50 SCR_CampaignBuildingManagerComponent buildingManagerComponent = SCR_CampaignBuildingManagerComponent.Cast(gameMode.FindComponent(SCR_CampaignBuildingManagerComponent));
51 if (!buildingManagerComponent)
58 ResourceName resName = editableEntity.GetPrefab();
59 if (resName.IsEmpty())
62 int prefabId = buildingManagerComponent.GetCompositionId(resName);
79 if (!compositionOutlineResource.IsValid())
82 EntitySpawnParams spawnParams =
new EntitySpawnParams();
83 spawnParams.TransformMode = ETransformMode.WORLD;
84 spawnParams.Parent = entity.GetOwner();
86 IEntity compositionLayout =
GetGame().SpawnEntityPrefab(compositionOutlineResource,
GetGame().GetWorld(), spawnParams);
87 if (!compositionLayout)
90 SCR_CampaignBuildingLayoutComponent layoutComponent = SCR_CampaignBuildingLayoutComponent.Cast(compositionLayout.FindComponent(SCR_CampaignBuildingLayoutComponent));
94 SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(entity.GetOwner().FindComponent(SCR_CampaignBuildingCompositionComponent));
95 if (!compositionComponent)
99 SCR_ServicePointComponent serviceComponent = SCR_ServicePointComponent.Cast(entity.GetOwner().FindComponent(SCR_ServicePointComponent));
100 if (serviceComponent)
101 serviceComponent.SetServiceState(SCR_EServicePointStatus.UNDER_CONSTRUCTION);
103 layoutComponent.SetPrefabId(prefabId);
104 compositionComponent.SetPrefabId(prefabId);
111 BaseGameMode gameMode =
GetGame().GetGameMode();
115 SCR_CampaignBuildingManagerComponent buildingManagerComponent = SCR_CampaignBuildingManagerComponent.Cast(gameMode.FindComponent(SCR_CampaignBuildingManagerComponent));
116 if (!buildingManagerComponent)
123 return outlineManager.GetCompositionOutline(entity);
129 SCR_EditorLinkComponent linkComponent = SCR_EditorLinkComponent.Cast(owner.FindComponent(SCR_EditorLinkComponent));
149 IEntity child =
GetOwner().GetChildren();
156 child = child.GetSibling();
161 SCR_CampaignBuildingLayoutComponent layoutComponent = SCR_CampaignBuildingLayoutComponent.Cast(child.FindComponent(SCR_CampaignBuildingLayoutComponent));
164 child = child.GetSibling();
169 SCR_DestructionMultiPhaseComponent destructionComponent = SCR_DestructionMultiPhaseComponent.Cast(child.FindComponent(SCR_DestructionMultiPhaseComponent));
170 if (!destructionComponent)
173 child = child.GetSibling();
201 Replication.BumpMe();
244 array<ref SCR_EntityBudgetValue> outBudgets = {};
245 editableEnt.GetEntityBudgetCost(outBudgets,
GetOwner());
250 m_iCost = budgetEnt.GetBudgetValue();
369 filter.Validate(entity);
387 SCR_CampaignBuildingTransformingEditorComponent transformComponent = SCR_CampaignBuildingTransformingEditorComponent.Cast(modeEntity.FindComponent(SCR_CampaignBuildingTransformingEditorComponent));
388 if (!transformComponent)
391 transformComponent.ReleaseLastRejectedPivot();
400 RplId
id = RplId.Invalid();
404 RplComponent comp = RplComponent.Cast(newOwner.FindComponent(RplComponent));
435 RplComponent rplComp = RplComponent.Cast(Replication.FindItem(
m_RplCompId));
447 if (!m_AudioSourceConfigurationSpawn || !m_AudioSourceConfigurationSpawn.IsValid())
451 if (soundManagerEntity)
452 soundManagerEntity.CreateAndPlayAudioSource(
GetOwner(), m_AudioSourceConfigurationSpawn);
458 RplComponent rplComponent = RplComponent.Cast(
GetOwner().FindComponent(RplComponent));
459 return (rplComponent && rplComponent.IsProxy());
463 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
470 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
473 IEntity newOwner =
null;
475 RplComponent rplComp = RplComponent.Cast(Replication.FindItem(rplCompId));
477 newOwner = IEntity.Cast(rplComp.GetEntity());
483 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
500 RplComponent rplComp = RplComponent.Cast(
m_ProviderEntity.FindComponent(RplComponent));
508 writer.WriteRplId(rplComp.Id());
519 reader.ReadBool(providerExist);
524 RplComponent rplComp = RplComponent.Cast(Replication.FindItem(
m_RplCompId));
544 if (soundManagerEntity)