IReagentEffect and some chemistry stuff uses EntityUid

This commit is contained in:
Vera Aguilera Puerto
2021-11-09 11:51:17 +01:00
parent 222541f1a2
commit c5fda6daca
7 changed files with 36 additions and 26 deletions

View File

@@ -10,11 +10,11 @@ namespace Content.Server.Chemistry.EntitySystems
{
public class ChemicalReactionSystem : SharedChemicalReactionSystem
{
protected override void OnReaction(Solution solution, ReactionPrototype reaction, IEntity owner, FixedPoint2 unitReactions)
protected override void OnReaction(Solution solution, ReactionPrototype reaction, EntityUid ownerUid, FixedPoint2 unitReactions)
{
base.OnReaction(solution, reaction, owner, unitReactions);
base.OnReaction(solution, reaction, ownerUid, unitReactions);
SoundSystem.Play(Filter.Pvs(owner), reaction.Sound.GetSound(), owner);
SoundSystem.Play(Filter.Pvs(ownerUid, entityManager:EntityManager), reaction.Sound.GetSound(), ownerUid);
}
}
}

View File

@@ -128,8 +128,7 @@ namespace Content.Server.Chemistry.EntitySystems
// Process reactions
if (needsReactionsProcessing && solutionHolder.CanReact)
{
_chemistrySystem
.FullyReactSolution(solutionHolder, EntityManager.GetEntity(uid), solutionHolder.MaxVolume);
_chemistrySystem.FullyReactSolution(solutionHolder, uid, solutionHolder.MaxVolume);
}
UpdateAppearance(uid, solutionHolder);

View File

@@ -89,9 +89,9 @@ namespace Content.Server.Chemistry.ReactionEffects
IoCManager.InjectDependencies(this);
}
public void React(Solution solution, IEntity solutionEntity, double intensity)
public void React(Solution solution, EntityUid solutionEntity, double intensity, IEntityManager entityManager)
{
var splitSolution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(solutionEntity.Uid, solution, solution.MaxVolume);
var splitSolution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(solutionEntity, solution, solution.MaxVolume);
// We take the square root so it becomes harder to reach higher amount values
var amount = (int) Math.Round(_rangeConstant + _rangeMultiplier*Math.Sqrt(intensity));
amount = Math.Min(amount, _maxRange);
@@ -117,11 +117,13 @@ namespace Content.Server.Chemistry.ReactionEffects
splitSolution.RemoveSolution(splitSolution.TotalVolume * solutionFraction);
}
if (!_mapManager.TryFindGridAt(solutionEntity.Transform.MapPosition, out var grid)) return;
var transform = entityManager.GetComponent<TransformComponent>(solutionEntity);
var coords = grid.MapToGrid(solutionEntity.Transform.MapPosition);
if (!_mapManager.TryFindGridAt(transform.MapPosition, out var grid)) return;
var ent = solutionEntity.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
var coords = grid.MapToGrid(transform.MapPosition);
var ent = entityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
var areaEffectComponent = GetAreaEffectComponent(ent);

View File

@@ -28,11 +28,11 @@ namespace Content.Server.Chemistry.ReactionEffects
/// </summary>
[DataField("maxScale")] private float _maxScale = 1;
public void React(Solution solution, IEntity solutionEntity, double intensity)
public void React(Solution solution, EntityUid solutionEntity, double intensity, IEntityManager entityManager)
{
var floatIntensity = (float) intensity;
if (!solutionEntity.HasComponent<SolutionContainerManagerComponent>())
if (!entityManager.HasComponent<SolutionContainerManagerComponent>(solutionEntity))
return;
//Handle scaling