Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Апстрим до 26.05.2024 #216

Merged
merged 21 commits into from
May 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
5 changes: 4 additions & 1 deletion Content.Client/Administration/UI/AdminAnnounceWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public AdminAnnounceWindow()
AnnounceMethod.SetItemMetadata(0, AdminAnnounceType.Station);
AnnounceMethod.AddItem(_localization.GetString("admin-announce-type-server"));
AnnounceMethod.SetItemMetadata(1, AdminAnnounceType.Server);
AnnounceMethod.AddItem(_localization.GetString("admin-announce-type-antag")); // Frontier
AnnounceMethod.SetItemMetadata(2, AdminAnnounceType.Antag); // Frontier
AnnounceMethod.OnItemSelected += AnnounceMethodOnOnItemSelected;
Announcement.OnKeyBindUp += AnnouncementOnOnTextChanged;
}
Expand All @@ -35,7 +37,8 @@ private void AnnouncementOnOnTextChanged(GUIBoundKeyEventArgs args)
private void AnnounceMethodOnOnItemSelected(OptionButton.ItemSelectedEventArgs args)
{
AnnounceMethod.SelectId(args.Id);
Announcer.Editable = ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Station) == AdminAnnounceType.Station;
Announcer.Editable = ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Station) == AdminAnnounceType.Station
|| ((AdminAnnounceType?)args.Button.SelectedMetadata ?? AdminAnnounceType.Antag) == AdminAnnounceType.Antag; // Frontier
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Client.Salvage;
using Content.Client.Station;
using Content.Server.Worldgen.Components.Debris;
using Content.Server._NF.Worldgen.Components.Debris;
using Content.Shared.Shipyard.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand Down
26 changes: 23 additions & 3 deletions Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Wieldable.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand Down Expand Up @@ -95,10 +96,29 @@ public override void Update(float frameTime)
// it's kinda tricky.
// I think as long as we make secondaries their own component it's probably fine
// as long as guncomp has an alt-use key then it shouldn't be too much of a PITA to deal with.
if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)

//Frontier: better support melee vs. ranged checks
/*if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)
{
return;
}*/

// Ranged component has priority over melee if both are supported.
bool gunBoundToUse = false;
bool gunBoundToAlt = false;
if (TryComp<GunComponent>(weaponUid, out var gun)) {
gunBoundToUse = gun.UseKey;
gunBoundToAlt = !gun.UseKey; //Bound to alt-use when false

// If ranged mode only works when wielded, do not block melee attacks when unwielded
// (e.g. crusher & crusher glaive)
if (TryComp<GunRequiresWieldComponent>(weaponUid, out var _) &&
TryComp<WieldableComponent>(weaponUid, out var wield)) {
gunBoundToUse &= wield.Wielded;
gunBoundToAlt &= wield.Wielded;
}
}
//End Frontier

var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);

Expand All @@ -119,7 +139,7 @@ public override void Update(float frameTime)
}

// Heavy attack.
if (altDown == BoundKeyState.Down)
if (altDown == BoundKeyState.Down && !gunBoundToAlt) //Frontier: add !gunBoundToAlt condition
{
// If it's an unarmed attack then do a disarm
if (weapon.AltDisarm && weaponUid == entity)
Expand All @@ -140,7 +160,7 @@ public override void Update(float frameTime)
}

// Light attack
if (useDown == BoundKeyState.Down)
if (useDown == BoundKeyState.Down && !gunBoundToUse) //Frontier: add !gunBoundToUse condition
{
var attackerPos = Transform(entity).MapPosition;

Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Administration/UI/AdminAnnounceEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Server.EUI;
using Content.Shared.Administration;
using Content.Shared.Eui;
using Robust.Shared.Audio; // Frontier

namespace Content.Server.Administration.UI
{
Expand Down Expand Up @@ -52,6 +53,9 @@ public override void HandleMessage(EuiMessageBase msg)
case AdminAnnounceType.Station:
_chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, colorOverride: Color.Gold);
break;
case AdminAnnounceType.Antag: // Frontier
_chatSystem.DispatchGlobalAnnouncement(doAnnounce.Announcement, doAnnounce.Announcer, true, new SoundPathSpecifier("/Audio/Announcements/war.ogg"), colorOverride: Color.Red);
break;
}

StateDirty();
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent com
("approverName", approverName),
("approverJob", approverJob),
("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
//_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); # Frontier
ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(uid).EntityName)));

// Log order approval
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
using Content.Shared.Tools.Systems;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Utility;
using Content.Server.Administration.Logs; // Frontier
using Content.Shared.Database; // Frontier

namespace Content.Server.VendingMachines
{
Expand All @@ -57,6 +59,8 @@ public sealed class VendingMachineSystem : SharedVendingMachineSystem

[Dependency] private readonly DamageableSystem _damageableSystem = default!;

[Dependency] private readonly IAdminLogManager _adminLogger = default!; // Frontier

private ISawmill _sawmill = default!;

public override void Initialize()
Expand Down Expand Up @@ -418,6 +422,9 @@ public void AuthorizedVend(EntityUid uid, EntityUid sender, InventoryType type,
}

UpdateVendingMachineInterfaceState(uid, component, bank.Balance);

_adminLogger.Add(LogType.Action, LogImpact.Low, // Frontier - Vending machine log
$"{ToPrettyString(sender):user} bought from [vendingMachine:{ToPrettyString(uid!)}, product:{proto.Name}, cost:{totalPrice}, with balance at {bank.Balance}"); // Frontier - Vending machine log
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using System.Linq;
using System.Numerics;
using Content.Server.Worldgen.Components;
using Content.Server.Worldgen.Components.Debris;
using Content.Server.Worldgen.Systems.GC;
using Content.Server.Worldgen.Tools;
using JetBrains.Annotations;
Expand All @@ -10,6 +9,8 @@
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.Worldgen.Components.Debris;
using Content.Server._NF.Worldgen.Components.Debris;

namespace Content.Server.Worldgen.Systems.Debris;

Expand Down Expand Up @@ -227,7 +228,8 @@ private void OnChunkLoaded(EntityUid uid, DebrisFeaturePlacerControllerComponent
var owned = EnsureComp<OwnedDebrisComponent>(ent);
owned.OwningController = uid;
owned.LastKey = point;
EnsureComp<SpaceDebrisComponent>(ent);

EnsureComp<SpaceDebrisComponent>(ent); // Frontier
}

if (failures > 0)
Expand Down
30 changes: 1 addition & 29 deletions Content.Server/Worldgen/Systems/GC/GCQueueSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System.Linq;
using System.Linq;
using Content.Server.Worldgen.Components.GC;
using Content.Server.Worldgen.Prototypes;
using Content.Shared.CCVar;
using JetBrains.Annotations;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
Expand All @@ -19,7 +18,6 @@ public sealed class GCQueueSystem : EntitySystem
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;

[ViewVariables] private TimeSpan _maximumProcessTime = TimeSpan.Zero;

Expand Down Expand Up @@ -72,32 +70,6 @@ public override void Update(float frameTime)
/// <param name="e">Entity to GC.</param>
public void TryGCEntity(EntityUid e)
{
if (!EntityManager.TryGetComponent<TransformComponent>(e, out var transform))
{
Log.Error("Entity was missing transform component");
return;
}

if (transform.GridUid == null)
{
Log.Error("Entity has no associated grid?");
return;
}

foreach (var player in Filter.Empty().AddInGrid(transform.GridUid.Value, EntityManager).Recipients)
{
if (player.AttachedEntity.HasValue)
{
var playerEntityUid = player.AttachedEntity.Value;
if (HasComp<GCAbleObjectComponent>(playerEntityUid))
{
// Mobs are NEVER immune (even if they're from a different grid, they shouldn't be here)
continue;
}
_transform.SetParent(playerEntityUid, transform.ParentUid);
}
}

if (!TryComp<GCAbleObjectComponent>(e, out var comp))
{
QueueDel(e); // not our problem :)
Expand Down
58 changes: 38 additions & 20 deletions Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Linq;
using System.Linq;
using Content.Server.Worldgen.Components;
using Content.Server.Worldgen.Components.Debris;
using Content.Shared.Humanoid;
using Content.Shared.Mobs.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Spawners;

using Content.Server._NF.Worldgen.Components.Debris; // Frontier
using Content.Shared.Humanoid; // Frontier
using Content.Shared.Mobs.Components; // Frontier
using System.Numerics; // Frontier
using Robust.Shared.Map; // Frontier
using Content.Server._NF.Salvage; // Frontier
using EntityPosition = (Robust.Shared.GameObjects.EntityUid Entity, Robust.Shared.Map.EntityCoordinates Coordinates);
using Robust.Shared.Spawners; // Frontier

namespace Content.Server.Worldgen.Systems;

Expand All @@ -17,21 +19,17 @@ public sealed class LocalityLoaderSystem : BaseWorldSystem
{
[Dependency] private readonly TransformSystem _xformSys = default!;

// Frontier
private List<(Entity<TransformComponent> Entity, EntityUid MapUid, Vector2 LocalPosition)> _detachEnts = new(); // Frontier
private EntityQuery<SpaceDebrisComponent> _debrisQuery;

private readonly List<(EntityUid Debris, List<EntityPosition> Entity)> _terminatingDebris = [];

// Duration to reset the despawn timer to when a debris is loaded into a player's view.
private const float DebrisActiveDuration = 1200; // 10 минут Corvax.

public override void Initialize()
{
_debrisQuery = GetEntityQuery<SpaceDebrisComponent>();

SubscribeLocalEvent<SpaceDebrisComponent, EntityTerminatingEvent>(OnDebrisDespawn);

EntityManager.EntityDeleted += OnEntityDeleted;
}
// Frontier

/// <inheritdoc />
public override void Update(float frameTime)
Expand Down Expand Up @@ -95,22 +93,42 @@ private void ResetTimedDespawn(EntityUid uid)
}
}

// Frontier
private void OnDebrisDespawn(EntityUid entity, SpaceDebrisComponent component, EntityTerminatingEvent e)
{
var mobQuery = AllEntityQuery<HumanoidAppearanceComponent, MobStateComponent, TransformComponent>();
if (entity != null)
{
// Handle mobrestrictions getting deleted
var query = AllEntityQuery<SalvageMobRestrictionsNFComponent>();

List<EntityPosition> positions = [];
while (query.MoveNext(out var salvUid, out var salvMob))
{
if (entity == salvMob.LinkedGridEntity)
{
QueueDel(salvUid);
}
}

var mobQuery = AllEntityQuery<HumanoidAppearanceComponent, MobStateComponent, TransformComponent>();
_detachEnts.Clear();

while (mobQuery.MoveNext(out var mob, out _, out _, out var xform))
if (xform.MapUid is not null && xform.GridUid == entity)
while (mobQuery.MoveNext(out var mobUid, out _, out _, out var xform))
{
positions.Add((mob, new(xform.MapUid.Value, _xformSys.GetWorldPosition(xform))));
if (xform.GridUid == null || entity != xform.GridUid.Value || xform.MapUid == null)
continue;

_xformSys.DetachParentToNull(mob, xform);
// Can't parent directly to map as it runs grid traversal.
_detachEnts.Add(((mobUid, xform), xform.MapUid.Value, _xformSys.GetWorldPosition(xform)));
_xformSys.DetachParentToNull(mobUid, xform);
}

_terminatingDebris.Add((entity, positions));
foreach (var detachEnt in _detachEnts)
{
_xformSys.SetCoordinates(detachEnt.Entity.Owner, new EntityCoordinates(detachEnt.MapUid, detachEnt.LocalPosition));
}
}
}
// Frontier

private void OnEntityDeleted(Entity<MetaDataComponent> entity)
{
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Administration/AdminAnnounceEuiState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public enum AdminAnnounceType
{
Station,
Server,
Antag, // Frontier
}

[Serializable, NetSerializable]
Expand Down
8 changes: 0 additions & 8 deletions Content.Shared/SpaceDebrisComponent.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Robust.Shared.GameStates;

namespace Content.Server._NF.Worldgen.Components.Debris;

[RegisterComponent, NetworkedComponent]
public sealed partial class SpaceDebrisComponent : Component
{
/// <summary>
/// TODO: Add this so we can track all the debris active entities.
/// </summary>
[DataField]
public List<EntityUid>? ActiveEntities;
}
22 changes: 22 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4658,3 +4658,25 @@ Entries:
message: new Cryo Chem
id: 4990
time: '2024-05-21T21:55:06.0000000+00:00'
- author: whatston3
changes:
- type: Add
message: 'Future ranged weapons can support melee attacks on the alt-use key. '
id: 4991
time: '2024-05-24T19:22:22.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: >-
Maintenance pass on a number of shuttles with minor changes to: Brigand,
Harbormaster, Kilderkin, Lantern, Legman, Liquidator and Searchlight;
Major changes to Gasbender and Pioneer. Gasbender is now expedition
capable. Pioneer is now smaller.
id: 4992
time: '2024-05-24T19:47:11.0000000+00:00'
- author: Myzumi
changes:
- type: Fix
message: Fixed Clippy not hearing Service Radio
id: 4993
time: '2024-05-26T14:18:25.0000000+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
admin-announce-type-antag = Antag
Loading
Loading