Fix Butcherable handling, ItemSlots for clown shoes (#25661)
* Fix butcherable handling * ItemSlots for clown shoes * Return if handled * Handle if popup * Whitespace, spoons are metal * Zero damage plastic utensils, blacklist by metal+melee * Hmmm truthy * Plastic knives are knives too, just use that * Delete unused tag * Always true if doAfter * Raw rat meat should be sliceable too
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Body.Components;
|
|||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
@@ -34,7 +35,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract);
|
SubscribeLocalEvent<SharpComponent, AfterInteractEvent>(OnAfterInteract, before: new[] { typeof(UtensilSystem) });
|
||||||
SubscribeLocalEvent<SharpComponent, SharpDoAfterEvent>(OnDoAfter);
|
SubscribeLocalEvent<SharpComponent, SharpDoAfterEvent>(OnDoAfter);
|
||||||
|
|
||||||
SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
|
SubscribeLocalEvent<ButcherableComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
|
||||||
@@ -42,31 +43,34 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
|
private void OnAfterInteract(EntityUid uid, SharpComponent component, AfterInteractEvent args)
|
||||||
{
|
{
|
||||||
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (args.Target is null || !args.CanReach)
|
if (args.Target is null || !args.CanReach)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryStartButcherDoafter(uid, args.Target.Value, args.User);
|
args.Handled = TryStartButcherDoAfter(uid, args.Target.Value, args.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryStartButcherDoafter(EntityUid knife, EntityUid target, EntityUid user)
|
private bool TryStartButcherDoAfter(EntityUid knife, EntityUid target, EntityUid user)
|
||||||
{
|
{
|
||||||
if (!TryComp<ButcherableComponent>(target, out var butcher))
|
if (!TryComp<ButcherableComponent>(target, out var butcher))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (!TryComp<SharpComponent>(knife, out var sharp))
|
if (!TryComp<SharpComponent>(knife, out var sharp))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (butcher.Type != ButcheringType.Knife && target != user)
|
if (butcher.Type != ButcheringType.Knife && target != user)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("butcherable-different-tool", ("target", target)), knife, user);
|
_popupSystem.PopupEntity(Loc.GetString("butcherable-different-tool", ("target", target)), knife, user);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp<MobStateComponent>(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!sharp.Butchering.Add(target))
|
if (!sharp.Butchering.Add(target))
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
var doAfter =
|
var doAfter =
|
||||||
new DoAfterArgs(EntityManager, user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
|
new DoAfterArgs(EntityManager, user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
|
||||||
@@ -77,6 +81,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
NeedHand = true
|
NeedHand = true
|
||||||
};
|
};
|
||||||
_doAfterSystem.TryStartDoAfter(doAfter);
|
_doAfterSystem.TryStartDoAfter(doAfter);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent args)
|
private void OnDoAfter(EntityUid uid, SharpComponent component, DoAfterEvent args)
|
||||||
@@ -161,7 +166,7 @@ public sealed class SharpSystem : EntitySystem
|
|||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
if (!disabled)
|
if (!disabled)
|
||||||
TryStartButcherDoafter(args.Using!.Value, args.Target, args.User);
|
TryStartButcherDoAfter(args.Using!.Value, args.Target, args.User);
|
||||||
},
|
},
|
||||||
Message = message,
|
Message = message,
|
||||||
Disabled = disabled,
|
Disabled = disabled,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
using Content.Shared.Nutrition.EntitySystems;
|
using Content.Shared.Nutrition.EntitySystems;
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<UtensilComponent, AfterInteractEvent>(OnAfterInteract);
|
SubscribeLocalEvent<UtensilComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(ItemSlotsSystem) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -33,6 +34,9 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev)
|
private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev)
|
||||||
{
|
{
|
||||||
|
if (ev.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ev.Target == null || !ev.CanReach)
|
if (ev.Target == null || !ev.CanReach)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
clothing-military-boots-sidearm = Sidearm
|
clothing-boots-sidearm = Sidearm
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
- type: ItemSlots
|
- type: ItemSlots
|
||||||
slots:
|
slots:
|
||||||
item:
|
item:
|
||||||
name: clothing-military-boots-sidearm
|
name: clothing-boots-sidearm
|
||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
- Knife
|
- Knife
|
||||||
|
|||||||
@@ -9,8 +9,26 @@
|
|||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Clothing/Shoes/Specific/chef.rsi
|
sprite: Clothing/Shoes/Specific/chef.rsi
|
||||||
|
|
||||||
|
# stuff common to all clown & jester shoes
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingShoesBaseButcherable
|
abstract: true
|
||||||
|
parent: [ClothingShoesBaseButcherable, ClothingSlotBase]
|
||||||
|
id: ClothingShoesClownBase
|
||||||
|
components:
|
||||||
|
- type: ItemSlots
|
||||||
|
slots:
|
||||||
|
item:
|
||||||
|
name: clothing-boots-sidearm
|
||||||
|
whitelist:
|
||||||
|
tags:
|
||||||
|
- Knife
|
||||||
|
- ToySidearm
|
||||||
|
blacklist:
|
||||||
|
components:
|
||||||
|
- Sharp
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: ClothingShoesClownBase
|
||||||
id: ClothingShoesClown
|
id: ClothingShoesClown
|
||||||
name: clown shoes
|
name: clown shoes
|
||||||
description: "The prankster's standard-issue clowning shoes. Damn they're huge!"
|
description: "The prankster's standard-issue clowning shoes. Damn they're huge!"
|
||||||
@@ -49,7 +67,7 @@
|
|||||||
acceleration: 5
|
acceleration: 5
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingShoesBaseButcherable
|
parent: ClothingShoesClownBase
|
||||||
id: ClothingShoesBling
|
id: ClothingShoesBling
|
||||||
name: bling clown shoes
|
name: bling clown shoes
|
||||||
description: Made of refined bananium and shined with the pulp of a fresh banana peel. These make a flashy statement.
|
description: Made of refined bananium and shined with the pulp of a fresh banana peel. These make a flashy statement.
|
||||||
|
|||||||
@@ -400,6 +400,9 @@
|
|||||||
Quantity: 3
|
Quantity: 3
|
||||||
- ReagentId: Fat
|
- ReagentId: Fat
|
||||||
Quantity: 3
|
Quantity: 3
|
||||||
|
- type: SliceableFood
|
||||||
|
count: 3
|
||||||
|
slice: FoodMeatCutlet
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw lizard meat
|
name: raw lizard meat
|
||||||
|
|||||||
@@ -893,6 +893,7 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Sidearm
|
- Sidearm
|
||||||
|
- ToySidearm
|
||||||
- type: Gun
|
- type: Gun
|
||||||
selectedMode: SemiAuto
|
selectedMode: SemiAuto
|
||||||
availableModes:
|
availableModes:
|
||||||
@@ -925,14 +926,14 @@
|
|||||||
suffix: Fake
|
suffix: Fake
|
||||||
description: Looks almost like the real thing! Ages 8 and up.
|
description: Looks almost like the real thing! Ages 8 and up.
|
||||||
components:
|
components:
|
||||||
- type: RevolverAmmoProvider
|
- type: RevolverAmmoProvider
|
||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
- CartridgeCap
|
- CartridgeCap
|
||||||
- SpeedLoaderCap
|
- SpeedLoaderCap
|
||||||
- CartridgeMagnum
|
- CartridgeMagnum
|
||||||
- SpeedLoaderMagnum
|
- SpeedLoaderMagnum
|
||||||
proto: CartridgeMagnumAP
|
proto: CartridgeMagnumAP
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
sprite: Objects/Misc/utensils.rsi
|
sprite: Objects/Misc/utensils.rsi
|
||||||
- type: Item # TODO add inhand sprites for all utensils
|
- type: Item # TODO add inhand sprites for all utensils
|
||||||
sprite: Objects/Misc/utensils.rsi
|
sprite: Objects/Misc/utensils.rsi
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Metal
|
|
||||||
- type: SpaceGarbage
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -23,8 +20,14 @@
|
|||||||
price: 0
|
price: 0
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Plastic
|
- Plastic
|
||||||
- Trash
|
- Trash
|
||||||
|
- type: MeleeWeapon
|
||||||
|
wideAnimationRotation: 180
|
||||||
|
attackRate: 1.5
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Blunt: 0
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: UtensilBase
|
parent: UtensilBase
|
||||||
@@ -66,6 +69,9 @@
|
|||||||
name: spoon
|
name: spoon
|
||||||
description: There is no spoon.
|
description: There is no spoon.
|
||||||
components:
|
components:
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- Metal
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: spoon
|
state: spoon
|
||||||
- type: Item
|
- type: Item
|
||||||
@@ -99,7 +105,7 @@
|
|||||||
speedModifier: 0.1 # you can try
|
speedModifier: 0.1 # you can try
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: UtensilBase
|
parent: UtensilBasePlastic
|
||||||
id: KnifePlastic
|
id: KnifePlastic
|
||||||
name: plastic knife
|
name: plastic knife
|
||||||
description: That's not a knife. This is a knife.
|
description: That's not a knife. This is a knife.
|
||||||
@@ -109,3 +115,8 @@
|
|||||||
- type: Utensil
|
- type: Utensil
|
||||||
types:
|
types:
|
||||||
- Knife
|
- Knife
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- Plastic
|
||||||
|
- Trash
|
||||||
|
- Knife
|
||||||
|
|||||||
@@ -1181,6 +1181,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
id: Torch
|
id: Torch
|
||||||
|
|
||||||
|
- type: Tag
|
||||||
|
id: ToySidearm
|
||||||
|
|
||||||
- type: Tag
|
- type: Tag
|
||||||
id: Trash
|
id: Trash
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user