14 [
Attribute(defvalue:
"0", uiwidget:
UIWidgets.Slider,
desc:
"Lifetime in seconds, 0 is valid and means the decal is permanent",
"0 360 0.1")]
18 [
Attribute(defvalue:
"300", uiwidget:
UIWidgets.EditBox,
desc:
"Lifetime in seconds, 0 is valid and means the decal is permanent",
"")]
19 private float Lifetime;
21 private bool TerrainOnly;
24 const float NearPlane = 0;
29 ref
Shape m_IntersectionShape;
31 bool m_bCheckIntersection;
43 m_bCheckIntersection =
false;
54 vector GetForwardVec()
63 return Math.Clamp(
scale, 0.01, 10.0);
70 vector dir = to - from;
71 float len = dir.Length();
75 vector dir1 = dir *
size;
76 vector center = to - dir1;
79 vector dir2 = dir.Perpend() *
size;
84 pts[2] = to - dir1 - dir2;
86 pts[4] = to - dir1 + dir2;
89 return Shape.CreateLines(color,
flags, pts, 6);
93 void GetPitchMatrix(
float pitchRad, out vector rotMat[3])
95 float sp = Math.Sin(pitchRad);
96 float cp = Math.Cos(pitchRad);
112 void RecreateVisualizers()
115 vector forward = GetForwardVec();
122 entMat[0] = entMat[0].Normalized();
123 entMat[1] = entMat[1].Normalized();
124 entMat[2] = entMat[2].Normalized();
128 GetPitchMatrix((Angle)*Math.DEG2RAD, rotMat);
131 Math3D.MatrixMultiply3(entMat, rotMat, mat);
148 int color = 0x80FF4000;
149 if (m_bCheckIntersection)
154 if (m_bCheckIntersection)
156 float sphereSize = Math.Clamp(
size*0.025, 0.01, 0.5);
157 m_IntersectionShape = Shape.CreateSphere(
165 m_IntersectionShape = null;
170 override void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)
186 float a = 0.707*Math.Max(1,
Stretch);
202 if (m_IntersectionShape)
203 delete m_IntersectionShape;
223 RecreateVisualizers();
233 RecreateVisualizers();
261 if (Mat ==
string.Empty)
265 vector forward = GetForwardVec();
268 auto param =
new TraceParam;
269 param.Start = origin - forward*farPlane;
270 param.End = origin + forward*farPlane;
274 param.Exclude =
this;
279 m_bCheckIntersection =
false;
285 Decal decal = world.CreateDecal(param.TraceEnt, param.Start, forward,
NearPlane,
FarPlane, Angle* Math.DEG2RAD,
GetSize(),
Stretch, Mat, Lifetime, 0xFFFFFFFF, 0);
288 m_bCheckIntersection =
true;
289 m_vIntersection = param.Start + (param.End - param.Start)*frac;
SCR_EAIThreatSectorFlags flags
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override bool Destroy(int editorPlayerID)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum EVehicleType IEntity
event void _WB_GetBoundBox(inout vector min, inout vector max, IEntitySource src)
Editor needs to know a bound box of entity (For ray-casting, visualizers etc.). You can return any cu...
proto external WorldEditorAPI _WB_GetEditorAPI()
This returns world editor API, which is safe to use from editor events bellow.
event void _WB_SetTransform(inout vector mat[4], IEntitySource src)
Editor changed transformation matrix source. This is the place to apply it on entity....
event void _WB_SetExtraVisualiser(EntityVisualizerType type, IEntitySource src)
If entity needs to have a special visualizer instead of default one, here is the place where you can ...
proto external EntityEvent SetEventMask(EntityEvent e)
proto external float GetScale()
void EOnInit(IEntity owner)
proto external vector GetOrigin()
proto external BaseWorld GetWorld()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external vector GetTransformAxis(int axis)
See IEntity::GetTransformAxis.
proto external void GetTransform(out vector mat[])
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
Instance of created debug visualizer.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
EntityVisualizerType
Game editor entity visualizer type.
proto native vector Vector(float x, float y, float z)