11 string m_CollisionDetails;
85 string baseStringBegin = Watchtower.BASE_VIEW_NAME;
86 string baseIgnoreStringEnd = Watchtower.BASE_WALL_NAME;
88 int floors = Watchtower.MAX_WATCHTOWER_FLOORS;
89 int walls = Watchtower.MAX_WATCHTOWER_WALLS;
92 for (
int i = 1; i < floors + 1; ++i)
94 compName = baseStringBegin + i.
ToString();
95 for (
int j = 1; j < walls + 1; ++j)
105 string configPathProjectionTypename =
string.Format(
"CfgVehicles %1 projectionTypename",
m_Parent.GetType());
106 if (
GetGame().ConfigIsExisting(configPathProjectionTypename))
115 projectionEntity.SetAllowDamage(
false);
122 if (projectionEntity == null)
134 if (
ItemBase.Cast(projectionEntity))
140 if (
GetGame().ConfigIsExisting(configPathSlope))
146 if (
GetGame().ConfigIsExisting(configPathAlign))
152 if (
GetGame().ConfigIsExisting(configPathOrientationLimit))
173 #ifdef DIAG_DEVELOPER
200 string cfg_access =
"CfgVehicles " +
m_Projection.GetType() +
" AnimationSources ";
202 if (
GetGame().ConfigIsExisting(cfg_access) )
204 int cfg_access_count =
g_Game.ConfigGetChildrenCount(cfg_access);
206 for (
int i = 0; i < cfg_access_count; ++i )
211 float anim_phase =
m_Parent.GetAnimationPhase(found_anim);
237 return "GardenPlotPlacing";
243 return item.GetType() +
"Placing";
246 return item.GetType();
276 #ifdef DIAG_DEVELOPER
316 angles[1] = angles[1] + 270;
318 angles[0] =
Math.
Clamp( angles[0], 0, 360 );
319 angles[1] =
Math.
Clamp( angles[1], 0, 360 );
320 angles[2] =
Math.
Clamp( angles[2], 0, 360 );
322 projection_orientation_angles[0] = projection_orientation_angles[0] + ( 360 - angles[0] );
334 if ( y_p_r[0] > 180 )
336 y_p_r[0] = y_p_r[0] - 360;
339 if ( y_p_r[0] < -180 )
341 y_p_r[0] = y_p_r[0] + 360;
396 #ifdef DIAG_DEVELOPER
397 void DebugText(
string header,
bool mustBeTrue =
false,
bool condition =
true,
string info =
"")
401 int color = 0xFFFFFFFF;
403 if (mustBeTrue && !condition || !mustBeTrue && condition)
406 string text = header + condition + info;
411 protected float m_PitchOverride;
412 protected float m_RollOverride;
413 void DebugConfigValues()
422 DbgUI.InputFloat(
"pitch limit override", m_PitchOverride);
424 DbgUI.InputFloat(
"roll limit override", m_RollOverride);
434 #ifdef DIAG_DEVELOPER
435 m_CollisionDetails =
"";
440 #ifdef DIAG_DEVELOPER
441 m_CollisionDetails +=
"[Player]";
452 #ifdef DIAG_DEVELOPER
453 DebugText(
"Inherits from TrapSpawnBase, checking IsPlaceableAtposition",
true);
462 #ifdef DIAG_DEVELOPER
463 DebugText(
"Inherits from TrapBase, checking IsPlaceableAtposition",
true);
487 #ifdef DIAG_DEVELOPER
493 #ifdef DIAG_DEVELOPER
494 MiscGameplayFunctions.IsUnderRoofFromToCalculation(
m_Projection, from, to);
495 DrawArrow(from, to, !b2);
499 #ifdef DIAG_DEVELOPER
500 DebugText(
"IsClippingRoof: ",
false, b1,
" | (projection height) " +
m_Projection.GetPosition()[1] +
" > (camera height) " +
GetGame().GetCurrentCameraPosition()[1]);
501 DebugText(
"IsClippingRoof: ",
false, b2,
" | (DoPlacingHeightCheck) " +
m_Projection.DoPlacingHeightCheck() +
" && (IsUnderRoof) " + MiscGameplayFunctions.IsUnderRoof(
m_Projection) +
" | from: " + from[1] +
" | to: " + to[1]);
513 #ifdef DIAG_DEVELOPER
520 #ifdef DIAG_DEVELOPER
547 vector absoluteOffset =
"0 0.05 0";
555 relativeOffset[1] = (minMax[1][1] - minMax[0][1]) * 0.5;
556 center =
m_Projection.GetPosition() + relativeOffset + absoluteOffset;
562 excludedObjects.Insert(action_item);
566 bool isTrue =
GetGame().
IsBoxCollidingGeometry(center, orientation, edgeLength, ObjIntersectFire, ObjIntersectGeom, excludedObjects, collidedObjects);
567 #ifdef DIAG_DEVELOPER
571 foreach (
Object object: collidedObjects)
572 text +=
" | " +
Object.GetDebugName(
object);
574 DebugText(
"IsCollidingBBox: ",
false, isTrue, text);
576 int color = 0x01FFFFFF;
610 vector contact_pos_left_close;
611 vector contact_pos_right_close;
612 vector contact_pos_left_far;
613 vector contact_pos_right_far;
614 vector contact_dir_left_close;
615 vector contact_dir_right_close;
616 vector contact_dir_left_far;
617 vector contact_dir_right_far;
618 int contact_component_left_close;
619 int contact_component_right_close;
620 int contact_component_left_far;
621 int contact_component_right_far;
622 set<Object> results_left_close =
new set<Object>;
623 set<Object> results_right_close =
new set<Object>;
624 set<Object> results_left_far =
new set<Object>;
625 set<Object> results_right_far =
new set<Object>;
632 DayZPhysics.
RaycastRV(from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, results_left_close, null,
m_Projection,
false,
false, ObjIntersectFire);
633 if (results_left_close.Count() > 0)
634 obj_left_close = results_left_close[results_left_close.Count() - 1];
636 DayZPhysics.
RaycastRV(from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, results_right_close, null,
m_Projection,
false,
false, ObjIntersectFire);
637 if (results_right_close.Count() > 0)
638 obj_right_close = results_right_close[results_right_close.Count() - 1];
640 DayZPhysics.
RaycastRV(from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, results_left_far, null,
m_Projection,
false,
false, ObjIntersectFire);
641 if (results_left_far.Count() > 0)
642 obj_left_far = results_left_far[results_left_far.Count() - 1];
644 DayZPhysics.
RaycastRV(from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, results_right_far, null,
m_Projection,
false,
false, ObjIntersectFire);
645 if (results_right_far.Count() > 0)
646 obj_right_far = results_right_far[results_right_far.Count() - 1];
648 return IsBaseIntact(obj_left_close, obj_right_close, obj_left_far, obj_right_far ) &&
IsBaseStatic( obj_left_close ) &&
IsBaseFlat( contact_pos_left_close, contact_pos_right_close, contact_pos_left_far, contact_pos_right_far);
656 #ifdef DIAG_DEVELOPER
667 #ifdef DIAG_DEVELOPER
668 DebugText(
"IsCollidingZeroPos: ",
false, isTrue);
686 #ifdef DIAG_DEVELOPER
687 if (objectToCheck == null)
688 DebugText(
"IsBaseStatic(must be true): ",
true,
true,
" | objectToCheck is null (this is good)");
690 DebugText(
"IsBaseStatic(must be true): ",
true,
IsObjectStatic(objectToCheck));
702 bool isTrue = (under_left_close == under_right_close && under_right_close == under_left_far && under_left_far == under_right_far);
703 #ifdef DIAG_DEVELOPER
704 DebugText(
"IsBaseIntact(must be true and all equal): ",
true, isTrue,
" | ulc: " +
Object.GetDebugName(under_left_close) +
" | urc: " +
Object.GetDebugName(under_right_close) +
" | ulf: " +
Object.GetDebugName(under_left_far) +
" | urf: " +
Object.GetDebugName(under_right_far));
708 conditions.Insert(under_left_close == null);
709 conditions.Insert(under_right_close == null);
710 conditions.Insert(under_left_far == null);
711 conditions.Insert(under_right_far == null);
713 int amountOfNull = 0;
714 if (!under_left_close)
716 if (!under_right_close)
720 if (!under_right_far)
723 if ( amountOfNull < 3 )
724 for (
int i = 0; i < conditions.Count(); ++i)
725 conditions[i] = !conditions[i];
727 DrawBaseSpheres(conditions);
734 #ifdef DIAG_DEVELOPER
739 int color = 0xFFFFFFFF;
747 void DrawSphere(vector pos,
bool condition)
751 int color = 0x01FFFFFF;
759 void DrawBaseSpheres(array<bool> conditions)
763 array<vector> positions =
new array<vector>();
769 for (
int i = 0; i < positions.Count(); ++i)
770 DrawSphere(positions[i], conditions[i]);
774 void DrawDebugArrow(
float start,
float dist,
int color = 0xFF1FFFFF)
778 vector from =
m_Player.GetPosition() + start * MiscGameplayFunctions.GetHeadingVector(
m_Player);
779 vector to =
m_Player.GetPosition() + dist * MiscGameplayFunctions.GetHeadingVector(
m_Player);
789 float slope_pos_left_close =
Math.
AbsFloat(projection_pos[1] - contact_pos_left_close[1]);
790 float slope_pos_right_close =
Math.
AbsFloat(projection_pos[1] - contact_pos_right_close[1]);
791 float slope_pos_left_far =
Math.
AbsFloat(projection_pos[1] - contact_pos_left_far[1]);
792 float slope_pos_right_far =
Math.
AbsFloat(projection_pos[1] - contact_pos_right_far[1]);
795 #ifdef DIAG_DEVELOPER
796 DebugText(
"IsBaseFlat(must be true): ",
true, isTrue,
" (slope < slopeTolerance) | slopeTolerance: " +
m_SlopeTolerance +
" | lc: " + slope_pos_left_close +
" | rc: " + slope_pos_right_close +
" | lf: " + slope_pos_left_far +
" | rf: " + slope_pos_right_far);
797 DrawArrow(projection_pos, contact_pos_left_close, slope_pos_left_close <
m_SlopeTolerance);
798 DrawArrow(projection_pos, contact_pos_right_close, slope_pos_right_close <
m_SlopeTolerance);
799 DrawArrow(projection_pos, contact_pos_left_far, slope_pos_left_far <
m_SlopeTolerance);
800 DrawArrow(projection_pos, contact_pos_right_far, slope_pos_right_far <
m_SlopeTolerance);
814 #ifdef DIAG_DEVELOPER
815 DebugText(
"IsPlacementPermitted(must be true): ",
true, isTrue,
" (Note: ItemBase::CanBePlaced() return value)");
829 float delta1 = playerpos[1] - projectionpos[1];
833 #ifdef DIAG_DEVELOPER
834 DebugText(
"HeightPlacementCheck(must be true): ",
true,
false,
" | Height difference between item and player is larger than " +
DEFAULT_MAX_PLACEMENT_HEIGHT_DIFF);
839 #ifdef DIAG_DEVELOPER
840 DebugText(
"HeightPlacementCheck(must be true): ",
true,
true);
856 #ifdef DIAG_DEVELOPER
857 DebugText(
"IsUnderwater: ",
false,
true,
" | Surface under object is water");
867 float maxSea =
g_Game.SurfaceGetSeaLevelMax() + 0.03;
868 bool belowMaxSea = left_close[1] < maxSea || right_close[1] < maxSea || left_far[1] < maxSea || right_far[1] < maxSea;
870 #ifdef DIAG_DEVELOPER
872 float lc =
g_Game.GetWaterDepth(left_close);
873 float rc =
g_Game.GetWaterDepth(right_close);
874 float lf =
g_Game.GetWaterDepth(left_far);
875 float rf =
g_Game.GetWaterDepth(right_far);
876 bool isTrue = (lc > 0 || rc > 0 || lf > 0 || rf > 0 || belowMaxSea);
877 DebugText(
"IsUnderwater: ",
false, isTrue,
" belowMaxSea: " + belowMaxSea +
" | (all must be less than zero) | lc: " + lc +
" | rc: " + rc +
" | lf: " + lf +
" | rf: " + rf);
881 array<bool> conditions = {lc <= 0, rc <= 0, lf <= 0, rf <= 0};
882 DrawBaseSpheres(conditions);
886 return (belowMaxSea ||
g_Game.GetWaterDepth(left_close) > 0 ||
g_Game.GetWaterDepth(right_close) > 0 ||
g_Game.GetWaterDepth(left_far) > 0 ||
g_Game.GetWaterDepth(right_far) > 0);
893 vector fromHeightOffset =
"0 0.3 0";
894 vector toHeightOffset =
"0 1 0";
897 vector to_left_close_down = from_left_close + toHeightOffset;
900 vector to_right_close_down = from_right_close + toHeightOffset;
903 vector to_left_far_down = from_left_far + toHeightOffset;
906 vector to_right_far_down = from_right_far + toHeightOffset;
908 vector contact_pos_left_close;
909 vector contact_pos_right_close;
910 vector contact_pos_left_far;
911 vector contact_pos_right_far;
913 vector contact_dir_left_close;
914 vector contact_dir_right_close;
915 vector contact_dir_left_far;
916 vector contact_dir_right_far;
918 int contact_component_left_close;
919 int contact_component_right_close;
920 int contact_component_left_far;
921 int contact_component_right_far;
923 #ifdef DIAG_DEVELOPER
925 set<Object> lcO =
new set<Object>();
926 set<Object> rcO =
new set<Object>();
927 set<Object> lfO =
new set<Object>();
928 set<Object> rfO =
new set<Object>();
929 bool lc =
DayZPhysics.
RaycastRV( from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, lcO,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire );
930 bool rc =
DayZPhysics.
RaycastRV( from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, rcO,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire );
931 bool lf =
DayZPhysics.
RaycastRV( from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, lfO,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire );
932 bool rf =
DayZPhysics.
RaycastRV( from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, rfO,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire );
933 bool isTrue = ( lc || rc || lf || rf );
947 text +=
" | lcO: " + lcO[0];
949 text +=
" | rcO: " + rcO[0];
951 text +=
" | lfO: " + lfO[0];
953 text +=
" | rfO: " + rfO[0];
956 DrawBaseSpheres(conditions);
958 DebugText(
"IsInTerrain: ",
false, isTrue, text);
961 if (
DayZPhysics.
RaycastRV( from_left_close, to_left_close_down, contact_pos_left_close, contact_dir_left_close, contact_component_left_close, NULL,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire ))
964 if (
DayZPhysics.
RaycastRV( from_right_close, to_right_close_down, contact_pos_right_close, contact_dir_right_close, contact_component_right_close, NULL,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire ))
967 if (
DayZPhysics.
RaycastRV( from_left_far, to_left_far_down, contact_pos_left_far, contact_dir_left_far, contact_component_left_far, NULL,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire ))
970 if (
DayZPhysics.
RaycastRV( from_right_far, to_right_far_down, contact_pos_right_far, contact_dir_right_far, contact_component_right_far, NULL,
m_Projection,
m_Projection,
false,
true, ObjIntersectFire ))
982 m_Parent.GetCompEM().UpdatePlugState();
987 if (!
m_Parent.GetCompEM().IsPlugged())
996 if (entity_for_placing.IsInherited(
TentBase) || entity_for_placing.IsBasebuildingKit() )
998 return entity_for_placing;
1004 return entity_for_placing;
1013 return entity_for_placing;
1020 min_max[0] =
m_Projection.GetMemoryPointPos(
"box_placing_min" );
1021 min_max[1] =
m_Projection.GetMemoryPointPos(
"box_placing_max" );
1031 box_size[0] = min_max[1][0] - min_max[0][0];
1032 box_size[2] = min_max[1][2] - min_max[0][2];
1033 box_size[1] = min_max[1][1] - min_max[0][1];
1050 min_max[1][1] = min_max[0][1];
1051 min_max[1][2] = min_max[0][2];
1060 min_max[0][2] = min_max[1][2];
1069 min_max[1][1] = min_max[0][1];
1089 float minProjectionDistance;
1090 float maxProjectionDistance;
1094 float cameraToPlayerDistance =
vector.
Distance(
GetGame().GetCurrentCameraPosition(), player.GetPosition());
1103 minProjectionDistance = projectionRadius;
1104 maxProjectionDistance = projectionRadius * 2;
1111 set<Object> hitObjects =
new set<Object>();
1113 DayZPhysics.
RaycastRV(from, to, contactPosition,
m_ContactDir,
m_ContactComponent, hitObjects, player,
m_Projection,
false,
false, ObjIntersectFire);
1115 bool contactHitProcessed =
false;
1119 if (hitObjects.Count() > 0)
1121 if (hitObjects[0].IsInherited(Watchtower))
1123 contactHitProcessed =
true;
1127 if (!contactHitProcessed && hitObjects[0].IsInherited(
InventoryItem))
1128 contactPosition = hitObjects[0].GetPosition();
1132 static const float raycastOriginOffsetOnFail = 0.25;
1133 static const float minDistFromStart = 0.01;
1135 if ((hitObjects.Count() > 0) && (
vector.
DistanceSq(from, contactPosition) < minDistFromStart))
1138 DayZPhysics.
RaycastRV(from, to, contactPosition,
m_ContactDir,
m_ContactComponent, hitObjects, player,
m_Projection,
false,
false, ObjIntersectFire);
1141 bool isFloating =
SetHologramPosition(player.GetPosition(), minProjectionDistance, maxProjectionDistance, contactPosition);
1144 #ifdef DIAG_DEVELOPER
1145 DrawDebugArrow(minProjectionDistance, maxProjectionDistance);
1154 return contactPosition;
1167 float playerToProjectionDistance =
vector.
Distance(startPosition, contactPosition);
1168 vector playerToProjection;
1170 #ifdef DIAG_DEVELOPER
1171 DebugText(
"SetHologramPosition::startPosition: ",
false,
m_IsHidden,
string.Format(
" | %1", startPosition));
1172 DebugText(
"SetHologramPosition::contactPosition [in]: ",
false,
m_IsHidden,
string.Format(
" | %1", contactPosition));
1173 DebugText(
"SetHologramPosition::minProjectionDistance: ",
false,
m_IsHidden,
string.Format(
" | %1", minProjectionDistance));
1174 DebugText(
"SetHologramPosition::maxProjectionDistance: ",
false,
m_IsHidden,
string.Format(
" | %1", maxProjectionDistance));
1175 DebugText(
"SetHologramPosition::playerToProjectionDistance: ",
false,
m_IsHidden,
string.Format(
" | %1", playerToProjectionDistance));
1179 if (playerToProjectionDistance <= minProjectionDistance)
1181 playerToProjection = contactPosition - startPosition;
1186 contactPosition = startPosition + (playerToProjection * minProjectionDistance);
1188 #ifdef DIAG_DEVELOPER
1189 DebugText(
"SetHologramPosition::contactPosition[out] (< minProjectDistance): ",
false,
m_IsHidden,
string.Format(
" | %1", contactPosition));
1195 else if (playerToProjectionDistance >= maxProjectionDistance)
1197 playerToProjection = contactPosition - startPosition;
1202 contactPosition = startPosition + (playerToProjection * maxProjectionDistance);
1204 #ifdef DIAG_DEVELOPER
1205 DebugText(
"SetHologramPosition::contactPosition[out] (< maxProjectionDistance): ",
false,
m_IsHidden,
string.Format(
" | %1", contactPosition));
1223 contactPos[1] = hitObject.GetActionComponentPosition(contactComponent,
LOD.
NAME_VIEW)[1];
1243 diameter = diagonal.
Length();
1257 diameter = diagonal.
Length();
1258 radius = diameter / 2;
1295 #ifdef DIAG_DEVELOPER
1296 DebugText(
"Is colliding: ",
false, is_colliding, m_CollisionDetails);
1318 #ifdef DIAG_DEVELOPER
1331 #ifdef DIAG_DEVELOPER
1341 #ifdef DIAG_DEVELOPER
1381 vector player_to_projection_vector;
1386 vector to = from + ground;
1396 for (
int i = 0; i < results.Count(); i++)
1398 res = results.Get(i);
1401 contact_pos = res.
pos;
1408 if (contact_pos !=
"0 0 0")
1412 int check_component = -1;
1413 set<Object> hit_object =
new set<Object>;
1415 to[1] = to[1] + 0.1;
1418 if (
DayZPhysics.
RaycastRV(from, to, check_pos, check_dir, check_component, hit_object, null,
m_Player,
false,
false, ObjIntersectFire))
1420 if ((hit_object.Count() > 0)&& (!hit_object[0].IsInherited(Watchtower) || (hit_object[0].IsInherited(Watchtower) && (
m_WatchtowerIgnoreComponentNames.Find(hit_object[0].GetActionComponentName(check_component,
LOD.
NAME_VIEW)) == -1))))
1422 contact_pos =
"0 0 0";
1476 int idx =
m_Projection.GetHiddenSelectionIndex(selection);
1493 foreach (
string s : selection)
1501 static const string textureName =
"#(argb,8,8,3)color(0.5,0.5,0.5,0.75,ca)";
1503 int hidden_selection = 0;
1504 string selection_to_refresh;
1505 string config_material =
string.Format(
"CfgVehicles %1 hologramMaterial",
m_Projection.GetType());
1507 string config_model =
string.
Format(
"CfgVehicles %1 hologramMaterialPath",
m_Projection.GetType());
1514 m_Projection.SetObjectTexture(hidden_selection, textureName);
1515 m_Projection.SetObjectMaterial(hidden_selection, hologram_material_path);
1527 else if (
m_Parent.HasEnergyManager())
1530 string SEL_CORD_PLUGGED =
m_Parent.GetCompEM().SEL_CORD_PLUGGED;
1531 string SEL_CORD_FOLDED =
m_Parent.GetCompEM().SEL_CORD_FOLDED;
eBleedingSourceType GetType()
const int ECE_OBJECT_SWAP
const int ECE_PLACE_ON_SURFACE
const int ECE_CREATEPHYSICS
void DrawDebugCollisionBox(vector min_max[2], int color)
void DestroyDebugCollisionBox()
void DeployableContainer_Base()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native bool IsBoxCollidingGeometry(vector center, vector orientation, vector edgeLength, int iPrimaryType, int iSecondaryType, array< Object > excludeObjects, array< Object > collidedObjects=NULL)
Finds all objects with geometry iType that are in choosen oriented bounding box (OBB)
proto native vector ConfigGetVector(string path)
Get vector value from config on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native bool SurfaceIsSea(float x, float z)
string ConfigGetTextOut(string path)
Get string value from config on path.
proto native vector SurfaceGetNormal(float x, float z)
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto native bool SurfaceIsPond(float x, float z)
proto native vector GetCurrentCameraPosition()
proto native vector GetCurrentCameraDirection()
proto native void ObjectDelete(Object obj)
static bool GetDisableIsInTerrainCheck()
static bool GetDisableIsClippingRoofCheck()
static bool GetDisableIsUnderwaterCheck()
static bool GetDisableIsCollidingBBoxCheck()
static bool GetDisableHeightPlacementCheck()
static bool GetDisableIsPlacementPermittedCheck()
static bool GetDisableIsCollidingPlayerCheck()
static bool GetDisableIsCollidingGPlotCheck()
static bool GetDisableIsCollidingAngleCheck()
static bool GetDisableIsBaseViableCheck()
Super root of all classes in Enforce script.
bool IsEnergySourceAtReach(vector from_position, float add_tolerance=0, vector override_source_position="-1 -1 -1")
Energy manager: Returns true if this device's virtual power cord can reach its energy source at the g...
bool IsPlugged()
Energy manager: Returns true if this device is plugged into some other device (even if they are OFF o...
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
vector m_DefaultOrientation
const string ANIMATION_PLACING
vector GetCollisionBoxSize(vector min_max[2])
string CorrectMaterialPathName()
void SetProjectionEntity(EntityAI projection)
bool IsBaseIntact(Object under_left_close, Object under_right_close, Object under_left_far, Object under_right_far)
string GetProjectionName(ItemBase item)
const string SELECTION_PLACING
const float LARGE_PROJECTION_DISTANCE_LIMIT
Deprecated.
void SetSelectionToRefresh(array< string > selection)
bool IsCollidingZeroPos()
void SetSelectionToRefresh(string selection)
void SetIsCollidingGPlot(bool is_colliding_gplot)
const string SUFFIX_MATERIAL_DEPLOYABLE
vector GetLeftFarProjectionVector()
const float PROJECTION_TRANSITION_MAX
void EvaluateCollision(ItemBase action_item=null)
vector m_YawPitchRollLimit
void SetUpdatePosition(bool state)
bool HeightPlacementCheck()
Checks height relative to player's position.
EntityAI GetParentEntity()
const float SMALL_PROJECTION_RADIUS
void Hologram(PlayerBase player, vector pos, ItemBase item)
void SetProjectionOrientation(vector orientation)
void AddProjectionRotation(float addition)
vector HideWhenClose(vector pos)
vector SetOnGround(vector position)
bool IsObjectStatic(Object obj)
const vector PLACEMENT_RC_START_OFFSET
void UpdateHologram(float timeslice)
ref array< string > m_WatchtowerBlockedComponentNames
vector GetRightFarProjectionVector()
void SetIsHidden(bool is_hidden)
string m_ProjectionTypename
const vector PLACEMENT_RC_END_OFFSET
ref set< string > m_SelectionsToRefresh
const float DISTANCE_SMALL_PROJECTION
bool IsPlacementPermitted()
Checks if the item can be legally placed (usually checked by action as well)
bool IsCollidingBBox(ItemBase action_item=null)
static bool DoesHaveProjection(ItemBase item)
DEPRECATED.
vector SmoothProjectionMovement(vector y_p_r, float timeslice)
bool IsSurfaceWater(vector position)
bool SetHologramPosition(vector startPosition, float minProjectionDistance, float maxProjectionDistance, inout vector contactPosition)
Sets hologram position based on player and projection distance.
vector GetLeftCloseProjectionVector()
void SetIsColliding(bool is_colliding)
vector GetProjectionOrientation()
bool IsSurfaceSea(vector position)
void SubtractProjectionRotation(float subtraction)
vector GetRightCloseProjectionVector()
int GetHiddenSelection(string selection)
const string SUFFIX_MATERIAL_UNDEPLOYABLE
vector AlignProjectionOnTerrain(float timeslice)
vector GetProjectionEntityPosition(PlayerBase player)
ProjectionTrigger m_ProjectionTrigger
bool IsFenceOrWatchtowerKit()
EntityAI GetProjectionEntity()
static const float DEFAULT_MAX_PLACEMENT_HEIGHT_DIFF
bool IsBaseFlat(vector contact_pos_left_close, vector contact_pos_right_close, vector contact_pos_left_far, vector contact_pos_right_far)
void SetIsCollidingPlayer(bool is_colliding)
void SetIsFloating(bool is_floating)
const float SMALL_PROJECTION_GROUND
vector CorrectForWatchtower(int contactComponent, vector contactPos, PlayerBase player, Object hitObject)
float GetProjectionRadius()
vector GetProjectionRotation()
bool IsBehindObstacle()
DEPRECATED.
void GetProjectionCollisionBox(out vector min_max[2])
float GetProjectionDiameter()
const float LOOKING_TO_SKY
string ProjectionBasedOnParent()
ref array< string > m_WatchtowerIgnoreComponentNames
vector GetProjectionPosition()
void SetProjectionPosition(vector position)
vector GetDefaultOrientation()
const float PROJECTION_TRANSITION_MIN
const string SELECTION_INVENTORY
const string ANIMATION_INVENTORY
EntityAI PlaceEntity(EntityAI entity_for_placing)
bool IsBaseStatic(Object objectToCheck)
const string SUFFIX_MATERIAL_POWERED
bool IsRestrictedFromAdvancedPlacing()
override bool IsBasebuildingKit()
override bool CanMakeGardenplot()
override bool IsDeployable()
static const string NAME_VIEW
Object obj
object,that we collide with (NULL if none), If hierLevel > 0 object is the proxy object
bool entry
is false if begining point was TriggerInsider
vector pos
position of collision (in world coord)
Object parent
if hierLevel > 0 most parent of the proxy object
override bool IsPlaceableAtPosition(vector position)
override void OnLeave(Object obj)
override void OnEnter(Object obj)
void SetParentOwner(PlayerBase player)
void UpdateInsiders(int timeout)
void SetParentObject(Hologram projection)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native float Length()
Returns length of vector (magnitude)
proto float Normalize()
Normalizes vector. Returns length.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native CGame GetGame()
static proto native void ColoredText(int color, string label)
const float ROOF_CHECK_RAYCAST_DIST
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int LIQUID_GROUP_WATER
static proto vector MatrixToAngles(vector mat[3])
Returns angles of rotation matrix.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto void MatrixMultiply3(vector mat0[3], vector mat1[3], out vector res[3])
Transforms rotation matrix.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float AbsFloat(float f)
Returns absolute value.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.