8 protected vector m_vMinBounds;
11 protected vector m_vMaxBounds;
14 protected float m_fMaxRallyPointDistance;
16 [
Attribute(defvalue:
"30",
params:
"1 inf",
desc:
"Maximum distance for teleporting characters out of slot.",
category:
"Entity Spawner")]
17 protected float m_fTeleportMaxDistance;
19 [
Attribute(defvalue:
"3",
params:
"1 inf",
desc:
"Size of Cylinder used to search empty terrain position. Should be big enough to prevent empty position being too close to slot center.",
category:
"Entity Spawner")]
20 protected float m_fTeleportSearchSize;
24 float GetMaxRallyPointDistance()
26 return m_fMaxRallyPointDistance;
31 vector GetMinBoundsVector()
38 vector GetMaxBoundsVector()
52 float GetTeleportMaximumDistance()
54 return m_fTeleportMaxDistance;
59 float GetTeleportSearchSize()
61 return m_fTeleportSearchSize;
72 protected bool m_bShowDebugShape;
74 protected ref Shape m_DebugShape;
94 float maxDistance = prefabData.GetMaxRallyPointDistance();
96 return vector.DistanceSqXZ(labelComp.GetOwner().GetOrigin(),
GetOwner().
GetOrigin()) > maxDistance * maxDistance;
134 return prefabData.GetSlotType();
145 TraceOBB trace =
new TraceOBB();
146 GetOwner().GetWorldTransform(trace.Mat);
151 trace.Start =
GetOwner().GetOrigin();
153 trace.LayerMask = EPhysicsLayerPresets.Projectile;
154 trace.Flags = TraceFlags.ENTS;
155 trace.Mins = prefabData.GetMinBoundsVector();
156 trace.Maxs = prefabData.GetMaxBoundsVector();
160 return trace.TraceEnt;
179 array<ChimeraCharacter> characterArray = {};
182 if (characterArray.IsEmpty())
186 array <vector> positions = {};
187 if (
SCR_WorldTools.FindAllEmptyTerrainPositions(positions,
GetOwner().
GetOrigin(), prefabData.GetTeleportMaximumDistance(), prefabData.GetTeleportSearchSize(), maxResults:characterArray.Count()) == 0)
191 PlayerController playerController;
192 SCR_SpawnerRequestComponent requestComp;
197 foreach (
int i, ChimeraCharacter character : characterArray)
200 if (!positions.IsIndexValid(i))
203 playerId = playerManager.GetPlayerIdFromControlledEntity(character);
206 playerController = playerManager.GetPlayerController(playerId);
207 requestComp = SCR_SpawnerRequestComponent.Cast(playerController.FindComponent(SCR_SpawnerRequestComponent));
209 requestComp.RequestPlayerTeleport(positions[i]);
217 character.GetWorldTransform(transform);
218 transform[3] = positions[i];
221 editableComp.SetTransform(transform);
243 return characterArray.Count();
255 set<SCR_EditableEntityComponent> childrenSet =
new set<SCR_EditableEntityComponent> ();
260 parent.GetChildren(childrenSet);
263 if (!editableChildren)
279 ChimeraCharacter character = ChimeraCharacter.Cast(ent);
294 if (ent.IsInherited(ChimeraCharacter))
306 if (ent.IsLoaded() || ent.GetPhysics().GetSimulationState() == 0 || ent.FindComponent(
BaseLoadoutClothComponent) || ent.FindComponent(WeaponComponent))
310 EntityFlags entityFlags = ent.GetFlags();
311 if (entityFlags & EntityFlags.PROXY)
314 if (ent.IsInherited(ChimeraCharacter))
335 SCR_DamageManagerComponent damageManager = SCR_DamageManagerComponent.Cast(entity.FindComponent(SCR_DamageManagerComponent));
337 return damageManager.IsDestroyed();
358 SCR_EntityLabelPointComponent labelComp = SCR_EntityLabelPointComponent.Cast(ent.FindComponent(SCR_EntityLabelPointComponent));
372 if (m_bShowDebugShape)
382 Print(
"Gamemode is missing SCR_SlotManagerComponent, which is required for functionality of SCR_EntitySpawnerSlotComponent", LogLevel.WARNING);
388 m_RplComponent = RplComponent.Cast(owner.FindComponent(RplComponent));
390 Print(
"SCR_EntitySpawnerSlotComponent is missing RplComponent. It won't work properly without it", LogLevel.WARNING);
396 super.OnPostInit(owner);
397 SetEventMask(owner, EntityEvent.INIT);
400 if (m_bShowDebugShape)
401 SetEventMask(owner, EntityEvent.FRAME);
426 owner.GetTransform(transform);
428 int shapeFlags = ShapeFlags.WIREFRAME;
429 m_DebugShape = Shape.Create(ShapeType.BBOX,
m_iDebugShapeColor, shapeFlags, prefabData.GetMinBoundsVector(), prefabData.GetMaxBoundsVector());
431 m_DebugShape.SetMatrix(transform);
435 override void EOnFrame(IEntity owner,
float timeSlice)
437 if (m_bShowDebugShape && m_DebugShape)
440 owner.GetTransform(transform);
441 m_DebugShape.SetMatrix(transform);
446 override event void _WB_AfterWorldUpdate(IEntity owner,
float timeSlice)
448 if (m_bShowDebugShape && m_DebugShape)
451 owner.GetTransform(transform);
452 m_DebugShape.SetMatrix(transform);