("cf_lco_can_drop_item",
[
(store_script_param, ":troop_id", 1),
(store_script_param, ":slot_id", 2),
(store_script_param, ":item_id", 3),
(store_script_param, ":modifier", 4),
(assign, reg0, "str_lco_drop_error_control"),
(call_script, "script_cf_lco_controllable", ":troop_id"),
(assign, ":can_drop", 0),
(assign, ":result", "str_lco_drop_error_type"),
(try_begin),
(ge, ":slot_id", num_equipment_kinds),
(try_begin),
(this_or_next|eq, ":troop_id", "trp_player"),
(eq, ":troop_id", "$g_lco_garbage_troop"),
(assign, ":can_drop", 1), # We can drop anything into player's inventory slots or to the garbage
(else_try),
(item_get_type, ":type", ":item_id"),
(eq, ":type", itp_type_book), # We can only drop books into other companions inventory slots
(assign, ":can_drop", 1),
(try_end),
(else_try),
(item_get_type, ":type", ":item_id"),
(try_begin),
(lt, ":slot_id", 4), # Weapon slot
(this_or_next|eq, ":type", itp_type_one_handed_wpn),
(this_or_next|eq, ":type", itp_type_two_handed_wpn),
(this_or_next|eq, ":type", itp_type_polearm),
(this_or_next|eq, ":type", itp_type_arrows),
(this_or_next|eq, ":type", itp_type_bolts),
(this_or_next|eq, ":type", itp_type_shield),
(this_or_next|eq, ":type", itp_type_bow),
(this_or_next|eq, ":type", itp_type_crossbow),
(this_or_next|eq, ":type", itp_type_thrown),
(this_or_next|eq, ":type", itp_type_pistol),
(this_or_next|eq, ":type", itp_type_musket),
(eq, ":type", itp_type_bullets),
(assign, ":can_drop", 1),
(else_try),
(eq, ":slot_id", 4), # Head armor
(eq, ":type", itp_type_head_armor),
(assign, ":can_drop", 1),
(else_try),
(eq, ":slot_id", 5), # Body armor
(eq, ":type", itp_type_body_armor),
(assign, ":can_drop", 1),
(else_try),
(eq, ":slot_id", 6), # Leg armor
(eq, ":type", itp_type_foot_armor),
(assign, ":can_drop", 1),
(else_try),
(eq, ":slot_id", 7), # Hand armor
(eq, ":type", itp_type_hand_armor),
(assign, ":can_drop", 1),
(else_try),
(eq, ":slot_id", 8), # Horse
(eq, ":type", itp_type_horse),
(assign, ":can_drop", 1),
(try_end),
(try_begin),
(eq, ":can_drop", 1), # Item and slot match by type, but can the character actually equip this item?
(neq, ":type", itp_type_arrows), # Do not check for ammo
(neq, ":type", itp_type_bolts), # Do not check for ammo
(neq, ":type", itp_type_bullets), # Do not check for ammo
(neq, ":type", itp_type_shield), # Do not check for shields
(assign, ":result", "str_lco_drop_error_reqs"),
(call_script, "script_lco_replicate_attributes", ":troop_id"),
(call_script, "script_lco_clear_all_items", lco_storage),
(troop_set_auto_equip, lco_storage, 0),
(troop_set_inventory_slot, lco_storage, num_equipment_kinds, ":item_id"),
(troop_set_inventory_slot_modifier, lco_storage, num_equipment_kinds, ":modifier"),
(troop_equip_items, lco_storage),
(troop_get_inventory_slot, ":copy_item_id", lco_storage, num_equipment_kinds),
(call_script, "script_lco_clear_all_items", lco_storage),
(ge, ":copy_item_id", 0), # He did not equip it!
(assign, ":can_drop", 0), # Hence original troop cannot equip it either!
(try_end),
(try_end),
(assign, reg0, ":result"),
(eq, ":can_drop", 1),
]
),