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

◆ TakeMaterialsServer()

void TakeMaterialsServer ( string part_name,
bool repairing = false )
protected

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

1140 {
1141 ConstructionPart part = GetConstructionPart(part_name);
1143 foreach (ConstructionMaterialData dta : materials)
1144 {
1145 ItemBase attachment = ItemBase.Cast(m_EntityParent.FindAttachmentBySlotName(dta.m_MaterialSlotName));
1146 if (!attachment)
1147 continue;
1148
1149 if (repairing && dta.m_SkipOnRepair)
1150 continue;
1151
1152 if (dta.m_MaterialLockable)
1153 {
1154 //lock attachment
1155 InventoryLocation invloc = new InventoryLocation();
1156 attachment.GetInventory().GetCurrentInventoryLocation(invloc);
1157
1158 m_EntityParent.GetInventory().SetSlotLock(invloc.GetSlot(), true);
1159 }
1160 else
1161 {
1162 if (dta.m_MaterialQuantity > 0.0) //0 - ignores quantity
1163 {
1164 float quantity = dta.m_MaterialQuantity;
1165 if (repairing)
1166 {
1167 quantity *= REPAIR_MATERIAL_PERCENTAGE;
1168 quantity = Math.Max(Math.Floor(quantity),1);
1169 }
1170 //subtract quantity
1171 attachment.AddQuantity(-quantity);
1172 }
1173 else if (dta.m_MaterialQuantity == -1.0) //-1 - deletes the object
1174 {
1175 g_Game.ObjectDelete(attachment);
1176 }
1177 }
1178 }
1179 }
ConstructionPart GetConstructionPart()
Определения ActionPartInfo.c:235
static const float REPAIR_MATERIAL_PERCENTAGE
Определения ConstructionBase.c:34
EntityAI m_EntityParent
Определения ConstructionBase.c:45
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
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation.
Определения InventoryLocation.c:30
Определения EnMath.c:7
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(), InventoryLocation::GetSlot(), m_EntityParent, Math::Max() и REPAIR_MATERIAL_PERCENTAGE.

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