DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HasMaterialsEx()

bool HasMaterialsEx ( string part_name,
bool repairing = false,
out string slotName = "",
out float requiredQuantity = 0.0 )
protected

returns true if materials to build the part are available

См. определение в файле ConstructionBase.c строка 1081

1082 {
1083 #ifdef DIAG_DEVELOPER
1084 if (g_Game.IsClient() || !g_Game.IsMultiplayer()) //weird, I know, but this is just used for initial filtering purposes. Action conditions take care of the rest for both sides
1085 {
1086 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
1087 if (player)
1088 {
1089 if (player.GetConstructionActionData().GetFastConstructionMode())
1090 return true;
1091 }
1092 }
1093 #endif
1094
1095 ConstructionPart part = GetConstructionPart(part_name);
1097 foreach (ConstructionMaterialData dta : materials)
1098 {
1099 float quantity = dta.m_MaterialQuantity;
1100 if (quantity == 0.0) //0 - ignores quantity
1101 continue;
1102
1103 if (repairing)
1104 {
1105 quantity *= REPAIR_MATERIAL_PERCENTAGE;
1106 quantity = Math.Max(Math.Floor(quantity),1);
1107 }
1108
1109 //if the selected material (or its quantity) is not available
1110 if (!HasMaterialWithQuantityAttached(dta.m_MaterialSlotName, quantity))
1111 {
1112 slotName = dta.m_MaterialSlotName;
1113 requiredQuantity = quantity;
1114 return false;
1115 }
1116 }
1117
1118 return true; //return true even if no material required
1119 }
ConstructionPart GetConstructionPart()
Определения ActionPartInfo.c:235
PlayerSpawnPreset slotName
static const float REPAIR_MATERIAL_PERCENTAGE
Определения ConstructionBase.c:34
bool HasMaterialWithQuantityAttached(string slot_name, float quantity)
Определения ConstructionBase.c:1129
DayZGame g_Game
Определения DayZGame.c:4074
instanced data holder for single construction material
Определения ConstructionMaterials.c:3
array< ref ConstructionMaterialData > GetMaterialsData()
Определения ConstructionPart.c:346
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки Math::Floor(), g_Game, GetConstructionPart(), ConstructionPart::GetMaterialsData(), HasMaterialWithQuantityAttached(), Math::Max(), REPAIR_MATERIAL_PERCENTAGE и slotName.

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