Merge branch 'master' into replace-sounds-with-sound-specifier
This commit is contained in:
@@ -21,14 +21,22 @@ namespace Content.Server.GameTicking
|
||||
[ViewVariables]
|
||||
public bool DisallowLateJoin { get; private set; } = false;
|
||||
|
||||
[ViewVariables]
|
||||
public bool StationOffset { get; private set; } = false;
|
||||
|
||||
[ViewVariables]
|
||||
public float MaxStationOffset { get; private set; } = 0f;
|
||||
|
||||
private void InitializeCVars()
|
||||
{
|
||||
_configurationManager.OnValueChanged(CCVars.GameLobbyEnabled, value => LobbyEnabled = value, true);
|
||||
_configurationManager.OnValueChanged(CCVars.GameDummyTicker, value => DummyTicker = value, true);
|
||||
_configurationManager.OnValueChanged(CCVars.GameMap, value => ChosenMap = value, true);
|
||||
_configurationManager.OnValueChanged(CCVars.GameLobbyDuration, value => LobbyDuration = TimeSpan.FromSeconds(value), true);
|
||||
_configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins, invokeImmediately:true,
|
||||
onValueChanged:value => { DisallowLateJoin = value; UpdateLateJoinStatus(); UpdateJobsAvailable(); });
|
||||
_configurationManager.OnValueChanged(CCVars.GameDisallowLateJoins,
|
||||
value => { DisallowLateJoin = value; UpdateLateJoinStatus(); UpdateJobsAvailable(); }, true);
|
||||
_configurationManager.OnValueChanged(CCVars.StationOffset, value => StationOffset = value, true);
|
||||
_configurationManager.OnValueChanged(CCVars.MaxStationOffset, value => MaxStationOffset = value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -62,6 +63,14 @@ namespace Content.Server.GameTicking
|
||||
throw new InvalidOperationException($"No grid found for map {map}");
|
||||
}
|
||||
|
||||
if (StationOffset)
|
||||
{
|
||||
// Apply a random offset to the station grid entity.
|
||||
var x = _robustRandom.NextFloat() * MaxStationOffset * 2 - MaxStationOffset;
|
||||
var y = _robustRandom.NextFloat() * MaxStationOffset * 2 - MaxStationOffset;
|
||||
EntityManager.GetEntity(grid.GridEntityId).Transform.LocalPosition = new Vector2(x, y);
|
||||
}
|
||||
|
||||
DefaultGridId = grid.Index;
|
||||
_spawnPoint = grid.ToCoordinates();
|
||||
|
||||
@@ -280,7 +289,7 @@ namespace Content.Server.GameTicking
|
||||
}
|
||||
|
||||
// Delete all entities.
|
||||
foreach (var entity in _entityManager.GetEntities().ToList())
|
||||
foreach (var entity in EntityManager.GetEntities().ToList())
|
||||
{
|
||||
// TODO: Maybe something less naive here?
|
||||
// FIXME: Actually, definitely.
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Server.Roles;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Server.Speech.Components;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
@@ -144,7 +145,8 @@ namespace Content.Server.GameTicking
|
||||
|
||||
var mob = SpawnObserverMob();
|
||||
mob.Name = name;
|
||||
mob.GetComponent<GhostComponent>().CanReturnToBody = false;
|
||||
var ghost = mob.GetComponent<GhostComponent>();
|
||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
||||
data.Mind.TransferTo(mob);
|
||||
|
||||
_playersInLobby[player] = LobbyPlayerStatus.Observer;
|
||||
@@ -155,7 +157,7 @@ namespace Content.Server.GameTicking
|
||||
private IEntity SpawnPlayerMob(Job job, HumanoidCharacterProfile? profile, bool lateJoin = true)
|
||||
{
|
||||
var coordinates = lateJoin ? GetLateJoinSpawnPoint() : GetJobSpawnPoint(job.Prototype.ID);
|
||||
var entity = _entityManager.SpawnEntity(PlayerPrototypeName, coordinates);
|
||||
var entity = EntityManager.SpawnEntity(PlayerPrototypeName, coordinates);
|
||||
|
||||
if (job.StartingGear != null)
|
||||
{
|
||||
@@ -175,7 +177,7 @@ namespace Content.Server.GameTicking
|
||||
private IEntity SpawnObserverMob()
|
||||
{
|
||||
var coordinates = GetObserverSpawnPoint();
|
||||
return _entityManager.SpawnEntity(ObserverPrototypeName, coordinates);
|
||||
return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -189,7 +191,7 @@ namespace Content.Server.GameTicking
|
||||
var equipmentStr = startingGear.GetGear(slot, profile);
|
||||
if (equipmentStr != string.Empty)
|
||||
{
|
||||
var equipmentEntity = _entityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
|
||||
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
|
||||
inventory.Equip(slot, equipmentEntity.GetComponent<ItemComponent>());
|
||||
}
|
||||
}
|
||||
@@ -200,7 +202,7 @@ namespace Content.Server.GameTicking
|
||||
var inhand = startingGear.Inhand;
|
||||
foreach (var (hand, prototype) in inhand)
|
||||
{
|
||||
var inhandEntity = _entityManager.SpawnEntity(prototype, entity.Transform.Coordinates);
|
||||
var inhandEntity = EntityManager.SpawnEntity(prototype, entity.Transform.Coordinates);
|
||||
handsComponent.TryPickupEntity(hand, inhandEntity, checkActionBlocker: false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ namespace Content.Server.GameTicking
|
||||
UpdateRoundFlow(frameTime);
|
||||
}
|
||||
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IMapLoader _mapLoader = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Server.Player;
|
||||
@@ -75,7 +76,7 @@ namespace Content.Server.GameTicking.Presets
|
||||
ghost.Name = mind.CharacterName ?? string.Empty;
|
||||
|
||||
var ghostComponent = ghost.GetComponent<GhostComponent>();
|
||||
ghostComponent.CanReturnToBody = canReturn;
|
||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, canReturn);
|
||||
|
||||
if (canReturn)
|
||||
mind.Visit(ghost);
|
||||
|
||||
Reference in New Issue
Block a user