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

Закрытые статические члены

static void SpawnConstructionMaterialPiles (notnull EntityAI entity, Man player, string cfg_path, string main_part_name, string damagezone_name="", bool is_base=false)
 spawns material from any construction; 'player' parameter optional
 

Подробное описание

Методы

◆ SpawnConstructionMaterialPiles()

static void SpawnConstructionMaterialPiles ( notnull EntityAI entity,
Man player,
string cfg_path,
string main_part_name,
string damagezone_name = "",
bool is_base = false )
inlinestaticprivate

spawns material from any construction; 'player' parameter optional

1226 {
1227 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
1228
1229 for ( int i = 0; i < child_count; i++ )
1230 {
1231 string child_name;
1232 GetGame().ConfigGetChildName( cfg_path, i, child_name );
1233
1234 //get type, quantity from material
1235 string config_path;
1236 string type;
1237 string slot_name;
1238 config_path = cfg_path + " " + child_name + " " + "type";
1239 GetGame().ConfigGetText( config_path, type );
1240 config_path = cfg_path + " " + child_name + " " + "slot_name";
1241 GetGame().ConfigGetText( config_path, slot_name );
1242 config_path = cfg_path + " " + child_name + " " + "quantity";
1243 float quantity = GetGame().ConfigGetFloat( config_path );
1244 config_path = cfg_path + " " + child_name + " " + "lockable";
1245 bool lockable = GetGame().ConfigGetInt( config_path );
1246
1247 //receive material quantity
1248 ItemBase attachment = ItemBase.Cast( entity.FindAttachmentBySlotName( slot_name ) );
1249 int slot_id;
1250
1251 //material still attached
1252 if ( lockable ) //if lockable
1253 {
1254 if ( attachment )
1255 {
1257 attachment.GetInventory().GetCurrentInventoryLocation( src );
1258 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName( entity) + " DropNonUsableMaterials UNlocking slot=" + src.GetSlot() );
1259 entity.GetInventory().SetSlotLock( src.GetSlot() , false );
1260
1261 //detach if base
1262 if ( is_base )
1263 {
1264 if ( GetGame().IsMultiplayer() && player )
1265 {
1268 player.ServerTakeToDst( src, dst );
1269 }
1270 else
1271 {
1272 entity.GetInventory().DropEntity( InventoryMode.PREDICTIVE, entity, attachment );
1273 }
1274 }
1275 }
1276 }
1277 else
1278 {
1279 float pile_health;
1280 float qty_coef;
1281 vector destination = entity.GetPosition();
1282 //placed on helper memory point, if available
1283 if ( entity.MemoryPointExists("" + main_part_name + "_materials") )
1284 {
1285 destination = entity.GetMemoryPointPos("" + main_part_name + "_materials");
1286 destination = GetGame().ObjectModelToWorld(entity,destination);
1287 }
1288 else if ( entity.MemoryPointExists(main_part_name) )
1289 {
1290 destination = entity.GetMemoryPointPos(main_part_name);
1291 destination = GetGame().ObjectModelToWorld(entity,destination);
1292 }
1293 //pile_health = GameConstants.DAMAGE_WORN_VALUE * MiscGameplayFunctions.GetTypeMaxGlobalHealth(type);
1294 pile_health = entity.GetHealth01(damagezone_name,"Health") * MiscGameplayFunctions.GetTypeMaxGlobalHealth(type);
1295 qty_coef = 1 - (entity.GetHealthLevel(damagezone_name) * Construction.DECONSTURCT_MATERIAL_LOSS) - Construction.DECONSTURCT_MATERIAL_LOSS;
1296 quantity *= qty_coef;
1298 MiscGameplayFunctions.CreateItemBasePiles(type,destination,quantity,pile_health,true);
1299 }
1300 }
1301 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
Definition BaseBuildingBase.c:1234
void Construction(BaseBuildingBase parent)
Definition Construction.c:26
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition Inventory.c:1255
InventoryLocation.
Definition InventoryLocation.c:29
Definition InventoryItem.c:731
Definition Debug.c:600
static bool IsBaseBuildingLogEnable()
Definition Debug.c:704
Definition EnMath.c:7
Definition ObjectTyped.c:2
Definition EntityAI.c:95
Definition EnConvert.c:106
proto native CGame GetGame()
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки bsbDebugPrint(), Construction(), Math::Floor(), GetGame(), LogManager::IsBaseBuildingLogEnable(), Math::Max() и GameInventory::SetGroundPosByOwner().

Используется в TentBase::Deconstruct() и ReceiveMaterialsServer().


Объявления и описания членов класса находятся в файле: