DIFF

class MiscGameplayFunctionsSource

Methods 80

static float Truncate(float value, int decimals = 2)

truncate float to specified precision

References Math.Clamp(), Math.Floor(), Math.Pow()
Show 2 more, float.LOWEST, and float.MAX
Referenced by TruncateToS()
static vector TruncateVec(vector value, int decimals = 2)

truncate float to specified precision

References Math.Clamp(), Math.Floor(), Math.Pow()
Show 3 more, Vector(), float.LOWEST, and float.MAX
static string TruncateVecToS(vector value, int decimals = 2, string delimiter = " ")
References TruncateToS()
static string ValueToBar(float value, string bar = "[----------]", string mark = "x")

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

References Math.Clamp(), InsertAtPos(), string.Length()
Show 2 more, Math.Lerp(), and Math.Round()
static string InsertAtPos(string base, string insert, int pos)

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

Referenced by ValueToBar()
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 TransferItemVariables(ItemBase source, ItemBase target, bool exclude_quantity = false)

DEPRECATED

static void TransferEntityHealth(EntityAI source, EntityAI target, array<string> healthTypes = null, bool transferZoneDamage = true)
static void TurnItemIntoItem(notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
static void TurnItemInHandsIntoItem(notnull ItemBase old_item, string new_item_type, notnull PlayerBase player)
static array<ItemBase> CreateItemBasePiles(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<ItemBase> CreateItemBasePilesDispersed(string item_name, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)

creation method using raycast-dispersed positioning; ECE_TRACE not used as a result

static array<Magazine> CreateMagazinePiles(string item_name, vector ground_position, float quantity, float health)
static array<Magazine> CreateMagazinePilesDispersed(string item_name, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)

creation method using raycast-dispersed positioning; ECE_TRACE not used as a result

static array<Magazine> CreateMagazinePilesFromBullet(string bullet_type, vector ground_position, float quantity, float health)
static array<Magazine> CreateMagazinePilesFromBulletDispersed(string bullet_type, vector starPos, vector targetPos, float radius, float quantity, float health, Object ignoreObjectCollison)
static int GetHealthLevelForAmmo(string class_name, float health)
static bool GetProjectedCursorPos3d(out vector position, Weapon_Base weapon)
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)

dir in cone or in a tip of cone

static bool ComplexBuildCollideCheckClient(PlayerBase player, ActionTarget target, ItemBase item, string partName = "")
static bool BuildCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
static void IsUnderRoofFromToCalculation(EntityAI entity, out vector from, out vector to, float height = GameConstants.ROOF_CHECK_RAYCAST_DIST)
static bool IsUnderRoofEx(EntityAI entity, float height = GameConstants.ROOF_CHECK_RAYCAST_DIST, int geometry = ObjIntersectView)
static vector GetRandomizedPosition(vector targetPos, float radius)
static vector GetRandomizedPositionVerifiedPlayer(Man player, float distance, float radius, Object ignore)
static void FilterObstructingObjects(array<Object> potentiallyObstructingObjects, out array<Object> obstructingObjects)

apply factors

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 IsObjectObstructedFilter(Object object, IsObjectObstructedCache cache, PlayerBase player)
static float Normalize(int val, int maxVal)
References Debug.LogError()
static float Bobbing(float period, float amplitude, float elapsedTime)
References FModulus(), and Math.Sin()
static float FModulus(float x, float y)
References Math.ModFloat()
Referenced by Bobbing()
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)
Referenced by TeleportCheck()
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 int GetComponentIndex(array<Selection> pSelection, string pCompName)
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)