Skip to content

Commit

Permalink
Revert "Merge branch 'master' into Languages"
Browse files Browse the repository at this point in the history
This reverts commit f2adcee, reversing
changes made to 90f3588.
  • Loading branch information
FoxxoTrystan committed May 6, 2024
1 parent f2adcee commit f5e8bca
Show file tree
Hide file tree
Showing 365 changed files with 3,225 additions and 105,703 deletions.
6 changes: 0 additions & 6 deletions Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Content.Client.Weapons.Ranged.Components;
using Content.Shared.Camera;
using Content.Shared.CombatMode;
using Content.Shared.Mech.Components;
using Content.Shared.Weapons.Ranged;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
Expand Down Expand Up @@ -142,11 +141,6 @@ public override void Update(float frameTime)

var entity = entityNull.Value;

if (TryComp<MechPilotComponent>(entity, out var mechPilot))
{
entity = mechPilot.Mech;
}

if (!TryGetGun(entity, out var gunUid, out var gun))
{
return;
Expand Down
1 change: 0 additions & 1 deletion Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public sealed class PostMapInitTest
"MeteorArena",
"NukieOutpost",
"Pebble", //DeltaV
"Saltern", //Syndicate Station
"Edge", //DeltaV
"Shoukou", //DeltaV
"Tortuga", //DeltaV
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Audio;
using Content.Shared.Mobs.Components;
using Content.Shared.Physics;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;

namespace Content.Server.Atmos.EntitySystems
Expand Down Expand Up @@ -48,7 +51,8 @@ private void UpdateHighPressure(float frameTime)
comp.Accumulator = 0f;
toRemove.Add(ent);

if (TryComp<PhysicsComponent>(uid, out var body))
if (HasComp<MobStateComponent>(uid) &&
TryComp<PhysicsComponent>(uid, out var body))
{
_physics.SetBodyStatus(body, BodyStatus.OnGround);
}
Expand All @@ -68,7 +72,7 @@ private void UpdateHighPressure(float frameTime)
}
}

private void AddMovedByPressure(EntityUid uid, MovedByPressureComponent component, PhysicsComponent body)
private void AddMobMovedByPressure(EntityUid uid, MovedByPressureComponent component, PhysicsComponent body)
{
if (!TryComp<FixturesComponent>(uid, out var fixtures))
return;
Expand Down Expand Up @@ -158,7 +162,7 @@ private void HighPressureMovements(Entity<GridAtmosphereComponent> gridAtmospher
(entity, pressureMovements),
gridAtmosphere.Comp.UpdateCounter,
tile.PressureDifference,
tile.PressureDirection,
tile.PressureDirection, 0,
tile.PressureSpecificTarget != null ? _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.PressureSpecificTarget.GridIndices) : EntityCoordinates.Invalid,
gridWorldRotation,
xforms.GetComponent(entity),
Expand All @@ -179,13 +183,12 @@ private void ConsiderPressureDifference(GridAtmosphereComponent gridAtmosphere,
tile.PressureDirection = differenceDirection;
}

//The EE version of this function drops pressureResistanceProbDelta, since it's not needed. If you are for whatever reason calling this function
//And it isn't working, you've probably still got the ResistancePobDelta line included.
public void ExperiencePressureDifference(
Entity<MovedByPressureComponent> ent,
int cycle,
float pressureDifference,
AtmosDirection direction,
float pressureResistanceProbDelta,
EntityCoordinates throwTarget,
Angle gridWorldRotation,
TransformComponent? xform = null,
Expand All @@ -198,34 +201,55 @@ public void ExperiencePressureDifference(
if (!Resolve(uid, ref xform))
return;

// TODO ATMOS stuns?

var maxForce = MathF.Sqrt(pressureDifference) * 2.25f;
var moveProb = 100f;

if (component.PressureResistance > 0)
moveProb = MathF.Abs((pressureDifference / component.PressureResistance * MovedByPressureComponent.ProbabilityBasePercent) -
MovedByPressureComponent.ProbabilityOffset);

// Can we yeet the thing (due to probability, strength, etc.)
if (physics.BodyType != BodyType.Static
&& !float.IsPositiveInfinity(component.MoveResist)
&& physics.Mass != 0)
if (moveProb > MovedByPressureComponent.ProbabilityOffset && _robustRandom.Prob(MathF.Min(moveProb / 100f, 1f))
&& !float.IsPositiveInfinity(component.MoveResist)
&& (physics.BodyType != BodyType.Static
&& (maxForce >= (component.MoveResist * MovedByPressureComponent.MoveForcePushRatio)))
|| (physics.BodyType == BodyType.Static && (maxForce >= (component.MoveResist * MovedByPressureComponent.MoveForceForcePushRatio))))
{
var moveForce = pressureDifference / physics.Mass;
if (HasComp<MobStateComponent>(uid))
{
AddMobMovedByPressure(uid, component, physics);
}

if (moveForce > physics.Mass)
if (maxForce > MovedByPressureComponent.ThrowForce)
{
AddMovedByPressure(uid, component, physics);
var moveForce = maxForce;
moveForce /= (throwTarget != EntityCoordinates.Invalid) ? SpaceWindPressureForceDivisorThrow : SpaceWindPressureForceDivisorPush;
moveForce *= MathHelper.Clamp(moveProb, 0, 100);

// Apply a sanity clamp to prevent being thrown through objects.
var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass;
moveForce = MathF.Min(moveForce, maxSafeForceForObject);

// Grid-rotation adjusted direction
var dirVec = (direction.ToAngle() + gridWorldRotation).ToWorldVec();
var maxSafeForceForObject = SpaceWindMaxVelocity * physics.Mass;

// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
if (throwTarget != EntityCoordinates.Invalid)
{
var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
_physics.ApplyLinearImpulse(uid, pos * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics);
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
}
else
{
_physics.ApplyLinearImpulse(uid, dirVec * Math.Clamp(moveForce, 0, maxSafeForceForObject), body: physics);
moveForce = MathF.Min(moveForce, SpaceWindMaxPushForce);
_physics.ApplyLinearImpulse(uid, dirVec * moveForce, body: physics);
}

component.LastHighPressureMovementAirCycle = cycle;
}
}
}
}
}
}
6 changes: 0 additions & 6 deletions Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Mech.Components;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
Expand Down Expand Up @@ -306,11 +305,6 @@ public void Ignite(EntityUid uid, EntityUid ignitionSource, FlammableComponent?
if (!Resolve(uid, ref flammable))
return;

// I would rather there be a cancellable event for this but I really don't wanna fuck with this janky system more than I have too.
// FlammableSystem rework when?
if (TryComp<MechPilotComponent>(uid, out var mechPilot) && TryComp<MechComponent>(mechPilot.Mech, out var mech) && mech.Airtight)
return;

if (flammable.AlwaysCombustible)
{
flammable.FireStacks = Math.Max(flammable.FirestacksOnIgnite, flammable.FireStacks);
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void TrySendInGameOOCMessage(
/// <param name="colorOverride">Optional color for the announcement message</param>
public void DispatchGlobalAnnouncement(
string message,
string sender = "High Command",
string sender = "Central Command",
bool playSound = true,
SoundSpecifier? announcementSound = null,
Color? colorOverride = null
Expand All @@ -350,7 +350,7 @@ public void DispatchGlobalAnnouncement(
public void DispatchStationAnnouncement(
EntityUid source,
string message,
string sender = "High Command",
string sender = "Central Command",
bool playDefaultSound = true,
SoundSpecifier? announcementSound = null,
Color? colorOverride = null)
Expand Down
75 changes: 0 additions & 75 deletions Content.Server/Mech/Equipment/EntitySystems/MechGunSystem.cs

This file was deleted.

1 change: 0 additions & 1 deletion Content.Server/Mech/Systems/MechSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Mech.Components;
using Content.Server.Power.Components;
Expand Down
5 changes: 0 additions & 5 deletions Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Content.Server.Administration.Logs;
using Content.Server.Cargo.Systems;
using Content.Server.Interaction;
using Content.Server.Mech.Equipment.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Stunnable;
using Content.Server.Weapons.Ranged.Components;
Expand All @@ -12,7 +11,6 @@
using Content.Shared.Database;
using Content.Shared.Effects;
using Content.Shared.Interaction.Components;
using Content.Shared.Mech.Equipment.Components;
using Content.Shared.Projectiles;
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Ranged;
Expand Down Expand Up @@ -172,12 +170,9 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?

// Something like ballistic might want to leave it in the container still
if (!cartridge.DeleteOnSpawn && !Containers.IsEntityInContainer(ent!.Value))
{
EjectCartridge(ent.Value, angle);
}

Dirty(ent!.Value, cartridge);

break;
// Ammo shoots itself
case AmmoComponent newAmmo:
Expand Down
3 changes: 0 additions & 3 deletions Content.Shared/Mech/EntitySystems/SharedMechSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
Expand Down Expand Up @@ -44,9 +43,7 @@ public override void Initialize()
{
SubscribeLocalEvent<MechComponent, MechToggleEquipmentEvent>(OnToggleEquipmentAction);
SubscribeLocalEvent<MechComponent, MechEjectPilotEvent>(OnEjectPilotEvent);

SubscribeLocalEvent<MechComponent, InteractNoHandEvent>(RelayInteractionEvent);

SubscribeLocalEvent<MechComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<MechComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<MechComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
Expand Down
Loading

0 comments on commit f5e8bca

Please sign in to comment.