-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
451 additions
and
5 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
Content.Server/Backmen/Arrivals/Centcomm/CentComEventId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Content.Server.Backmen.Arrivals.CentComm; | ||
|
||
public enum CentComEventId : int | ||
{ | ||
Noop = 0, | ||
AddWorker, | ||
AddOperator, | ||
AddSecurity, | ||
AddCargo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Content.Server.Backmen.Arrivals.CentComm; | ||
|
||
public sealed class CentCommEvent(EntityUid station,CentComEventId eventId) : HandledEntityEventArgs | ||
{ | ||
public EntityUid Station { get; } = station; | ||
public CentComEventId EventId { get; } = eventId; | ||
} |
123 changes: 123 additions & 0 deletions
123
Content.Server/Backmen/Arrivals/Centcomm/CentCommSpawnSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using Content.Server.Spawners.Components; | ||
using Content.Server.Station.Components; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server.Backmen.Arrivals.CentComm; | ||
|
||
public sealed class CentCommSpawnSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<StationCentCommDirectorComponent, CentCommEvent>(OnCentCommEvent); | ||
} | ||
|
||
private void OnCentCommEvent(Entity<StationCentCommDirectorComponent> ent, ref CentCommEvent args) | ||
{ | ||
if(args.Handled) | ||
return; | ||
|
||
switch (args.EventId) | ||
{ | ||
case CentComEventId.AddWorker: | ||
args.Handled = true; | ||
|
||
AddWorker(args.Station); | ||
break; | ||
case CentComEventId.AddOperator: | ||
args.Handled = true; | ||
|
||
AddOperator(args.Station); | ||
break; | ||
case CentComEventId.AddSecurity: | ||
args.Handled = true; | ||
|
||
AddSecurity(args.Station); | ||
break; | ||
case CentComEventId.AddCargo: | ||
args.Handled = true; | ||
|
||
AddCargo(args.Station); | ||
break; | ||
default: | ||
return; | ||
} | ||
} | ||
|
||
[ValidatePrototypeId<EntityPrototype>] | ||
private const string WorkerProto = "SpawnPointCMBKCCAssistant"; | ||
private void AddWorker(EntityUid station) | ||
{ | ||
var point = FindSpawnPoint(station); | ||
if (point == null) | ||
{ | ||
Log.Warning($"Can't find spawn point for {station}"); | ||
return; | ||
} | ||
Spawn(WorkerProto, point.Value); | ||
} | ||
[ValidatePrototypeId<EntityPrototype>] | ||
private const string OperatorProto = "SpawnPointCMBKCCOperator"; | ||
private void AddOperator(EntityUid station) | ||
{ | ||
var point = FindSpawnPoint(station); | ||
if (point == null) | ||
{ | ||
Log.Warning($"Can't find spawn point for {station}"); | ||
return; | ||
} | ||
Spawn(OperatorProto, point.Value); | ||
} | ||
[ValidatePrototypeId<EntityPrototype>] | ||
private const string SecurityProto = "SpawnPointCMBKCCSecOfficer"; | ||
private void AddSecurity(EntityUid station) | ||
{ | ||
var point = FindSpawnPoint(station); | ||
if (point == null) | ||
{ | ||
Log.Warning($"Can't find spawn point for {station}"); | ||
return; | ||
} | ||
Spawn(SecurityProto, point.Value); | ||
} | ||
[ValidatePrototypeId<EntityPrototype>] | ||
private const string CargoProto = "SpawnPointCMBKCCCargo"; | ||
private void AddCargo(EntityUid station) | ||
{ | ||
var point = FindSpawnPoint(station); | ||
if (point == null) | ||
{ | ||
Log.Warning($"Can't find spawn point for {station}"); | ||
return; | ||
} | ||
Spawn(CargoProto, point.Value); | ||
} | ||
|
||
private EntityCoordinates? FindSpawnPoint(EntityUid station) | ||
{ | ||
var stationData = CompOrNull<StationDataComponent>(station); | ||
if (stationData == null) | ||
return null; | ||
|
||
var stationGrids = stationData.Grids; | ||
|
||
var result = new List<EntityCoordinates>(); | ||
|
||
var q = EntityQueryEnumerator<SpawnPointComponent,TransformComponent>(); | ||
while (q.MoveNext(out var uid, out var spawnPoint, out var transform)) | ||
{ | ||
if(spawnPoint.SpawnType != SpawnPointType.LateJoin || transform.GridUid == null) | ||
continue; | ||
if(!stationGrids.Contains(transform.GridUid.Value)) | ||
continue; | ||
|
||
result.Add(transform.Coordinates); | ||
} | ||
|
||
return result.Count == 0 ? null : _random.Pick(result); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Content.Server/Backmen/Arrivals/Centcomm/FtlCentComAnnounce.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Content.Server.Shuttles.Components; | ||
|
||
namespace Content.Server.Backmen.Arrivals.CentComm; | ||
|
||
public sealed class FtlCentComAnnounce : EntityEventArgs | ||
{ | ||
public Entity<ShuttleComponent> Source { get; set; } | ||
} |
21 changes: 21 additions & 0 deletions
21
Content.Server/Backmen/Arrivals/Centcomm/StationCentCommDirectorComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
|
||
namespace Content.Server.Backmen.Arrivals.CentComm; | ||
|
||
[RegisterComponent] | ||
public sealed partial class StationCentCommDirectorComponent : Component | ||
{ | ||
/// <summary> | ||
/// Keeps track of the internal event scheduler. | ||
/// </summary> | ||
[ViewVariables] | ||
[DataField("nextEventTick", customTypeSerializer: typeof(TimeOffsetSerializer))] | ||
public TimeSpan NextEventTick; | ||
|
||
/// <summary> | ||
/// The schedule of events to occur. | ||
/// </summary> | ||
[ViewVariables] | ||
[DataField("eventSchedule")] | ||
public List<(TimeSpan timeOffset, CentComEventId eventId)> EventSchedule = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
- type: entity | ||
id: SpawnPointCMBKCCAssistant | ||
name: Ассистент ЦК | ||
suffix: Спавнер, Директор Событий | ||
parent: MarkerBase | ||
components: | ||
- type: GhostRole | ||
allowMovement: true | ||
allowSpeech: true | ||
makeSentient: true | ||
name: Ассистент ЦК | ||
description: Разнорабочий призванный для поддержки экипажа ЦК и для поддержки самой станции цк в текущем секторе. | ||
rules: Вы обязаны выполнять поручения экипажа станции цк, опеспечивать станцию цк в рабочем состоянии, также запрещено покидать станцию цк! | ||
raffle: | ||
settings: short | ||
requirements: | ||
- !type:DepartmentTimeRequirement | ||
department: Engineering | ||
time: 108000 | ||
- !type:DepartmentTimeRequirement | ||
department: Medical | ||
time: 108000 | ||
- !type:DepartmentTimeRequirement | ||
department: Civilian | ||
time: 108000 | ||
job: BKCCAssistant | ||
- type: GhostRoleMobSpawner | ||
prototype: MobHumanCMBKCCAssistant | ||
- type: Sprite | ||
sprite: Markers/jobs.rsi | ||
layers: | ||
- state: green | ||
- sprite: Mobs/Animals/regalrat.rsi | ||
state: icon | ||
|
||
|
||
- type: entity | ||
name: Ассистент ЦК | ||
suffix: Спавнер, Директор Событий | ||
parent: MobHumanCombine | ||
id: MobHumanCMBKCCAssistant | ||
components: | ||
- type: Icon | ||
sprite: Markers/jobs.rsi | ||
state: ai | ||
- type: AutoImplant | ||
implants: | ||
- MindShieldImplant | ||
- FreedomImplant | ||
- type: SpecForce | ||
actionBssActionName: ActionCentcomFtlAction | ||
- type: NpcFactionMember | ||
factions: | ||
- CentralCommand | ||
- type: Loadout | ||
prototypes: [CentComInternGear] | ||
- type: RandomHumanoidAppearance | ||
randomizeName: true | ||
- type: AntagImmune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
- type: entity | ||
id: SpawnPointCMBKCCCargo | ||
name: Карго ЦК | ||
suffix: Спавнер, Директор Событий | ||
parent: MarkerBase | ||
components: | ||
- type: GhostRole | ||
allowMovement: true | ||
allowSpeech: true | ||
makeSentient: true | ||
name: Карго ЦК | ||
description: кек | ||
rules: кек | ||
raffle: | ||
settings: short | ||
requirements: | ||
- !type:DepartmentTimeRequirement | ||
department: Cargo | ||
time: 126000 | ||
- !type:RoleTimeRequirement | ||
role: JobCentralCommandAssistant | ||
time: 21600 | ||
- !type:DepartmentTimeRequirement | ||
department: CentCom | ||
time: 43200 | ||
job: BKCCCargo | ||
- type: GhostRoleMobSpawner | ||
prototype: MobHumanCMBKCCCargo | ||
- type: Sprite | ||
sprite: Markers/jobs.rsi | ||
layers: | ||
- state: green | ||
- sprite: Mobs/Animals/regalrat.rsi | ||
state: icon | ||
|
||
- type: entity | ||
name: Карго ЦК | ||
suffix: Директор Событий | ||
parent: MobHumanCombine | ||
id: MobHumanCMBKCCCargo | ||
components: | ||
- type: Icon | ||
sprite: Markers/jobs.rsi | ||
state: ai | ||
- type: AutoImplant | ||
implants: | ||
- MindShieldImplant | ||
- FreedomImplant | ||
- type: SpecForce | ||
actionBssActionName: ActionCentcomFtlAction | ||
- type: NpcFactionMember | ||
factions: | ||
- CentralCommand | ||
- type: Loadout | ||
prototypes: [CCCargo] | ||
- type: RandomHumanoidAppearance | ||
randomizeName: true | ||
- type: AntagImmune |
Oops, something went wrong.