ItemCell.gd 703 B

123456789101112131415161718192021222324
  1. extends BaseCell
  2. class_name ItemCell
  3. @export var slot : ActorCommons.Slot = ActorCommons.Slot.NONE
  4. @export var textures : Array[Texture2D] = []
  5. @export var shader : Resource = null
  6. @export var customfield : String = ""
  7. #
  8. func Use():
  9. if usable:
  10. super.Use()
  11. elif slot >= ActorCommons.Slot.FIRST_EQUIPMENT and slot < ActorCommons.Slot.LAST_EQUIPMENT and Launcher.Player and Launcher.Player.inventory:
  12. var equipmentCell : ItemCell = Launcher.Player.inventory.equipments[slot]
  13. if CellCommons.IsSameCell(self, equipmentCell):
  14. Network.UnequipItem(id, customfield)
  15. else:
  16. Network.EquipItem(id, customfield)
  17. #
  18. func _init():
  19. super._init()
  20. textures.resize(ActorCommons.Gender.COUNT)