Openable refactor (#19750)
This commit is contained in:
@@ -40,6 +40,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
||||
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
||||
@@ -156,6 +157,10 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
if (!TryComp<FoodComponent>(targetUid, out var food))
|
||||
return 0f;
|
||||
|
||||
// mice can't eat unpeeled bananas, need monkey's help
|
||||
if (_openable.IsClosed(targetUid))
|
||||
return 0f;
|
||||
|
||||
if (!_food.IsDigestibleBy(owner, targetUid, food))
|
||||
return 0f;
|
||||
|
||||
@@ -173,7 +178,11 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
}
|
||||
case DrinkValueCon:
|
||||
{
|
||||
if (!TryComp<DrinkComponent>(targetUid, out var drink) || !drink.Opened)
|
||||
if (!TryComp<DrinkComponent>(targetUid, out var drink))
|
||||
return 0f;
|
||||
|
||||
// can't drink closed drinks
|
||||
if (_openable.IsClosed(targetUid))
|
||||
return 0f;
|
||||
|
||||
// only drink when thirsty
|
||||
|
||||
Reference in New Issue
Block a user