mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
## Mirror of PR #26287: [Code cleanup: Purge obsoleted SharedPhysicsSystem methods](https://github.com/space-wizards/space-station-14/pull/26287) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `964c6d54caae45b205a326143f56d6458a1bbc8a` PR opened by <img src="https://avatars.githubusercontent.com/u/85356?v=4" width="16"/><a href="https://github.com/Tayrtahn"> Tayrtahn</a> at 2024-03-20 13:37:25 UTC --- PR changed 16 files with 43 additions and 43 deletions. The PR had the following labels: - Status: Needs Review --- <details open="true"><summary><h1>Original Body</h1></summary> > <!-- Please read these guidelines before opening your PR: https://docs.spacestation14.io/en/getting-started/pr-guideline --> > <!-- The text between the arrows are comments - they will not be visible on your PR. --> > > Requires https://github.com/space-wizards/RobustToolbox/pull/4979 > > ## About the PR > <!-- What did you change in this PR? --> > Cleans up some obsolete method calls. > > ## Why / Balance / Technical > <!-- Why was it changed? Link any discussions or issues here. Please discuss how this would affect game balance. --> > Cleaning up obsolete Dirty calls in RT required changing the signatures of some public methods in SharedPhysicsSystem. This updates the calls to those methods here in Content to use the new signatures passing in UIDs. > > </details> Co-authored-by: SimpleStation14 <Unknown>
63 lines
2.5 KiB
C#
63 lines
2.5 KiB
C#
using Content.Server.ParticleAccelerator.Components;
|
|
using Content.Server.Singularity.Components;
|
|
using Content.Shared.Projectiles;
|
|
using Content.Shared.Singularity.Components;
|
|
using Robust.Shared.Physics.Components;
|
|
|
|
namespace Content.Server.ParticleAccelerator.EntitySystems;
|
|
|
|
public sealed partial class ParticleAcceleratorSystem
|
|
{
|
|
private void FireEmitter(EntityUid uid, ParticleAcceleratorPowerState strength, ParticleAcceleratorEmitterComponent? emitter = null)
|
|
{
|
|
if (!Resolve(uid, ref emitter))
|
|
return;
|
|
|
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
|
if (!xformQuery.TryGetComponent(uid, out var xform))
|
|
{
|
|
Log.Error("ParticleAccelerator attempted to emit a particle without (having) a transform from which to base its initial position and orientation.");
|
|
return;
|
|
}
|
|
|
|
var emitted = Spawn(emitter.EmittedPrototype, xform.Coordinates);
|
|
|
|
if (xformQuery.TryGetComponent(emitted, out var particleXform))
|
|
_transformSystem.SetLocalRotation(emitted, xform.LocalRotation, particleXform);
|
|
|
|
if (TryComp<PhysicsComponent>(emitted, out var particlePhys))
|
|
{
|
|
var angle = _transformSystem.GetWorldRotation(uid, xformQuery);
|
|
_physicsSystem.SetBodyStatus(emitted, particlePhys, BodyStatus.InAir);
|
|
|
|
var velocity = angle.ToWorldVec() * 20f;
|
|
if (TryComp<PhysicsComponent>(uid, out var phys))
|
|
velocity += phys.LinearVelocity; // Inherit velocity from parent so if the clown has strapped a dozen engines to departures we don't outpace the particles.
|
|
|
|
_physicsSystem.SetLinearVelocity(emitted, velocity, body: particlePhys);
|
|
}
|
|
|
|
if (TryComp<ProjectileComponent>(emitted, out var proj))
|
|
_projectileSystem.SetShooter(emitted, proj, uid);
|
|
|
|
if (TryComp<SinguloFoodComponent>(emitted, out var food))
|
|
{
|
|
// TODO: Unhardcode this.
|
|
food.Energy = strength switch
|
|
{
|
|
ParticleAcceleratorPowerState.Standby => 0,
|
|
ParticleAcceleratorPowerState.Level0 => 1,
|
|
ParticleAcceleratorPowerState.Level1 => 2,
|
|
ParticleAcceleratorPowerState.Level2 => 3,
|
|
ParticleAcceleratorPowerState.Level3 => 10,
|
|
_ => 0,
|
|
} * 10;
|
|
}
|
|
|
|
if (TryComp<ParticleProjectileComponent>(emitted, out var particle))
|
|
particle.State = strength;
|
|
|
|
_appearanceSystem.SetData(emitted, ParticleAcceleratorVisuals.VisualState, strength);
|
|
}
|
|
}
|