672 {
674 string cfg_path =
"cfgVehicles" +
" " +
GetParent().GetType() +
" "+
"Construction" +
" " + main_part_name +
" " + part_name +
" " +
"Materials";
675
676 if (
g_Game.ConfigIsExisting( cfg_path ) )
677 {
678 int child_count =
g_Game.ConfigGetChildrenCount( cfg_path );
679
680 for ( int i = 0; i < child_count; i++ )
681 {
682 string child_name;
683 g_Game.ConfigGetChildName( cfg_path, i, child_name );
684
685
686 string config_path;
687 string slot_name;
688 config_path = cfg_path + " " + child_name + " " + "slot_name";
689 g_Game.ConfigGetText( config_path, slot_name );
690 config_path = cfg_path + " " + child_name + " " + "quantity";
691 float quantity =
g_Game.ConfigGetFloat( config_path );
692 config_path = cfg_path + " " + child_name + " " + "lockable";
693 bool lockable =
g_Game.ConfigGetInt( config_path );
694
696 if ( lockable )
697 {
698
700 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
701
702 GetParent().GetInventory().SetSlotLock( inventory_location.
GetSlot(),
true );
703 }
704 else
705 {
706 if ( quantity > -1 )
707 {
708 if (repairing)
709 {
712 }
713
714 attachment.AddQuantity( -quantity );
715 }
716 else
717 {
718 g_Game.ObjectDelete( attachment );
719 }
720 }
721 }
722 }
723 }
ConstructionPart GetConstructionPart(string part_name)
enum ConstructionMaterialType REPAIR_MATERIAL_PERCENTAGE
proto native int GetSlot()
returns slot id if current type is Attachment
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Floor(float f)
Returns floor of value.