Skip to content

Commit

Permalink
Merge?
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Jun 7, 2024
1 parent 8a8fec5 commit b4cfa6b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 39 deletions.
7 changes: 1 addition & 6 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,14 @@ public override void Update(float frameTime)
var query = EntityQueryEnumerator<RespiratorComponent, BodyComponent>();
while (query.MoveNext(out var uid, out var respirator, out var body))
{
if (_gameTiming.CurTime < respirator.NextUpdate)
if (_gameTiming.CurTime < respirator.NextUpdate || respirator.HasImmunity) // Sunrise-Edit
continue;

respirator.NextUpdate += respirator.UpdateInterval;

if (_mobState.IsDead(uid))
continue;

// Sunrise-start
if (respirator.HasImmunity)
continue;
// Sunrise-end

UpdateSaturation(uid, -(float) respirator.UpdateInterval.TotalSeconds, respirator);

if (!_mobState.IsIncapacitated(uid)) // cannot breathe in crit.
Expand Down
7 changes: 1 addition & 6 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,7 @@ private void SpawnPlayer(ICommonSession player,

_playTimeTrackings.PlayerRolesChanged(player);

// Sunrise-start
if (jobPrototype.AlwaysUseSpawner)
lateJoin = false;
// Sunrise-end

var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character, lateJoin: lateJoin);
var mobMaybe = _stationSpawning.SpawnPlayerCharacterOnStation(station, job, character);
DebugTools.AssertNotNull(mobMaybe);
var mob = mobMaybe!.Value;

Expand Down
19 changes: 2 additions & 17 deletions Content.Server/Spawners/EntitySystems/SpawnPointSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,19 @@ private void OnPlayerSpawning(PlayerSpawningEvent args)
if (args.Station != null && _stationSystem.GetOwningStation(uid, xform) != args.Station)
continue;

if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin && args.LateJoin) // Sunrise-edit
if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin)
{
possiblePositions.Add(xform.Coordinates);
}

if ((_gameTicker.RunLevel != GameRunLevel.InRound || args.LateJoin is false) && // Sunrise-edit
if (_gameTicker.RunLevel != GameRunLevel.InRound &&
spawnPoint.SpawnType == SpawnPointType.Job &&
(args.Job == null || spawnPoint.Job == args.Job.Prototype))
{
possiblePositions.Add(xform.Coordinates);
}
}

// Sunrise-start
// Чтобы роли у которых нет спавнеров появились в +- подходящем месте а не были закинуты в каюту капитана.
if (possiblePositions.Count == 0)
{
var points3 = EntityQueryEnumerator<SpawnPointComponent, TransformComponent>();
while (points3.MoveNext(out var uid, out var spawnPoint, out var xform))
{
if (spawnPoint.SpawnType != SpawnPointType.LateJoin)
continue;
if (_stationSystem.GetOwningStation(uid, xform) == args.Station)
possiblePositions.Add(xform.Coordinates);
}
}
// Sunrise-end

if (possiblePositions.Count == 0)
{
// Ok we've still not returned, but we need to put them /somewhere/.
Expand Down
13 changes: 3 additions & 10 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public override void Initialize()
/// <remarks>
/// This only spawns the character, and does none of the mind-related setup you'd need for it to be playable.
/// </remarks>
public EntityUid? SpawnPlayerCharacterOnStation(EntityUid? station, JobComponent? job, HumanoidCharacterProfile? profile, StationSpawningComponent? stationSpawning = null, bool lateJoin = true) // Sunrise-edit
public EntityUid? SpawnPlayerCharacterOnStation(EntityUid? station, JobComponent? job, HumanoidCharacterProfile? profile, StationSpawningComponent? stationSpawning = null)
{
if (station != null && !Resolve(station.Value, ref stationSpawning))
throw new ArgumentException("Tried to use a non-station entity as a station!", nameof(station));

var ev = new PlayerSpawningEvent(job, profile, station, lateJoin); // Sunrise-edit
var ev = new PlayerSpawningEvent(job, profile, station);

if (station != null && profile != null)
{
Expand Down Expand Up @@ -307,18 +307,11 @@ public sealed class PlayerSpawningEvent : EntityEventArgs
/// The target station, if any.
/// </summary>
public readonly EntityUid? Station;
// Sunrise-start
/// <summary>
/// Нада
/// </summary>
public bool LateJoin;
// Sunrise-end

public PlayerSpawningEvent(JobComponent? job, HumanoidCharacterProfile? humanoidCharacterProfile, EntityUid? station, bool lateJoin) // Sunrise-edit
public PlayerSpawningEvent(JobComponent? job, HumanoidCharacterProfile? humanoidCharacterProfile, EntityUid? station)
{
Job = job;
HumanoidCharacterProfile = humanoidCharacterProfile;
Station = station;
LateJoin = lateJoin; // Sunrise-edit
}
}

0 comments on commit b4cfa6b

Please sign in to comment.