4 [
Attribute(
"{A8FFCD3F3697D77F}Prefabs/Editor/Lightning/LightningStrike.et")]
5 protected ResourceName m_sLightningPrefab;
8 override bool CanBeShown(
SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,
int flags)
11 if (world.IsGameTimePaused())
16 return !hoveredEntity || hoveredEntity.GetPos(positionCheck);
19 override bool CanBePerformed(
SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,
int flags)
21 return CanBeShown(hoveredEntity, selectedEntities, cursorWorldPosition, flags);
24 override void Perform(
SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,
int flags,
int param = -1)
27 hoveredEntity.GetPos(cursorWorldPosition);
29 Resource resource = Resource.Load(m_sLightningPrefab);
38 EntitySpawnParams spawnParams =
new EntitySpawnParams;
39 spawnParams.Transform[3] = cursorWorldPosition;
45 entitySource.Get(
"scale", scale);
47 Math3D.MatrixScale(spawnParams.Transform, scale);
50 vector angles = Math3D.MatrixToAngles(spawnParams.Transform);
51 angles[0] = Math.RandomFloat(0, 360);
52 Math3D.AnglesToMatrix(angles, spawnParams.Transform);
54 GetGame().SpawnEntityPrefab(resource,
GetGame().GetWorld(), spawnParams);