Revert 'Revert 'Solution Entities'' (#23168)

This commit is contained in:
TemporalOroboros
2023-12-29 04:47:43 -08:00
committed by GitHub
parent 93e1af2f8d
commit d23c8d5c19
180 changed files with 3541 additions and 2956 deletions

View File

@@ -1,18 +1,18 @@
using Content.Server.Nutrition.Components;
using Content.Server.Body.Components;
using Content.Shared.Interaction;
using Content.Server.DoAfter;
using System.Threading;
using Content.Server.Explosion.EntitySystems;
using Content.Shared.Damage;
using Content.Server.Popups;
using Content.Shared.IdentityManagement;
using Content.Shared.DoAfter;
using Content.Shared.Emag.Systems;
using Content.Shared.Emag.Components;
using Content.Shared.Nutrition;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.DoAfter;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Nutrition;
using System.Threading;
/// <summary>
/// System for vapes
@@ -35,16 +35,14 @@ namespace Content.Server.Nutrition.EntitySystems
SubscribeLocalEvent<VapeComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnVapeInteraction(EntityUid uid, VapeComponent comp, AfterInteractEvent args)
private void OnVapeInteraction(Entity<VapeComponent> entity, ref AfterInteractEvent args)
{
_solutionContainerSystem.TryGetRefillableSolution(uid, out var solution);
var delay = comp.Delay;
var delay = entity.Comp.Delay;
var forced = true;
var exploded = false;
if (!args.CanReach
|| solution == null
|| !_solutionContainerSystem.TryGetRefillableSolution(entity.Owner, out _, out var solution)
|| !HasComp<BloodstreamComponent>(args.Target)
|| _foodSystem.IsMouthBlocked(args.Target.Value, args.User))
{
@@ -61,14 +59,14 @@ namespace Content.Server.Nutrition.EntitySystems
if (args.Target == args.User)
{
delay = comp.UserDelay;
delay = entity.Comp.UserDelay;
forced = false;
}
if (comp.ExplodeOnUse || HasComp<EmaggedComponent>(uid))
if (entity.Comp.ExplodeOnUse || HasComp<EmaggedComponent>(entity.Owner))
{
_explosionSystem.QueueExplosion(uid, "Default", comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false);
EntityManager.DeleteEntity(uid);
_explosionSystem.QueueExplosion(entity.Owner, "Default", entity.Comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false);
EntityManager.DeleteEntity(entity);
exploded = true;
}
else
@@ -80,11 +78,11 @@ namespace Content.Server.Nutrition.EntitySystems
// just re-use the existing RiggableSystem.
foreach (var name in solution.Contents)
{
if (name.Reagent.Prototype != comp.SolutionNeeded)
if (name.Reagent.Prototype != entity.Comp.SolutionNeeded)
{
exploded = true;
_explosionSystem.QueueExplosion(uid, "Default", comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false);
EntityManager.DeleteEntity(uid);
_explosionSystem.QueueExplosion(entity.Owner, "Default", entity.Comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false);
EntityManager.DeleteEntity(entity);
break;
}
}
@@ -113,7 +111,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!exploded)
{
var vapeDoAfterEvent = new VapeDoAfterEvent(solution, forced);
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, delay, vapeDoAfterEvent, uid, target: args.Target, used: uid)
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, delay, vapeDoAfterEvent, entity.Owner, target: args.Target, used: entity.Owner)
{
BreakOnTargetMove = true,
BreakOnUserMove = false,
@@ -121,9 +119,9 @@ namespace Content.Server.Nutrition.EntitySystems
});
}
args.Handled = true;
}
}
private void OnVapeDoAfter(EntityUid uid, VapeComponent comp, VapeDoAfterEvent args)
private void OnVapeDoAfter(Entity<VapeComponent> entity, ref VapeDoAfterEvent args)
{
if (args.Handled
|| args.Args.Target == null)
@@ -136,10 +134,10 @@ namespace Content.Server.Nutrition.EntitySystems
}
//Smoking kills(your lungs, but there is no organ damage yet)
_damageableSystem.TryChangeDamage(args.Args.Target.Value, comp.Damage, true);
_damageableSystem.TryChangeDamage(args.Args.Target.Value, entity.Comp.Damage, true);
var merger = new GasMixture(1) { Temperature = args.Solution.Temperature};
merger.SetMoles(comp.GasType, args.Solution.Volume.Value / comp.ReductionFactor);
var merger = new GasMixture(1) { Temperature = args.Solution.Temperature };
merger.SetMoles(entity.Comp.GasType, args.Solution.Volume.Value / entity.Comp.ReductionFactor);
_atmosphereSystem.Merge(environment, merger);
@@ -165,9 +163,9 @@ namespace Content.Server.Nutrition.EntitySystems
args.Args.Target.Value);
}
}
private void OnEmagged(EntityUid uid, VapeComponent component, ref GotEmaggedEvent args)
private void OnEmagged(Entity<VapeComponent> entity, ref GotEmaggedEvent args)
{
args.Handled = true;
}
}
}
}