# Donut

# There is a newer, better version of the donutbox from tgstation included in the
# donut.rsi. The reason it isn't implemented is it requires a StackVisuals offsetting
# the layer sprite by a couple pixels everytime a new donut is added. It also requires
# an alpha color which -Y- said he would implement.

- type: entity
  parent: [ BoxCardboard, BaseBagOpenClose ]
  id: FoodBoxDonut
  name: donut box
  description: Mmm, Donuts.
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/Baked/donut.rsi
    state: box
    layers:
    - state: box
      map: ["closeLayer"]
    - state: box-open
      map: ["openLayer"]
      visible: false
    - state: box1
      map: ["box1"]
      visible: false
    - state: pink-box2
      map: ["pink-box2"]
      visible: false
    - state: box3
      map: ["box3"]
      visible: false
    - state: pink-box4
      map: ["pink-box4"]
      visible: false
    - state: box5
      map: ["box5"]
      visible: false
    - state: pink-box6
      map: ["pink-box6"]
      visible: false
  - type: Storage
    grid:
    - 0,0,5,0
    whitelist:
      tags:
      - Donut
  - type: Item
    sprite: Objects/Consumable/Food/Baked/donut.rsi
    size: Normal
    shape:
    - 0,0,2,1
    heldPrefix: box
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: FoodDonutPink
          amount: 3
        - id: FoodDonutPlain
          amount: 3
  - type: ItemCounter
    count:
      tags: [Donut]
    composite: true
    layerStates:
    - box1
    - pink-box2
    - box3
    - pink-box4
    - box5
    - pink-box6
  - type: Appearance

# Egg

- type: entity
  parent: [ BoxCardboard, BaseBagOpenClose ]
  id: FoodContainerEgg
  name: egg carton
  description: Don't drop 'em!
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/egg.rsi
    state: box-closed
    layers:
    - state: box-closed
      map: ["closeLayer"]
    - state: box-open
      map: ["openLayer"]
      visible: false
    - state: box1
      map: ["box1"]
      visible: false
    - state: box2
      map: ["box2"]
      visible: false
    - state: box3
      map: ["box3"]
      visible: false
    - state: box4
      map: ["box4"]
      visible: false
    - state: box5
      map: ["box5"]
      visible: false
    - state: box6
      map: ["box6"]
      visible: false
    - state: box7
      map: ["box7"]
      visible: false
    - state: box8
      map: ["box8"]
      visible: false
    - state: box9
      map: ["box9"]
      visible: false
    - state: box10
      map: ["box10"]
      visible: false
    - state: box11
      map: ["box11"]
      visible: false
    - state: box12
      map: ["box12"]
      visible: false
  - type: Storage
    grid:
    - 0,0,5,1
    whitelist:
      tags:
      - Egg
  - type: Item
    sprite: Objects/Consumable/Food/egg.rsi
    size: Normal
    shape:
    - 0,0,2,1
    storedOffset: 0,-6
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodEgg
        amount: 12
  - type: ItemCounter
    count:
      tags: [Egg]
    composite: true
    layerStates:
    - box1
    - box2
    - box3
    - box4
    - box5
    - box6
    - box7
    - box8
    - box9
    - box10
    - box11
    - box12
  - type: Appearance
  # Someday...
  # - type: DamageOnLand
  # - type: DamageOtherOnHit
  # - type: Damageable
  # - type: Destructible
  #   thresholds:
  #   - trigger:
  #       !type:DamageTrigger
  #       damage: 10
  #     behaviors:
  #     - !type:PlaySoundBehavior
  #       collection: desecration
  #     - !type:SpawnEntitiesBehavior
  #       spawn:
  #         EggBoxBroken:
  #           min: 1
  #           max: 1
  #         PuddleEgg:
  #           min: 1
  #           max: 12
  #     - !type:DoActsBehavior
  #       acts: [ "Destruction" ]

- type: entity
  parent: FoodContainerEgg
  id: EggBoxBroken
  suffix: Broken
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: Eggshells
        amount: 12
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 10

# Pizza

# This - is pretty hacky. It works, but you can't have stuff like messy pizza box
# layers after a pizza has been in. Also pizza box stacking, but this is impossible
# Since you could open pizza boxes in the stack.

- type: entity
  parent: BoxCardboard
  id: FoodBoxPizza
  name: pizza box
  description: A box for pizza. It keeps in the heat, the smell, and the memories of the best five minutes of your life.
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/Baked/pizza.rsi
    drawdepth: SmallObjects
    layers:
    - state: box
      map: ["enum.StorageVisualLayers.Base"]
    - state: box-open
      map: ["enum.StorageVisualLayers.Door"]
  # TODO make these entitystorage again + placeablesurface after entity storage ECS gets merged.
  - type: Storage
    grid:
    - 0,0,3,1
    maxItemSize: Normal
    whitelist:
      components:
      - Utensil
      tags:
      - Pizza
  - type: Item
    sprite: Objects/Consumable/Food/Baked/pizza.rsi
    heldPrefix: box
    shape:
    - 0,0,2,1
    storedOffset: 0,-6
  - type: Appearance
  - type: EntityStorageVisuals
    stateDoorOpen: box-open
    stateDoorClosed: box
  - type: StaticPrice
    price: 0

- type: entity
  parent: FoodBoxPizza
  id: FoodBoxPizzaFilled
  suffix: Filled
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: KnifePlastic
        - !type:GroupSelector
          children:
          - id: FoodPizzaArnold
            weight: 1.5
          - id: FoodPizzaSassysage
            weight: 1.5
          - id: FoodPizzaMargherita
            weight: 1.5
          - id: FoodPizzaMeat
            weight: 1.5
          - id: FoodPizzaMushroom
            weight: 1.5
          - id: FoodPizzaPineapple
            weight: 1.5
          - id: FoodPizzaVegetable
            weight: 1.5
          - id: FoodPizzaDank
          - id: FoodPizzaDonkpocket
          - id: FoodPizzaCotton
          - id: FoodPizzaWorldpeas
            weight: 0.5

- type: entity
  parent: FoodBoxPizza
  id: FoodBoxPizzaCotton
  suffix: Cotton Pizza
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: FoodPizzaCotton
        - id: KnifePlastic

# Nugget

- type: entity
  parent: [ BoxCardboard, BaseBagOpenClose ]
  id: FoodBoxNugget
  name: chicken nuggets
  description: You suddenly have an urge to trade on the intergalactic stock market.
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/Baked/nuggets.rsi
    state: box
    layers:
    - state: box
      map: ["closeLayer"]
    - state: box-open
      map: ["openLayer"]
      visible: false
    - state: box1
      map: ["box1"]
      visible: false
    - state: box2
      map: ["box2"]
      visible: false
    - state: box3
      map: ["box3"]
      visible: false
    - state: box4
      map: ["box4"]
      visible: false
    - state: box5
      map: ["box5"]
      visible: false
    - state: box6
      map: ["box6"]
      visible: false
  - type: Storage
    grid:
    - 0,0,1,2
  - type: Item
    sprite: Objects/Consumable/Food/Baked/nuggets.rsi
    size: Small
    heldPrefix: box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodBakedNugget
        amount: 6
  - type: ItemCounter
    count:
      tags: [Nugget]
    composite: true
    layerStates:
    - box1
    - box2
    - box3
    - box4
    - box5
    - box6
  - type: Appearance

# Donkpocket

- type: entity
  parent: BoxCardboard
  id: FoodBoxDonkpocket
  name: box of donk-pockets
  description: 'Instructions: Heat in microwave. Product will cool if not eaten within seven minutes.'
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/Baked/donkpocket.rsi
    state: box
  - type: Storage
    grid:
    - 0,0,3,2
    whitelist:
      tags:
      - DonkPocket
  - type: Item
    sprite: Objects/Consumable/Food/Baked/donkpocket.rsi
    size: Normal
    shape:
    - 0,0,2,1
    storedOffset: -1,1
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: FoodDonkpocket
          amount: 6
        - id: DonkcoLighter
          prob: 0.10

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketSpicy
  name: box of spicy-flavoured donk-pockets
  components:
  - type: Sprite
    state: spicy-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketSpicy
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketTeriyaki
  name: box of teriyaki-flavoured donk-pockets
  components:
  - type: Sprite
    state: teriyaki-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketTeriyaki
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketPizza
  name: box of pizza-flavoured donk-pockets
  components:
  - type: Sprite
    state: pizza-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketPizza
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketStonk
  name: box of limited edition stonk-pockets
  components:
  - type: Sprite
    state: stonk-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketStonk
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketCarp
  name: box of carp-pockets
  components:
  - type: Sprite
    state: carp-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketCarp
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketBerry
  name: box of berry-flavoured donk-pockets
  components:
  - type: Sprite
    state: berry-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketBerry
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketHonk
  name: box of banana-flavoured donk-pockets
  components:
  - type: Sprite
    state: banana-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketHonk
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketDink
  name: box of dunk-pockets # starcup: rewritten for tone
  description: Net Zero carbohydrates! No need for heating!
  components:
  - type: Sprite
    state: dink-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketDink
        amount: 6

- type: entity
  parent: FoodBoxDonkpocket
  id: FoodBoxDonkpocketMoth
  name: box of moth-pockets
  components:
  - type: Sprite
    state: moth-box
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: FoodDonkpocketMoth
        amount: 6

- type: entity
  id: HappyHonk
  parent: [ BoxCardboard, BaseBagOpenClose ]
  name: happy honk meal
  suffix: Toy Safe
  description: The toy is more edible than the food.
  components:
  - type: Sprite
    sprite: Objects/Storage/Happyhonk/clown.rsi
    state: box
  - type: Item
    sprite: Objects/Storage/Happyhonk/clown.rsi
    heldPrefix: box
  - type: Storage
    maxItemSize: Normal
    grid:
    - 0,0,3,3
  - type: Tag
    tags:
    - Trash
    - HappyHonk
    - BoxCardboard
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:NestedSelector
        tableId: HappyHonkToySafeEntityTable

- type: entity
  id: HappyHonkMime
  parent: HappyHonk
  description: A limited mime edition of the happy honk meal.
  suffix: Toy Safe
  components:
  - type: Tag
    tags:
    - Trash
    - MimeHappyHonk
  - type: Sprite
    sprite: Objects/Storage/Happyhonk/mime.rsi
  - type: Item
    sprite: Objects/Storage/Happyhonk/mime.rsi

- type: entity
  id: HappyHonkNukie
  parent: [HappyHonk, BaseSyndicateContraband]
  name: robust nukie meal
  description: A sus meal with a potentially explosive surprise.
  suffix: Toy Unsafe
  components:
  - type: Sprite
    sprite: Objects/Storage/Happyhonk/nukie.rsi
  - type: Item
    sprite: Objects/Storage/Happyhonk/nukie.rsi
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:NestedSelector
        tableId: HappyHonkToyUnsafeEntityTable

- type: entity
  parent: HappyHonkNukie
  id: HappyHonkNukieSnacks
  suffix: Toy Unsafe, Snacks
  name: syndicate snack box
  components:
  - type: Storage
    grid:
    - 0,0,5,2
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        # toy
        - !type:NestedSelector
          tableId: HappyHonkToyUnsafeEntityTable
        # drinks - 4 cans, up to 2 blood-red brews
        - !type:GroupSelector
          rolls: 2
          children:
          - id: DrinkNukieCan
            weight: 0.2
          - id: DrinkColaCan
        - id: DrinkColaCan
          amount: 2
        # food
        - !type:GroupSelector
          children:
          - id: FoodSaladValid
            weight: 0.05
            amount: 2
          - id: FoodSnackSyndi
            amount: 4

- type: entity
  id: HappyHonkCluwne
  parent: HappyHonk
  name: woeful cluwne meal
  description: Nothing good can come of this.
  components:
  - type: Tag
    tags:
    - Trash
    - CluwneHappyHonk # BAD: Intentional removal of parent tag
    - BoxCardboard
  - type: Sprite
    sprite: Objects/Storage/Happyhonk/cluwne.rsi
  - type: Item
    sprite: Objects/Storage/Happyhonk/cluwne.rsi
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: CluwneHorn

- type: entity
  id: FoodMealHappyHonkClown
  parent: HappyHonk
  suffix: random food spawner meal
  categories: [ HideSpawnMenu ]
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: FoodBurgerCheese
        - !type:GroupSelector
          children:
          - id: DrinkColaCan
          - id: DrinkLemonLimeCan
          - id: DrinkLemonLimeCranberryCan
          - id: DrinkIcedTeaCan
        - !type:NestedSelector
          tableId: HappyHonkToySafeEntityTable

- type: entity
  id: FoodMealHappyHonkBigBite
  parent: HappyHonk
  name: Happy Honk Big Bite Meal
  description: Someone paid good money to get this fast food meal shipped out this way. It smells fresh, somehow.
  components:
  - type: EntityTableContainerFill
    containers:
      storagebase: !type:AllSelector
        children:
        - id: FoodBurgerBig
        - id: DrinkColaBottleFull
        - !type:NestedSelector
          tableId: HappyHonkToySafeEntityTable
        - id: FoodMealFriesCheesy
        - id: FoodPieAppleSlice

- type: entity
  parent: BoxCardboard
  id: FoodBoxCloth
  name: box of FlutterSoft-brand cloth
  description: Fiber is the most important doptera meal of the day! Don't skip it or use bottom-of-the-locker junk, buy high-quality FlutterSoft-brand cloth instead. # starcup: moth to doptera
  components:
  - type: Sprite
    sprite: Objects/Consumable/Food/ingredients.rsi
    state: cloth-box
  - type: Storage
    grid:
    - 0,0,1,1
    maxItemSize: Normal
    whitelist: # TODO BoxCardboard shouldn't have whitelisted storage
      tags:
      - ClothMade
  - type: Item
    size: Normal
    shape:
    - 0,0,1,1
  - type: EntityTableContainerFill
    containers:
      storagebase:
        id: MaterialCloth10

- type: entityTable # size: 2x2
  id: HappyHonkToySafeEntityTable
  table: !type:GroupSelector
    children:
    - id: ToyMouse
    - id: ToyAi
    - id: ToyNuke
    - id: ToyFigurinePassenger
    - id: ToyFigurineGriffin
    - id: ToyIan
    - id: ToyFigurineOwlman
    - id: ToyFigurineSkeleton
    - id: FoamBlade
    - id: ClothingHeadHatBunny
    - id: PersonalAI
    - id: CrayonBox
    - id: ToySword
    - id: RevolverCapGun
    - id: ToyRubberDuck
    - id: BikeHorn
      weight: 0.5
    - id: GoldenBikeHorn
      weight: 0.1
    - !type:NestedSelector
      tableId: AllFigurineMechsTable
      weight: 6

- type: entityTable # size: 1x2
  id: HappyHonkToyUnsafeEntityTable
  table: !type:GroupSelector
    children: # Total Weight 6
    # begin starcup: remove
    #- id: ClothingHeadHatCatEars
    #  weight: 0.25
    # end starcup
    - id: C4
      weight: 0.05
    - id: ToyMarauder
    - id: ToyMauler
    - id: ToyNuke
    - id: ToySword
    # begin starcup: put back into uplink
    #- id: WeaponRevolverPythonAP
    #  weight: 0.4
    # end starcup
    - id: BalloonSyn
      weight: 0.3
    - id: PlushieNuke
