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

◆ SpawnRubbleMaterials()

void SpawnRubbleMaterials ( EntityAI parent,
Man builder )
protected

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

941 {
942 PlayerBase player;
944 if (Class.CastTo(player, builder) && Class.CastTo(typeData, m_PartTypeData))
945 {
946 array<string> itemTypes = typeData.GetRubbleMaterialTypes();
947 array<float> itemBaseQuantities = typeData.GetRubbleMaterialBaseQuantities();
948 if (!itemTypes || !itemBaseQuantities)
949 return;
950
951 float quantityToolCoef = 1.0;
952 ItemBase tool = player.GetItemInHands();
953 if (tool)
954 {
955 //some modification of 'quantityToolCoef' here?
956 }
957
958 //position considerations
959 vector posHead = MiscGameplayFunctions.GetPlayerHeadPosition(player);
960 vector destination = player.GetPosition();
961 string partName = m_PartTypeData.GetPartName();
962 string mainPartName = m_PartTypeData.GetMainPartName();
963 if (parent.MemoryPointExists("" + partName + "_materials"))
964 {
965 destination = parent.GetMemoryPointPos("" + partName + "_materials");
966 destination = g_Game.ObjectModelToWorld(parent, destination);
967 }
968 else if (parent.MemoryPointExists("" + mainPartName + "_materials"))
969 {
970 destination = parent.GetMemoryPointPos("" + mainPartName + "_materials");
971 destination = g_Game.ObjectModelToWorld(parent, destination);
972 }
973
974 //spawning
975 int count = itemTypes.Count();
976 for (int i = 0; i < count; ++i)
977 {
978 string itemType = itemTypes[i];
979 float quantity = itemBaseQuantities[i];
980 quantity *= quantityToolCoef;
981 quantity = Math.Round(quantity); //just to make sure
982 if (quantity <= 0)
983 {
984 continue;
985 }
986
987 MiscGameplayFunctions.CreateItemBasePilesDispersed(itemType, posHead, destination, UAItemsSpreadRadius.NARROW,quantity, MiscGameplayFunctions.GetTypeMaxGlobalHealth(itemType), player);
988 }
989 }
990 }
ConstructionPartTypeData m_PartTypeData
Определения ConstructionPart.c:526
DayZGame g_Game
Определения DayZGame.c:4074
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
const float NARROW
Определения ActionConstants.c:130
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.

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