Hypo can inject solutions back into beakers (#19877)

* Inject to beakers

* Stop fighting in my pr

* Review
This commit is contained in:
Vasilis
2023-09-07 18:49:02 +02:00
committed by GitHub
parent 63c7bca04e
commit 2446c6a37b
3 changed files with 17 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ namespace Content.Server.Chemistry.EntitySystems
if (!Resolve(uid, ref component))
return false;
if (!EligibleEntity(target, _entMan))
if (!EligibleEntity(target, _entMan, component))
return false;
if (TryComp(uid, out UseDelayComponent? delayComp) && _useDelay.ActiveDelay(uid, delayComp))
@@ -84,7 +84,7 @@ namespace Content.Server.Chemistry.EntitySystems
if (target == user)
msgFormat = "hypospray-component-inject-self-message";
else if (EligibleEntity(user, _entMan) && _interaction.TryRollClumsy(user, component.ClumsyFailChance))
else if (EligibleEntity(user, _entMan, component) && _interaction.TryRollClumsy(user, component.ClumsyFailChance))
{
msgFormat = "hypospray-component-inject-self-clumsy-message";
target = user;
@@ -143,13 +143,15 @@ namespace Content.Server.Chemistry.EntitySystems
return true;
}
static bool EligibleEntity([NotNullWhen(true)] EntityUid? entity, IEntityManager entMan)
static bool EligibleEntity([NotNullWhen(true)] EntityUid? entity, IEntityManager entMan, HyposprayComponent component)
{
// TODO: Does checking for BodyComponent make sense as a "can be hypospray'd" tag?
// In SS13 the hypospray ONLY works on mobs, NOT beakers or anything else.
return entMan.HasComponent<SolutionContainerManagerComponent>(entity)
&& entMan.HasComponent<MobStateComponent>(entity);
// But this is 14, we dont do what SS13 does just because SS13 does it.
return component.OnlyMobs
? entMan.HasComponent<SolutionContainerManagerComponent>(entity) &&
entMan.HasComponent<MobStateComponent>(entity)
: entMan.HasComponent<SolutionContainerManagerComponent>(entity);
}
}
}