diff --git a/.wiki/_DV/Laws/SpaceLaw.txt b/.wiki/_DV/Laws/SpaceLaw.txt index 3047daacac3..99361d3f393 100644 --- a/.wiki/_DV/Laws/SpaceLaw.txt +++ b/.wiki/_DV/Laws/SpaceLaw.txt @@ -269,7 +269,7 @@ Sentencing modifiers are to be applied by the sentencing officer, judge, or arbi | style="border: 1px solid black;" | [[File:SL_BreakingAndEntering.png]] ! style="border: 1px solid black;" | {{anchor|Breaking and Entering}}Breaking and Entering | style="border: 1px solid black;" | 5 minutes -| style="border: 1px solid black;" | To break and enter into a high security area where one is not authorised nor invited, with intent to commit a crime within. +| style="border: 1px solid black;" | To break and enter into an area where one is not authorised nor invited. |- | style="border: 1px solid black;" | 203 | style="border: 1px solid black;" | [[File:SL_Rioting.png]] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 447e62aa0b3..cf27bbfc228 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,28 +73,88 @@ If you are adding a lot of C# code, then take advantage of partial classes. Put Otherwise, **add comments on or around any changed lines.** -A comment on a new imported namespace: +### Single-Line Changes +Format should look like this. ```cs -using Content.Server.Psionics.Glimmer; // DeltaV +/* Importing Namespaces - Include optional comment if its not obvious what its being used for. */ +using Content.Server._DV.Psionics.Glimmer; // DeltaV +using Content.Shared.Damage.Systems; // DeltaV - Addition of HandHeldArmor + +/* Changing an upstream line - Same line as the change */ +if (!TryComp(ent, out var eye) || _disabled) // DeltaV - check if disabled + +/* Adding - Either same line or above the line. */ + EnsureComp(entity); // Deltav - Psionics + +/* "Deleting" - Don't actually delete, just comment out and say why. This only applies to upstream code. */ +// args.StatusIcons.Add(_prototype.Index(component.Icon)); // DeltaV - commented out. status icon now added above ``` -A pair of comments enclosing a block of added code: +> * Its pretty obvious in the example above that importing `Content.Server._DV.Psionics.Glimmer` means we'll be interacting with glimmer so putting `// DeltaV - Add Glimmer` is needlessly redundant. +> * It's not as obvious what the `Content.Shared.Damage.Systems` namespace is used for, since its so broad, so adding a comment what feature is using it helps. +> * Actual code changes should almost always include the comment after ``// DeltaV`. + +### Multi-Line Changes +Depending on how much you are editing, putting a comment on EACH line may be excessive, so if you have a larger block of code you are changing, denote it like so: ```cs -private EntityUid Slice(...) +// BEGIN DeltaV - Remove innate radio and radios from pockets +for (var i = 1; i <= 4; i++) // Arachnids have 4 pockets { - ... - - _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 - - ... + if (_inventory.TryGetSlotEntity(target, $"pocket{i}", out var headset) && HasComp(headset)) + _inventory.TryUnequip(target, $"pocket{i}", true, true); } + +RemComp(target); // If the zombie has an innate radio, get rid of it. +// END DeltaV ``` +> * Denoting these with a BEGIN and END clearly shows they are block of code without having to read the entire comment. This makes it easier to tell when you're dealing with single-line comments versus a block with merging in conflicts. +> * Case and order of the first two words is less of a concern. `// DeltaV Begin` or `// Begin DeltaV` will work fine too. +> * Try to make your blocks as small as possible, but use your discretion. +> * If you deleting multiple lines, use line comments (``//``) if its a few lines but if its a larger block (like commenting out an entire function), it is preferable to use block comments (`/* */`). + +#### Soft Exceptions to the Multi-Line "Rules" +Some multi-line changes can use a single-line comment in certain scenarios. But if you are UNSURE, just use `// BEGIN DeltaV` and `// END DeltaV` comments like the previous section does and it'll be fine. + +I'll give some examples. +```cs +/* This change comments out 3 lines but only needs a single line comment because commenting out the if statement implies that its logic will be commented out too. */ +// if (obj.WasModified()) // DeltaV - Refreshed in TraitsTab +// { +// _profileEditor.RefreshTraits(); +// } + +/* Same principle here. This adds two lines but the if statement implies the next line so commenting both lines isn't really needed. */ +if (_flight.IsFlying(entity.Owner)) // DeltaV - Harpy Flight + return true; +``` +### New Methods or Component Variables +Sometimes, you'll need to implement a whole new method or component variable and instead of wrapping it in `// BEGIN DeltaV` and `// END DeltaV`, you can just denote that it's a DeltaV function in the summary block before the function. This denotes the WHOLE function as a DeltaV addition. + +```cs +/* New Method Example */ +/// +/// DeltaV - Handle revealing ninja if cloaked when attacked by a hitscan attack. +/// +private void OnNinjaAttacked(Entity ent, ref DamageChangedEvent args) +{ + ... +} + +/* New Component Variable Example */ +/// +/// DeltaV - If disabled the action will not disable when no charges remain. Use if you want to handle no charges differently. +/// +[DataField] +public bool DisableWhenEmpty = true; +``` + +In short: +* Use `// BEGIN DeltaV` and `// END Delta` to denote a *block* of changes. + * Keep blocks as small as possible. +* Use `// DeltaV` on or before the line if its not a block of changes. +* Use exceptions when they make sense. + ### Changing Upstream Localization Fluent .ftl files **Move all changed locale strings to a new DeltaV file** - use a `.ftl` file in the `_DV` folder. Comment out the old strings in the upstream file, and explain that they were moved. @@ -104,10 +164,10 @@ Example: Commented out old string in `Resources\Locale\en-US\xenoarchaeology\artifact-analyzer.ftl` ``` # DeltaV - moved to _DV file -#analysis-console-info-effect-value = [font="Monospace" size=11][color=gray]{ $state -> -# [true] {$info} -# *[false] Unlock nodes to gain info -#}[/color][/font] +# analysis-console-info-effect-value = [font="Monospace" size=11][color=gray]{ $state -> +# [true] {$info} +# *[false] Unlock nodes to gain info +# }[/color][/font] ``` The new version of the string in `Resources\Locale\en-US\_DV\xenoarchaeology\artifact-analyzer.ftl` diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 1614b4ab67f..5d963b5dddd 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -8,12 +8,14 @@ using Content.Shared.CCVar; using Content.Shared.Ghost; using Content.Shared.Mind; using Content.Shared.Roles; +using Content.Shared.SSDIndicator; // DeltaV - SSD time indicator using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Shared.Configuration; using Robust.Shared.Enums; using Robust.Shared.Prototypes; +using Robust.Shared.Timing; // DeltaV - SSD time indicator namespace Content.Client.Administration; @@ -26,6 +28,7 @@ internal sealed class AdminNameOverlay : Overlay private readonly IUserInterfaceManager _userInterfaceManager; private readonly SharedRoleSystem _roles; private readonly IPrototypeManager _prototypeManager; + private readonly IGameTiming _timing; // DeltaV - Add timing private readonly Font _font; private readonly Font _fontBold; private AdminOverlayAntagFormat _overlayFormat; @@ -53,7 +56,8 @@ internal sealed class AdminNameOverlay : Overlay IUserInterfaceManager userInterfaceManager, IConfigurationManager config, SharedRoleSystem roles, - IPrototypeManager prototypeManager) + IPrototypeManager prototypeManager, + IGameTiming timing) // DeltaV - Add timing { _system = system; _entityManager = entityManager; @@ -62,6 +66,7 @@ internal sealed class AdminNameOverlay : Overlay _userInterfaceManager = userInterfaceManager; _roles = roles; _prototypeManager = prototypeManager; + _timing = timing; // DeltaV - Add timing ZIndex = 200; // Setting these to a specific ttf would break the antag symbols _font = resourceCache.NotoStack(); @@ -231,6 +236,18 @@ internal sealed class AdminNameOverlay : Overlay currentOffset += lineoffset; } + // DeltaV - SSD Time START + if (_entityManager.TryGetComponent(entity, out var ssdIndicator) + && ssdIndicator.SsdSince is {} ssdSince) + { + color = Color.MediumPurple; + color.A = alpha; + var ssdText = Loc.GetString("admin-overlay-ssd-time", ("time", (_timing.CurTime - ssdSince).ToString("%hh':'mm':'ss"))); + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, ssdText, uiScale, color); + currentOffset += lineoffset; + } + // DeltaV END + // Determine antag symbol string? symbol; switch (_overlaySymbolStyle) diff --git a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs index e000bdc0ba0..e406ce69bfd 100644 --- a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs +++ b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs @@ -5,6 +5,7 @@ using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Shared.Configuration; using Robust.Shared.Prototypes; +using Robust.Shared.Timing; // DeltaV - SSD time indicator namespace Content.Client.Administration.Systems { @@ -19,6 +20,7 @@ namespace Content.Client.Administration.Systems [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly SharedRoleSystem _roles = default!; [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly IGameTiming _timing = default!; // DeltaV - added for SSD time indicator private AdminNameOverlay _adminNameOverlay = default!; @@ -36,7 +38,8 @@ namespace Content.Client.Administration.Systems _userInterfaceManager, _configurationManager, _roles, - _proto); + _proto, + _timing); // DeltaV - Add timing _adminManager.AdminStatusUpdated += OnAdminStatusUpdated; } diff --git a/Content.Client/Doors/DoorSystem.cs b/Content.Client/Doors/DoorSystem.cs index dc16b2ba7bb..3f116141d47 100644 --- a/Content.Client/Doors/DoorSystem.cs +++ b/Content.Client/Doors/DoorSystem.cs @@ -191,6 +191,9 @@ public sealed class DoorSystem : SharedDoorSystem case DoorState.Denying: // ES START // AnimationKey -> DenyKey + if (_animationSystem.HasRunningAnimation(entity, DoorComponent.DenyKey)) + return; + _animationSystem.Play(entity, (Animation)entity.Comp.DenyingAnimation, DoorComponent.DenyKey); // ES END @@ -198,6 +201,9 @@ public sealed class DoorSystem : SharedDoorSystem case DoorState.Emagging: // ES START // AnimationKey -> DenyKey + if (_animationSystem.HasRunningAnimation(entity, DoorComponent.EmagKey)) + return; + if (_sprite.TryGetLayer(entity.Owner, DoorVisualLayers.BaseEmagging, out var _, false)) _animationSystem.Play(entity, (Animation)entity.Comp.EmaggingAnimation, DoorComponent.EmagKey); // ES END diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml b/Content.Client/Options/UI/Tabs/MiscTab.xaml index 8a73aa9aec4..1c6f82b5581 100644 --- a/Content.Client/Options/UI/Tabs/MiscTab.xaml +++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml @@ -20,6 +20,7 @@ +