789 {
791
792 string cfg_path =
"cfgVehicles" +
" " +
GetParent().GetType() +
" " +
"Construction" +
" " + construction_part.
GetMainPartName() +
" " + construction_part.
GetPartName() +
" " +
"platform_support";
793 string platform_support;
794
795 if (
g_Game.ConfigIsExisting( cfg_path ) )
796 {
797 g_Game.ConfigGetText( cfg_path, platform_support );
798 }
799
800 if ( platform_support.
Length() > 0 || construction_part.
IsBase() )
801 {
802 string at_cfg_path =
"cfgVehicles" +
" " +
GetParent().GetType() +
" "+
"GUIInventoryAttachmentsProps";
803
804 if (
g_Game.ConfigIsExisting( at_cfg_path ) )
805 {
806 int child_count =
g_Game.ConfigGetChildrenCount( at_cfg_path );
807
808 for ( int i = 0; i < child_count; i++ )
809 {
810 string child_name;
811 g_Game.ConfigGetChildName( at_cfg_path, i, child_name );
813
814 if ( child_name.
Contains( platform_support ) )
815 {
817 g_Game.ConfigGetTextArray( at_cfg_path +
" " + child_name +
" " +
"attachmentSlots", attachment_slots );
818
819 for ( int j = 0; j < attachment_slots.Count(); ++j )
820 {
821
823
824
825 if ( attachment )
826 {
828 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
830
831
832 GetParent().GetInventory().SetSlotLock( inventory_location.
GetSlot() ,
false );
833
835 if (!parent)
836 parent = player;
837
838 int quantity_max = attachment.GetTargetQuantityMax(-1);
841 attachment.GetTransform(mat);
842
843 if ( parent.MemoryPointExists("" + part_name + "_materials") )
844 {
845 vector destination = parent.GetMemoryPointPos(
"" + part_name +
"_materials");
846 destination =
g_Game.ObjectModelToWorld(parent,destination);
847 float health = attachment.GetHealth("","Health");
848 float quantity = attachment.GetQuantity() - 1;
849 if (quantity < 1.0)
850 quantity = 1.0;
851 float dir[4];
852 inventory_location.
GetDir(dir);
854
855 if (player)
856 {
858 MiscGameplayFunctions.GetHeadBonePos(
PlayerBase.Cast(player),posHead);
859 MiscGameplayFunctions.CreateItemBasePilesDispersed(attachment.GetType(),posHead,destination,
UAItemsSpreadRadius.
NARROW,quantity,health,player);
860 }
861 else
862 {
863 MiscGameplayFunctions.CreateItemBasePiles(attachment.GetType(),destination,quantity,health,true);
864 }
865 attachment.AddQuantity( -quantity );
866 }
867 else
868 {
870
871 for ( int k = attachment.GetQuantity(); k > quantity_max; )
872 {
875
876 if( new_item )
877 {
878 MiscGameplayFunctions.TransferItemProperties( attachment, new_item );
879 attachment.AddQuantity( -quantity_max );
881 }
882 k -= quantity_max;
883 }
884 }
885
886
887 if (attachment.GetQuantity() > 0)
888 {
889 if (
g_Game.IsMultiplayer() )
890 {
892 }
893 else
894 {
896 }
897 }
898 else
899 {
900 attachment.Delete();
901 }
902 }
903 }
904 }
905 }
906 }
907 }
908 }
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
const int ECE_PLACE_ON_SURFACE
ConstructionPart GetConstructionPart(string part_name)
override bool LocalTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
override bool ServerTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
proto native void GetDir(out float dir[4])
returns direction of item in world if type is Ground
proto native int GetSlot()
returns slot id if current type is Attachment
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
static bool IsBaseBuildingLogEnable()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native int Length()
Returns length of string.
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.