Skip to content

Commit

Permalink
Merge branch 'master' into Clothing-Contributions
Browse files Browse the repository at this point in the history
  • Loading branch information
Aikakakah authored Nov 7, 2024
2 parents 3c4c972 + 741464b commit b75e7ae
Show file tree
Hide file tree
Showing 1,498 changed files with 43,405 additions and 19,875 deletions.
13 changes: 6 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Guidelines: https://docs.spacestation14.io/en/getting-started/pr-guideline -->
<!-- If you are new to the Delta-V repository, please read the [Contributing Guidelines](https://github.com/DeltaV-Station/Delta-v/blob/master/CONTRIBUTING.md) -->

## About the PR
<!-- What did you change? -->
Expand All @@ -10,23 +10,22 @@
<!-- Summary of code changes for easier review. -->

## Media
<!-- Attach media if the PR makes ingame changes (clothing, items, features, etc).
Small fixes/refactors are exempt. Media may be used in SS14 progress reports with credit. -->
<!-- Attach media if the PR makes ingame changes (clothing, items, features, etc).
Small fixes/refactors are exempt. -->

## Requirements
<!-- Confirm the following by placing an X in the brackets [X]: -->
- [ ] I have read and am following the [Pull Request and Changelog Guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html).
- [ ] I have tested all added content and changes.
- [ ] I have added media to this PR or it does not require an ingame showcase.
<!-- You should understand that not following the above may get your PR closed at maintainer’s discretion -->

## Breaking changes
<!-- List any breaking changes, including namespaces, public class/method/field changes, prototype renames; and provide instructions for fixing them.
This will be posted in #codebase-changes. -->
<!-- List any breaking changes, including namespaces, public class/method/field changes, prototype renames; and provide instructions for fixing them. -->

**Changelog**
<!-- Add a Changelog entry to make players aware of new features or changes that could affect gameplay.
Make sure to read the guidelines and take this Changelog template out of the comment block in order for it to show up.
Changelog must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog. -->
Changelogs must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog. -->
<!--
:cl:
- add: Added fun!
Expand Down
101 changes: 101 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Delta-V Contributing Guidelines

Generally we follow [upstream's PR guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html) for code quality and such.

Importantly do not make webedits, copied verbatim from above:
> Do not use GitHub's web editor to create PRs. PRs submitted through the web editor may be closed without review.
Upstream is the [space-wizards/space-station-14](https://github.com/space-wizards/space-station-14) repository that wizden runs on.

# Content specific to Delta-V

In general anything you create from scratch (not modifying something that exists from upstream) should go in a DeltaV subfolder.

Examples:
- `Content.Server/DeltaV/Chapel/SacrificialAltarSystem.cs`
- `Resources/Prototypes/DeltaV/ai_factions.yml`
- `Resources/Audio/DeltaV/Items/gavel.ogg`
- `Resources/Textures/DeltaV/Icons/cri.rsi`
- `Resources/Locale/en-US/deltav/shipyard/shipyard-console.ftl`
The locale subfolder is lowercase `deltav` instead of `DeltaV`.
- `Resources/ServerInfo/Guidebook/DeltaV/AlertProcedure.xml`
Note that guidebooks go in `ServerInfo/Guidebook/DeltaV` and not `ServerInfo/DeltaV`!

# Changes to upstream files

If you make a change to an upstream C# or YAML file **you must add comments on or around the changed lines**.
The comments should clarify what changed, to make conflict resolution simpler when a file is changed upstream.

For YAML specifically, if you add a new component to a prototype add the comment to the `type: ...` line.
If you just modify some fields of a component, comment the fields instead.

For C# files, if you are adding a lot of code try to put it in a partial class when it makes sense.

The exception to this is early merging commits that are going to be cherry picked in the future regardless, there's no harm in leaving them as-is.

As an aside, fluent (.ftl) files **do not support comments on the same line** as a locale value, so be careful when changing them.

## Examples of comments in upstream files

A single line comment on a changed yml field:
```yml
- type: entity
parent: BasePDA
id: SciencePDA
name: epistemics PDA # DeltaV - Epistemics Department replacing Science
```
A pair of comments enclosing a list of added items to starting gear:
```yml
storage:
back:
- EmergencyRollerBedSpawnFolded
# Begin DeltaV additions
- BodyBagFolded
- Portafib
# End DeltaV additions
```

A comment on a new imported namespace:
```cs
using Content.Server.Psionics.Glimmer; // DeltaV
```

A pair of comments enclosing a block of added code:
```cs
private EntityUid Slice(...)
{
...

_transform.SetLocalRotation(sliceUid, 0);

// DeltaV - start of deep frier stuff
var slicedEv = new FoodSlicedEvent(user, uid, sliceUid);
RaiseLocalEvent(uid, ref slicedEv);
// DeltaV - end of deep frier stuff
...
}
```

# Mapping

If you want to make changes to a map, get in touch with its maintainer to make sure you don't both make changes at the same time.

Conflicts with maps make PRs mutually exclusive so either your work on the maintainer's work will be lost, communicate to avoid this!

# Before you submit

Double-check your diff on GitHub before submitting: look for unintended commits or changes and remove accidental whitespace or line-ending changes.

Additionally for long-lasting PRs, if you see `RobustToolbox` in the changed files you have to revert it, use `git checkout upstream/master RobustToolbox` (replacing `upstream` with the name of your DeltaV-Station/Delta-V remote)

# Changelogs

By default any changelogs goes in the DeltaV changelog, you can use the DeltaV admin changelog by putting `DELTAVADMIN:` in a line after `:cl:`.

Do not use `ADMIN:` as **it will mangle** the upstream admin changelog!

# Additional resources

If you are new to contributing to SS14 in general, have a look at the [SS14 docs](https://docs.spacestation14.io/) or ask for help in `#contribution-help` on [Discord](https://go.delta-v.org/AtDxv)!
27 changes: 27 additions & 0 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,29 @@ public override void Initialize()
SubscribeLocalEvent<EntityWorldTargetActionComponent, ComponentHandleState>(OnEntityWorldTargetHandleState);
}

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

var worldActionQuery = EntityQueryEnumerator<WorldTargetActionComponent>();
while (worldActionQuery.MoveNext(out var uid, out var action))
{
UpdateAction(uid, action);
}

var instantActionQuery = EntityQueryEnumerator<InstantActionComponent>();
while (instantActionQuery.MoveNext(out var uid, out var action))
{
UpdateAction(uid, action);
}

var entityActionQuery = EntityQueryEnumerator<EntityTargetActionComponent>();
while (entityActionQuery.MoveNext(out var uid, out var action))
{
UpdateAction(uid, action);
}
}

private void OnInstantHandleState(EntityUid uid, InstantActionComponent component, ref ComponentHandleState args)
{
if (args.Current is not InstantActionComponentState state)
Expand Down Expand Up @@ -96,6 +119,8 @@ private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, Ba
component.Icon = state.Icon;
component.IconOn = state.IconOn;
component.IconColor = state.IconColor;
component.OriginalIconColor = state.OriginalIconColor;
component.DisabledIconColor = state.DisabledIconColor;
component.Keywords.Clear();
component.Keywords.UnionWith(state.Keywords);
component.Enabled = state.Enabled;
Expand Down Expand Up @@ -126,6 +151,8 @@ public override void UpdateAction(EntityUid? actionId, BaseActionComponent? acti
if (!ResolveActionData(actionId, ref action))
return;

action.IconColor = action.Charges < 1 ? action.DisabledIconColor : action.OriginalIconColor;

base.UpdateAction(actionId, action);
if (_playerManager.LocalEntity != action.AttachedEntity)
return;
Expand Down
54 changes: 54 additions & 0 deletions Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed partial class AtmosAlertsComputerWindow : FancyWindow
{
private readonly IEntityManager _entManager;
private readonly SpriteSystem _spriteSystem;
private readonly SharedNavMapSystem _navMapSystem;

private EntityUid? _owner;
private NetEntity? _trackedEntity;
Expand All @@ -47,6 +48,7 @@ public AtmosAlertsComputerWindow(AtmosAlertsComputerBoundUserInterface userInter
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
_spriteSystem = _entManager.System<SpriteSystem>();
_navMapSystem = _entManager.System<SharedNavMapSystem>();

// Pass the owner to nav map
_owner = owner;
Expand Down Expand Up @@ -179,6 +181,9 @@ public void UpdateUI(EntityCoordinates? consoleCoords, AtmosAlertsComputerEntry[
// Add tracked entities to the nav map
foreach (var device in console.AtmosDevices)
{
if (!device.NetEntity.Valid)
continue;

if (!NavMap.Visible)
continue;

Expand Down Expand Up @@ -270,6 +275,34 @@ public void UpdateUI(EntityCoordinates? consoleCoords, AtmosAlertsComputerEntry[
else
MasterTabContainer.SetTabTitle(0, Loc.GetString("atmos-alerts-window-tab-alerts", ("value", activeAlarmCount)));

// Update sensor regions
NavMap.RegionOverlays.Clear();
var prioritizedRegionOverlays = new Dictionary<NavMapRegionOverlay, int>();

if (_owner != null &&
_entManager.TryGetComponent<TransformComponent>(_owner, out var xform) &&
_entManager.TryGetComponent<NavMapComponent>(xform.GridUid, out var navMap))
{
var regionOverlays = _navMapSystem.GetNavMapRegionOverlays(_owner.Value, navMap, AtmosAlertsComputerUiKey.Key);

foreach (var (regionOwner, regionOverlay) in regionOverlays)
{
var alarmState = GetAlarmState(regionOwner);

if (!TryGetSensorRegionColor(regionOwner, alarmState, out var regionColor))
continue;

regionOverlay.Color = regionColor.Value;

var priority = (_trackedEntity == regionOwner) ? 999 : (int)alarmState;
prioritizedRegionOverlays.Add(regionOverlay, priority);
}

// Sort overlays according to their priority
var sortedOverlays = prioritizedRegionOverlays.OrderBy(x => x.Value).Select(x => x.Key).ToList();
NavMap.RegionOverlays = sortedOverlays;
}

// Auto-scroll re-enable
if (_autoScrollAwaitsUpdate)
{
Expand Down Expand Up @@ -298,6 +331,27 @@ private void AddTrackedEntityToNavMap(AtmosAlertsDeviceNavMapData metaData, Atmo
NavMap.TrackedEntities[metaData.NetEntity] = blip;
}

private bool TryGetSensorRegionColor(NetEntity regionOwner, AtmosAlarmType alarmState, [NotNullWhen(true)] out Color? color)
{
color = null;

var blip = GetBlipTexture(alarmState);

if (blip == null)
return false;

// DeltaV: fix client until upstream does
// Color the region based on alarm state and entity tracking
var output = blip.Value.Item2 * new Color(154, 154, 154);

if (_trackedEntity != null && _trackedEntity != regionOwner)
output *= Color.DimGray;

color = output;

return true;
}

private void UpdateUIEntry(AtmosAlertsComputerEntry entry, int index, Control table, AtmosAlertsComputerComponent console, AtmosAlertsFocusDeviceData? focusData = null)
{
// Make new UI entry if required
Expand Down
7 changes: 3 additions & 4 deletions Content.Client/Audio/ContentAudioSystem.LobbyMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public sealed partial class ContentAudioSystem
{
[Dependency] private readonly IBaseClient _client = default!;
[Dependency] private readonly ClientGameTicker _gameTicker = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;

private readonly AudioParams _lobbySoundtrackParams = new(-5f, 1, 0, 0, 0, false, 0f);
Expand Down Expand Up @@ -71,7 +70,7 @@ private void InitializeLobbyMusic()
Subs.CVar(_configManager, CCVars.LobbyMusicEnabled, LobbyMusicCVarChanged);
Subs.CVar(_configManager, CCVars.LobbyMusicVolume, LobbyMusicVolumeCVarChanged);

_stateManager.OnStateChanged += StateManagerOnStateChanged;
_state.OnStateChanged += StateManagerOnStateChanged;

_client.PlayerLeaveServer += OnLeave;

Expand Down Expand Up @@ -115,7 +114,7 @@ private void LobbyMusicVolumeCVarChanged(float volume)

private void LobbyMusicCVarChanged(bool musicEnabled)
{
if (musicEnabled && _stateManager.CurrentState is LobbyState)
if (musicEnabled && _state.CurrentState is LobbyState)
{
StartLobbyMusic();
}
Expand Down Expand Up @@ -234,7 +233,7 @@ private void PlayRestartSound(RoundRestartCleanupEvent ev)

private void ShutdownLobbyMusic()
{
_stateManager.OnStateChanged -= StateManagerOnStateChanged;
_state.OnStateChanged -= StateManagerOnStateChanged;

_client.PlayerLeaveServer -= OnLeave;

Expand Down
16 changes: 0 additions & 16 deletions Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BuckleComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<BuckleComponent, AppearanceChangeEvent>(OnAppearanceChange);
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
}
Expand Down Expand Up @@ -57,21 +56,6 @@ private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveE
}
}

private void OnHandleState(Entity<BuckleComponent> ent, ref ComponentHandleState args)
{
if (args.Current is not BuckleState state)
return;

ent.Comp.DontCollide = state.DontCollide;
ent.Comp.BuckleTime = state.BuckleTime;
var strapUid = EnsureEntity<BuckleComponent>(state.BuckledTo, ent);

SetBuckledTo(ent, strapUid == null ? null : new (strapUid.Value, null));

var (uid, component) = ent;

}

private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args)
{
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
Expand Down
21 changes: 21 additions & 0 deletions Content.Client/Cargo/Systems/ClientPriceGunSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared.Timing;
using Content.Shared.Cargo.Systems;

namespace Content.Client.Cargo.Systems;

/// <summary>
/// This handles...
/// </summary>
public sealed class ClientPriceGunSystem : SharedPriceGunSystem
{
[Dependency] private readonly UseDelaySystem _useDelay = default!;

protected override bool GetPriceOrBounty(EntityUid priceGunUid, EntityUid target, EntityUid user)
{
if (!TryComp(priceGunUid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((priceGunUid, useDelay)))
return false;

// It feels worse if the cooldown is predicted but the popup isn't! So only do the cooldown reset on the server.
return true;
}
}
10 changes: 10 additions & 0 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ public void Initialize()
_sawmill.Level = LogLevel.Info;
}

public void SendAdminAlert(string message)
{
// See server-side manager. This just exists for shared code.
}

public void SendAdminAlert(EntityUid player, string message)
{
// See server-side manager. This just exists for shared code.
}

public void SendMessage(string text, ChatSelectChannel channel)
{
var str = text.ToString();
Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Chat/Managers/IChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace Content.Client.Chat.Managers
{
public interface IChatManager
public interface IChatManager : ISharedChatManager
{
void Initialize();

public void SendMessage(string text, ChatSelectChannel channel);

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
if (layerData.State is not null && inventory.SpeciesId is not null && layerData.State.EndsWith(inventory.SpeciesId))
continue;

_displacement.TryAddDisplacement(displacementData, sprite, index, key, revealedLayers);
if (_displacement.TryAddDisplacement(displacementData, sprite, index, key, revealedLayers))
index++;
}
}

Expand Down
Loading

0 comments on commit b75e7ae

Please sign in to comment.