5 [
Attribute(
desc:
"When enabled, the action will not be available if target entity is a player or a vehicle containing players.")]
6 protected bool m_bCannotDeletePlayer;
10 return CanBePerformed(selectedEntity, cursorWorldPosition, flags);
15 if (m_bCannotDeletePlayer)
17 SCR_PossessingManagerComponent possessionManager = SCR_PossessingManagerComponent.GetInstance();
20 set<SCR_EditableEntityComponent> children =
new set<SCR_EditableEntityComponent>();
21 selectedEntity.GetChildren(children);
24 IEntity owner = child.GetOwner();
25 SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(owner.FindComponent(SCR_BaseCompartmentManagerComponent));
26 if (compartmentManager)
29 array<IEntity> occupants = {};
30 compartmentManager.GetOccupants(occupants);
31 foreach (IEntity occupant: occupants)
33 if (possessionManager)
35 if (possessionManager.GetIdFromMainEntity(occupant) != 0)
40 if ((
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(occupant) != 0))
48 if (possessionManager)
50 if (possessionManager.GetIdFromMainEntity(owner) != 0)
55 if ((
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(owner) != 0))
70 selectedEntity.Delete(
true);