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 (
GetGame().ConfigIsExisting( cfg_path ) )
796 {
798 }
799
800 if ( platform_support.
Length() > 0 || construction_part.
IsBase() )
801 {
802 string at_cfg_path =
"cfgVehicles" +
" " +
GetParent().GetType() +
" "+
"GUIInventoryAttachmentsProps";
803
804 if (
GetGame().ConfigIsExisting( at_cfg_path ) )
805 {
807
808 for ( int i = 0; i < child_count; i++ )
809 {
810 string child_name;
813
814 if ( child_name.
Contains( platform_support ) )
815 {
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");
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 (
GetGame().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)
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings 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 vector ObjectModelToWorld(Object obj, vector modelPos)
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 CGame GetGame()
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.