Skip to content

Commit

Permalink
Merge branch 'master' into pirates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratyyy authored Dec 21, 2024
2 parents ba3670c + 2b6fe4a commit 7c67efa
Show file tree
Hide file tree
Showing 96 changed files with 2,457 additions and 158 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Shared._RMC14.Stealth;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Prototypes;

namespace Content.Client._RMC14.Stealth;

public sealed class EntityInvisibilityVisualsSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypes = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<EntityTurnInvisibleComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<EntityTurnInvisibleComponent, ComponentShutdown>(OnShutdown);
}

private void OnStartup(Entity<EntityTurnInvisibleComponent> ent, ref ComponentStartup args)
{
if (!TryComp(ent, out SpriteComponent? sprite))
return;

sprite.PostShader = _prototypes.Index<ShaderPrototype>("RMCInvisible").InstanceUnique();
}

private void OnShutdown(Entity<EntityTurnInvisibleComponent> ent, ref ComponentShutdown args)
{
if (TerminatingOrDeleted(ent))
return;

if (!TryComp(ent, out SpriteComponent? sprite))
return;

sprite.PostShader = null;
}

public override void Update(float frameTime)
{
var invisible = EntityQueryEnumerator<EntityTurnInvisibleComponent, SpriteComponent>();
while (invisible.MoveNext(out var uid, out var comp, out var sprite))
{
var opacity = TryComp<EntityActiveInvisibleComponent>(uid, out var activeInvisible) ? activeInvisible.Opacity : 1;
sprite.PostShader?.SetParameter("visibility", opacity);
}
}
}
4 changes: 4 additions & 0 deletions Content.Client/StatusIcon/StatusIconSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
using Content.Shared._RMC14.Stealth; // ADT Tweak

namespace Content.Client.StatusIcon;

Expand Down Expand Up @@ -85,6 +86,9 @@ public bool IsVisible(Entity<MetaDataComponent> ent, StatusIconData data)
if (data.HideOnStealth && TryComp<StealthComponent>(ent, out var stealth) && stealth.Enabled)
return false;

if (data.HideOnStealth && HasComp<EntityActiveInvisibleComponent>(ent)) // ADT Tweak
return false;

if (data.ShowTo != null && !_entityWhitelist.IsValid(data.ShowTo, viewer))
return false;

Expand Down
29 changes: 29 additions & 0 deletions Content.Server/ADT/Abilities/XenoQeen/XenoQeenComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Abilities.XenoQeen
{
/// <summary>
/// Lets its owner entity use mime powers, like placing invisible walls.
/// </summary>
[RegisterComponent]
public sealed partial class XenoQeenComponent : Component
{
/// <summary>
/// Whether this component is active or not.
/// </summarY>
[DataField("enabled")]
public bool Enabled = true;

/// <summary>
/// The wall prototype to use.
/// </summary>
[DataField("wallPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string XenoTurret = "WeaponTurretXeno";

[DataField("xenoTurretAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? XenoTurretAction = "ActionXenoQeenTurret";

[DataField("xenoTurretActionEntity")] public EntityUid? XenoTurretActionEntity;
}
}
66 changes: 66 additions & 0 deletions Content.Server/ADT/Abilities/XenoQeen/XenoQeenSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Actions.Events;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Robust.Shared.Containers;
using Robust.Shared.Map;

namespace Content.Server.Abilities.XenoQeen
{
public sealed class XenoQeenSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly IMapManager _mapMan = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<XenoQeenComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<XenoQeenComponent, InvisibleWallActionEvent>(OnCreateTurret);
}

public override void Update(float frameTime)
{
base.Update(frameTime);
}
private void OnComponentInit(EntityUid uid, XenoQeenComponent component, ComponentInit args)
{
_actionsSystem.AddAction(uid, ref component.XenoTurretActionEntity, component.XenoTurretAction, uid);
}
private void OnCreateTurret(EntityUid uid, XenoQeenComponent component, InvisibleWallActionEvent args)
{
if (!component.Enabled)
return;

if (_container.IsEntityOrParentInContainer(uid))
return;

var xform = Transform(uid);
// Get the tile in front of the Qeen
var offsetValue = xform.LocalRotation.ToWorldVec();
var coords = xform.Coordinates.Offset(offsetValue).SnapToGrid(EntityManager, _mapMan);
var tile = coords.GetTileRef(EntityManager, _mapMan);
if (tile == null)
return;

// Check if the tile is blocked by a wall or mob, and don't create the wall if so
if (_turf.IsTileBlocked(tile.Value, CollisionGroup.Impassable | CollisionGroup.Opaque))
{
_popupSystem.PopupEntity(Loc.GetString("create-turret-failed"), uid, uid);
return;
}

_popupSystem.PopupEntity(Loc.GetString("create-turret"), uid);
// Make sure we set the invisible wall to despawn properly
Spawn(component.XenoTurret, _turf.GetTileCenter(tile.Value));
// Handle args so cooldown works
args.Handled = true;
}

}
}

This file was deleted.

2 changes: 1 addition & 1 deletion Content.Server/Flash/FlashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using Robust.Shared.Audio;
using Robust.Shared.Random;
using InventoryComponent = Content.Shared.Inventory.InventoryComponent;
using Content.Server.ADT.Eye.Blinding;
using Content.Shared.ADT.Eye.Blinding;

namespace Content.Server.Flash
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public sealed partial class NukeopsRuleComponent : Component
/// Minimal operatives count for war declaration
/// </summary>
[DataField]
public int WarDeclarationMinOps = 4;
public int WarDeclarationMinOps = 3; // adt tweak

[DataField]
public WinType WinType = WinType.Neutral;
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Content.Shared.Verbs;
using Robust.Shared.GameObjects.Components.Localization;
using Robust.Shared.Prototypes; // ADT-Changeling-Tweak
using Content.Server.Forensics; // ADT DNA-Cloning Tweak

namespace Content.Server.Humanoid;

Expand Down Expand Up @@ -67,6 +68,12 @@ public void SetAppearance(HumanoidAppearanceComponent sourceHumanoid, HumanoidAp
grammar.Gender = sourceHumanoid.Gender;
}

if (TryComp<DnaComponent>(targetHumanoid.Owner, out var targetDNAComp) &&
TryComp<DnaComponent>(sourceHumanoid.Owner, out var sourceDNAComp))
{
targetDNAComp.DNA = sourceDNAComp.DNA; // ADT DNA-Cloning Tweak
}

Dirty(targetHumanoid.Owner, targetHumanoid);
}
// ADT-Changeling-Tweak-End
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace Content.Server.ADT.Eye.Blinding;
using Robust.Shared.GameStates;

[RegisterComponent]
[Access(typeof(DamageEyesOnFlashSystem))]
namespace Content.Shared.ADT.Eye.Blinding;

[RegisterComponent, NetworkedComponent]
public sealed partial class DamageEyesOnFlashedComponent : Component
{
[DataField]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Robust.Shared.GameStates;

namespace Content.Shared.ADT.Eye.Blinding;

[RegisterComponent, NetworkedComponent]
public sealed partial class NoEyeDamageOnFlashComponent : Component
{
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Content.Server.ADT.Eye.Blinding;
namespace Content.Shared.ADT.Eye.Blinding;

[ByRefEvent]
public record struct FlashedEvent(EntityUid? User, EntityUid? Used);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Shared.Eye.Blinding.Systems;
using Robust.Shared.Timing;

namespace Content.Server.ADT.Eye.Blinding;
namespace Content.Shared.ADT.Eye.Blinding;

public sealed class DamageEyesOnFlashSystem : EntitySystem
{
Expand Down
11 changes: 8 additions & 3 deletions Content.Shared/ADT/NightVision/SharedNightVisionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Rounding;
using Content.Shared.Toggleable;
using Robust.Shared.Timing;
using Content.Shared.ADT.Eye.Blinding;

namespace Content.Shared.ADT.NightVision;

Expand Down Expand Up @@ -127,10 +128,10 @@ private void UpdateAlert(Entity<NightVisionComponent> ent)
{
if (ent.Comp.Alert is { } alert)
{
var level = MathF.Max((int) NightVisionState.Off, (int) ent.Comp.State);
var level = MathF.Max((int)NightVisionState.Off, (int)ent.Comp.State);
var max = _alerts.GetMaxSeverity(alert);
var severity = max - ContentHelpers.RoundToLevels(level, (int) NightVisionState.Full, max + 1);
_alerts.ShowAlert(ent, alert, (short) severity);
var severity = max - ContentHelpers.RoundToLevels(level, (int)NightVisionState.Full, max + 1);
_alerts.ShowAlert(ent, alert, (short)severity);
}

NightVisionChanged(ent);
Expand Down Expand Up @@ -161,6 +162,9 @@ private void EnableNightVisionItem(Entity<NightVisionItemComponent> item, Entity
var nightVision = EnsureComp<NightVisionComponent>(user);
nightVision.State = NightVisionState.Full;
Dirty(user, nightVision);

var eyeDamage = EnsureComp<DamageEyesOnFlashedComponent>(user);
Dirty(user, eyeDamage);
}

_actions.SetToggled(item.Comp.Action, true);
Expand All @@ -187,6 +191,7 @@ protected void DisableNightVisionItem(Entity<NightVisionItemComponent> item, Ent
!nightVision.Innate)
{
RemCompDeferred<NightVisionComponent>(user.Value);
RemCompDeferred<DamageEyesOnFlashedComponent>(user.Value);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Content.Shared.Humanoid;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared._RMC14.Armor.ThermalCloak;

[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ThermalCloakComponent : Component
{
public bool Enabled;

[DataField, AutoNetworkedField]
public TimeSpan Cooldown = TimeSpan.FromSeconds(3);

[DataField, AutoNetworkedField]
public TimeSpan ForcedCooldown = TimeSpan.FromSeconds(10);

[DataField, AutoNetworkedField]
public float Opacity = 0.1f;

[DataField, AutoNetworkedField]
public SoundSpecifier? CloakSound;

[DataField, AutoNetworkedField]
public SoundSpecifier? UncloakSound;

[DataField, AutoNetworkedField]
public bool RestrictWeapons;

/// <summary>
/// Layers to hide while cloaked
/// </summary>
[DataField]
public HashSet<HumanoidVisualLayers> CloakedHideLayers = new();

/// <summary>
/// Amount of time after uncloaking weapons remain locked
/// </summary>
[DataField]
[AutoNetworkedField]
public TimeSpan UncloakWeaponLock = TimeSpan.FromSeconds(1);

[DataField, AutoNetworkedField]
public EntProtoId ActionId = "ADTActionToggleCloak";

[DataField, AutoNetworkedField]
public EntityUid? Action;

[DataField, AutoNetworkedField]
public EntProtoId CloakEffect = "RMCEffectCloak";

[DataField, AutoNetworkedField]
public EntProtoId UncloakEffect = "RMCEffectUncloak";

[DataField, AutoNetworkedField]
public bool NinjaSuit = false;

[DataField, AutoNetworkedField]
public bool HandsBlock = true;
}
Loading

0 comments on commit 7c67efa

Please sign in to comment.