Skip to content

Commit

Permalink
Merge branch 'master' into energo
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 authored Jan 6, 2025
2 parents a0e9806 + aba400c commit f830ffa
Show file tree
Hide file tree
Showing 37 changed files with 182,698 additions and 60,625 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-test-debug-win.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build & Test Debug Windows

on:
push:
branches: [ master, staging, trying ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ master ]
# push:
# branches: [ master, staging, trying ]
# merge_group:
# pull_request:
# types: [ opened, reopened, synchronize, ready_for_review ]
# branches: [ master ]
workflow_dispatch: # ручной запуск

jobs:
Expand Down Expand Up @@ -60,4 +60,4 @@ jobs:
runs-on: windows-latest
steps:
- name: CI succeeded
run: exit 0
run: exit 0
57 changes: 57 additions & 0 deletions Content.Client/ADT/Salvage/MegafaunaVisualsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Content.Client.DamageState;
using Content.Client.Humanoid;
using Content.Shared.ADT.Salvage;
using Content.Shared.ADT.Salvage.Components;
using Content.Shared.Mobs.Components;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

namespace Content.Client.ADT.Salvage;

public sealed class MegafaunaVisualsSystem : EntitySystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
[Dependency] private readonly HumanoidAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly IEntityManager _entManager = default!;

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

SubscribeLocalEvent<MegafaunaComponent, AppearanceChangeEvent>(OnAppearanceChange);
}

private void OnAppearanceChange(EntityUid uid, MegafaunaComponent comp, ref AppearanceChangeEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
if (!TryComp<DamageStateVisualsComponent>(uid, out var state))
return;
if (!TryComp<MobStateComponent>(uid, out var mob))
return;
if (!state.States.TryGetValue(mob.CurrentState, out var layers))
return;

if (_appearance.TryGetData<bool>(uid, AshdrakeVisuals.Swoop, out var swoop))
{
if (!sprite.LayerMapTryGet("drake_swoop", out var index))
index = sprite.LayerMapReserveBlank("drake_swoop");
sprite.LayerSetState(index, "swoop");
sprite.LayerSetVisible(index, swoop);

foreach (var (key, _) in layers)
{
if (!sprite.LayerMapTryGet(key, out var layer)) continue;
sprite.LayerSetVisible(layer, !swoop);
}
}
}
}
1 change: 1 addition & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public sealed class PostMapInitTest
// ADT-Halloween-End

// ADT-New-Year-Start
"ADT_AspidNewYear",
"ADT_BagelNewYear",
"ADT_BoxNewYear",
"ADT_Cluster_LegacyNewYear",
Expand Down
112 changes: 112 additions & 0 deletions Content.Server/ADT/Salvage/Systems/Megafauna/MegafaunaSystem.Drake.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using System.Numerics;
using Content.Server.Actions;
using Content.Server.ADT.Language;
using Content.Server.ADT.Salvage.Components;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Interaction;
using Content.Server.Polymorph.Systems;
using Content.Server.Popups;
using Content.Server.Stunnable;
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.ADT.Language;
using Content.Shared.ADT.Salvage;
using Content.Shared.ADT.Salvage.Components;
using Content.Shared.Chasm;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Lathe;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Server.ADT.Salvage.Systems;

public sealed partial class MegafaunaSystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly StunSystem _stun = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly PolymorphSystem _polymorph = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly GunSystem _gun = default!;
[Dependency] private readonly TransformSystem _transform = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AshDrakeSwoopActionEvent>(OnSwoop);
SubscribeLocalEvent<AshDrakeMeteoritesActionEvent>(OnMeteors);
SubscribeLocalEvent<AshDrakeFireActionEvent>(OnFire);
SubscribeLocalEvent<AshDrakeBreathActionEvent>(OnBreath);
}

private void OnSwoop(AshDrakeSwoopActionEvent args)
{
var uid = args.Performer;

_appearance.SetData(uid, AshdrakeVisuals.Swoop, true);

_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false);
Timer.Spawn(TimeSpan.FromSeconds(0.5f), () => Swoop(uid));
}

private void OnMeteors(AshDrakeMeteoritesActionEvent args)
{
var uid = args.Performer;

var randVector = _random.NextVector2(6);

var pseudoGun = Spawn("WeaponDragonMeteorites", Transform(uid).Coordinates);
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), new(Transform(uid).ParentUid, randVector.X, randVector.Y));
QueueDel(pseudoGun);
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false);
}

private void OnFire(AshDrakeFireActionEvent args)
{
var uid = args.Performer;
if (!args.Coords.HasValue)
return;

var coords = args.Coords.Value;

var pseudoGun = Spawn("WeaponDragonFire", Transform(uid).Coordinates);
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), coords);
QueueDel(pseudoGun);
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false);
}

private void OnBreath(AshDrakeBreathActionEvent args)
{
var uid = args.Performer;
if (!args.Coords.HasValue)
return;

var coords = args.Coords.Value;

var pseudoGun = Spawn("WeaponDragonBreath", Transform(uid).Coordinates);
_gun.AttemptShoot(uid, pseudoGun, Comp<GunComponent>(pseudoGun), coords);
QueueDel(pseudoGun);
_stun.TryStun(uid, TimeSpan.FromSeconds(0.5f), false);
}

private void Swoop(EntityUid uid)
{
_appearance.SetData(uid, AshdrakeVisuals.Swoop, false);
_polymorph.PolymorphEntity(uid, "SwoopDrake");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Content.Server.ADT.Salvage.Systems;

public sealed partial class MegafaunaSystem : EntitySystem
{
}
11 changes: 4 additions & 7 deletions Content.Server/Administration/Managers/AdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public async void DeAdmin(ICommonSession session) // ADT-tweak: add "async"
return;
var payload = new WebhookPayload
{
Content = $"**Снял права**: **{session.Name}**"
Content = $"**Снял права**: `{session.Name}`"
};
var identifier = webhookData.ToIdentifier();
await _discord.CreateMessage(identifier, payload);
Expand Down Expand Up @@ -198,7 +198,7 @@ public async void ReAdmin(ICommonSession session) // ADT-tweak: add "async"
return;
var payload = new WebhookPayload
{
Content = $"**Вернул права**: **{session.Name}**"
Content = $"**Вернул права**: `{session.Name}`"
};
var identifier = webhookData.ToIdentifier();
await _discord.CreateMessage(identifier, payload);
Expand Down Expand Up @@ -407,7 +407,7 @@ private async void DisconnectedAdminMaybe(ICommonSession session)
return;
var payload = new WebhookPayload
{
Content = $"**Оповещение: Админ ВЫШЕЛ {senderName}**"
Content = $"**Оповещение: Админ ВЫШЕЛ** `{senderName}`"
};
var identifier = webhookData.ToIdentifier();
await _discord.CreateMessage(identifier, payload);
Expand Down Expand Up @@ -459,14 +459,11 @@ private async void LoginAdminMaybe(ICommonSession session)
var senderAdmin = GetAdminData(session);
if (senderAdmin == null)
return;
var senderName = session.Name;
if (!string.IsNullOrEmpty(senderAdmin.Title))
senderName += $"\\[{senderAdmin.Title}\\]";
if (await _discord.GetWebhook(webhookUrl) is not { } webhookData)
return;
var payload = new WebhookPayload
{
Content = $"**Оповещение: Админ зашёл {senderName}**"
Content = $"**Оповещение: Админ ЗАШЁЛ** `{session.Name}`[{senderAdmin.Title}]"
};
var identifier = webhookData.ToIdentifier();
await _discord.CreateMessage(identifier, payload);
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private async void SendAdminChat(ICommonSession player, string message)
return;
var payload = new WebhookPayload
{
Content = $"***AdminChat***: **{senderName}**: {message}"
Content = $"***AdminChat***: `{player.Name}`[{senderAdmin.Title}]: {message}"
};
var identifier = webhookData.ToIdentifier();
await _discord.CreateMessage(identifier, payload);
Expand Down
25 changes: 20 additions & 5 deletions Content.Server/NPC/Components/NPCUseActionOnTargetComponent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Content.Server.NPC.Systems;
using Content.Shared.Actions;
using Content.Shared.Random;
using Robust.Shared.Prototypes;

namespace Content.Server.NPC.Components;

// ADT: Компонент был полностью переписан, заменяйте при апстриме на нашу версию.

/// <summary>
/// This is used for an NPC that constantly tries to use an action on a given target.
/// </summary>
Expand All @@ -16,12 +19,24 @@ public sealed partial class NPCUseActionOnTargetComponent : Component
[DataField]
public string TargetKey = "Target";

/// <summary>
/// Action that's going to attempt to be used.
/// </summary>
// /// <summary>
// /// Action that's going to attempt to be used.
// /// </summary>
// [DataField(required: true)]
// public EntProtoId<EntityWorldTargetActionComponent> ActionId;

// [DataField]
// public EntityUid? ActionEnt;

[DataField(required: true)]
public EntProtoId<EntityWorldTargetActionComponent> ActionId;
public ProtoId<WeightedRandomEntityPrototype> Actions = "GoliathActions";

[ViewVariables]
public Dictionary<EntityUid, float> ActionEntities = new();

[DataField]
public EntityUid? ActionEnt;
public float Delay = 7f;

[ViewVariables]
public TimeSpan LastAction = TimeSpan.Zero;
}
Loading

0 comments on commit f830ffa

Please sign in to comment.