1035 {
1036 if (!player)
1037 {
1038 ErrorEx(
"WARNING - trying to equip non-existent object! | MenuDefaultCharacterData::EquipDefaultCharacter");
1039 return;
1040 }
1041
1042 int slot_ID;
1043 string attachment_type;
1044 string current_attachment_type;
1045 EntityAI current_attachment_object;
1046
1047 GameInventory playerInventory = player.GetInventory();
1049 {
1050 attachment_type = "";
1051 current_attachment_type = "";
1054 current_attachment_object = playerInventory.
FindAttachment(slot_ID);
1055
1056 if (current_attachment_object)
1057 {
1058 current_attachment_type = current_attachment_object.GetType();
1059 }
1060 if (current_attachment_type != attachment_type)
1061 {
1062 if (current_attachment_object)
1063 g_Game.ObjectDelete(current_attachment_object);
1064 if (attachment_type != "")
1066 }
1067 }
1068 }
proto native EntityAI CreateAttachmentEx(string typeName, int slotId)
Create Entity of specified type as attachment of entity.
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)