make tinned foods use openable (#19884)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-10-07 01:35:32 +01:00
committed by GitHub
parent 2079dc05ff
commit 6af7c90b73
23 changed files with 196 additions and 229 deletions

View File

@@ -0,0 +1,17 @@
using Content.Server.Nutrition.EntitySystems;
namespace Content.Server.Destructible.Thresholds.Behaviors;
/// <summary>
/// Causes the drink/food to open when the destruction threshold is reached.
/// If it is already open nothing happens.
/// </summary>
[DataDefinition]
public sealed partial class OpenBehavior : IThresholdBehavior
{
public void Execute(EntityUid uid, DestructibleSystem system, EntityUid? cause = null)
{
var openable = EntitySystem.Get<OpenableSystem>();
openable.TryOpen(uid);
}
}

View File

@@ -1,8 +1,10 @@
# Base
# uses "icon" and "icon-open" states for the main item.
# trash prototypes use "trash" state
- type: entity
abstract: true
parent: BaseItem
parent: [FoodBase, FoodOpenableBase]
id: FoodTinBase
name: tin
description: A tin of something, sealed tight.
@@ -11,8 +13,27 @@
solutions:
food:
maxVol: 20
- type: Sprite
sprite: Objects/Consumable/Food/snacks.rsi
reagents:
- ReagentId: Nutriment
Quantity: 15
- type: Openable
openableByHand: false
sound:
path: /Audio/Items/can_open3.ogg
- type: Destructible
thresholds:
# if tinned food is nuked just delete it, no sound
- trigger:
!type:DamageTrigger
damage: 50
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 6
behaviors:
- !type:OpenBehavior
- type: Item
sprite: Objects/Consumable/Food/snacks.rsi
heldPrefix: packet
@@ -27,9 +48,8 @@
Blunt: 3
- type: Damageable
damageContainer: Inorganic
- type: PhysicalComposition
materialComposition:
Steel: 100
- type: StaticPrice
price: 50
- type: entity
abstract: true
@@ -39,17 +59,18 @@
description: An empty tin. Could get a bit of metal from this.
components:
- type: Sprite
sprite: Objects/Consumable/Food/snacks.rsi
state: trash
- type: Item
sprite: Objects/Consumable/Food/snacks.rsi
heldPrefix: packet
size: 3
- type: Tag
tags:
- Trash
- type: PhysicalComposition
materialComposition:
Steel: 100
- type: Tag
tags:
- Trash
# Tins
# Need something that you can open these tins with. I suggest a prying or cutting tool.
@@ -61,45 +82,11 @@
description: Just a nice can of ripe peaches swimming in their own juices.
components:
- type: Sprite
state: peachtin
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 6
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/Items/can_open3.ogg
- !type:SpawnEntitiesBehavior
spawn:
FoodTinPeachesOpen:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: StaticPrice
price: 50
- type: entity
parent: FoodTinBase
id: FoodTinPeachesOpen
name: tinned peaches
description: Just a nice can of ripe peaches swimming in their own juices.
components:
- type: Sprite
state: peachtin-open
- type: SolutionContainerManager
solutions:
food:
maxVol: 20
reagents:
- ReagentId: Nutriment
Quantity: 15
sprite: Objects/Consumable/Food/Tins/peaches.rsi
- type: FlavorProfile
flavors:
- sweet
- funny
- sweet
- funny
- type: Food
trash: FoodTinPeachesTrash
@@ -109,59 +96,39 @@
name: tinned peaches
components:
- type: Sprite
state: peachtin-empty
sprite: Objects/Consumable/Food/Tins/peaches.rsi
# slightly run down texture and different name
- type: entity
parent: FoodTinBase
parent: FoodTinPeaches
id: FoodTinPeachesMaint
name: Maintenance Peaches
description: Just a nice can of ripe peaches swimming in their own juices.
components:
- type: Sprite
state: peachtinmaint
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 6
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/Items/can_open3.ogg
- !type:SpawnEntitiesBehavior
spawn:
FoodTinPeachesMaintOpen:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: StaticPrice
price: 50
- type: entity
parent: FoodTinBase
id: FoodTinPeachesMaintOpen
name: Maintenance Peaches
description: Just a nice can of ripe peaches swimming in their own juices.
components:
- type: Sprite
state: peachtinmaint-open
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Nutriment
Quantity: 15
sprite: Objects/Consumable/Food/Tins/maint_peaches.rsi
- type: Food
trash: FoodTinPeachesMaintTrash
# only exists for backwards compatibility with a few maps, nothing else uses it
- type: entity
parent: FoodTinPeachesMaint
id: FoodTinPeachesMaintOpen
suffix: Open
components:
- type: Sprite
layers:
- state: icon-open
map: ["icon"]
- type: Openable
opened: true
- type: entity
parent: FoodTinBaseTrash
id: FoodTinPeachesMaintTrash
name: Maintenance Peaches
components:
- type: Sprite
state: peachtinmaint-empty
sprite: Objects/Consumable/Food/Tins/maint_peaches.rsi
- type: entity
parent: FoodTinBase
@@ -170,45 +137,12 @@
description: Musical fruit in a slightly less musical container.
components:
- type: Sprite
state: beans
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 6
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/Items/can_open3.ogg
- !type:SpawnEntitiesBehavior
spawn:
FoodTinBeansOpen:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: StaticPrice
price: 50
- type: entity
parent: FoodTinBase
id: FoodTinBeansOpen
name: tin of beans
description: Musical fruit in a slightly less musical container.
components:
- type: Sprite
state: beans-open
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Nutriment
Quantity: 15
sprite: Objects/Consumable/Food/Tins/beans.rsi
- type: FlavorProfile
flavors:
- savory
- salty
- cheap
- savory
- salty
- cheap
- type: Food
trash: FoodTinBeansTrash
@@ -218,7 +152,8 @@
name: tin of beans
components:
- type: Sprite
state: beans-empty
sprite: Objects/Consumable/Food/Tins/beans.rsi
# MRE can
- type: entity
@@ -228,51 +163,15 @@
description: A standard issue tin of meat with a convenient pull tab.
components:
- type: Sprite
sprite: Objects/Consumable/Food/mre.rsi
state: tin-closed
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 6
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/Items/can_open3.ogg
- !type:SpawnEntitiesBehavior
spawn:
FoodTinMREOpen:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: SpawnItemsOnUse
items:
- id: FoodTinMREOpen
sound:
path: /Audio/Items/can_open3.ogg
- type: entity
parent: FoodTinBase
id: FoodTinMREOpen
name: tinned meat
description: A standard issue tin of meat.
components:
- type: Sprite
sprite: Objects/Consumable/Food/mre.rsi
state: tin-open
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Nutriment
Quantity: 15
sprite: Objects/Consumable/Food/Tins/meat.rsi
# the convenient pull tab
- type: Openable
openableByHand: true
- type: FlavorProfile
flavors:
- meaty
- salty
- cheap
- meaty
- salty
- cheap
- type: Food
trash: FoodTinMRETrash
@@ -282,5 +181,4 @@
name: tinned meat
components:
- type: Sprite
sprite: Objects/Consumable/Food/mre.rsi
state: tin-trash
sprite: Objects/Consumable/Food/Tins/meat.rsi

View File

@@ -28,3 +28,22 @@
solution: food
- type: RefillableSolution
solution: food
# usable by any food that can be opened
# handles appearance with states "icon" and "icon-open"
- type: entity
id: FoodOpenableBase
abstract: true
components:
- type: Appearance
- type: Sprite
layers:
- state: icon
map: ["icon"]
- type: GenericVisualizer
visuals:
enum.OpenableVisuals.Opened:
icon:
True: {state: "icon-open"}
False: {state: "icon"}
- type: Openable

View File

@@ -8,7 +8,6 @@
- type: FlavorProfile
flavors:
- meaty
- type: Food
- type: Sprite
sprite: Objects/Consumable/Food/meat.rsi
- type: Extractable
@@ -524,6 +523,7 @@
- type: Tag
tags:
- Raw
- Meat
- type: Sprite
state: rouny
- type: SolutionContainerManager
@@ -615,12 +615,11 @@
# Cooked
- type: entity
parent: BaseItem
parent: FoodBase
id: MaterialSmileExtract
name: smile extract
description: It's a real panacea. But at what cost?
components:
- type: Food
- type: Extractable
grindableSolutionName: food
- type: FlavorProfile
@@ -641,8 +640,6 @@
Quantity: 10
- ReagentId: Iron
Quantity: 10
- type: Item
size: 5
- type: StaticPrice
price: 3000 #It has so much Omnizin in it
- type: Tag
@@ -687,7 +684,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: bacon-cooked
@@ -720,7 +716,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: product-cooked
@@ -749,7 +744,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: bird-cooked
@@ -778,7 +772,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: bird-cooked
@@ -836,7 +829,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: bird-cooked
@@ -868,7 +860,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: crab-cooked
@@ -894,7 +885,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: goliath-cooked
@@ -923,6 +913,7 @@
- type: Tag
tags:
- Cooked
- Meat
- type: Sprite
layers:
- state: rouny-cooked
@@ -948,7 +939,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: lizard-cooked
@@ -977,7 +967,6 @@
tags:
- Cooked
- Meat
- type: Food
- type: Sprite
layers:
- state: spiderleg-cooked

View File

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View File

@@ -0,0 +1,20 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c6e3401f2e7e1e55c57060cdf956a98ef1fefc24",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "icon-open"
},
{
"name": "trash"
}
]
}

View File

@@ -0,0 +1,20 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c6e3401f2e7e1e55c57060cdf956a98ef1fefc24",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "icon-open"
},
{
"name": "trash"
}
]
}

View File

Before

Width:  |  Height:  |  Size: 927 B

After

Width:  |  Height:  |  Size: 927 B

View File

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 551 B

View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

@@ -0,0 +1,31 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cev-eris at https://github.com/discordia-space/CEV-Eris/raw/9c980cb9bc84d07b1c210c5447798af525185f80/icons/obj/food.dmi",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "icon-hot",
"delays": [
[
0.5,
0.5,
0.5,
0.5
]
]
},
{
"name": "icon-open"
},
{
"name": "trash"
}
]
}

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

View File

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

View File

@@ -0,0 +1,20 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c6e3401f2e7e1e55c57060cdf956a98ef1fefc24",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "icon-open"
},
{
"name": "trash"
}
]
}

View File

@@ -28,26 +28,6 @@
{
"name": "box-closed"
},
{
"name": "tin-closed"
},
{
"name": "tin-hot",
"delays": [
[
0.5,
0.5,
0.5,
0.5
]
]
},
{
"name": "tin-open"
},
{
"name": "tin-trash"
},
{
"name": "candy"
},

View File

@@ -7,15 +7,6 @@
"y": 32
},
"states": [
{
"name": "beans"
},
{
"name": "beans-empty"
},
{
"name": "beans-open"
},
{
"name": "boritos"
},
@@ -104,24 +95,6 @@
"name": "packet-inhand-left",
"directions": 4
},
{
"name": "peachtin"
},
{
"name": "peachtin-empty"
},
{
"name": "peachtin-open"
},
{
"name": "peachtinmaint"
},
{
"name": "peachtinmaint-empty"
},
{
"name": "peachtinmaint-open"
},
{
"name": "pistachio"
},