9 static Widget m_DebugLayoutCanvas;
12 static IEntity g_TraceFilterEnt = null;
15 static ref set<IEntity> g_TraceFilterList =
new set<IEntity>();
18 static float g_fPhysicsHz = 60;
21 static bool IsScope2DEnabled()
41 return "platform-windows";
44 return "platform-playstation";
47 return "platform-xbox";
50 return "platform-windows";
57 static string GetProfileName()
61 if (
GetGame().GetBackendApi().IsLocalPlatformAssigned())
63 Print(
"Profile - Using Local Platform Name!");
74 if (name ==
string.Empty)
76 name =
System.GetProfileName();
77 if (name ==
string.Empty)
79 Print(
"Profile - Using MachineName!");
80 name =
System.GetMachineName();
92 for (
int a = 0; a < 3; a++)
111 if (!
GetGame().GetWorldEntity().GetWorld().IsOcean())
114 if (!
GetGame().GetWorldEntity())
118 GetGame().GetWorldEntity().GetWorldBounds(min, max);
120 for (
int a = 0; a < 3; a++)
138 static bool GetIntersectPointPlane(
vector start,
vector end, out
vector result,
float height)
141 float dist = dir.NormalizeSize();
146 for (
int a = 0; a < 3; a++)
151 float val1 = start[a];
164 float intersectPct =
Math3D.IntersectionRayBox(start, end, mins -
"1 0 1", maxs +
"1 0 1");
165 if (intersectPct < 0)
168 result = dir * dist * intersectPct + start;
180 static void GetDistForHUD(
float dist,
bool imperial, out
string tgtDist, out
string distFormat)
188 dist =
Math.Floor(dist * 10) * 0.1;
189 tgtDist = dist.ToString();
192 else if (dist >= 100)
194 dist =
Math.Floor(dist * 10) * 0.1;
195 tgtDist = dist.ToString();
200 dist =
Math.Floor(dist * 100) * 0.01;
201 tgtDist = dist.ToString();
206 dist =
Math.Floor(dist * 360) * 0.1;
207 tgtDist = dist.ToString();
216 dist =
Math.Floor(dist * 10) * 0.1;
217 tgtDist = dist.ToString();
220 else if (dist >= 100)
222 dist =
Math.Floor(dist * 10) * 0.1;
223 tgtDist = dist.ToString();
228 dist =
Math.Floor(dist * 100) * 0.01;
229 tgtDist = dist.ToString();
234 dist =
Math.Floor(dist * 1000) * 0.1;
235 tgtDist = dist.ToString();
243 static bool FilterCallback_IgnoreNotInList(notnull
IEntity target)
245 if (g_TraceFilterList.Contains(target))
254 static bool FilterCallback_IgnoreCharactersWithChildren(notnull
IEntity target)
261 target = target.GetParent();
270 static bool FilterCallback_IgnoreCharacters(notnull
IEntity target)
281 static bool FilterCallback_IgnoreEntityWithChildren(notnull
IEntity target,
vector rayorigin,
vector raydirection)
283 if (g_TraceFilterEnt == null)
288 if (target == g_TraceFilterEnt)
291 target = target.GetParent();
299 static bool FilterCallback_IgnoreAllButEntityWithChildren(notnull
IEntity target,
vector rayorigin,
vector raydirection)
301 if (g_TraceFilterEnt == null)
306 if (target == g_TraceFilterEnt)
309 target = target.GetParent();
317 static bool FilterCallback_IgnoreAllButEntity(notnull
IEntity target,
vector rayorigin,
vector raydirection)
319 if (g_TraceFilterEnt == null)
322 if (target == g_TraceFilterEnt)
333 static bool FilterCallback_IgnoreAllButMeleeAttackable(notnull
IEntity target,
vector rayorigin,
vector raydirection)
335 typename type = target.Type();
355 static bool FilterCallback_IgnoreAllButBuildingRegions(notnull
IEntity target,
vector rayorigin,
vector raydirection)
357 typename type = target.Type();
383 return damage * dmgScale;
389 static int GetChildIndex(
IEntity ent)
411 static array<ref ParamEnum> GetBonesAsParamEnums(
IEntity entity)
413 array<ref ParamEnum> retEnums =
new array<ref ParamEnum>;
414 array<string> boneNames =
new array<string>;
416 anim.GetBoneNames(boneNames);
418 retEnums.Insert(
new ParamEnum(
"NONE",
"-1",
""));
419 foreach (
string s : boneNames)
421 int nodeid = anim.GetBoneIndex(s);
422 retEnums.Insert(
new ParamEnum(s, nodeid.ToString(),
""));
431 static void SetEntityAsChildToParent(
IEntity parent,
IEntity child)
440 Math3D.MatrixInvMultiply4(parentMat, childMat, childLocalMat);
453 result[0] = inputVec[0] * scaleVec[0];
454 result[1] = inputVec[1] * scaleVec[1];
455 result[2] = inputVec[2] * scaleVec[2];
463 static float GetGlobalYawForMat(
vector mat[4])
467 vector angs = fw.VectorToAngles();
475 static void LerpMatrix(
vector mat1[4],
vector mat2[4], out
vector matOut[4],
float pct)
494 float q1[4], q2[4], qOut[4];
495 Math3D.MatrixToQuat(mat1, q1);
496 Math3D.MatrixToQuat(mat2, q2);
497 Math3D.QuatLerp(qOut, q1, q2, pct);
498 Math3D.QuatToMatrix(qOut, matOut);
499 matOut[3] = (mat2[3] - mat1[3]) * pct + mat1[3];
505 static void GetLocalMatrix(
vector parentMat[4],
vector childMat[4])
508 Math3D.MatrixCopy(childMat, childOrigMat);
509 Math3D.MatrixInvMultiply4(parentMat, childOrigMat, childMat);
518 pt1 = mins.Multiply4(mat);
519 pt2 = maxs.Multiply4(mat);
522 for (
int i = 0; i < 3; i++)
524 if (pt1[i] < mins[i])
526 if (pt2[i] < mins[i])
528 if (pt1[i] > maxs[i])
530 if (pt2[i] > maxs[i])
542 static void GetWorldBoundsWithChildren(
IEntity entity, out
vector min, out
vector max,
bool isChild =
false)
555 vector entityMin, entityMax;
558 min[0] =
Math.Min(min[0], entityMin[0]);
559 min[1] =
Math.Min(min[1], entityMin[1]);
560 min[2] =
Math.Min(min[2], entityMin[2]);
562 max[0] =
Math.Max(max[0], entityMax[0]);
563 max[1] =
Math.Max(max[1], entityMax[1]);
564 max[2] =
Math.Max(max[2], entityMax[2]);
570 GetWorldBoundsWithChildren(entity, min, max,
true);
578 static bool GetObjectAtOffsetFromObject(
IEntity parent,
IEntity child,
vector localPos,
vector localAng,
float tolerancePos,
float toleranceAng)
584 Math3D.AnglesToMatrix(localAng, offsetMat);
585 offsetMat[3] = localPos;
587 vector parentOffsetMat[4];
588 Math3D.MatrixMultiply4(parentMat, offsetMat, parentOffsetMat);
594 Math3D.MatrixInvMultiply4(parentOffsetMat, childMat, relativeMat);
596 vector pos = relativeMat[3];
597 if (pos.Length() > tolerancePos)
603 dir = relativeMat[0];
604 cross = dir *
vector.Right;
605 if (
Math.AbsFloat(cross) > toleranceAng)
608 dir = relativeMat[1];
610 if (
Math.AbsFloat(cross) > toleranceAng)
613 dir = relativeMat[2];
614 cross = dir *
vector.Forward;
615 if (
Math.AbsFloat(cross) > toleranceAng)
625 for (
int i = 0; i < 3; i++)
627 if (pos[i] > maxs[i])
629 if (pos[i] < mins[i])
639 static bool IntersectBoxSphere(
vector center,
float radius,
vector mins,
vector maxs, out
float intersectDist = 0)
641 float dist_sq = -
Math.Pow(radius, 2);
643 if (center[0] < mins[0])
644 dist_sq +=
Math.Pow(center[0] - mins[0], 2);
645 else if (center[0] > maxs[0])
646 dist_sq +=
Math.Pow(center[0] - maxs[0], 2);
647 if (center[1] < mins[1])
648 dist_sq +=
Math.Pow(center[1] - mins[1], 2);
649 else if (center[1] > maxs[1])
650 dist_sq +=
Math.Pow(center[1] - maxs[1], 2);
651 if (center[2] < mins[2])
652 dist_sq +=
Math.Pow(center[2] - mins[2], 2);
653 else if (center[2] > maxs[2])
654 dist_sq +=
Math.Pow(center[2] - maxs[2], 2);
657 intersectDist = -
Math.Sqrt(-dist_sq);
659 intersectDist =
Math.Sqrt(dist_sq);
669 static float FractionOf(
float input,
float fracOf)
671 float result = input / fracOf;
684 static float ClampToGrid(
float input,
float grid)
686 float frac = FractionOf(input, grid);
688 if (frac >= 0.5) input += (1 - frac) * grid;
689 else if (frac > 0 && frac < 0.5) input -= frac * grid;
690 else if (frac <= -0.5) input -= (1 + frac) * grid;
691 else if (frac < 0 && frac > -0.5) input += -frac * grid;
701 vector dir = posTo - viewMat[3];
703 vector dirAng = dir.InvMultiply3(viewMat);
704 dirAng = dirAng.VectorToAngles();
705 dirAng = dirAng.MapAngles();
712 [
Obsolete(
"Use SCR_Math.fmod or Math.Repeat instead")]
713 static float fmod(
float dividend,
float divisor)
717 return dividend -
Math.Floor(dividend/divisor) * divisor;
726 for (
int i = 0; i < 3; i++)
728 if (pos[i] > maxs[i])
730 if (pos[i] < mins[i])
739 static int VectorToRGBA255(
vector colorVec,
float alpha)
748 a = (
int)alpha << 24;
753 return r | g | b | a;
761 bool snapToGrid =
false;
762 if (gridSize !=
vector.Zero)
767 vector point1 = entmins.Multiply3(mat);
768 vector point2 = entmaxs.Multiply3(mat);
771 for (
int i = 0; i < 3; i++)
773 if (point1[i] < entmins[i])
774 entmins[i] = point1[i];
775 if (point2[i] < entmins[i])
776 entmins[i] = point2[i];
777 if (point1[i] > entmaxs[i])
778 entmaxs[i] = point1[i];
779 if (point2[i] > entmaxs[i])
780 entmaxs[i] = point2[i];
784 for (
int i = 0; i < 3; i++)
786 float posAxis = pos[i];
787 float min = entmins[i];
788 float max = entmaxs[i];
789 float grid = gridSize[i];
793 min = ClampToGrid(min, grid * 0.5);
794 max = ClampToGrid(max, grid * 0.5);
796 if (pos[i] > maxs[i] - max)
797 posAxis = maxs[i] - max;
798 if (pos[i] < mins[i] - min)
799 posAxis = mins[i] - min;
812 Math3D.MatrixInvMultiply4(localMat, origMat, mat);
814 bool snapToGrid =
false;
815 if (gridSize !=
vector.Zero)
820 vector point1 = entmins.Multiply3(mat);
821 vector point2 = entmaxs.Multiply3(mat);
824 for (
int i = 0; i < 3; i++)
826 if (point1[i] < entmins[i])
827 entmins[i] = point1[i];
828 if (point2[i] < entmins[i])
829 entmins[i] = point2[i];
830 if (point1[i] > entmaxs[i])
831 entmaxs[i] = point1[i];
832 if (point2[i] > entmaxs[i])
833 entmaxs[i] = point2[i];
837 for (
int i = 0; i < 3; i++)
839 float posAxis = pos[i];
840 float min = entmins[i];
841 float max = entmaxs[i];
842 float grid = gridSize[i];
846 min = ClampToGrid(min, grid * 0.5);
847 max = ClampToGrid(max, grid * 0.5);
849 if (pos[i] > localMaxs[i] - max)
850 posAxis = localMaxs[i] - max;
851 if (pos[i] < localMins[i] - min)
852 posAxis = localMins[i] - min;
858 Math3D.MatrixMultiply4(localMat, mat, origMat);
864 static void WorldSnapMatrix(
vector mat[4],
vector gridSize)
867 if (gridSize !=
vector.Zero)
870 for (
int i = 0; i < 3; i++)
872 float grid = gridSize[i];
873 float pos = ClampToGrid(tempPos[i], grid);
894 float bestVecsVal[3];
899 for (
int i = 0; i < 6; i++)
902 float calc = mat0 * norm;
903 if (calc > bestVecsVal[0])
905 bestVecsVal[0] = calc;
906 bestVecs[0] = norms[i];
910 if (calc > bestVecsVal[1])
912 bestVecsVal[1] = calc;
913 bestVecs[1] = norms[i];
917 if (calc > bestVecsVal[2])
919 bestVecsVal[2] = calc;
920 bestVecs[2] = norms[i];
924 float bestAxisVal1 = -1;
926 for (
int i = 0; i < 3; i++)
928 if (bestVecsVal[i] > bestAxisVal1)
930 bestAxisVal1 = bestVecsVal[i];
934 float bestAxisVal2 = -1;
936 for (
int i = 0; i < 3; i++)
938 if (i == bestAxisNum1)
941 if (bestVecsVal[i] > bestAxisVal2)
943 bestAxisVal2 = bestVecsVal[i];
948 vector bestAxis1 = bestVecs[bestAxisNum1];
949 vector bestAxis2 = bestVecs[bestAxisNum2];
951 if (bestAxisNum1 == 2 && bestAxisNum2 == 0)
952 bestAxis3 = bestAxis1 * bestAxis2;
953 else if (bestAxisNum1 == 0 && bestAxisNum2 == 2)
954 bestAxis3 = bestAxis2 * bestAxis1;
955 else if (bestAxisNum2 < bestAxisNum1)
956 bestAxis3 = bestAxis2 * bestAxis1;
958 bestAxis3 = bestAxis1 * bestAxis2;
960 for (
int i = 0; i < 3; i++)
962 if (i == bestAxisNum1 || i == bestAxisNum2)
968 mat[bestAxisNum1] = bestAxis1;
969 mat[bestAxisNum2] = bestAxis2;
978 Math3D.MatrixInvMultiply4(localMat, origMat, mat);
981 if (gridSize !=
vector.Zero)
984 for (
int i = 0; i < 3; i++)
986 float grid = gridSize[i];
987 float pos = ClampToGrid(tempPos[i], grid);
1000 norms[4] =
"0 -1 0";
1001 norms[5] =
"0 0 -1";
1008 float bestVecsVal[3];
1009 bestVecsVal[0] = -1;
1010 bestVecsVal[1] = -1;
1011 bestVecsVal[2] = -1;
1013 for (
int i = 0; i < 6; i++)
1016 float calc = mat0 * norm;
1017 if (calc > bestVecsVal[0])
1019 bestVecsVal[0] = calc;
1020 bestVecs[0] = norms[i];
1024 if (calc > bestVecsVal[1])
1026 bestVecsVal[1] = calc;
1027 bestVecs[1] = norms[i];
1031 if (calc > bestVecsVal[2])
1033 bestVecsVal[2] = calc;
1034 bestVecs[2] = norms[i];
1038 float bestAxisVal1 = -1;
1040 for (
int i = 0; i < 3; i++)
1042 if (bestVecsVal[i] > bestAxisVal1)
1044 bestAxisVal1 = bestVecsVal[i];
1048 float bestAxisVal2 = -1;
1050 for (
int i = 0; i < 3; i++)
1052 if (i == bestAxisNum1)
1055 if (bestVecsVal[i] > bestAxisVal2)
1057 bestAxisVal2 = bestVecsVal[i];
1062 vector bestAxis1 = bestVecs[bestAxisNum1];
1063 vector bestAxis2 = bestVecs[bestAxisNum2];
1065 if (bestAxisNum1 == 2 && bestAxisNum2 == 0)
1066 bestAxis3 = bestAxis1 * bestAxis2;
1067 else if (bestAxisNum1 == 0 && bestAxisNum2 == 2)
1068 bestAxis3 = bestAxis2 * bestAxis1;
1069 else if (bestAxisNum2 < bestAxisNum1)
1070 bestAxis3 = bestAxis2 * bestAxis1;
1072 bestAxis3 = bestAxis1 * bestAxis2;
1074 for (
int i = 0; i < 3; i++)
1076 if (i == bestAxisNum1 || i == bestAxisNum2)
1082 mat[bestAxisNum1] = bestAxis1;
1083 mat[bestAxisNum2] = bestAxis2;
1085 Math3D.MatrixMultiply4(localMat, mat, origMat);
1093 float min_x, min_y, min_z;
1094 float max_x, max_y, max_z;
1102 float surfArea_top =
Math.AbsFloat(max_z - min_z) *
Math.AbsFloat(max_x - min_x);
1103 float surfArea_right =
Math.AbsFloat(max_z - min_z) *
Math.AbsFloat(max_y - min_y);
1104 float surfArea_front =
Math.AbsFloat(max_x - min_x) *
Math.AbsFloat(max_y - min_y);
1110 float result =
Math.AbsFloat(dir * objFw * surfArea_front);
1111 result +=
Math.AbsFloat(dir * objRt * surfArea_right);
1112 result +=
Math.AbsFloat(dir * objUp * surfArea_top);
1127 return GetMatAndBoundsSurfaceAreaInDir(ent, dir, matObj, mins, maxs);
1138 return (entMaxs + entMins) * 0.5;
1144 static bool GetStringContainsInvalidCharacters(
string s)
1146 int ascii_FwSlash = 47;
1147 int ascii_BkSlash = 92;
1148 int ascii_Quote = 34;
1150 if (s ==
"")
return true;
1151 else if (s.Contains(
"~"))
return true;
1152 else if (s.Contains(
"#"))
return true;
1153 else if (s.Contains(
"%"))
return true;
1154 else if (s.Contains(
"\""))
return true;
1155 else if (s.Contains(
"&"))
return true;
1156 else if (s.Contains(
"*"))
return true;
1157 else if (s.Contains(
"{"))
return true;
1158 else if (s.Contains(
"}"))
return true;
1159 else if (s.Contains(ascii_BkSlash.AsciiToString()))
return true;
1160 else if (s.Contains(
":"))
return true;
1161 else if (s.Contains(
"<"))
return true;
1162 else if (s.Contains(
">"))
return true;
1163 else if (s.Contains(
"?"))
return true;
1164 else if (s.Contains(ascii_FwSlash.AsciiToString()))
return true;
1165 else if (s.Contains(
"|"))
return true;
1166 else if (s.Contains(ascii_Quote.AsciiToString()))
return true;
1174 static void DisplayEntityNameText(
IEntity ent,
int color,
int camIndex)
1179 ent.
GetWorld().GetCamera(camIndex, textMat);
1181 float distScale =
vector.Distance(textMat[3], pos) * 0.07;
1182 distScale =
Math.Clamp(distScale, 0.5, 10);
1184 float textEndSize = (0.2 * distScale) /
vector.Distance(textMat[3], ent.
GetOrigin());
1185 if (textEndSize < 0.005)
1188 textMat[3] = pos + textMat[1] * 0.7;
1196 Physics entPhys = ent.GetPhysics();
1199 if (entPhys.IsDynamic())
1200 entPhys.SetVelocity(newVelocity);
1216 Physics entPhys = ent.GetPhysics();
1219 if (entPhys.IsDynamic())
1220 entPhys.SetVelocity(newVelocity);
1235 Physics entPhys = ent.GetPhysics();
1239 if (entPhys.IsDynamic())
1241 entPhys.SetAngularVelocity(newAngularVelocity);
1242 if (entFrom && entFromPhys && entFromPhys.IsDynamic())
1244 vector velAt = entFromPhys.GetVelocityAt(ent.GetOrigin());
1245 entPhys.SetVelocity(velAt);
1264 Physics entPhys = ent.GetPhysics();
1265 if (entPhys && entPhys.IsDynamic())
1266 entPhys.SetAngularVelocity(newAngularVelocity);
1280 Physics entPhys = ent.GetPhysics();
1283 if (entPhys.IsDynamic())
1285 entPhys.SetActive(activeState);
1288 entPhys.SetVelocity(
vector.Zero );
1289 entPhys.SetAngularVelocity(
vector.Zero );
1308 Physics entPhys = ent.GetPhysics();
1311 if (entPhys.IsDynamic())
1314 entPhys.SetActive(activeState);
1317 entPhys.SetVelocity(
vector.Zero );
1318 entPhys.SetAngularVelocity(
vector.Zero );
1338 for (
int i = 0; i < typenames.Count(); i++)
1340 ret = ret || entity.IsInherited( typenames.Get(i) );
1353 Tree tree = Tree.Cast(entity);
1370 Building building = Building.Cast(entity);
1397 bool useDefaultHZ =
false;
1399 useDefaultHZ =
true;
1401 if (useDefaultHZ && dmc.GetDefaultHitZone())
1402 hitZone = dmc.GetDefaultHitZone().GetName();
1424 if (actionsManager != null)
1426 if (activeOnly && !actionsManager.IsActive())
1429 return actionsManager;
1446 auto actionsManager = SCR_EditorActionsManagerComponent.Cast(genericEntity.FindComponent(SCR_EditorActionsManagerComponent));
1447 if (actionsManager != null)
1448 return actionsManager;
1458 remap =
string.Empty;
1472 if (prefabBase.ToVObject())
1474 modelPath = resourcePath;
1489 for (
int c = components.Count() - 1; c >= 0; c--)
1491 meshComponent = components.Get(c);
1492 if (meshComponent.GetClassName() ==
"MeshObject")
1495 meshComponent = null;
1501 meshComponent.Get(
"Object", modelPath);
1507 for (
int m = materialsRemap.Count() - 1; m >= 0; m--)
1511 material.Get(
"SourceMaterial", matSrc);
1512 material.Get(
"AssignedMaterial", matTgt);
1513 remap +=
"$remap '" + matSrc +
"' '" + matTgt +
"';";
1538 if (!prefabBase.ToEntitySource())
1553 for (
int c = components.Count() - 1; c >= 0; c--)
1555 component = components.Get(c);
1556 if (component.GetClassName() == componentClassName)
1569 return !
game || !
game.InPlayMode();
1579 return world && world.IsEditMode();
1589 referenceEntity.
GetWorld().GetCurrentCamera(camMat);
1595 if (worldEdAPI && workspace)
1597 int imouseX = worldEdAPI.GetMousePosX(
true);
1598 int imouseY = worldEdAPI.GetMousePosY(
true);
1599 int realScreenX = worldEdAPI.GetScreenWidth();
1600 int realScreenY = worldEdAPI.GetScreenHeight();
1601 if (imouseX > 0 && imouseX < realScreenX && imouseY > 0 && imouseY < realScreenY)
1603 float xMult = realScreenX / realScreenY;
1604 float mouseXPct = (imouseX / realScreenX - 0.5) * xMult;
1605 float mouseYPct = imouseY / realScreenY;
1606 float width, height;
1607 workspace.GetScreenSize(width, height);
1608 float mouseX = mouseXPct * width + width * 0.5;
1609 float mouseY = mouseYPct * height;
1610 workspace.ProjScreenToWorldNative(mouseX, mouseY, dir, referenceEntity.
GetWorld(), referenceEntity.
GetWorld().GetCurrentCameraId());
1643 IEntity player =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId);
1648 PlayerController playerController =
GetGame().GetPlayerManager().GetPlayerController(playerId);
1649 if (playerController)
1651 SCR_PlayerTeleportedFeedbackComponent teleportFeedback = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
1652 if (teleportFeedback)
1653 teleportFeedback.PlayerTeleported(player,
false, teleportReason);
1660 if (compartmentAccess)
1670 transform[3] = worldPosition;
1676 BaseGameEntity baseGameEntity = BaseGameEntity.Cast(player);
1678 baseGameEntity.Teleport(transform);
1685 phys.SetVelocity(
vector.Zero);
1686 phys.SetAngularVelocity(
vector.Zero);
1749 vector line[2] = {matrix[3], matrix[3] + matrix[0] *
scale};
1752 line = {matrix[3], matrix[3] + matrix[1] *
scale};
1755 line = {matrix[3], matrix[3] + matrix[2] *
scale};
1771 lines[0] = trace.Start;
1773 if (traceCoef != -1)
1775 lines[0] =
vector.Lerp(trace.Start, trace.End, traceCoef);
1776 lines[1] = trace.Start;
1777 Shape.CreateLines(colorIntersect,
flags, lines, 2);
1778 Shape.CreateSphere(colorIntersect,
flags, lines[0], 0.05);
1781 lines[1] = trace.End;
1782 Shape.CreateLines(colorEnd,
flags, lines, 2);
1783 Shape.CreateSphere(colorEnd,
flags, trace.Start, 0.05);
1800 string materials[256];
1801 int numMats = mesh.GetMaterials(materials);
1802 for (
int i = 0; i < numMats; i++)
1804 remap +=
string.Format(
"$remap '%1' '%2';", materials[i], material);
1806 entity.SetObject(mesh, remap);
1831 return (oldDevice == EInputDeviceType.KEYBOARD && newDevice == EInputDeviceType.MOUSE) || (oldDevice == EInputDeviceType.MOUSE && newDevice == EInputDeviceType.KEYBOARD);
1847 if (!worldResource || !worldResource.IsValid())
1850 BaseContainer container = worldResource.GetResource().ToBaseContainer();
1852 container.Get(
"Parent", parent);
1869 if (!meta || !meta.IsValid())
1873 meta.GetResource().ToBaseContainer().Get(
"Name",
resourceName);
1889 BaseRadioComponent radioComponent;
1890 array<SCR_GadgetComponent> gadgets = gadgetManager.
GetGadgetsByType(EGadgetType.RADIO);
1891 gadgets.InsertAll(gadgetManager.
GetGadgetsByType(EGadgetType.RADIO_BACKPACK));
1892 foreach (SCR_GadgetComponent gadget : gadgets)
1897 radioComponent = BaseRadioComponent.Cast(gadget.GetOwner().FindComponent(BaseRadioComponent));
1899 if (!radioComponent || !radioComponent.IsPowered() || radioComponent.TransceiversCount() == 0)
1902 for (
int i = radioComponent.TransceiversCount() - 1; i >= 0; --i)
1904 outFrequencies.Insert(radioComponent.GetTransceiver(i).GetFrequency());
1907 return outFrequencies.Count();
1929 return GetGame().GetPlayerManager().HasPlayerRole(playerID,
EPlayerRole.ADMINISTRATOR)
1930 ||
GetGame().GetPlayerManager().HasPlayerRole(playerID,
EPlayerRole.SESSION_ADMINISTRATOR);
1940 int playerID =
GetGame().GetPlayerController().GetPlayerId();
1941 return GetGame().GetPlayerManager().HasPlayerRole(playerID,
EPlayerRole.ADMINISTRATOR)
1942 ||
GetGame().GetPlayerManager().HasPlayerRole(playerID,
EPlayerRole.SESSION_ADMINISTRATOR);
1989 game.GetWorldEntity().GetTerrain(0, 0).GetTerrainBoundBox(mins, maxs);
1990 if (x < mins[0] || x > maxs[0])
1993 if (z < mins[2] || z > maxs[2])
1996 float surfaceY =
game.GetWorld().GetSurfaceY(x, z);
1997 return y > surfaceY ||
float.AlmostEqual(y, surfaceY, 0.01);