DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл MiscGameplayFunctions.c

См. исходные тексты.

Структуры данных

class  ReplaceItemWithNewLambda
 adds automatic QuickBar handling Подробнее...
 
class  TurnItemIntoItemLambda
 
class  DropEquipAndDestroyRootLambda
 this one is a bit special: it drops all items and destroys the ex-root of the hierarchy Подробнее...
 
class  DestroyItemInCorpsesHandsAndCreateNewOnGndLambda
 

Перечисления

enum  TransferInventoryResult { Ok , DroppedSome }
 
enum  ThrowEntityFlags
 

Функции

class TurnItemIntoItemLambdaAnimSysNotifyLambda extends TurnItemIntoItemLambda OnSuccess (EntityAI new_item)
 
void DropEquipAndDestroyRootLambda (EntityAI old_item, string new_item_type, PlayerBase player)
 
override void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
 
void MoveEquipToExistingItemAndDestroyOldRootLambda (EntityAI old_item, string new_item_type, PlayerBase player, EntityAI new_item)
 
void RemoveNetworkObjectInfo ()
 
void UndoRemoveNetworkObjectInfo ()
 
void CreateNetworkObjectInfo (EntityAI new_item)
 
enum ThrowEntityFlags Truncate (float value, int decimals=2)
 truncate float to specified precision
 
static string TruncateToS (float value, int decimals=2)
 truncate float to specified precision, output as string
 
static vector TruncateVec (vector value, int decimals=2)
 truncate float to specified precision
 
static string TruncateVecToS (vector value, int decimals=2, string delimiter=" ")
 
static string GetColorString (float r, float g, float b, float a)
 
static string ValueToBar (float value, string bar="[----------]", string mark="x")
 Produces ACII "progress bar" based on an 0..1 'value' input.
 
static string InsertAtPos (string base, string insert, int pos)
 Insert 'insert' behind index 'pos' of the 'base' string.
 
static void TransferItemProperties (EntityAI source, notnull EntityAI target, bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false)
 will transform variables, agents and other local scripted properties as well as any relevant non-scripted properties like health
 
static void TransferEntityVariables (EntityAI source, EntityAI target, bool exclude_quantity=false)
 
static void TransferItemVariables (ItemBase source, ItemBase target, bool exclude_quantity=false)
 DEPRECATED.
 
static TransferInventoryResult TransferInventory (EntityAI sourceItem, EntityAI targetItem, PlayerBase player)
 
static void TransferEntityHealth (EntityAI source, EntityAI target, array< string > healthTypes=null, bool transferZoneDamage=true)
 
static void UnlimitedAmmoDebugCheck (Weapon_Base weapon)
 
static void TurnItemIntoItem (notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
 
static void TurnItemIntoItemEx (notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
 
static void TurnItemInHandsIntoItem (notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
 
static void TurnItemInHandsIntoItemEx (notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
 
static array< ItemBaseCreateItemBasePiles (string item_name, vector ground_position, float quantity, float health, bool floaty_spawn=false)
 Spawns multiple piles of stackable ItemBase objects on ground (intended for generic use)
 
static array< MagazineCreateMagazinePiles (string item_name, vector ground_position, float quantity, float health)
 
static array< MagazineCreateMagazinePilesFromBullet (string bullet_type, vector ground_position, float quantity, float health)
 
static int GetHealthLevelForAmmo (string class_name, float health)
 
static float GetTypeMaxGlobalHealth (string class_name, string health_type="Health")
 
static bool GetProjectedCursorPos3d (out vector position, Weapon_Base weapon)
 
static void GetHeadBonePos (notnull PlayerBase player, out vector pos)
 
static vector GetHeadingVector (notnull PlayerBase player)
 
static float GetHeadingAngle (notnull DayZPlayerImplement player)
 
static float GetEnergyMetabolicSpeed (int movement_speed)
 
static float GetWaterMetabolicSpeed (int movement_speed)
 
static string ObtainRestrainItemTargetClassname (notnull EntityAI entity)
 
static void TransformRestrainItem (EntityAI current_item, EntityAI tool, PlayerBase player_source, PlayerBase player_target, bool destroy=false)
 
static bool IsValueInRange (float value, float from, float to)
 
static bool IsPlayerOrientedTowardPos (notnull DayZPlayerImplement player, vector target_pos, float cone_angle)
 Check if player direction(based on cone of defined angle) is oriented to target position.
 
static string SanitizeString (string input)
 
static bool ComplexBuildCollideCheckClient (PlayerBase player, ActionTarget target, ItemBase item, string partName="")
 
static bool ComplexBuildCollideCheckClient (PlayerBase player, ActionTarget target, ItemBase item, int constraction_index)
 
static bool BuildCondition (PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
 
static bool BuildCondition (PlayerBase player, ActionTarget target, ItemBase item, bool camera_check, int constraction_index)
 
static void IsUnderRoofFromToCalculation (EntityAI entity, out vector from, out vector to, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST)
 
static bool IsUnderRoof (EntityAI entity, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST)
 
static bool IsUnderRoofEx (EntityAI entity, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST, int geometry=ObjIntersectView)
 
static vector GetSteamPosition (EntityAI parent)
 
static vector GetRandomizedPosition (vector targetPos, float radius)
 
static vector GetRandomizedPositionVerified (vector startPos, vector targetPos, float radius, Object ignore=null)
 
static void DropAllItemsInInventoryInBounds (ItemBase ib, vector halfExtents)
 
static void ThrowAllItemsInInventory (notnull EntityAI parent, int flags)
 
static void ThrowEntityFromInventory (notnull EntityAI entity, vector position, float direction[4], vector force, int flags)
 
static float GetCurrentItemHeatIsolation (ItemBase pItem)
 
static void FilterObstructingObjects (array< Object > potentiallyObstructingObjects, out array< Object > obstructingObjects)
 
static bool CanIgnoreDistanceCheck (Object obj)
 
static void FilterObstructedObjectsByGrouping (vector origin, float range, float distanceDelta, array< Object > objects, array< Object > obstructingObjects, out array< Object > filteredObjects, bool doDistanceCheck=false, bool checkIfDistanceCanBeIgnored=false, float maxDist=0)
 group objects that are close to each other together
 
static void SplitArrayIntoGroupsByDistance (array< Object > objects, array< ref array< Object > > objectGroups, float squaredDistanceDelta)
 
static bool IsObjectObstructed (Object object, bool doDistanceCheck=false, vector distanceCheckPos="0 0 0", float maxDist=0)
 
static bool IsObjectObstructedEx (Object object, IsObjectObstructedCache cache, bool doDistanceCheck=false, vector distanceCheckPos="0 0 0", float maxDist=0)
 
static bool IsObjectObstructedProxy (Object object, IsObjectObstructedCache cache, PlayerBase player)
 
static bool IsObjectObstructedFilter (Object object, IsObjectObstructedCache cache, PlayerBase player)
 
static bool IsObjectObstructedFilterEx (Object object, IsObjectObstructedCache cache, PlayerBase player, int geometryTypeOverride=-1)
 groups 'RaycastRVProxy' and 'RaycastRV' approaches into one method, allowes for comprehensive geometry override, if desired
 
static void DealEvinronmentAdjustedDmg (ItemBase item, PlayerBase player, float baseDamage)
 
static void DealAbsoluteDmg (ItemBase item, float dmg)
 
static float Normalize (int val, int maxVal)
 
static float Bobbing (float period, float amplitude, float elapsedTime)
 
static float FModulus (float x, float y)
 
static void RemoveSplint (PlayerBase player)
 
static void TeleportCheck (notnull PlayerBase player, notnull array< ref array< float > > safe_positions)
 checks if we should teleport the player to a safe location and if so, performs the teleportation
 
static vector GetClosestSafePos (vector to_pos, notnull array< ref array< float > > positions)
 
static bool TeleportPlayerToSafeLocation3D (notnull PlayerBase player, vector safePos)
 'stupider' teleport method, does not touch flag management. Applies Y from the position as well!
 
static void GenerateAINoiseAtPosition (vector position, float lifeTime, NoiseParams noiseParams)
 
static float GetMinValue (array< float > pArray)
 
static float GetMaxValue (array< float > pArray)
 
static string GetItemDisplayName (string type)
 
static bool IsComponentInSelection (array< Selection > pSelection, string pCompName)
 
static int GetComponentIndex (array< Selection > pSelection, string pCompName)
 
static void RemoveAllAttachedChildrenByTypename (notnull EntityAI parent, array< typename > listOfTypenames)
 
static void DeleteAttachedChildrenByTypename (notnull EntityAI parent, array< typename > listOfTypenames)
 
static void GetAttachedChildren (IEntity parent, array< IEntity > outputObjects)
 Fills the provided array with all children entities in hierarchy of this entity.
 
static void SoakItemInsideParentContainingLiquidAboveThreshold (notnull ItemBase item, notnull ItemBase parent, float liquidQuantityThresholdPercentage=0.05)
 
static float GetCombinedSnowfallWindValue ()
 
void IsObjectObstructedCache (vector rayCastStart, int totalObjects)
 
void ClearCache ()
 

Переменные

PlayerBase m_Player
 
EntityAI m_NewItem
 
 NONE = 0
 
 SPLIT = 1
 
DestroyItemInCorpsesHandsAndCreateNewOnGndLambda RaycastStart = "0 0 0"
 
int TotalObjects = 0
 
vector ObjectCenterPos = "0 0 0"
 
vector ObjectContactPos = "0 0 0"
 
vector ObjectContactDir = "0 0 0"
 
int ContactComponent = -1
 
ref array< ref RaycastRVResultHitProxyObjects = new array<ref RaycastRVResult>
 
ref set< ObjectHitObjects = new set<Object>
 

Перечисления

◆ ThrowEntityFlags

208{
209 NONE = 0,
210 SPLIT = 1, //< Splits the item when it has quantity, recommended to use when called on an attachment
211}
SPLIT
Definition MiscGameplayFunctions.c:218
NONE
Definition MiscGameplayFunctions.c:217

◆ TransferInventoryResult

Элементы перечислений
Ok 
DroppedSome 
203{
205};
@ Ok
Definition MiscGameplayFunctions.c:204
@ DroppedSome
Definition MiscGameplayFunctions.c:204

Функции

◆ Bobbing()

static float Bobbing ( float period,
float amplitude,
float elapsedTime )
staticprotected
1509 {
1510 //Prevent division by 0
1511 if ( period == 0 )
1512 period = 1;
1513
1514 elapsedTime /= period;
1515
1516 float cycle;
1517 cycle += elapsedTime;
1518 cycle = FModulus(cycle, 360);
1520
1521 return cycle;
1522 }
static float FModulus(float x, float y)
Definition MiscGameplayFunctions.c:1525
Definition EnMath.c:7
Definition EntityAI.c:95
static proto float Sin(float angle)
Returns sinus of angle in radians.

Перекрестные ссылки FModulus() и Math::Sin().

◆ BuildCondition() [1/2]

static bool BuildCondition ( PlayerBase player,
ActionTarget target,
ItemBase item,
bool camera_check )
staticprotected
831 {
832 return true;
833 }

Используется в ComplexBuildCollideCheckClient().

◆ BuildCondition() [2/2]

static bool BuildCondition ( PlayerBase player,
ActionTarget target,
ItemBase item,
bool camera_check,
int constraction_index )
staticprotected
836 {
837 Object targetObject = target.GetObject();
838 if ( targetObject && targetObject.CanUseConstruction() )
839 {
841 ConstructionActionData construction_action_data = player.GetConstructionActionData();
843
845 if ( item )
846 {
848 }
849 else
850 {
852 }
853
854 //Debug
855 /*
856 if ( constrution_part )
857 {
858 Construction construction = base_building.GetConstruction();
859 construction.IsColliding( constrution_part.GetPartName() );
860 }
861 */
862
863 if ( constrution_part )
864 {
865 //camera and position checks
866 bool position_check = ( base_building.MustBeBuiltFromOutside() && !base_building.IsPlayerInside(player, constrution_part.GetMainPartName()) ) || ( !base_building.MustBeBuiltFromOutside() && base_building.IsPlayerInside(player, constrution_part.GetMainPartName()) );
867 if ( position_check && !player.GetInputController().CameraIsFreeLook() )
868 {
869 //Camera check (client-only)
870 if ( camera_check )
871 {
872 if ( GetGame() && ( !GetGame().IsDedicatedServer() ) )
873 {
874 return !base_building.IsFacingCamera( constrution_part.GetMainPartName() );
875 }
876 }
877
878 return true;
879 }
880 }
881 }
882
883 return false;
884 }
Definition Fence.c:2
Definition ConstructionActionData.c:2
Definition ConstructionPart.c:2
Definition ObjectTyped.c:2
proto native CGame GetGame()

Перекрестные ссылки GetGame().

◆ CanIgnoreDistanceCheck()

static bool CanIgnoreDistanceCheck ( Object obj)
staticprotected
1194 {
1195 return obj.IsTransport() || obj.CanUseConstruction();
1196 }

Используется в FilterObstructedObjectsByGrouping().

◆ ClearCache()

void ClearCache ( )
protected
1851 {
1852 ObjectCenterPos = "0 0 0";
1853 ObjectContactPos = "0 0 0";
1854 ObjectContactDir = "0 0 0";
1855 ContactComponent = -1;
1856 HitProxyObjects.Clear();
1857 HitObjects.Clear();
1858 }
ref array< ref RaycastRVResult > HitProxyObjects
Definition MiscGameplayFunctions.c:1840
vector ObjectContactDir
Definition MiscGameplayFunctions.c:1838
vector ObjectContactPos
Definition MiscGameplayFunctions.c:1837
vector ObjectCenterPos
Definition MiscGameplayFunctions.c:1836
ref set< Object > HitObjects
Definition MiscGameplayFunctions.c:1841
int ContactComponent
Definition MiscGameplayFunctions.c:1839

Перекрестные ссылки ContactComponent, HitObjects, HitProxyObjects, ObjectCenterPos, ObjectContactDir и ObjectContactPos.

◆ ComplexBuildCollideCheckClient() [1/2]

static bool ComplexBuildCollideCheckClient ( PlayerBase player,
ActionTarget target,
ItemBase item,
int constraction_index )
staticprotected
794 {
796 if (base_building)
797 {
798 Construction construction = base_building.GetConstruction();
800 {
801 ConstructionActionData construction_action_data = player.GetConstructionActionData();
802 string partName;
803 if ( item )
804 {
805 partName = construction_action_data.GetBuildPartAtIndex(constraction_index).GetPartName();
806 }
807 else
808 {
809 partName = construction_action_data.GetBuildPartNoToolAtIndex(constraction_index).GetPartName();
810 }
811 bool boo;
812 if (base_building.PerformRoofCheckForBase(partName,player,boo) && boo)
813 return false;
814 if ( player.IsPlacingLocal() || player.IsPlacingServer() )
815 return false;
816
817 /*float distance_root = vector.DistanceSq(target.GetCursorHitPos(), player.GetPosition());
818
819 if (!CfgGameplayHandler.GetDisableDistanceCheck() && distance_root < UAMaxDistances.BASEBUILDING_SHORT)
820 {
821 return false;
822 } */
823 return !construction.IsColliding( partName );
824 }
825 }
826 return false;
827 }
void Construction(BaseBuildingBase parent)
Definition Construction.c:26
static bool BuildCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
Definition MiscGameplayFunctions.c:830

Перекрестные ссылки BuildCondition() и Construction().

◆ ComplexBuildCollideCheckClient() [2/2]

static bool ComplexBuildCollideCheckClient ( PlayerBase player,
ActionTarget target,
ItemBase item,
string partName = "" )
staticprotected
789 {
790 return true;
791 }

◆ CopyOldPropertiesToNew()

override void CopyOldPropertiesToNew ( notnull EntityAI old_item,
EntityAI new_item )

We don't care if a valid transform couldn't be found, we just want to preferably use it instead of placing on the old item

125 {
126 super.CopyOldPropertiesToNew(old_item, new_item);
127
128 InventoryLocation understash_src = m_NewLocation; // m_NewLocation is a backup of original old_item's src before the operation started
129
131 old_item.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, children);
132 int count = children.Count();
133 for (int i = 0; i < count; i++)
134 {
135 EntityAI child = children.Get(i);
136 if (child)
137 {
139 child.GetInventory().GetCurrentInventoryLocation(child_src);
140
142 //@TODO: modify _dst with place on gnd?
143
144 vector m4[4];
146
149
150 child_dst.SetGround(child,m4);
151
152 m_Player.LocalTakeToDst(child_src, child_dst);
153
154 GetGame().RemoteObjectTreeCreate(child); // this forces server to send CreateVehicle Message to client. This is needed for preserving the appearance of network operations on client (so that DeleteObject(old) arrives before CreateVehicle(new)). @NOTE: this does not delete the object on server, only it's network representation.
155 }
156 }
157 }
PlayerBase m_Player
Definition MiscGameplayFunctions.c:117
Definition Building.c:6
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
Finds a transformation for the item to be dropped to If the initial transforation overlaps with anoth...
InventoryLocation.
Definition InventoryLocation.c:29
Definition EnMath3D.c:28
Definition EnConvert.c:106
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:256

◆ CreateItemBasePiles()

static array< ItemBase > CreateItemBasePiles ( string item_name,
vector ground_position,
float quantity,
float health,
bool floaty_spawn = false )
staticprotected

Spawns multiple piles of stackable ItemBase objects on ground (intended for generic use)

476 {
478 float max_stack_size;
480
482 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varStackMax");
483 if( max_stack_size < 1)
484 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varQuantityMax");
485 if( max_stack_size < 1)
486 max_stack_size = 1;
487
490
491 for ( int i = 0; i < full_piles_count; i++ )
492 {
493 if (floaty_spawn)
495 else
497 pile.SetQuantity(max_stack_size);
498 pile.SetHealth(health);
499 item_piles.Insert(pile);
500 }
501 if ( rest > 0 )
502 {
503 if (floaty_spawn)
505 else
507 pile.SetQuantity(rest);
508 pile.SetHealth(health);
509 item_piles.Insert(pile);
510 }
511 return item_piles;
512 }
const int ECE_PLACE_ON_SURFACE
Definition CentralEconomy.c:37
const int ECE_UPDATEPATHGRAPH
Definition CentralEconomy.c:13
const int ECE_CREATEPHYSICS
Definition CentralEconomy.c:16
DayZGame g_Game
Definition DayZGame.c:3815
Definition InventoryItem.c:731
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки ECE_CREATEPHYSICS, ECE_PLACE_ON_SURFACE, ECE_UPDATEPATHGRAPH, Math::Floor(), g_Game и GetGame().

◆ CreateMagazinePiles()

static array< Magazine > CreateMagazinePiles ( string item_name,
vector ground_position,
float quantity,
float health )
staticprotected
515 {
517 float stack_size;
519
521 stack_size = g_Game.ConfigGetInt("cfgMagazines " + item_name + " count");
522
525
526 for ( int i = 0; i < piles_count; i++ )
527 {
529 pile.ServerSetAmmoCount(stack_size);
530 items.Insert(pile);
531 }
532 if ( rest > 0)
533 {
535 pile.ServerSetAmmoCount(rest);
536 items.Insert(pile);
537 }
538 return items;
539 }

Перекрестные ссылки ECE_PLACE_ON_SURFACE, Math::Floor(), g_Game и GetGame().

◆ CreateMagazinePilesFromBullet()

static array< Magazine > CreateMagazinePilesFromBullet ( string bullet_type,
vector ground_position,
float quantity,
float health )
staticprotected
542 {
545 float stack_size;
547 string item_name;
548 if( !g_Game.ConfigGetText("cfgAmmo " + bullet_type + " spawnPileType", item_name) )
549 return items;
550
551 stack_size = g_Game.ConfigGetInt("cfgMagazines " + item_name + " count");
552
553 if(stack_size > 0)
554 {
557
558 for ( int i = 0; i < piles_count; i++ )
559 {
561 pile.ServerSetAmmoCount(stack_size);
562 items.Insert(pile);
563 }
564 if ( rest > 0)
565 {
567 pile.ServerSetAmmoCount(rest);
568 items.Insert(pile);
569 }
570 }
571 return items;
572 }

Перекрестные ссылки ECE_PLACE_ON_SURFACE, Math::Floor(), g_Game и GetGame().

◆ CreateNetworkObjectInfo()

void CreateNetworkObjectInfo ( EntityAI new_item)
protected
196 {
197 super.CreateNetworkObjectInfo(new_item);
198 GetGame().RemoteObjectTreeCreate(m_NewItem);
199 }
EntityAI m_NewItem
Definition MiscGameplayFunctions.c:166

Перекрестные ссылки GetGame() и m_NewItem.

◆ DealAbsoluteDmg()

static void DealAbsoluteDmg ( ItemBase item,
float dmg )
staticprotected
1492 {
1493 item.DecreaseHealth(dmg, false);
1494 }

Используется в DealEvinronmentAdjustedDmg().

◆ DealEvinronmentAdjustedDmg()

static void DealEvinronmentAdjustedDmg ( ItemBase item,
PlayerBase player,
float baseDamage )
staticprotected
1472 {
1473 string surfaceType;
1474 int liquidType;
1475 float adjustedDamage;
1476
1477 GetGame().SurfaceUnderObject(player, surfaceType, liquidType);
1478 float modifierSurface = Surface.GetParamFloat(surfaceType, "toolDamage"); // toolDamage
1479 if (modifierSurface == 0)
1480 modifierSurface = 1;
1481
1482 if (player.GetInColdArea())
1483 adjustedDamage = baseDamage * (modifierSurface + GetGame().GetMission().GetWorldData().GetColdAreaToolDamageModifier();
1484 else
1486
1488 }
static void DealAbsoluteDmg(ItemBase item, float dmg)
Definition MiscGameplayFunctions.c:1491
Definition Surface.c:2
static float GetParamFloat(string surface_name, string param_name)
Definition Surface.c:18

Перекрестные ссылки DealAbsoluteDmg(), GetGame() и Surface::GetParamFloat().

◆ DeleteAttachedChildrenByTypename()

static void DeleteAttachedChildrenByTypename ( notnull EntityAI parent,
array< typename > listOfTypenames )
staticprotected
1756 {
1757 if (listOfTypenames.Count() > 0)
1758 {
1759 Object child = Object.Cast(parent.GetChildren());
1760 while (child)
1761 {
1763 child = Object.Cast(child.GetSibling());
1764
1765 if (childToRemove.IsAnyInherited(listOfTypenames))
1766 {
1767 parent.RemoveChild(childToRemove, false);
1768 childToRemove.Delete();
1769 }
1770 }
1771 }
1772 }

◆ DropAllItemsInInventoryInBounds()

static void DropAllItemsInInventoryInBounds ( ItemBase ib,
vector halfExtents )
staticprotected
1002 {
1003 if (!GetGame().IsServer())
1004 return;
1006 ib.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, items);
1007
1008 vector direction = ib.GetDirection();
1010
1011 float angle = Math.Acos(dot);
1012 if (direction[0] < 0)
1013 angle = -angle;
1014
1015 float cos = Math.Cos(angle);
1016 float sin = Math.Sin(angle);
1017
1018 EntityAI item;
1019 int count = items.Count();
1020 for ( int i = 0; i < count; ++i )
1021 {
1022 item = items.Get(i);
1023 if ( item )
1024 ib.GetInventory().DropEntityInBounds(InventoryMode.SERVER, ib, item, halfExtents, angle, cos, sin);
1025 }
1026 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
static const vector Forward
Definition EnConvert.c:109
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Cos(float angle)
Returns cosinus of angle in radians.

Перекрестные ссылки Math::Acos(), Math::Cos(), vector::Dot(), vector::Forward, GetGame() и Math::Sin().

◆ DropEquipAndDestroyRootLambda()

void DropEquipAndDestroyRootLambda ( EntityAI old_item,
string new_item_type,
PlayerBase player )
120 {
122 }

◆ FilterObstructedObjectsByGrouping()

static void FilterObstructedObjectsByGrouping ( vector origin,
float range,
float distanceDelta,
array< Object > objects,
array< Object > obstructingObjects,
out array< Object > filteredObjects,
bool doDistanceCheck = false,
bool checkIfDistanceCanBeIgnored = false,
float maxDist = 0 )
staticprotected

group objects that are close to each other together

1200 {
1203
1204 int i = 0;
1205 int j = 0;
1206 int k = 0;
1207 int mCount = vicinityObjects.Count();
1208
1209 if (!filteredObjects)
1211
1212 // Remove objects that are too far from the player anyways
1213 if ( doDistanceCheck )
1214 {
1215 for ( i = vicinityObjects.Count() - 1; i >= 0; --i )
1216 {
1217 Object obj = vicinityObjects[i];
1218 if ( obj && !CanIgnoreDistanceCheck( obj ) && vector.DistanceSq(origin, obj.GetPosition()) > maxDist * maxDist )
1219 vicinityObjects.Remove(i);
1220 }
1221 }
1222
1223 // Sort obstructingObjects to have the furthest one first
1227 float distance, dist1, dist2;
1228
1229 for ( i = 0; i < obstructingObjects.Count(); ++i )
1230 {
1231 distance = vector.DistanceSq(obstructingObjects[i].GetWorldPosition(), origin);
1232 distanceHelper.Insert(distance);
1233 }
1234
1236 distanceHelper.Sort();
1237
1238 for ( i = distanceHelper.Count() - 1; i >= 0; --i )
1240
1244
1245 float cos = Math.Cos(90);
1246 float sin = Math.Sin(90);
1247
1248 // Iterate through sorted obstructingObjects
1249 for ( i = 0; i < sortedObstructingObjects.Count(); ++i )
1250 {
1252 vector worldPos = obstrObj.GetWorldPosition();
1253 vector min, max;
1254 vector minMax[2];
1255 if ( obstrObj.GetCollisionBox(minMax) )
1256 {
1257 min = minMax[0];
1258 max = minMax[1];
1259 max = max * (obstrObj.GetOrientation() * range);
1260
1261 vector center, dx, dy, dz, half;
1262 center = (min + max) * 0.5;
1263 dz = obstrObj.GetOrientation();
1266 half = (max - min) * 0.5;
1268
1269 group = new array<Object>;
1270
1271 // Group objects within the above box
1272 for ( j = vicinityObjects.Count() - 1; j >= 0; --j )
1273 {
1275 if ( vicObj )
1276 {
1277 vector d = vicObj.GetWorldPosition() - worldPos + center;
1278 if ( Math.AbsFloat(vector.Dot(d, dx)) <= half[0] && Math.AbsFloat(vector.Dot(d, dy)) <= half[1] && Math.AbsFloat(vector.Dot(d, dz)) <= half[2] )
1279 {
1280 group.Insert(vicObj);
1281 vicinityObjects.Remove(j);
1282 }
1283 }
1284 }
1285
1286 if ( group.Count() > 0 )
1287 tempGroups.Insert(group);
1288 }
1289 }
1290
1291 // Go through the objects grouped by obstruction to split them by distance too
1292 for ( i = 0; i < tempGroups.Count(); ++i )
1294
1295 // Split initial groups by distance
1297
1298 // Raycast accordingly to groups
1300 for ( i = 0; i < objectGroups.Count(); ++i )
1301 {
1304
1306 filteredObjects.InsertAll(objectGroup);
1307
1308 cache.ClearCache();
1309 }
1310 }
static bool CanIgnoreDistanceCheck(Object obj)
Definition MiscGameplayFunctions.c:1193
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
Definition MiscGameplayFunctions.c:1843
static bool IsObjectObstructedEx(Object object, IsObjectObstructedCache cache, bool doDistanceCheck=false, vector distanceCheckPos="0 0 0", float maxDist=0)
Definition MiscGameplayFunctions.c:1355
static void SplitArrayIntoGroupsByDistance(array< Object > objects, array< ref array< Object > > objectGroups, float squaredDistanceDelta)
Definition MiscGameplayFunctions.c:1312
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
Definition EnConvert.c:477
static const vector Up
Definition EnConvert.c:107
static const vector Aside
Definition EnConvert.c:108
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat(), vector::Aside, CanIgnoreDistanceCheck(), Math::Cos(), vector::DistanceSq(), vector::Dot(), IsObjectObstructedCache(), IsObjectObstructedEx(), vector::RotateAroundZero(), Math::Sin(), SplitArrayIntoGroupsByDistance(), vector::Up и Vector().

◆ FilterObstructingObjects()

static void FilterObstructingObjects ( array< Object > potentiallyObstructingObjects,
out array< Object > obstructingObjects )
staticprotected
1181 {
1182 if (!obstructingObjects)
1184
1185 for ( int i = 0; i < potentiallyObstructingObjects.Count(); ++i )
1186 {
1188 if ( obj && ( obj.CanObstruct() || obj.CanProxyObstruct() ) )
1189 obstructingObjects.Insert(obj);
1190 }
1191 }

◆ FModulus()

static float FModulus ( float x,
float y )
staticprotected
1526 {
1527 return Math.ModFloat(x, y);
1528 }
Icon x
Icon y
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.

Перекрестные ссылки Math::ModFloat(), x и y.

Используется в Bobbing().

◆ GenerateAINoiseAtPosition()

static void GenerateAINoiseAtPosition ( vector position,
float lifeTime,
NoiseParams noiseParams )
staticprotected
1648 {
1649 if (GetGame().IsServer())
1650 {
1651 NoiseSystem noise = GetGame().GetNoiseSystem();
1652 if (noise)
1653 {
1654 noise.AddNoiseTarget(position, lifeTime, noiseParams, NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather()));
1655 }
1656 }
1657 }
Definition SensesAIEvaluate.c:2
static float GetNoiseReduction(Weather weather)
Definition SensesAIEvaluate.c:18
Definition Noise.c:2

Перекрестные ссылки GetGame() и NoiseAIEvaluate::GetNoiseReduction().

◆ GetAttachedChildren()

static void GetAttachedChildren ( IEntity parent,
array< IEntity > outputObjects )
staticprotected

Fills the provided array with all children entities in hierarchy of this entity.

1776 {
1777 IEntity child = parent.GetChildren();
1778 while (child)
1779 {
1780 outputObjects.Insert(child);
1781 child = child.GetSibling();
1782 }
1783 }
Definition EnEntity.c:165
proto native IEntity GetChildren()
Returns pointer to first child Entity in hierarchy.

Перекрестные ссылки IEntity::GetChildren().

◆ GetClosestSafePos()

static vector GetClosestSafePos ( vector to_pos,
notnull array< ref array< float > > positions )
staticprotected
1612 {
1614 float smallest_dist = float.MAX;
1615 foreach( array<float> pos:positions)
1616 {
1617 vector vpos = "0 0 0";
1618 vpos[0] = pos[0];
1619 vpos[2] = pos[1];
1620
1621 to_pos[1] = 0;
1622 float dist = vector.DistanceSq(to_pos, vpos);//2d dist sq
1623 if ( dist < smallest_dist)
1624 {
1626 closest_pos = vpos;
1627 }
1628 }
1629 return closest_pos;
1630 }

Перекрестные ссылки vector::DistanceSq().

◆ GetColorString()

static string GetColorString ( float r,
float g,
float b,
float a )
staticprotected
242 {
243 return string.Format("#(argb,8,8,3)color(%1,CO)", string.Format("%1,%2,%3,%4", r, g, b, a));
244 }

Перекрестные ссылки string::Format().

◆ GetCombinedSnowfallWindValue()

static float GetCombinedSnowfallWindValue ( )
staticprotected
1795 {
1796 float windMax;
1797 g_Game.GetWeather().GetWindMagnitude().GetLimits(null, windMax);
1798 float snowfall = g_Game.GetWeather().GetSnowfall().GetActual();
1799 float value = snowfall + g_Game.GetWeather().GetWindMagnitude().GetActual() / windMax;
1800
1801 return value;
1802 }

Перекрестные ссылки g_Game.

◆ GetComponentIndex()

static int GetComponentIndex ( array< Selection > pSelection,
string pCompName )
staticprotected
1712 {
1713 if (!MiscGameplayFunctions.IsComponentInSelection(pSelection, pCompName))
1714 {
1715 return INDEX_NOT_FOUND;
1716 }
1717
1718 for (int i = 0; i < pSelection.Count(); ++i)
1719 {
1720 pCompName.ToLower();
1721 if (pSelection[i] && pSelection[i].GetName() == pCompName)
1722 {
1723 return i;
1724 }
1725 }
1726
1727 return INDEX_NOT_FOUND;
1728 }
const int INDEX_NOT_FOUND
Definition gameplay.c:13
proto native owned string GetName()
Definition SyncedValue.c:119

Перекрестные ссылки GetName() и INDEX_NOT_FOUND.

◆ GetCurrentItemHeatIsolation()

static float GetCurrentItemHeatIsolation ( ItemBase pItem)
staticprotected

item heat isolation (from cfg)

item health (state)

item wetness

wet factor selection

health factor selection

apply factors

1119 {
1120 float wetFactor;
1121 float healthFactor;
1122
1123 float heatIsolation = pItem.GetHeatIsolation();
1124 float itemHealthLabel = pItem.GetHealthLevel();
1125 float itemWetness = pItem.GetWet();
1126
1129 {
1131 }
1133 {
1135 }
1137 {
1139 }
1141 {
1143 }
1145 {
1147 }
1148
1150 switch (itemHealthLabel)
1151 {
1154 break;
1155
1158 break;
1159
1162 break;
1163
1166 break;
1167
1170 break;
1171 }
1172
1176
1177 return heatIsolation;
1178 }
Definition constants.c:638
const float ENVIRO_ISOLATION_WETFACTOR_WET
Definition constants.c:744
const float ENVIRO_ISOLATION_HEALTHFACTOR_B_DAMAGED
Definition constants.c:751
const float ENVIRO_ISOLATION_WETFACTOR_SOAKED
Definition constants.c:745
const float ENVIRO_ISOLATION_WETFACTOR_DRENCHED
Definition constants.c:746
const float ENVIRO_ISOLATION_HEALTHFACTOR_DAMAGED
Definition constants.c:750
const float ENVIRO_ISOLATION_HEALTHFACTOR_RUINED
Definition constants.c:752
const float ENVIRO_ISOLATION_HEALTHFACTOR_WORN
Definition constants.c:749
const float ENVIRO_ISOLATION_HEALTHFACTOR_PRISTINE
impact of item health (state) to the heat isolation
Definition constants.c:748
const float ENVIRO_ISOLATION_WETFACTOR_DAMP
Definition constants.c:743
const float ENVIRO_ISOLATION_WETFACTOR_DRY
Minimal heatbuffer capacity of naked character.
Definition constants.c:742
const int STATE_RUINED
Definition constants.c:807
const int STATE_BADLY_DAMAGED
Definition constants.c:808
const int STATE_DAMAGED
Definition constants.c:809
const int STATE_PRISTINE
Definition constants.c:811
const int STATE_WORN
Definition constants.c:810
const float STATE_DRY
Definition constants.c:835
const float STATE_SOAKING_WET
Definition constants.c:832
const float STATE_WET
Definition constants.c:833
const float STATE_DRENCHED
Definition constants.c:831
const float STATE_DAMP
Definition constants.c:834

Перекрестные ссылки GameConstants::ENVIRO_ISOLATION_HEALTHFACTOR_B_DAMAGED, GameConstants::ENVIRO_ISOLATION_HEALTHFACTOR_DAMAGED, GameConstants::ENVIRO_ISOLATION_HEALTHFACTOR_PRISTINE, GameConstants::ENVIRO_ISOLATION_HEALTHFACTOR_RUINED, GameConstants::ENVIRO_ISOLATION_HEALTHFACTOR_WORN, GameConstants::ENVIRO_ISOLATION_WETFACTOR_DAMP, GameConstants::ENVIRO_ISOLATION_WETFACTOR_DRENCHED, GameConstants::ENVIRO_ISOLATION_WETFACTOR_DRY, GameConstants::ENVIRO_ISOLATION_WETFACTOR_SOAKED, GameConstants::ENVIRO_ISOLATION_WETFACTOR_WET, GameConstants::STATE_BADLY_DAMAGED, GameConstants::STATE_DAMAGED, GameConstants::STATE_DAMP, GameConstants::STATE_DRENCHED, GameConstants::STATE_DRY, GameConstants::STATE_PRISTINE, GameConstants::STATE_RUINED, GameConstants::STATE_SOAKING_WET, GameConstants::STATE_WET и GameConstants::STATE_WORN.

◆ GetEnergyMetabolicSpeed()

static float GetEnergyMetabolicSpeed ( int movement_speed)
staticprotected
660 {
661 float speed;
662 switch (movement_speed)
663 {
664 case DayZPlayerConstants.MOVEMENTIDX_WALK:
666 break;
667 case DayZPlayerConstants.MOVEMENTIDX_RUN:
669 break;
670 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
672 break;
673 default:
674 speed = 0;
675 break;
676 }
677
679 return speed;
680 }
Definition PlayerConstants.c:2
static const float METABOLIC_SPEED_ENERGY_BASAL
Definition PlayerConstants.c:67
static const float METABOLIC_SPEED_ENERGY_SPRINT
Definition PlayerConstants.c:71
static const float METABOLIC_SPEED_ENERGY_JOG
Definition PlayerConstants.c:70
static const float METABOLIC_SPEED_ENERGY_WALK
Definition PlayerConstants.c:69
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

Перекрестные ссылки PlayerConstants::METABOLIC_SPEED_ENERGY_BASAL, PlayerConstants::METABOLIC_SPEED_ENERGY_JOG, PlayerConstants::METABOLIC_SPEED_ENERGY_SPRINT и PlayerConstants::METABOLIC_SPEED_ENERGY_WALK.

◆ GetHeadBonePos()

static void GetHeadBonePos ( notnull PlayerBase player,
out vector pos )
staticprotected
632 {
633 // Get position of head for starting trace pos, otherwise use sane default
634 int headBoneIdx = player.GetBoneIndexByName("Head");
635 if ( headBoneIdx == -1 )
636 { pos = player.GetPosition()[1] + 1.6; }
637 else
638 { pos = player.GetBonePositionWS(headBoneIdx); }
639 }

◆ GetHeadingAngle()

static float GetHeadingAngle ( notnull DayZPlayerImplement player)
staticprotected
652 {
653 HumanInputController hic = player.GetInputController();
654 float headingAngle = hic.GetHeadingAngle();
655
656 return headingAngle;
657 }
Definition human.c:18

Используется в GetHeadingVector().

◆ GetHeadingVector()

static vector GetHeadingVector ( notnull PlayerBase player)
staticprotected
642 {
643 vector dir = vector.Zero;
645 dir[0] = Math.Cos(headingAngle + Math.PI_HALF);
646 dir[2] = Math.Sin(headingAngle + Math.PI_HALF);
647
648 return dir.Normalized();
649 }
static float GetHeadingAngle(notnull DayZPlayerImplement player)
Definition MiscGameplayFunctions.c:651
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static const vector Zero
Definition EnConvert.c:110
static const float PI_HALF
Definition EnMath.c:14

Перекрестные ссылки Math::Cos(), GetHeadingAngle(), vector::Normalized(), Math::PI_HALF, Math::Sin() и vector::Zero.

◆ GetHealthLevelForAmmo()

static int GetHealthLevelForAmmo ( string class_name,
float health )
staticprotected
575 {
576 float health_normalized = health / 100;
577 string config_path = CFG_WEAPONSPATH + " " + class_name + " DamageSystem" + " GlobalHealth" + " healthLabels";
579 GetGame().ConfigGetFloatArray(config_path, CachedObjectsArrays.ARRAY_FLOAT);
580 for(int i = 0; i < CachedObjectsArrays.ARRAY_FLOAT.Count(); i++)
581 {
583 {
584 return i;
585 }
586 }
587 return -1;
588 }
class OptionSelectorMultistate extends OptionSelector class_name
Definition UtilityClasses.c:41
static ref TFloatArray ARRAY_FLOAT
Definition UtilityClasses.c:50
const string CFG_WEAPONSPATH
Definition constants.c:218

Перекрестные ссылки CachedObjectsArrays::ARRAY_FLOAT, CFG_WEAPONSPATH, class_name и GetGame().

◆ GetItemDisplayName()

static string GetItemDisplayName ( string type)
staticprotected
1688 {
1689 return GetGame().ConfigGetTextOut("CfgVehicles " + type + " displayName");
1690 }

Перекрестные ссылки GetGame().

◆ GetMaxValue()

static float GetMaxValue ( array< float > pArray)
staticprotected
1674 {
1675 float maxValue = 0.0;
1676 for (int i = 0; i < pArray.Count(); i++)
1677 {
1678 if (maxValue == 0 || pArray.Get(i) > maxValue)
1679 {
1680 maxValue = pArray.Get(i);
1681 }
1682 }
1683
1684 return maxValue;
1685 }

◆ GetMinValue()

static float GetMinValue ( array< float > pArray)
staticprotected
1660 {
1661 float minValue = 0.0;
1662 for (int i = 0; i < pArray.Count(); i++)
1663 {
1664 if (minValue == 0 || pArray.Get(i) < minValue)
1665 {
1666 minValue = pArray.Get(i);
1667 }
1668 }
1669
1670 return minValue;
1671 }

◆ GetProjectedCursorPos3d()

static bool GetProjectedCursorPos3d ( out vector position,
Weapon_Base weapon )
staticprotected
614 {
615 vector usti_hlavne_position = weapon.GetSelectionPositionMS( "usti hlavne" );
616 vector konec_hlavne_position = weapon.GetSelectionPositionMS( "konec hlavne" );
621
625
627 return true;
628 return false;
629 }
Definition DayZPhysics.c:124
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.
const float PROJECTED_CURSOR_DISTANCE
Definition constants.c:617

Перекрестные ссылки PROJECTED_CURSOR_DISTANCE и DayZPhysics::RaycastRV().

◆ GetRandomizedPosition()

static vector GetRandomizedPosition ( vector targetPos,
float radius )
staticprotected
978 {
979 int angle = Math.RandomIntInclusive(1,360);
980 float usedRadius = Math.RandomFloat01() * radius;
982
983 return randomPos;
984 }
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126

Перекрестные ссылки Math::Cos(), Math::RandomFloat01(), Math::RandomIntInclusive(), Math::Sin() и Vector().

Используется в GetRandomizedPositionVerified().

◆ GetRandomizedPositionVerified()

static vector GetRandomizedPositionVerified ( vector startPos,
vector targetPos,
float radius,
Object ignore = null )
staticprotected
987 {
994 {
995 ret = results[0].pos;
996 ret[1] = targetPos[1];
997 }
998 return ret;
999 }
static vector GetRandomizedPosition(vector targetPos, float radius)
Definition MiscGameplayFunctions.c:977
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
Definition DayZPhysics.c:50

Перекрестные ссылки GetRandomizedPosition() и DayZPhysics::RaycastRVProxy().

◆ GetSteamPosition()

static vector GetSteamPosition ( EntityAI parent)
staticprotected
937 {
939 float steam_offset = 0;
940
941 if ( parent )
942 {
943 particle_pos = parent.GetPosition();
944
945 if ( parent.IsInherited( PortableGasStove ) )
946 {
947 steam_offset = 0.2;
948 }
949 else if ( parent.IsInherited( FireplaceBase ) )
950 {
951 FireplaceBase fireplace = FireplaceBase.Cast( parent );
952
953 if ( fireplace.IsBaseFireplace() )
954 {
955 steam_offset = 0.8;
956 }
957 else if ( fireplace.IsBarrelWithHoles() )
958 {
959 steam_offset = 1.1;
960 }
961 else if ( fireplace.IsFireplaceIndoor() )
962 {
963 steam_offset = 0.45;
964 }
965 else if ( fireplace.IsIndoorOven() )
966 {
967 steam_offset = 0.9;
968 }
969 }
970 }
971
973
974 return particle_pos;
975 }
Definition BarrelHoles_ColorBase.c:2

◆ GetTypeMaxGlobalHealth()

static float GetTypeMaxGlobalHealth ( string class_name,
string health_type = "Health" )
staticprotected
591 {
592 float max_health;
593 string cfg_path;
594
595 if ( GetGame().ConfigIsExisting(CFG_VEHICLESPATH+" "+class_name) )
596 {
598 }
599 else if ( GetGame().ConfigIsExisting(CFG_WEAPONSPATH+" "+class_name) )
600 {
602 }
603 else if ( GetGame().ConfigIsExisting(CFG_MAGAZINESPATH+" "+class_name) )
604 {
606 }
607 cfg_path = cfg_path + " "+class_name+" DamageSystem GlobalHealth " + health_type + " hitpoints";
608 max_health = GetGame().ConfigGetFloat(cfg_path);
609
610 return max_health;
611 }
const string CFG_VEHICLESPATH
Definition constants.c:217
const string CFG_MAGAZINESPATH
Definition constants.c:219

Перекрестные ссылки CFG_MAGAZINESPATH, CFG_VEHICLESPATH, CFG_WEAPONSPATH, class_name и GetGame().

◆ GetWaterMetabolicSpeed()

static float GetWaterMetabolicSpeed ( int movement_speed)
staticprotected
683 {
684 float speed;
685 switch (movement_speed)
686 {
687 case DayZPlayerConstants.MOVEMENTIDX_WALK:
689 break;
690 case DayZPlayerConstants.MOVEMENTIDX_RUN:
692 break;
693 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
695 break;
696 default:
697 speed = 0;
698 break;
699 }
700
702 return speed;
703 }
static const float METABOLIC_SPEED_WATER_WALK
Definition PlayerConstants.c:75
static const float METABOLIC_SPEED_WATER_JOG
Definition PlayerConstants.c:76
static const float METABOLIC_SPEED_WATER_BASAL
Definition PlayerConstants.c:73
static const float METABOLIC_SPEED_WATER_SPRINT
Definition PlayerConstants.c:77

Перекрестные ссылки PlayerConstants::METABOLIC_SPEED_WATER_BASAL, PlayerConstants::METABOLIC_SPEED_WATER_JOG, PlayerConstants::METABOLIC_SPEED_WATER_SPRINT и PlayerConstants::METABOLIC_SPEED_WATER_WALK.

◆ InsertAtPos()

static string InsertAtPos ( string base,
string insert,
int pos )
staticprotected

Insert 'insert' behind index 'pos' of the 'base' string.

259 {
260 int length_first = pos+1;
261 int length_base = base.Length();
263 string first = base.Substring(0,length_first);
264 string second = base.Substring(pos+1,length_second);
265 return first + insert + second;
266 }

Используется в ValueToBar().

◆ IsComponentInSelection()

static bool IsComponentInSelection ( array< Selection > pSelection,
string pCompName )
staticprotected
1693 {
1694 if (pSelection.Count() == 0 || pCompName.Length() == 0)
1695 {
1696 return false;
1697 }
1698
1699 for (int i = 0; i < pSelection.Count(); ++i)
1700 {
1701 pCompName.ToLower();
1702 if (pSelection[i] && pSelection[i].GetName() == pCompName)
1703 {
1704 return true;
1705 }
1706 }
1707
1708 return false;
1709 }

Перекрестные ссылки GetName().

◆ IsObjectObstructed()

static bool IsObjectObstructed ( Object object,
bool doDistanceCheck = false,
vector distanceCheckPos = "0 0 0",
float maxDist = 0 )
staticprotected
1347 {
1349 MiscGameplayFunctions.GetHeadBonePos(PlayerBase.Cast(GetGame().GetPlayer()), rayStart);
1351
1353 }
PlayerBase GetPlayer()
Definition ModifierBase.c:51
Definition PlayerBaseClient.c:2

Перекрестные ссылки GetGame(), GetPlayer(), IsObjectObstructedCache() и IsObjectObstructedEx().

◆ IsObjectObstructedCache()

void IsObjectObstructedCache ( vector rayCastStart,
int totalObjects )
protected
1844 {
1847 }
DestroyItemInCorpsesHandsAndCreateNewOnGndLambda RaycastStart
int TotalObjects
Definition MiscGameplayFunctions.c:1833

Перекрестные ссылки RaycastStart и TotalObjects.

Используется в ActionTargets::FilterObstructedObjects(), FilterObstructedObjectsByGrouping(), IsObjectObstructed() и ActionTargets::IsObstructed().

◆ IsObjectObstructedEx()

static bool IsObjectObstructedEx ( Object object,
IsObjectObstructedCache cache,
bool doDistanceCheck = false,
vector distanceCheckPos = "0 0 0",
float maxDist = 0 )
staticprotected
1356 {
1357 if (!object)
1358 return true;
1359
1360 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
1362 return true;
1363
1364 cache.ObjectCenterPos = object.GetCenter();
1365
1366 return IsObjectObstructedFilterEx(object, cache, player);
1367 }
static bool IsObjectObstructedFilterEx(Object object, IsObjectObstructedCache cache, PlayerBase player, int geometryTypeOverride=-1)
groups 'RaycastRVProxy' and 'RaycastRV' approaches into one method, allowes for comprehensive geometr...
Definition MiscGameplayFunctions.c:1426

Перекрестные ссылки vector::DistanceSq(), g_Game и IsObjectObstructedFilterEx().

Используется в FilterObstructedObjectsByGrouping() и IsObjectObstructed().

◆ IsObjectObstructedFilter()

static bool IsObjectObstructedFilter ( Object object,
IsObjectObstructedCache cache,
PlayerBase player )
staticprotected
1399 {
1400 for ( int m = 0; m < cache.HitObjects.Count(); m++ )
1401 {
1402 Object hit_object = cache.HitObjects.Get(m);
1403
1404 if ( hit_object.CanObstruct() )
1405 return true;
1406
1407 //4.3. ignore item if items are big and heavy >= OBJECT_OBSTRUCTION_WEIGHT
1408 //EntityAI eai;
1409 //if ( Class.CastTo( eai, hit_object ) )
1410 //{
1411 // if ( eai.GetWeight() >= OBJECT_OBSTRUCTION_WEIGHT )
1412 // {
1413 // if ( eai != filtered_object && eai.GetHierarchyRoot() != filtered_object )
1414 // {
1415 // //Print("!!!!!obstacle vaha: " + hit_object);
1416 // is_obstructed = true;
1417 // }
1418 // }
1419 //}
1420 }
1421
1422 return false;
1423 }

◆ IsObjectObstructedFilterEx()

static bool IsObjectObstructedFilterEx ( Object object,
IsObjectObstructedCache cache,
PlayerBase player,
int geometryTypeOverride = -1 )
staticprotected

groups 'RaycastRVProxy' and 'RaycastRV' approaches into one method, allowes for comprehensive geometry override, if desired

1427 {
1428 //first proxy geometries
1429 RaycastRVParams rayInput = new RaycastRVParams(cache.RaycastStart, cache.ObjectCenterPos, player);
1430 rayInput.flags = CollisionFlags.ALLOBJECTS;
1431 if (geometryTypeOverride != -1)
1432 rayInput.type = geometryTypeOverride; //default 'ObjIntersectView'
1433 DayZPhysics.RaycastRVProxy(rayInput, cache.HitProxyObjects);
1434 int count;
1435 int i;
1436
1437 if (cache.HitProxyObjects)
1438 {
1439 count = cache.HitProxyObjects.Count();
1440 Object parent;
1441 for (i = 0; i < count; i++)
1442 {
1443 if (cache.HitProxyObjects[i].hierLevel > 0) //parent has to exist, skipping nullcheck
1444 {
1445 parent = cache.HitProxyObjects[i].parent;
1446 if (parent && !parent.IsMan() && parent.CanProxyObstruct())
1447 {
1448 if (parent != object || (parent == object && object.CanProxyObstructSelf()))
1449 return true;
1450 }
1451 }
1452 }
1453 }
1454
1455 //second, regular raycast
1456 int geometry = ObjIntersectFire; //default for the RV raycast
1457 if (geometryTypeOverride != -1)
1459 DayZPhysics.RaycastRV(cache.RaycastStart, cache.ObjectCenterPos, cache.ObjectContactPos, cache.ObjectContactDir, cache.ContactComponent, cache.HitObjects, object, GetGame().GetPlayer(), false, false, geometry, 0.0, CollisionFlags.ALLOBJECTS);
1460 count = cache.HitObjects.Count();
1461 for (i = 0; i < count; i++ )
1462 {
1463 if (cache.HitObjects[i].CanObstruct())
1464 return true;
1465 }
1466
1467 return false;
1468 }
CollisionFlags
Definition EnDebug.c:141

Перекрестные ссылки GetGame(), GetPlayer(), DayZPhysics::RaycastRV() и DayZPhysics::RaycastRVProxy().

Используется в IsObjectObstructedEx().

◆ IsObjectObstructedProxy()

static bool IsObjectObstructedProxy ( Object object,
IsObjectObstructedCache cache,
PlayerBase player )
staticprotected
1370 {
1371 if (object.CanProxyObstruct())
1372 {
1373 RaycastRVParams rayInput = new RaycastRVParams(cache.RaycastStart, cache.ObjectCenterPos, player);
1374 DayZPhysics.RaycastRVProxy(rayInput, cache.HitProxyObjects);
1375 if (cache.HitProxyObjects)
1376 {
1377 if (cache.HitProxyObjects.Count() > 0)
1378 {
1379 if (cache.HitProxyObjects[0].hierLevel > 0)
1380 {
1381 // ignores attachments on player
1382 if (!cache.HitProxyObjects[0].parent.IsMan())
1383 {
1384 if (cache.HitProxyObjects[0].parent)
1385 {
1386 EntityAI proxyParent = EntityAI.Cast(cache.HitProxyObjects[0].parent);
1387 if (proxyParent.GetInventory() && proxyParent.GetInventory().GetCargo())
1388 return true;
1389 }
1390 }
1391 }
1392 }
1393 }
1394 }
1395 return false;
1396 }

Перекрестные ссылки DayZPhysics::RaycastRVProxy().

◆ IsPlayerOrientedTowardPos()

static bool IsPlayerOrientedTowardPos ( notnull DayZPlayerImplement player,
vector target_pos,
float cone_angle )
staticprotected

Check if player direction(based on cone of defined angle) is oriented to target position.

dir in cone or in a tip of cone

748 {
749 if (player)
750 {
751 vector player_dir = player.GetDirection();
752 vector to_target_dir = target_pos - player.GetPosition();
753
754 player_dir[1] = 0;
755 to_target_dir[1] = 0;
756
757 player_dir.Normalize();
758 to_target_dir.Normalize();
759
762
763 int dir = Math.Acos(cos_fi) * Math.RAD2DEG;
764
765 if( cross[1] < 0 )
766 dir = -dir;
767
769 if( (dir <= cone_angle && dir >= -cone_angle) || Math.AbsFloat(dir) == 90 )
770 {
771 return true;
772 }
773 }
774
775 return false;
776 }
static const float RAD2DEG
Definition EnMath.c:16

Перекрестные ссылки Math::AbsFloat(), Math::Acos(), vector::Dot() и Math::RAD2DEG.

◆ IsUnderRoof()

static bool IsUnderRoof ( EntityAI entity,
float height = GameConstants.ROOF_CHECK_RAYCAST_DIST )
staticprotected
917 {
919 }
static bool IsUnderRoofEx(EntityAI entity, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST, int geometry=ObjIntersectView)
Definition MiscGameplayFunctions.c:921

Перекрестные ссылки IsUnderRoofEx().

◆ IsUnderRoofEx()

static bool IsUnderRoofEx ( EntityAI entity,
float height = GameConstants.ROOF_CHECK_RAYCAST_DIST,
int geometry = ObjIntersectView )
staticprotected
922 {
923 vector from;
924 vector to;
925
927
931
933 }
static void IsUnderRoofFromToCalculation(EntityAI entity, out vector from, out vector to, float height=GameConstants.ROOF_CHECK_RAYCAST_DIST)
Definition MiscGameplayFunctions.c:886

Перекрестные ссылки IsUnderRoofFromToCalculation() и DayZPhysics::RaycastRV().

Используется в IsUnderRoof().

◆ IsUnderRoofFromToCalculation()

static void IsUnderRoofFromToCalculation ( EntityAI entity,
out vector from,
out vector to,
float height = GameConstants.ROOF_CHECK_RAYCAST_DIST )
staticprotected
887 {
888 vector minMax[2];
889 entity.GetCollisionBox(minMax);
890
891 vector size = Vector(0,0,0);
892 //size[1] = minMax[1][1] - minMax[0][1];
893 float from_override = entity.HeightStartCheckOverride();
894 if (from_override > 0.0)
895 {
896 size[1] = from_override;
897 }
898 else
899 {
900 size[1] = minMax[1][1] - minMax[0][1];
901 }
902
903 from = entity.GetPosition() + size;
904 if ( entity.HeightCheckOverride() > 0 )
905 {
906 to = entity.GetPosition() + Vector(0, entity.HeightCheckOverride(), 0);
907 }
908 else
909 {
910 vector ceiling = "0 0 0";
911 ceiling[1] = height;
912 to = from + ceiling; //+size ??? offset to cast same distance
913 }
914 }

Перекрестные ссылки Vector().

Используется в IsUnderRoofEx().

◆ IsValueInRange()

static bool IsValueInRange ( float value,
float from,
float to )
staticprotected
742 {
743 return (value >= from) && (value <= to);
744 }

◆ MoveEquipToExistingItemAndDestroyOldRootLambda()

void MoveEquipToExistingItemAndDestroyOldRootLambda ( EntityAI old_item,
string new_item_type,
PlayerBase player,
EntityAI new_item )
169 {
172 if (new_item_type != string.Empty)
173 Error("MoveEquipAndDestroyRootLambda expects new_item_type to be empty");
174 }
Empty
Definition Hand_States.c:14
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Empty, Error(), m_NewItem и m_Player.

Используется в ActionPlaceFireplaceIntoBarrel::OnExecuteServer().

◆ Normalize()

static float Normalize ( int val,
int maxVal )
staticprotected
1498 {
1499 if (maxVal == 0)
1500 {
1501 Debug.LogError("Division by 0 is not allowed");
1502 return 0;
1503 }
1504
1505 return val / maxVal;
1506 }
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:259

Перекрестные ссылки Debug::LogError().

◆ ObtainRestrainItemTargetClassname()

static string ObtainRestrainItemTargetClassname ( notnull EntityAI entity)
staticprotected
706 {
707 return entity.ConfigGetString( "OnRestrainChange");
708 }

◆ OnSuccess()

class TurnItemIntoItemLambdaAnimSysNotifyLambda extends TurnItemIntoItemLambda OnSuccess ( EntityAI new_item)
106 {
107 super.OnSuccess(new_item);
108 m_Player.SetRestrained(true);
109 }

◆ RemoveAllAttachedChildrenByTypename()

static void RemoveAllAttachedChildrenByTypename ( notnull EntityAI parent,
array< typename > listOfTypenames )
staticprotected
1731 {
1732 if (listOfTypenames.Count() > 0)
1733 {
1734 Object child = Object.Cast(parent.GetChildren());
1735 while (child)
1736 {
1738 child = Object.Cast(child.GetSibling());
1739
1740 if (childToRemove.IsAnyInherited(listOfTypenames))
1741 {
1742 vector pos = childToRemove.GetPosition();
1743 parent.RemoveChild(childToRemove, false);
1744
1745 vector m4[4];
1747 m4[3] = pos;
1748 childToRemove.SetTransform(m4);
1749 childToRemove.PlaceOnSurface();
1750 }
1751 }
1752 }
1753 }

Перекрестные ссылки Math3D::MatrixIdentity4().

◆ RemoveNetworkObjectInfo()

void RemoveNetworkObjectInfo ( )
protected
177 {
178 super.RemoveNetworkObjectInfo();
179 GetGame().RemoteObjectTreeDelete(m_NewItem);
180 }

Перекрестные ссылки GetGame() и m_NewItem.

◆ RemoveSplint()

static void RemoveSplint ( PlayerBase player)
staticprotected
1531 {
1532 EntityAI entity = player.GetInventory().CreateInInventory("Splint");
1533 if (!entity)
1534 entity = player.SpawnEntityOnGroundOnCursorDir("Splint", 0.5);
1535
1538 Class.CastTo(attachment, player.GetItemOnSlot("Splint_Right"));
1539 if ( attachment && attachment.GetType() == "Splint_Applied" )
1540 {
1541 if (new_item)
1542 {
1543 MiscGameplayFunctions.TransferItemProperties(attachment,new_item);
1544
1545 if (GetGame().IsServer())
1546 {
1547 //Lower health level of splint after use
1548 if (new_item.GetHealthLevel() < 4)
1549 {
1550 int newDmgLevel = new_item.GetHealthLevel() + 1;
1551
1552 float max = new_item.GetMaxHealth("","");
1553
1554 switch ( newDmgLevel )
1555 {
1558 break;
1559
1561 new_item.SetHealth( "", "", max * GameConstants.DAMAGE_DAMAGED_VALUE );
1562 break;
1563
1565 new_item.SetHealth( "", "", max * GameConstants.DAMAGE_WORN_VALUE );
1566 break;
1567
1569 new_item.SetHealth( "", "", max * GameConstants.DAMAGE_RUINED_VALUE );
1570 break;
1571
1572 default:
1573 break;
1574 }
1575 }
1576 }
1577 }
1578
1579 attachment.Delete();
1580 }
1581 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float DAMAGE_RUINED_VALUE
Definition constants.c:823
const float DAMAGE_DAMAGED_VALUE
Definition constants.c:821
const float DAMAGE_BADLY_DAMAGED_VALUE
Definition constants.c:822
const float DAMAGE_WORN_VALUE
Definition constants.c:820

Перекрестные ссылки Class::CastTo(), GameConstants::DAMAGE_BADLY_DAMAGED_VALUE, GameConstants::DAMAGE_DAMAGED_VALUE, GameConstants::DAMAGE_RUINED_VALUE, GameConstants::DAMAGE_WORN_VALUE, GetGame(), GameConstants::STATE_BADLY_DAMAGED, GameConstants::STATE_DAMAGED, GameConstants::STATE_RUINED и GameConstants::STATE_WORN.

◆ SanitizeString()

static string SanitizeString ( string input)
staticprotected
779 {
780 int max_length = 512;
781 string output = input;
782
783 output = output.Substring(0,Math.Clamp(max_length,0,output.Length()));
784 return output;
785 }
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'.

Перекрестные ссылки Math::Clamp().

◆ SoakItemInsideParentContainingLiquidAboveThreshold()

static void SoakItemInsideParentContainingLiquidAboveThreshold ( notnull ItemBase item,
notnull ItemBase parent,
float liquidQuantityThresholdPercentage = 0.05 )
staticprotected
1786 {
1787 if (g_Game.IsServer())
1788 {
1789 if (parent.GetLiquidType() != 0 && parent.GetQuantityNormalized() > liquidQuantityThresholdPercentage)
1790 item.SetWetMax();
1791 }
1792 }

Перекрестные ссылки g_Game.

◆ SplitArrayIntoGroupsByDistance()

static void SplitArrayIntoGroupsByDistance ( array< Object > objects,
array< ref array< Object > > objectGroups,
float squaredDistanceDelta )
staticprotected
1313 {
1315 for ( int i = 0; i < objects.Count(); )
1316 {
1317 Object obj1 = objects[i];
1318 if ( obj1 )
1319 {
1320 group = new array<Object>;
1321 group.Insert(obj1);
1322 for ( int j = objects.Count() - 1; j > i; --j )
1323 {
1324 Object obj2 = objects[j];
1325 if ( obj1 && obj2 )
1326 {
1327 vector start = obj1.GetWorldPosition();
1328 vector end = obj2.GetWorldPosition();
1329
1332 {
1333 group.Insert(obj2);
1334 objects.Remove(j);
1335 }
1336 }
1337 }
1338 objectGroups.Insert(group);
1339 objects.Remove(i);
1340 continue;
1341 }
1342 ++i;
1343 }
1344 }

Перекрестные ссылки vector::DistanceSq().

Используется в FilterObstructedObjectsByGrouping().

◆ TeleportCheck()

static void TeleportCheck ( notnull PlayerBase player,
notnull array< ref array< float > > safe_positions )
staticprotected

checks if we should teleport the player to a safe location and if so, performs the teleportation

1585 {
1586 if( player.GetSimulationTimeStamp() < 20 && !player.IsPersistentFlag(PersistentFlag.AREA_PRESENCE) )
1587 {
1588 //simulation time is bellow a threshold, which means the player has recently connected,
1589 //the player does not have the AREA_PRESENCE flag set, which means they were not inside the area when they disconnected,
1590 //that means they just spawned into a contaminated area, lets move them somewhere safe
1591 vector player_pos = player.GetPosition();
1593
1595 {
1597
1598 player.SetPosition( closest_safe_pos );//...so lets teleport them somewhere safe
1599 //DeveloperTeleport.SetPlayerPosition(player, closest_safe_pos);
1600 GetGame().RPCSingleParam(player, ERPCs.RPC_WARNING_TELEPORT, null, true, player.GetIdentity());
1601
1602 PluginAdminLog adminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
1603 if (adminLog)
1604 adminLog.PlayerTeleportedLog(player,player_pos,closest_safe_pos,"Unwillingly spawning in contaminated area.");
1605 }
1606
1607 player.SetPersistentFlag(PersistentFlag.AREA_PRESENCE, false);
1608 }
1609 }
ERPCs
Definition ERPCs.c:2
PersistentFlag
Definition PersistentFlag.c:6
PluginBase GetPlugin(typename plugin_type)
Definition PluginManager.c:316

Перекрестные ссылки GetGame() и GetPlugin().

◆ TeleportPlayerToSafeLocation3D()

static bool TeleportPlayerToSafeLocation3D ( notnull PlayerBase player,
vector safePos )
staticprotected

'stupider' teleport method, does not touch flag management. Applies Y from the position as well!

1634 {
1635 vector playerPos = player.GetPosition();
1636 if (playerPos != safePos)
1637 {
1638 player.SetPosition(safePos);
1639 GetGame().RPCSingleParam(player, ERPCs.RPC_WARNING_TELEPORT, null, true, player.GetIdentity());
1640
1641 return true;
1642 }
1643
1644 return false;
1645 }

Перекрестные ссылки GetGame().

◆ ThrowAllItemsInInventory()

static void ThrowAllItemsInInventory ( notnull EntityAI parent,
int flags )
staticprotected
1029 {
1030 vector position = parent.GetPosition();
1031 vector orientation = parent.GetOrientation();
1033 float direction[4];
1034
1035 vector minmax[2];
1036 parent.GetCollisionBox(minmax);
1037
1040
1042 for ( int i = 0; i < parent.GetInventory().AttachmentCount(); ++i )
1043 {
1044 randomPos = Vector(position[0] + Math.RandomFloat(minmax[0][0], minmax[1][0]),
1045 position[1] + Math.RandomFloat(minmax[0][1], minmax[1][1]),
1046 position[2] + Math.RandomFloat(minmax[0][2], minmax[1][2]));
1047
1048 ThrowEntityFromInventory(parent.GetInventory().GetAttachmentFromIndex( i ), randomPos, direction, -GetVelocity(parent), ThrowEntityFlags.NONE);
1049 }
1050
1051 for ( int j = 0; j < parent.GetInventory().GetCargo().GetItemCount(); ++j )
1052 {
1053 randomPos = Vector(position[0] + Math.RandomFloat(minmax[0][0], minmax[1][0]),
1054 position[1] + Math.RandomFloat(minmax[0][1], minmax[1][1]),
1055 position[2] + Math.RandomFloat(minmax[0][2], minmax[1][2]));
1056
1057 ThrowEntityFromInventory(parent.GetInventory().GetCargo().GetItem( j ), randomPos, direction, -GetVelocity(parent), ThrowEntityFlags.NONE);
1058 }
1059 }
ThrowEntityFlags
Definition MiscGameplayFunctions.c:208
static void ThrowEntityFromInventory(notnull EntityAI entity, vector position, float direction[4], vector force, int flags)
Definition MiscGameplayFunctions.c:1061
static proto void MatrixToQuat(vector mat[3], out float d[4])
Converts rotation matrix to quaternion.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.

Перекрестные ссылки GetVelocity(), Math3D::MatrixToQuat(), Math::RandomFloat(), ThrowEntityFromInventory(), Vector() и Math3D::YawPitchRollMatrix().

◆ ThrowEntityFromInventory()

static void ThrowEntityFromInventory ( notnull EntityAI entity,
vector position,
float direction[4],
vector force,
int flags )
staticprotected
1062 {
1064 if ( !GetGame().IsMultiplayer() )
1065 invMode = InventoryMode.LOCAL;
1066
1068 if (CastTo(entityIB, entity))
1069 {
1071 dst.SetGroundEx(entity, position, direction);
1072
1073 if ( (flags & ThrowEntityFlags.SPLIT) && entityIB.CanBeSplit() )
1074 {
1075 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1076 {
1078
1079 if ( new_item )
1080 {
1081 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1082 entityIB.AddQuantity( -1 );
1083 new_item.SetQuantity( 1 );
1084 new_item.ThrowPhysically(null, force, false);
1085 }
1086 }
1087 }
1088 else
1089 {
1090 float stackable = entityIB.GetTargetQuantityMax();
1091 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1092 {
1093 while (entityIB.GetQuantity() > stackable)
1094 {
1096 position[1] = position[1] + 0.1;
1097 spltDst.SetGroundEx(entity, position, direction);
1098
1099 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1100 splitItem.ThrowPhysically(null, force, false);
1101 }
1102 }
1103
1105 entity.GetInventory().GetCurrentInventoryLocation(src);
1106
1107 entity.GetInventory().TakeToDst(invMode, src, dst);
1108 entityIB.ThrowPhysically(null, force, false);
1109 }
1110 }
1111 else
1112 {
1113 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1115 }
1116 }
const int ECE_NONE
Definition CentralEconomy.c:7
const int RF_DEFAULT
Definition CentralEconomy.c:65
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)

Перекрестные ссылки dBodyApplyImpulse(), ECE_NONE, GetGame(), GameInventory::LocationCreateEntity() и RF_DEFAULT.

Используется в ThrowAllItemsInInventory().

◆ TransferEntityHealth()

static void TransferEntityHealth ( EntityAI source,
EntityAI target,
array< string > healthTypes = null,
bool transferZoneDamage = true )
staticprotected
387 {
389 if (!healthTypes || healthTypes.Count() == 0)
390 HPTypes.Insert("Health");
391 else
392 HPTypes.Copy(healthTypes);
393
395 {
398 source.GetDamageZones(zonesSrc);
399 target.GetDamageZones(zonesTgt);
400
401 foreach (string zone : zonesSrc)
402 {
403 if (zonesTgt.Find(zone) == -1)
404 continue;
405
406 foreach (string health : HPTypes)
407 {
408 target.SetHealth01(zone,health,source.GetHealth01(zone,health));
409 }
410 }
411 }
412
413 foreach (string gHealth : HPTypes)
414 {
415 target.SetHealth01("",gHealth,source.GetHealth01("",gHealth)); //global health last
416 }
417 }
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
array< string > TStringArray
Definition EnScript.c:685

Используется в TransferItemProperties().

◆ TransferEntityVariables()

static void TransferEntityVariables ( EntityAI source,
EntityAI target,
bool exclude_quantity = false )
staticprotected
289 {
291 {
292 int maskOriginal = source.m_VariablesMask;
293 source.RemoveItemVariable(VARIABLE_QUANTITY);
294 target.TransferVariablesFloat(source.GetVariablesFloat());
295 source.m_VariablesMask = maskOriginal;
296 }
297 else
298 {
299 target.TransferVariablesFloat(source.GetVariablesFloat());
300 }
301
302 if (source.IsMagazine() && target.IsMagazine())
303 {
306
307 target_mag.ServerSetAmmoCount(source_mag.GetAmmoCount());
308 }
309
310 if (source.IsWeapon() && target.IsWeapon())
311 {
314
315 target_wpn.CopyWeaponStateFrom(source_wpn);
316 }
317
318 if (source.HasEnergyManager() && target.HasEnergyManager())
319 {
320 ComponentEnergyManager ems = source.GetCompEM();
321 ComponentEnergyManager emt = target.GetCompEM();
322
323 emt.SetEnergy(ems.GetEnergy());
324
325 if (ems.IsSwitchedOn())
326 emt.SwitchOn();
327 }
328
332 {
333 if (source_edb.CanDecay() && target_edb.CanDecay())
334 target_edb.TransferFoodStage(source_edb);
335 }
336 }
Definition ComponentEnergyManager.c:19
Definition Edible_Base.c:2
shorthand
Definition BoltActionRifle_Base.c:6
const int VARIABLE_QUANTITY
Definition constants.c:605

Перекрестные ссылки Class::CastTo() и VARIABLE_QUANTITY.

Используется в TransferItemVariables().

◆ TransferInventory()

static TransferInventoryResult TransferInventory ( EntityAI sourceItem,
EntityAI targetItem,
PlayerBase player )
staticprotected
345 {
347
349 sourceItem.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, children);
350 int count = children.Count();
351 for (int i = 0; i < count; i++)
352 {
353 EntityAI child = children.Get(i);
354 if (child)
355 {
357 child.GetInventory().GetCurrentInventoryLocation( child_src );
358
360 child_dst.Copy( child_src );
361 child_dst.SetParent( targetItem );
362
363 bool drop = false;
364
366 {
367 // try to move it to the same exact place in dst
368 targetItem.GetInventory().TakeToDst(InventoryMode.LOCAL, child_src, child_dst);
369 }
370 else
371 {
372 drop = true; // or drop otherwise
373 }
374
375 if (drop)
376 {
377 player.LocalDropEntity(child);
378 GetGame().RemoteObjectTreeCreate(child);
379 result = TransferInventoryResult.DroppedSome;
380 }
381 }
382 }
383 return result;
384 }
TransferInventoryResult
Definition MiscGameplayFunctions.c:203
static proto native bool LocationCanAddEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/....

Перекрестные ссылки GetGame() и GameInventory::LocationCanAddEntity().

◆ TransferItemProperties()

static void TransferItemProperties ( EntityAI source,
notnull EntityAI target,
bool transfer_agents = true,
bool transfer_variables = true,
bool transfer_health = true,
bool exclude_quantity = false )
staticprotected

will transform variables, agents and other local scripted properties as well as any relevant non-scripted properties like health

270 {
272
274 target_ib.TransferAgents(source.GetAgents());
275
277 MiscGameplayFunctions.TransferEntityVariables(source, target, exclude_quantity);
278
279 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
280 {
281 if (transfer_health)
282 {
284 }
285 }
286 }
static void TransferEntityHealth(EntityAI source, EntityAI target, array< string > healthTypes=null, bool transferZoneDamage=true)
Definition MiscGameplayFunctions.c:386

Перекрестные ссылки GetGame() и TransferEntityHealth().

◆ TransferItemVariables()

static void TransferItemVariables ( ItemBase source,
ItemBase target,
bool exclude_quantity = false )
staticprotected

DEPRECATED.

340 {
342 }
static void TransferEntityVariables(EntityAI source, EntityAI target, bool exclude_quantity=false)
Definition MiscGameplayFunctions.c:288

Перекрестные ссылки TransferEntityVariables().

◆ TransformRestrainItem()

static void TransformRestrainItem ( EntityAI current_item,
EntityAI tool,
PlayerBase player_source,
PlayerBase player_target,
bool destroy = false )
staticprotected
711 {
712 bool type;
713
714 if ( tool )
715 {
716 //is unrestrain and not struggle
717 type = tool.ConfigGetBool("RestrainUnlockType");
718 }
719 string new_item_name = current_item.ConfigGetString( "OnRestrainChange");
720
721 if ( new_item_name != "" )
722 {
723 if ( player_target )
724 {
725 if (player_target.IsAlive())
727 else
729 }
730 else
731 {
733 }
734 }
735 else
736 {
737 Error("current_item:" +current_item+ ", tool:" +tool +". No value for 'OnRestrainChange' config parameter");
738 }
739 }
Definition MiscGameplayFunctions.c:1806
Definition ActionUnrestrainTarget.c:172

Перекрестные ссылки Error().

◆ Truncate()

enum ThrowEntityFlags Truncate ( float value,
int decimals = 2 )
protected

truncate float to specified precision

217 {
218 int multiplier = Math.Pow(10,decimals);
219 return Math.Clamp(Math.Floor(value * multiplier),float.LOWEST, float.MAX) / multiplier;
220 }
static proto float Pow(float v, float power)
Return power of v ^ power.

Используется в TruncateToS().

◆ TruncateToS()

static string TruncateToS ( float value,
int decimals = 2 )
staticprotected

truncate float to specified precision, output as string

223 {
224 return Truncate(value, decimals).ToString();
225 }
enum ThrowEntityFlags Truncate(float value, int decimals=2)
truncate float to specified precision
Definition MiscGameplayFunctions.c:216

Перекрестные ссылки Truncate().

◆ TruncateVec()

static vector TruncateVec ( vector value,
int decimals = 2 )
staticprotected

truncate float to specified precision

228 {
229 int multiplier = Math.Pow(10,decimals);
230 float v1 = Math.Clamp(Math.Floor(value[0] * multiplier),float.LOWEST, float.MAX) / multiplier;
231 float v2 = Math.Clamp(Math.Floor(value[1] * multiplier),float.LOWEST, float.MAX) / multiplier;
232 float v3 = Math.Clamp(Math.Floor(value[2] * multiplier),float.LOWEST, float.MAX) / multiplier;
233 return Vector(v1,v2,v3);
234 }

Перекрестные ссылки Math::Clamp(), Math::Floor(), Math::Pow() и Vector().

◆ TruncateVecToS()

static string TruncateVecToS ( vector value,
int decimals = 2,
string delimiter = " " )
staticprotected
237 {
239 }

◆ TurnItemInHandsIntoItem()

static void TurnItemInHandsIntoItem ( notnull ItemBase old_item,
string new_item_type,
notnull PlayerBase player )
staticprotected
465 {
467 }
static void TurnItemInHandsIntoItemEx(notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
Definition MiscGameplayFunctions.c:469
Definition MiscGameplayFunctions.c:92

Перекрестные ссылки TurnItemInHandsIntoItemEx().

◆ TurnItemInHandsIntoItemEx()

static void TurnItemInHandsIntoItemEx ( notnull PlayerBase player,
ReplaceItemWithNewLambdaBase lambda )
staticprotected
470 {
471 player.ServerReplaceItemInHandsWithNew(lambda);
472 }

Используется в TurnItemInHandsIntoItem().

◆ TurnItemIntoItem()

static void TurnItemIntoItem ( notnull ItemBase old_item,
string new_item_type,
notnull PlayerBase player )
staticprotected
455 {
457 }
static void TurnItemIntoItemEx(notnull PlayerBase player, ReplaceItemWithNewLambdaBase lambda)
Definition MiscGameplayFunctions.c:459

Перекрестные ссылки TurnItemIntoItemEx().

◆ TurnItemIntoItemEx()

static void TurnItemIntoItemEx ( notnull PlayerBase player,
ReplaceItemWithNewLambdaBase lambda )
staticprotected
460 {
461 player.ServerReplaceItemWithNew(lambda);
462 }

Используется в TurnItemIntoItem().

◆ UndoRemoveNetworkObjectInfo()

void UndoRemoveNetworkObjectInfo ( )
protected
182 {
183 super.UndoRemoveNetworkObjectInfo();
184 GetGame().RemoteObjectTreeCreate(m_NewItem);
185 }

Перекрестные ссылки GetGame() и m_NewItem.

◆ UnlimitedAmmoDebugCheck()

static void UnlimitedAmmoDebugCheck ( Weapon_Base weapon)
staticprotected
420 {
421 if ( ItemBase.GetDebugActionsMask() & DebugActionType.UNLIMITED_AMMO )
422 {
424 if ( GetGame().IsServer() )
425 {
426 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
427
428 if (magazine)
429 {
430 if (magazine.GetAmmoCount() <= 5)
431 {
432 magazine.ServerSetAmmoMax();
433 }
434 }
435 }
436 else
437 {
438 magazine = weapon.GetMagazine(weapon.GetCurrentMuzzle());
439
440 if (magazine)
441 {
442 if (magazine.GetAmmoCount() <= 5)
443 {
444 magazine.LocalSetAmmoMax();
445 }
446 }
447
448 }
449 }
450 }
DebugActionType
Definition PluginDiagMenu.c:7

Перекрестные ссылки GetGame().

◆ ValueToBar()

static string ValueToBar ( float value,
string bar = "[----------]",
string mark = "x" )
staticprotected

Produces ACII "progress bar" based on an 0..1 'value' input.

248 {
249 int length = bar.Length() - 2;
250 float index = Math.Lerp(0,length, value);
253
254 return InsertAtPos(bar,mark,index);
255 }
static string InsertAtPos(string base, string insert, int pos)
Insert 'insert' behind index 'pos' of the 'base' string.
Definition MiscGameplayFunctions.c:258
static proto float Round(float f)
Returns mathematical round of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки Math::Clamp(), InsertAtPos(), Math::Lerp() и Math::Round().

Переменные

◆ ContactComponent

int ContactComponent = -1
protected

Используется в ClearCache().

◆ HitObjects

ref set<Object> HitObjects = new set<Object>
protected

Используется в ClearCache().

◆ HitProxyObjects

ref array<ref RaycastRVResult> HitProxyObjects = new array<ref RaycastRVResult>
protected

Используется в ClearCache().

◆ m_NewItem

◆ m_Player

◆ NONE

@ NONE = 0

◆ ObjectCenterPos

vector ObjectCenterPos = "0 0 0"
protected

Используется в ClearCache().

◆ ObjectContactDir

vector ObjectContactDir = "0 0 0"
protected

Используется в ClearCache().

◆ ObjectContactPos

vector ObjectContactPos = "0 0 0"
protected

Используется в ClearCache().

◆ RaycastStart

DestroyItemInCorpsesHandsAndCreateNewOnGndLambda RaycastStart = "0 0 0"
protected

Используется в IsObjectObstructedCache().

◆ SPLIT

SPLIT = 1

◆ TotalObjects

int TotalObjects = 0
protected

Используется в IsObjectObstructedCache().