Skip to content

Commit

Permalink
Merge branch 'master' into query-shitfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 authored Jan 6, 2025
2 parents b881c00 + e16143d commit b3d030a
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

var system = EntMan.System<VendingMachineSystem>();

if (state is not VendingMachineInterfaceState newState)
return;

_cachedInventory = newState.Inventory;
_cachedInventory = system.GetAllInventory(Owner);

_menu?.Populate(Owner, _cachedInventory, newState.PriceMultiplier, newState.Credits); //ADT-Economy-Tweak
}
Expand Down
63 changes: 63 additions & 0 deletions Content.Server/Administration/ServerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Content.Server.Administration.Managers;
using Content.Shared.Chat;
using Content.Server.Chat.Managers;

namespace Content.Server.Administration;

Expand Down Expand Up @@ -58,6 +61,9 @@ public sealed partial class ServerApi : IPostInjectInit
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IAdminManager _admin = default!;
[Dependency] private readonly INetConfigurationManager _netConfigManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;

private string _token = string.Empty;
private ISawmill _sawmill = default!;
Expand All @@ -81,6 +87,7 @@ void IPostInjectInit.PostInject()
RegisterActorHandler(HttpMethod.Post, "/admin/actions/force_preset", ActionForcePreset);
RegisterActorHandler(HttpMethod.Post, "/admin/actions/set_motd", ActionForceMotd);
RegisterActorHandler(HttpMethod.Patch, "/admin/actions/panic_bunker", ActionPanicPunker);
RegisterActorHandler(HttpMethod.Post, "/admin/actions/a_chat", ActionAdminChat); // ADT Tweak
}

public void Initialize()
Expand Down Expand Up @@ -709,4 +716,60 @@ private sealed class GameruleResponse
}

#endregion

#region ADT-Tweak

private async Task ActionAdminChat(IStatusHandlerContext context, Actor actor)
{
var body = await ReadJson<AdminChatActionBody>(context);
if (body == null)
return;

string discordName = $"{body.NickName}(Discord)";
string message = body.Message;
var authorUser = new NetUserId(actor.Guid);

await RunOnMainThread(async () =>
{
var clients = _admin.ActiveAdmins.Select(p => p.Channel).ToList();

// Используем Loc.GetString для формирования сообщения
var wrappedMessage = Loc.GetString("chat-manager-send-admin-chat-wrap-message",
("adminChannelName", Loc.GetString("chat-manager-admin-channel-name")),
("playerName", discordName),
("message", FormattedMessage.EscapeText(body.Message))
);

// Отправляем сообщения всем администраторам
foreach (var client in clients)
{
bool isSource = true;
string? audioPath = isSource ? _netConfigManager.GetClientCVar(client, CCVars.AdminChatSoundPath) : default;
float audioVolume = isSource ? _netConfigManager.GetClientCVar(client, CCVars.AdminChatSoundVolume) : default;

_chatManager.ChatMessageToOne(
ChatChannel.AdminChat,
message,
wrappedMessage,
default,
false,
client,
audioPath: audioPath,
audioVolume: audioVolume,
author: authorUser
);
}

await RespondOk(context);
_sawmill.Info($"Send message by {FormatLogActor(actor)}");
});
}

private sealed class AdminChatActionBody
{
public required string Message { get; init; }
public required string NickName { get; init; }
}

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ ent-ADTClothingUniformAiryBlackSuit = черный воздушный костю
.desc = Готично, строго, сексуально. Для тех кто любит показывать свой красивый лифчик.
ent-ADTClothingJumpsuitHopAlt = деловой костюм главы персонала
.desc = Качетсвенно сделанная униформа для тех глав персонала, что могут себе такую позволить.
.desc = Качественно сделанная униформа для тех глав персонала, что могут себе такую позволить.
ent-ADTClothingJumpsuitSecOffMogesBrown = костюм офицера СБ с Могеса
.desc = Не совсем формальный, но очень подходящий для трофиков костюм офицера, служившего в филиале Нанотрейзен на планете Могес. Заслужить право носить такой может только ветеран СБ. Стоять, СБ Могеса!
ent-ADTClothingJumpsuitSecOffMogesBlue = костюм офицера СБ с Могеса
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Species/ipc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
- type: BloodCough
postingSayDamage: blood-cough-ipc
- type: TimeDespawnDamage
- type: OfferItem # ADT-Tweak

- type: entity
save: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@
reagents:
- ReagentId: EnergyDrink
Quantity: 30
- type: Appearance
- type: GenericVisualizer
visuals:
enum.OpenableVisuals.Opened:
enum.OpenableVisuals.Layer:
True: {state: "icon-open"}
False: {state: "icon"}
- type: Sprite
sprite: ADT/Objects/Consumable/Drinks/nostop.rsi
layers:
- state: icon
map: ["enum.OpenableVisuals.Layer"]

- type: entity
id: ADTDrinkBeerCanPack
Expand Down

0 comments on commit b3d030a

Please sign in to comment.