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

◆ DestroyMaterialsServer()

void DestroyMaterialsServer ( Man player,
string part_name )
protected

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

741 {
742 ConstructionPart cPart = GetConstructionPart( part_name );
743 string main_part_name = cPart.GetMainPartName();
744 string cfg_path = "cfgVehicles" + " " + GetParent().GetType() + " "+ "Construction" + " " + main_part_name + " " + part_name + " " + "Materials";
745
746 if ( GetGame().ConfigIsExisting( cfg_path ) )
747 {
748 int child_count = GetGame().ConfigGetChildrenCount( cfg_path );
749
750 for ( int i = 0; i < child_count; i++ )
751 {
752 string child_name;
753 GetGame().ConfigGetChildName( cfg_path, i, child_name );
754
755 //get type, quantity from material
756 string config_path;
757 string type;
758 string slot_name;
759 config_path = cfg_path + " " + child_name + " " + "type";
760 GetGame().ConfigGetText( config_path, type );
761 config_path = cfg_path + " " + child_name + " " + "slot_name";
762 GetGame().ConfigGetText( config_path, slot_name );
763 config_path = cfg_path + " " + child_name + " " + "quantity";
764 float quantity = GetGame().ConfigGetFloat( config_path );
765 config_path = cfg_path + " " + child_name + " " + "lockable";
766 bool lockable = GetGame().ConfigGetInt( config_path );
767
768 //get material
769 ItemBase attachment = ItemBase.Cast( GetParent().FindAttachmentBySlotName( slot_name ) );
770
771 //material still attached
772 if ( lockable ) //if lockable
773 {
774 if ( attachment )
775 {
776 InventoryLocation inventory_location = new InventoryLocation;
777 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
778 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] " + Object.GetDebugName(GetParent()) + " DestroyMaterialsServer unlock slot=" + inventory_location.GetSlot());
779
780 GetParent().GetInventory().SetSlotLock( inventory_location.GetSlot() , false );
781 GetGame().ObjectDelete( attachment ); //delete object
782 }
783 }
784 }
785 }
786 }
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
Определения BaseBuildingBase.c:1292
ConstructionPart GetConstructionPart(string part_name)
Определения Construction.c:280
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native void ObjectDelete(Object obj)
string GetMainPartName()
Определения ConstructionPart.c:35
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
static bool IsBaseBuildingLogEnable()
Определения Debug.c:698
Определения Debug.c:594
Определения ObjectTyped.c:2
proto native CGame GetGame()
BaseBuildingBase GetParent()
Get parent of the Effect.
Определения Construction.c:40

Перекрестные ссылки bsbDebugPrint(), CGame::ConfigGetChildName(), CGame::ConfigGetChildrenCount(), CGame::ConfigGetFloat(), CGame::ConfigGetInt(), CGame::ConfigGetText(), GetConstructionPart(), GetGame(), ConstructionPart::GetMainPartName(), GetParent(), InventoryLocation::GetSlot(), LogManager::IsBaseBuildingLogEnable() и CGame::ObjectDelete().

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