Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Продвинутые борги #247

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private void OnEntityTargetHandleState(EntityUid uid, EntityTargetActionComponen

component.Whitelist = state.Whitelist;
component.CanTargetSelf = state.CanTargetSelf;
component.IgnoreContainer = state.IgnoreContainer; // Sunrise-Edit
BaseHandleState<EntityTargetActionComponent>(uid, component, state);
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Silicons/Laws/Ui/SiliconLawMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'laws-ui-menu-title'}"
MinSize="200 100"
SetSize="450 515">
MinSize="700 500"
SetSize="700 500"> <!-- Sunrise-Edit -->
<BoxContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Sunrise.SolutionRegenerationSwitcher;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.Chemistry.Components;
Expand All @@ -8,7 +10,7 @@ namespace Content.Server.Chemistry.Components;
/// Passively increases a solution's quantity of a reagent.
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
[Access(typeof(SolutionRegenerationSystem))]
[Access(typeof(SolutionRegenerationSystem), typeof(SolutionRegenerationSwitcherSystem))] // Sunrise-Edit
public sealed partial class SolutionRegenerationComponent : Component
{
/// <summary>
Expand Down Expand Up @@ -41,4 +43,12 @@ public sealed partial class SolutionRegenerationComponent : Component
[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
[AutoPausedField]
public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0);

// Sunrise-start
public void ChangeGenerated(ReagentQuantity reagent)
{
Generated.RemoveAllSolution();
Generated.AddReagent(reagent);
}
// Sunrise-end
}
41 changes: 41 additions & 0 deletions Content.Server/CrewManifest/CrewManifestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
using Content.Server.Station.Systems;
using Content.Server.StationRecords;
using Content.Server.StationRecords.Systems;
using Content.Shared.Actions;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.CrewManifest;
using Content.Shared.GameTicking;
using Content.Shared.Roles;
using Content.Shared.Silicons.Borgs.Components;
using Content.Shared.StationRecords;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
Expand All @@ -26,6 +28,7 @@ public sealed class CrewManifestSystem : EntitySystem
[Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;

/// <summary>
/// Cached crew manifest entries. The alternative is to outright
Expand All @@ -46,8 +49,46 @@ public override void Initialize()

SubscribeLocalEvent<CrewManifestViewerComponent, BoundUIClosedEvent>(OnBoundUiClose);
SubscribeLocalEvent<CrewManifestViewerComponent, CrewManifestOpenUiMessage>(OpenEuiFromBui);
SubscribeLocalEvent<BorgCrewManifestViewerComponent, MapInitEvent>(BorgCrewManifestViewerMapInit);
SubscribeLocalEvent<BorgCrewManifestViewerComponent, CrewManifestOpenActionEvent>(OpenCrewManifest);
}

// Sunrise-Start
private void BorgCrewManifestViewerMapInit(EntityUid uid, BorgCrewManifestViewerComponent component, MapInitEvent args)
{
_actions.AddAction(uid, component.ActionViewCrewManifest);
}

private void OpenCrewManifest(EntityUid uid, BorgCrewManifestViewerComponent component, CrewManifestOpenActionEvent args)
{
if (args.Handled)
return;

var owningStation = _stationSystem.GetOwningStation(uid);
if (owningStation == null || !TryComp<ActorComponent>(args.Performer, out var actor))
{
return;
}

if (!_openEuis.TryGetValue(owningStation.Value, out var euis))
{
euis = new();
_openEuis.Add(owningStation.Value, euis);
}

if (euis.ContainsKey(actor.PlayerSession))
{
CloseEui(owningStation.Value, actor.PlayerSession, uid);
}
else
{
OpenEui(owningStation.Value, actor.PlayerSession, uid);
}

args.Handled = true;
}
// Sunrise-End

private void OnRoundRestart(RoundRestartCleanupEvent ev)
{
foreach (var (_, euis) in _openEuis)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Medical/HealthAnalyzerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ damageableComponent.DamageContainerID is not null &&

_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, uid.Comp.ScanDelay, new HealthAnalyzerDoAfterEvent(), uid, target: args.Target, used: uid)
{
NeedHand = true,
NeedHand = args.NeedHand, // Sunrise-Edit
BreakOnMove = true
});

Expand Down
10 changes: 8 additions & 2 deletions Content.Server/StationRecords/Systems/StationRecordsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ private void CreateGeneralRecord(EntityUid station, EntityUid player, HumanoidCh
|| !_prototypeManager.HasIndex<JobPrototype>(jobId))
return;

// Sunrise-Start
var name = profile.Name;
if (!_inventory.TryGetSlotEntity(player, "id", out var idUid))
return;
{
idUid = null;
name = MetaData(player).EntityName;
}
// Sunrise-End

TryComp<FingerprintComponent>(player, out var fingerprintComponent);
TryComp<DnaComponent>(player, out var dnaComponent);

CreateGeneralRecord(station, idUid.Value, profile.Name, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records);
CreateGeneralRecord(station, idUid, name, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records);
}


Expand Down
48 changes: 48 additions & 0 deletions Content.Server/_Sunrise/Abilities/BorgCuffedSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared._Sunrise.Abilities;
using Content.Shared.Actions;
using Content.Shared.Cuffs;
using Content.Shared.DoAfter;

namespace Content.Server._Sunrise.Abilities;
public sealed class BorgCuffedSystem : EntitySystem
{
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedCuffableSystem _cuffable = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BorgCuffedComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<BorgCuffedComponent, BorgCuffedActionEvent>(OnCuffed);
SubscribeLocalEvent<BorgCuffedComponent, BorgCuffedDoAfterEvent>(OnCuffedDoAfter);
}

private void OnInit(EntityUid uid, BorgCuffedComponent component, ComponentInit args)
{
_actions.AddAction(uid, component.CuffActionId);
}

private void OnCuffed(EntityUid uid, BorgCuffedComponent component, BorgCuffedActionEvent args)
{
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager ,uid, component.CuffTime,
new BorgCuffedDoAfterEvent(), uid, target: args.Target, used: uid)
{
BreakOnMove = true,
BreakOnDamage = true
});

args.Handled = true;
}

private void OnCuffedDoAfter(EntityUid uid, BorgCuffedComponent component,
BorgCuffedDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
return;

var cuffs = Spawn(component.CableCuffsId, Transform(uid).Coordinates);

if (!_cuffable.TryCuffingNow(args.Args.User, args.Args.Target.Value, cuffs))
QueueDel(cuffs);
}
}
35 changes: 35 additions & 0 deletions Content.Server/_Sunrise/Abilities/FabricateCandySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Shared._Sunrise.Abilities;
using Content.Shared.Actions;

namespace Content.Server._Sunrise.Abilities
{
public sealed class FabricateCandySystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FabricateCandyComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<FabricateCandyComponent, FabricateLollipopActionEvent>(OnLollipop);
SubscribeLocalEvent<FabricateCandyComponent, FabricateGumballActionEvent>(OnGumball);
}

private void OnInit(EntityUid uid, FabricateCandyComponent component, ComponentInit args)
{
_actions.AddAction(uid, component.ActionFabricateLollipop);
_actions.AddAction(uid, component.ActionFabricateGumball);
}

private void OnLollipop(EntityUid uid, FabricateCandyComponent component, FabricateLollipopActionEvent args)
{
Spawn(component.FoodLollipopId, Transform(args.Performer).Coordinates);
args.Handled = true;
}

private void OnGumball(EntityUid uid, FabricateCandyComponent component, FabricateGumballActionEvent args)
{
Spawn(component.FoodGumballId, Transform(args.Performer).Coordinates);
args.Handled = true;
}
}
}
29 changes: 29 additions & 0 deletions Content.Server/_Sunrise/Abilities/FabricateCookieSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared._Sunrise.Abilities;
using Content.Shared.Actions;
using Robust.Shared.Random;

namespace Content.Server._Sunrise.Abilities
{
public sealed class FabricateCookieSystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FabricateCookieComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<FabricateCookieComponent, FabricateCookieActionEvent>(OnCookie);
}

private void OnInit(EntityUid uid, FabricateCookieComponent component, ComponentInit args)
{
_actions.AddAction(uid, component.ActionFabricateCookie);
}

private void OnCookie(EntityUid uid, FabricateCookieComponent component, FabricateCookieActionEvent args)
{
Spawn(_random.Pick(component.CookieList), Transform(args.Performer).Coordinates);
args.Handled = true;
}
}
}
29 changes: 29 additions & 0 deletions Content.Server/_Sunrise/Abilities/FabricateSoapSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared._Sunrise.Abilities;
using Content.Shared.Actions;
using Robust.Shared.Random;

namespace Content.Server._Sunrise.Abilities
{
public sealed class FabricateSoapSystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FabricateSoapComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<FabricateSoapComponent, FabricateSoapActionEvent>(OnCookie);
}

private void OnInit(EntityUid uid, FabricateSoapComponent component, ComponentInit args)
{
_actions.AddAction(uid, component.ActionFabricateSoap);
}

private void OnCookie(EntityUid uid, FabricateSoapComponent component, FabricateSoapActionEvent args)
{
Spawn(_random.Pick(component.SoapList), Transform(args.Performer).Coordinates);
args.Handled = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Server.Atmos;
using Content.Shared.Atmos;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.Sunrise.GasRegeneration;

[RegisterComponent]
[Access(typeof(GasRegenerationSystem))]
public sealed partial class GasRegenerationComponent : Component
{
[DataField("airRegenerate")] public GasMixture AirRegen { get; set; } = new GasMixture();

[DataField("duration"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Duration = TimeSpan.FromSeconds(1);

[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Robust.Shared.Timing;

namespace Content.Server.Sunrise.GasRegeneration;

public sealed class GasRegenerationSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<GasRegenerationComponent, EntityUnpausedEvent>(OnUnpaused);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<GasRegenerationComponent, GasTankComponent>();
while (query.MoveNext(out var uid, out var gasRegen, out var gasTank))
{
if (_timing.CurTime < gasRegen.NextRegenTime)
continue;

gasRegen.NextRegenTime = _timing.CurTime + gasRegen.Duration;
_atmosphereSystem.Merge(gasTank.Air, gasRegen.AirRegen.Clone());
}
}

private void OnUnpaused(EntityUid uid, GasRegenerationComponent comp, ref EntityUnpausedEvent args)
{
comp.NextRegenTime += args.PausedTime;
}
}
19 changes: 19 additions & 0 deletions Content.Server/_Sunrise/InnateItem/InnateItemComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Server._Sunrise.InnateItem
{
[RegisterComponent]
public sealed partial class InnateItemComponent : Component
{
public bool AlreadyInitialized = false;

[ViewVariables(VVAccess.ReadOnly),
DataField("instantActions", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string?> InstantActions = new();

[ViewVariables(VVAccess.ReadOnly),
DataField("worldTargetActions", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string?> WorldTargetActions = new();
}
}
Loading
Loading