1 [
ComponentEditorProps(
category:
"GameScripted/Editor (Editables)", description:
"", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
67 array<BaseCompartmentSlot> compartments = {};
72 return occupant.GetAIGroup();
84 array<BaseCompartmentSlot> compartments = {};
103 array<BaseCompartmentSlot> compartments = {};
104 int playerIdToReturn = 0;
107 BaseCompartmentSlot compartment = compartments[i];
111 int playerId = occupant.GetPlayerID();
115 if (playerIdToReturn == 0)
116 playerIdToReturn = playerId;
122 return playerIdToReturn;
133 array<BaseCompartmentSlot> compartments = {};
142 int playerId = playerManager.GetPlayerIdFromControlledEntity(occupant.GetOwner());
154 override int GetCrew(out notnull array<CompartmentAccessComponent> crewCompartmentAccess,
bool ignorePlayers =
true)
156 SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(
GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
157 if (!compartmentManager)
164 playerManager =
GetGame().GetPlayerManager();
166 array<IEntity> occupants = {};
167 compartmentManager.GetOccupants(occupants);
168 CompartmentAccessComponent compartmentAccess;
170 foreach (IEntity occupant : occupants)
172 if (ignorePlayers && playerManager.GetPlayerIdFromControlledEntity(occupant) > 0)
175 compartmentAccess = CompartmentAccessComponent.Cast(occupant.FindComponent(CompartmentAccessComponent));
177 if (compartmentAccess && compartmentAccess.IsInCompartment())
178 crewCompartmentAccess.Insert(compartmentAccess);
181 return crewCompartmentAccess.Count();
188 SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(
GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
189 if (!compartmentManager)
192 array<IEntity> occupants = {};
193 SCR_EditableCharacterComponent editableCharacter;
194 compartmentManager.GetOccupants(occupants);
196 foreach (IEntity occupant : occupants)
198 editableCharacter = SCR_EditableCharacterComponent.Cast(occupant.FindComponent(SCR_EditableCharacterComponent));
199 if (editableCharacter)
200 editableCharacter.PlayerTeleportedByParentFeedback(
true);
205 override void SetTransform(vector transform[4],
bool changedByUser =
false)
207 super.SetTransform(transform, changedByUser);
225 bool CanOccupyVehicleWithCharacters(array<ECompartmentType> compartmentTypes,
bool checkHasDefaultOccupantsData,
int playerID,
bool checkEditorBudget =
true,
bool checkOccupyingFaction =
true,
bool checkForFreeCompartments =
true,
bool checkForFreeDefaultCompartments =
false)
227 FactionKey factionKey =
string.Empty;
232 if (checkOccupyingFaction)
236 factionKey = uiInfo.GetFactionKey();
239 bool hasEnoughBudgetForDefaultCompartments;
240 bool hasFreeDefaultCompartments;
242 if (checkEditorBudget || checkForFreeDefaultCompartments)
245 if (checkEditorBudget && !hasEnoughBudgetForDefaultCompartments)
248 if (checkForFreeDefaultCompartments && !hasFreeDefaultCompartments)
251 return m_CompartmentManager.CanOccupy(compartmentTypes, checkHasDefaultOccupantsData, factionKey, checkOccupyingFaction, checkForFreeCompartments);
258 noFreeDefaultCompartments =
true;
260 array<BaseCompartmentSlot> compartments = {};
268 array<ResourceName> occupantsToSpawn = {};
269 ResourceName occupant;
271 foreach (BaseCompartmentSlot compartment : compartments)
273 occupant = compartment.GetDefaultOccupantPrefab();
274 if (!occupant.IsEmpty())
275 occupantsToSpawn.Insert(occupant);
279 if (occupantsToSpawn.IsEmpty())
281 noFreeDefaultCompartments =
false;
294 editorManager = editorCore.GetEditorManager(playerID);
310 return contentBrowser && contentBrowser.CanPlace(occupantsToSpawn,
EEditableEntityType.CHARACTER);
339 array<ECompartmentType> compartmentsToFill = {};
347 if (!uiInfo || !uiInfo.GetEditorPlaceAsOneGroup())
350 compartmentsToFill.InsertAll(SCR_BaseCompartmentManagerComponent.CREW_COMPARTMENT_TYPES);
357 if (!uiInfo || !uiInfo.GetEditorPlaceAsOneGroup())
360 compartmentsToFill.InsertAll(SCR_BaseCompartmentManagerComponent.PASSENGER_COMPARTMENT_TYPES);
364 if (!compartmentsToFill.IsEmpty())
382 if (DiagMenu.GetValue(
SCR_DebugMenuID.DEBUGUI_EDITOR_ENTITIES_DISABLE))
385 super.OnPostInit(owner);
389 m_CompartmentManager = SCR_BaseCompartmentManagerComponent.Cast(owner.FindComponent(SCR_BaseCompartmentManagerComponent));
394 EventHandlerManagerComponent eventHandlerManager = EventHandlerManagerComponent.Cast(owner.FindComponent(EventHandlerManagerComponent));
395 if (eventHandlerManager)
396 eventHandlerManager.RegisterScriptHandler(
"OnDestroyed", owner,
OnDestroyed);