Skip to content

Commit

Permalink
Merge branch 'master' into DeltaV-Station_Delta-v_1052_2024-04-07
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed May 4, 2024
2 parents 66f26bc + 47c9bb6 commit bd20340
Show file tree
Hide file tree
Showing 130 changed files with 1,894 additions and 159 deletions.
3 changes: 3 additions & 0 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
// note that every insertion requires reshuffling & remapping all the existing layers.
sprite.AddBlankLayer(index);
sprite.LayerMapSet(key, index);

if (layerData.Color != null)
sprite.LayerSetColor(key, layerData.Color.Value);
}
else
index = sprite.LayerMapReserveBlank(key);
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Drugs/DrugOverlaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private void OnPlayerAttached(EntityUid uid, SeeingRainbowsComponent component,
private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args)
{
_overlay.Intoxication = 0;
_overlay.TimeTicker = 0;
_overlayMan.RemoveOverlay(_overlay);
}

Expand All @@ -52,6 +53,7 @@ private void OnShutdown(EntityUid uid, SeeingRainbowsComponent component, Compon
if (_player.LocalEntity == uid)
{
_overlay.Intoxication = 0;
_overlay.TimeTicker = 0;
_overlayMan.RemoveOverlay(_overlay);
}
}
Expand Down
13 changes: 12 additions & 1 deletion Content.Client/Drugs/RainbowOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public sealed class RainbowOverlay : Overlay
private readonly ShaderInstance _rainbowShader;

public float Intoxication = 0.0f;
public float TimeTicker = 0.0f;

private const float VisualThreshold = 10.0f;
private const float PowerDivisor = 250.0f;
Expand Down Expand Up @@ -48,7 +49,17 @@ protected override void FrameUpdate(FrameEventArgs args)
return;

var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;

TimeTicker += args.DeltaSeconds;

if (timeLeft - TimeTicker > timeLeft / 16f)
{
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
}
else
{
Intoxication -= Intoxication/(timeLeft - TimeTicker) * args.DeltaSeconds;
}
}

protected override bool BeforeDraw(in OverlayDrawArgs args)
Expand Down
14 changes: 11 additions & 3 deletions Content.Client/Shuttles/UI/MapScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,22 @@ private void RebuildMapObjects()

foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
{
_entManager.TryGetComponent(grid.Owner, out IFFComponent? iffComp);

var gridObj = new GridMapObject()
{
Name = _entManager.GetComponent<MetaDataComponent>(grid.Owner).EntityName,
Entity = grid.Owner
Entity = grid.Owner,
HideButton = iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0,
};

// Always show our shuttle immediately
if (grid.Owner == _shuttleEntity)
{
AddMapObject(mapComp.MapId, gridObj);
}
else
else if (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0)
{
_pendingMapObjects.Add((mapComp.MapId, gridObj));
}
Expand Down Expand Up @@ -423,10 +427,14 @@ public void SetMap(MapId mapId, Vector2 position)
/// </summary>
private void AddMapObject(MapId mapId, IMapObject mapObj)
{
var gridContents = _mapHeadings[mapId];
var existing = _mapObjects.GetOrNew(mapId);
existing.Add(mapObj);

if (mapObj.HideButton)
return;

var gridContents = _mapHeadings[mapId];

var gridButton = new Button()
{
Text = mapObj.Name,
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected override void Draw(DrawingHandleScreen handle)
// Rudimentary IFF for now, if IFF hiding on then we don't show on the map at all
if (grid.Owner != _shuttleEntity &&
EntManager.TryGetComponent(grid, out iffComp) &&
(iffComp.Flags & (IFFFlags.Hide | IFFFlags.HideLabel)) != 0x0)
(iffComp.Flags & IFFFlags.Hide) != 0x0)
{
continue;
}
Expand All @@ -367,6 +367,9 @@ protected override void Draw(DrawingHandleScreen handle)
AddMapObject(existingEdges, existingVerts, mapObject);

// Text
if (iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0)
continue;

// Force drawing it at this point.
var iffText = _shuttles.GetIFFLabel(grid, self: true, component: iffComp);

Expand Down
27 changes: 24 additions & 3 deletions Content.Client/Sprite/RandomSpriteSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Client.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Sprite;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
Expand All @@ -8,6 +10,7 @@ namespace Content.Client.Sprite;
public sealed class RandomSpriteSystem : SharedRandomSpriteSystem
{
[Dependency] private readonly IReflectionManager _reflection = default!;
[Dependency] private readonly ClientClothingSystem _clothing = default!;

public override void Initialize()
{
Expand All @@ -31,10 +34,29 @@ private void OnHandleState(EntityUid uid, RandomSpriteComponent component, ref C
component.Selected.Add(layer.Key, layer.Value);
}

UpdateAppearance(uid, component);
UpdateSpriteComponentAppearance(uid, component);
UpdateClothingComponentAppearance(uid, component);
}

private void UpdateAppearance(EntityUid uid, RandomSpriteComponent component, SpriteComponent? sprite = null)
private void UpdateClothingComponentAppearance(EntityUid uid, RandomSpriteComponent component, ClothingComponent? clothing = null)
{
if (!Resolve(uid, ref clothing, false))
return;

if (clothing.ClothingVisuals == null)
return;

foreach (var slotPair in clothing.ClothingVisuals)
{
foreach (var keyColorPair in component.Selected)
{
_clothing.SetLayerColor(clothing, slotPair.Key, keyColorPair.Key, keyColorPair.Value.Color);
_clothing.SetLayerState(clothing, slotPair.Key, keyColorPair.Key, keyColorPair.Value.State);
}
}
}

private void UpdateSpriteComponentAppearance(EntityUid uid, RandomSpriteComponent component, SpriteComponent? sprite = null)
{
if (!Resolve(uid, ref sprite, false))
return;
Expand All @@ -55,7 +77,6 @@ private void UpdateAppearance(EntityUid uid, RandomSpriteComponent component, Sp
continue;
}
}

sprite.LayerSetState(index, layer.Value.State);
sprite.LayerSetColor(index, layer.Value.Color ?? Color.White);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private bool CanDock(

foreach (var config in configs)
{
if (config.Coordinates.Equals(coordinates) && config.Angle.EqualsApprox(angle, 0.01))
if (config.Coordinates.Equals(coordinates) && config.Angle.EqualsApprox(angle, 0.15))
{
return config;
}
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Zombies/PendingZombieComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public sealed partial class PendingZombieComponent : Component
{
DamageDict = new ()
{
{ "Blunt", 0.25 },
{ "Poison", 0.1 },
{ "Poison", 0.3 },
}
};

Expand Down
33 changes: 33 additions & 0 deletions Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,38 @@ public void CopyVisuals(EntityUid uid, ClothingComponent otherClothing, Clothing
Dirty(uid, clothing);
}

public void SetLayerColor(ClothingComponent clothing, string slot, string mapKey, Color? color)
{
if (clothing.ClothingVisuals == null)
return;

foreach (var layer in clothing.ClothingVisuals[slot])
{
if (layer.MapKeys == null)
return;

if (!layer.MapKeys.Contains(mapKey))
continue;

layer.Color = color;
}
}
public void SetLayerState(ClothingComponent clothing, string slot, string mapKey, string state)
{
if (clothing.ClothingVisuals == null)
return;

foreach (var layer in clothing.ClothingVisuals[slot])
{
if (layer.MapKeys == null)
return;

if (!layer.MapKeys.Contains(mapKey))
continue;

layer.State = state;
}
}

#endregion
}
6 changes: 3 additions & 3 deletions Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void SetIFFColor(EntityUid gridUid, Color color, IFFComponent? component
return;

component.Color = color;
Dirty(component);
Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}

Expand All @@ -73,7 +73,7 @@ public void AddIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? componen
return;

component.Flags |= flags;
Dirty(component);
Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}

Expand All @@ -87,7 +87,7 @@ public void RemoveIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? compo
return;

component.Flags &= ~flags;
Dirty(component);
Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}
}
1 change: 1 addition & 0 deletions Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
public record struct GridMapObject : IMapObject
{
public string Name { get; set; }
public bool HideButton { get; init; }
public EntityUid Entity;
}
5 changes: 5 additions & 0 deletions Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
public interface IMapObject
{
string Name { get; }

/// <summary>
/// Should we hide the button from being shown (AKA just draw it).
/// </summary>
bool HideButton { get; }
}
5 changes: 4 additions & 1 deletion Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
namespace Content.Shared.Shuttles.UI.MapObjects;

[Serializable, NetSerializable]
public readonly record struct ShuttleBeaconObject(NetEntity Entity, NetCoordinates Coordinates, string Name) : IMapObject;
public readonly record struct ShuttleBeaconObject(NetEntity Entity, NetCoordinates Coordinates, string Name) : IMapObject
{
public bool HideButton => false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
namespace Content.Shared.Shuttles.UI.MapObjects;

[Serializable, NetSerializable]
public record struct ShuttleExclusionObject(NetCoordinates Coordinates, float Range, string Name = "") : IMapObject;
public record struct ShuttleExclusionObject(NetCoordinates Coordinates, float Range, string Name = "") : IMapObject
{
public bool HideButton => false;
}
4 changes: 2 additions & 2 deletions Content.Shared/Zombies/ZombieComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public sealed partial class ZombieComponent : Component, IAntagStatusIconCompone
/// The baseline infection chance you have if you are completely nude
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float MaxZombieInfectionChance = 0.50f;
public float MaxZombieInfectionChance = 0.80f;

/// <summary>
/// The minimum infection chance possible. This is simply to prevent
/// being invincible by bundling up.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float MinZombieInfectionChance = 0.20f;
public float MinZombieInfectionChance = 0.50f;

[ViewVariables(VVAccess.ReadWrite)]
public float ZombieMovementSpeedDebuff = 0.70f;
Expand Down
Binary file modified Resources/Audio/Voice/Misc/silly_snore.ogg
Binary file not shown.
8 changes: 8 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4038,3 +4038,11 @@ Entries:
message: Species in the character editor have a shortcut to their guidebook entry
id: 6105
time: '2024-03-23T02:09:54.0000000+00:00'
- author: LovelyLophi
changes:
- type: Tweak
message: >-
Sectech now says "Crack communist skulls!" instead of "Crack syndicate
skulls!"
id: 6106
time: '2024-04-17T04:07:41.0000000+00:00'
Loading

0 comments on commit bd20340

Please sign in to comment.