Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into 2024-05-Expedition-Factions
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhardSteinhauer authored May 24, 2024
2 parents 037a251 + f59430f commit a3c7961
Show file tree
Hide file tree
Showing 71 changed files with 8,087 additions and 9,247 deletions.
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
}
}
}
9 changes: 9 additions & 0 deletions Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ protected void DrawCircles(DrawingHandleScreen handle)
}
}

// Frontier Corvax: north line drawing
protected void DrawNorthLine(DrawingHandleScreen handle, Angle angle)
{
var origin = ScalePosition(-new Vector2(Offset.X, -Offset.Y));
var aExtent = (angle - Math.Tau / 4).ToVec() * ScaledMinimapRadius * 1.42f;
var lineColor = Color.Red.WithAlpha(0.1f);
handle.DrawLine(origin, origin + aExtent, lineColor);
}

protected void DrawGrid(DrawingHandleScreen handle, Matrix3 matrix, Entity<MapGridComponent> grid, Color color, float alpha = 0.01f)
{
var rator = Maps.GetAllTilesEnumerator(grid.Owner, grid.Comp);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Shuttles/UI/ShuttleDockControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected override void Draw(DrawingHandleScreen handle)
}

DrawCircles(handle);
DrawNorthLine(handle, _angle.Value); // Frontier Corvax: north line drawing
var gridNent = EntManager.GetNetEntity(GridEntity);
var mapPos = _xformSystem.ToMapCoordinates(_coordinates.Value);
var ourGridMatrix = _xformSystem.GetWorldMatrix(gridXform.Owner);
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ protected override void Draw(DrawingHandleScreen handle)
Matrix3.Multiply(posMatrix, ourEntMatrix, out var ourWorldMatrix);
var ourWorldMatrixInvert = ourWorldMatrix.Invert();

// Frontier Corvax: north line drawing
var rot = ourEntRot + _rotation.Value;
DrawNorthLine(handle, rot);

// Draw our grid in detail
var ourGridId = xform.GridUid;
if (EntManager.TryGetComponent<MapGridComponent>(ourGridId, out var ourGrid) &&
Expand Down Expand Up @@ -178,7 +182,6 @@ protected override void Draw(DrawingHandleScreen handle)

handle.DrawPrimitives(DrawPrimitiveTopology.TriangleFan, radarPosVerts, Color.Lime);

var rot = ourEntRot + _rotation.Value;
var viewBounds = new Box2Rotated(new Box2(-WorldRange, -WorldRange, WorldRange, WorldRange).Translated(mapPos.Position), rot, mapPos.Position);
var viewAABB = viewBounds.CalcBoundingBox();

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 @@ -407,6 +411,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,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Numerics;
using Content.Server.Worldgen.Components;
using Content.Server.Worldgen.Components.Debris;
Expand All @@ -10,6 +10,7 @@
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server._NF.Worldgen.Components.Debris; // Frontier

namespace Content.Server.Worldgen.Systems.Debris;

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

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
60 changes: 58 additions & 2 deletions Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
using Content.Server.Worldgen.Components;
using Content.Server.Worldgen.Components;
using Robust.Server.GameObjects;
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); // Frontier

namespace Content.Server.Worldgen.Systems;

Expand All @@ -10,6 +18,18 @@ 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 = [];

public override void Initialize()
{
_debrisQuery = GetEntityQuery<SpaceDebrisComponent>();
SubscribeLocalEvent<SpaceDebrisComponent, EntityTerminatingEvent>(OnDebrisDespawn);
}
// Frontier

/// <inheritdoc />
public override void Update(float frameTime)
{
Expand Down Expand Up @@ -54,10 +74,46 @@ public override void Update(float frameTime)
}
}
}

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

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 mobUid, out _, out _, out var xform))
{
if (xform.GridUid == null || entity != xform.GridUid.Value || xform.MapUid == null)
continue;

// 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);
}

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

/// <summary>
/// A directed fired on a loadable entity when a local loader enters it's vicinity.
/// </summary>
public record struct LocalStructureLoadedEvent;

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
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;
}
34 changes: 34 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4640,3 +4640,37 @@ Entries:
message: News consoles now publish and delete articles properly.
id: 4987
time: '2024-05-20T20:21:05.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Add
message: Added north line to shuttle console GUI (code by @FireNameFN)
id: 4988
time: '2024-05-20T23:38:12.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: Starting black web vest no longer come with additional armor inserts.
id: 4989
time: '2024-05-21T21:04:54.0000000+00:00'
- author: neuPanda
changes:
- type: Add
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'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
admin-announce-type-antag = Antag
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/reagents/meta/chemicals.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reagent-name-salicylicacid = salicylic acid
reagent-desc-salicylicacid = A powdery substance used for dermatological treatments.
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/reagents/meta/medicine.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reagent-name-tramoxadone = tramoxadone
reagent-desc-tramoxadone = A cryogenics chemical. Used to treat severe trauma via regeneration of the damaged tissue. Works regardless of the patient being alive or dead.
Loading

0 comments on commit a3c7961

Please sign in to comment.