mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-15 03:31:30 +01:00
* Initial commit
* Fixing merge conflict
* Merge conflict fixed
* Anchorable entities can now be marked as 'unanchorable'
* Revert "Anchorable entities can now be marked as 'unanchorable'"
This reverts commit 6a502e62a7
This functionality will be made into a separate PR
* Error sprite
* Update AI core appearance with sustained damage, spawn scrap on destroyed
* Added intellicard sprite
* AI damage overlays
* Added fixtures
* AI core accent changes when damaged or low on power
* Bug fix and pop up messages for inserting AIs into inoperable cores
* Updated 'dead' sprite
* Destroying the AI core reduces the number of AI job slots available
* AI battery duration set to 10 minutes
* Initial commit
* Allow MMIs used in the construction of AI cores to take them over
* Initial resources commit
* Initial code commit
* Sprite update
* Bug fixes and updates
* Basic console UI
* Code refactor
* Added lock screen
* Added all outstanding UI features
* Added purge sprites
* Better appearance handling
* Fixed issue with purge sprite
* Finalized UI design
* Major components finalized
* Bit of clean up
* Removed some code that was used for testing
* Tweaked some text
* Removed extra space
* Added the circuitboard to the RD's locker
* Addressed reviewer comments plus tweaks
* Addressed reviewer comments plus tweaks
* Removed instances of granular damage
* Various improvements
* Removed testing code
* Fixed issue with disabled buttons
* Finalized code
* Addressed review comments
* Added a spare Station AI core electronics to the research director's locker
* Fixing build failure
* Addressed review comments
* Addressed review comments
* Added reverse path for construction graph
* Removed unneeded reference
* Parts can be purchased through cargo
* Fixing merge conflict
* Merge conflict resolved
* Fixing merge conflict
* Code update
* Code updates
* Increased AI core health and gave it a sell price to fix test fail
* Added screen static sprite
* Added better support for ghosted AI players plus code tweaks
* Various improvements and clean up
* Increased purge duration to 60 seconds
* Fixed needless complication
* Addressed reviewer comments part 1
* Addressed reviewer comments part 2
* Further fixes
* Trying lower battery values to see if it fixes the test fail
* Adjusted power values again
* Addressed review comments
* Addressed review comments
* Fixed test fail
* Fixed bug with endless rebooting. Using rejuvenation on an AI core revives the AI inside.
* Added pop up text
* Bug fix
* Tweaks and fixes
* Fixed restoration console not updating when the AI finishes rebooting
* Update SharedStationAiSystem.Held.cs
---------
Co-authored-by: ScarKy0 <scarky0@onet.eu>
105 lines
3.9 KiB
C#
105 lines
3.9 KiB
C#
using Content.Server.GameTicking;
|
|
using Content.Server.Spawners.Components;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.Preferences;
|
|
using Robust.Server.Containers;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Server.Spawners.EntitySystems;
|
|
|
|
public sealed class ContainerSpawnPointSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ContainerSystem _container = default!;
|
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
[Dependency] private readonly StationSystem _station = default!;
|
|
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<PlayerSpawningEvent>(HandlePlayerSpawning, before: new []{ typeof(SpawnPointSystem) });
|
|
}
|
|
|
|
public void HandlePlayerSpawning(PlayerSpawningEvent args)
|
|
{
|
|
if (args.SpawnResult != null)
|
|
return;
|
|
|
|
// If it's just a spawn pref check if it's for cryo (silly).
|
|
if (args.HumanoidCharacterProfile?.SpawnPriority != SpawnPriorityPreference.Cryosleep &&
|
|
(!_proto.Resolve(args.Job, out var jobProto) || jobProto.JobEntity == null))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var query = EntityQueryEnumerator<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>();
|
|
var possibleContainers = new List<Entity<ContainerSpawnPointComponent, ContainerManagerComponent, TransformComponent>>();
|
|
|
|
while (query.MoveNext(out var uid, out var spawnPoint, out var container, out var xform))
|
|
{
|
|
if (args.Station != null && _station.GetOwningStation(uid, xform) != args.Station)
|
|
continue;
|
|
|
|
// If it's unset, then we allow it to be used for both roundstart and midround joins
|
|
if (spawnPoint.SpawnType == SpawnPointType.Unset)
|
|
{
|
|
// make sure we also check the job here for various reasons.
|
|
if (spawnPoint.Job == null || spawnPoint.Job == args.Job)
|
|
possibleContainers.Add((uid, spawnPoint, container, xform));
|
|
continue;
|
|
}
|
|
|
|
if (_gameTicker.RunLevel == GameRunLevel.InRound && spawnPoint.SpawnType == SpawnPointType.LateJoin)
|
|
{
|
|
possibleContainers.Add((uid, spawnPoint, container, xform));
|
|
}
|
|
|
|
if (_gameTicker.RunLevel != GameRunLevel.InRound &&
|
|
spawnPoint.SpawnType == SpawnPointType.Job &&
|
|
(args.Job == null || spawnPoint.Job == args.Job))
|
|
{
|
|
possibleContainers.Add((uid, spawnPoint, container, xform));
|
|
}
|
|
}
|
|
|
|
if (possibleContainers.Count == 0)
|
|
return;
|
|
// we just need some default coords so we can spawn the player entity.
|
|
var baseCoords = possibleContainers[0].Comp3.Coordinates;
|
|
|
|
args.SpawnResult = _stationSpawning.SpawnPlayerMob(
|
|
baseCoords,
|
|
args.Job,
|
|
args.HumanoidCharacterProfile,
|
|
args.Station);
|
|
|
|
_random.Shuffle(possibleContainers);
|
|
foreach (var (uid, spawnPoint, manager, xform) in possibleContainers)
|
|
{
|
|
if (!_container.TryGetContainer(uid, spawnPoint.ContainerId, out var container, manager))
|
|
continue;
|
|
|
|
if (!_container.Insert(args.SpawnResult.Value, container, containerXform: xform))
|
|
continue;
|
|
|
|
var ev = new ContainerSpawnEvent(args.SpawnResult.Value);
|
|
RaiseLocalEvent(uid, ref ev);
|
|
|
|
return;
|
|
}
|
|
|
|
Del(args.SpawnResult);
|
|
args.SpawnResult = null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised on a container when a player is spawned into it.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct ContainerSpawnEvent(EntityUid Player);
|