Skip to content

Commit

Permalink
Merge branch 'master' into perevodik
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkiich authored Oct 27, 2024
2 parents 2454294 + fdcedda commit 86cc36b
Show file tree
Hide file tree
Showing 135 changed files with 351,479 additions and 208 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/auto-cl-update-atd.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Auto CL update

on:
schedule:
- cron: '10 * * * *'
- cron: '20 * * * *'
- cron: '30 * * * *'
- cron: '40 * * * *'
- cron: '50 * * * *'
- cron: '59 * * * *'
workflow_dispatch:

push:
Expand Down
3 changes: 3 additions & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public sealed class PostMapInitTest
"Oasis",
"Cog",
// ADT-Start
"ADT_FrontierHalloween",
"ADT_TrainHalloween",
"ADT_SalternHalloween",
"ADT_Astra",
"ADT_Avrit",
"ADT_Bagel",
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/ADT/CustomAILaw/CustomAiLawBoardComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server.ADT.CustomAiLawBoard;

[RegisterComponent]
public sealed partial class CustomAiLawBoardComponent : Component
{

}
41 changes: 41 additions & 0 deletions Content.Server/ADT/CustomAILaw/CustomAiLawBoardSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Content.Shared.Interaction;
using Content.Shared.Tools.Systems;
using Content.Server.Silicons.Laws;
using Content.Shared.Silicons.Laws.Components;
using Content.Server.Administration.Managers;
using Content.Server.EUI;
using Robust.Server.Player;

namespace Content.Server.ADT.CustomAiLawBoard;

public sealed class CustomAiLawBoardSystem : EntitySystem
{
[Dependency] private readonly SharedToolSystem _toolSystem = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SiliconLawSystem _siliconLawSystem = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly EuiManager _euiManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CustomAiLawBoardComponent, InteractUsingEvent>(OnInteractUsing);
}
private void OnInteractUsing(EntityUid uid, CustomAiLawBoardComponent comp, InteractUsingEvent args)
{
if (args.Handled)
return;

if (!_toolSystem.HasQuality(args.Used, SharedToolSystem.PulseQuality))
return;

if (!TryComp<SiliconLawBoundComponent>(uid, out var lawBoundComponent))
return;
var ui = new SiliconLawEui(_siliconLawSystem, EntityManager, _adminManager);
if (!_playerManager.TryGetSessionByEntity(args.User, out var session))
{
return;
}
_euiManager.OpenEui(ui, session);
ui.UpdateLaws(lawBoundComponent, args.Target);
}
}
50 changes: 33 additions & 17 deletions Content.Server/ADT/DocumentPrinter/DocumentPrinterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,48 @@ public void OnPrinting(EntityUid uid, DocumentPrinterComponent component, Printi
}
DateTime time = DateTime.UtcNow.AddYears(TIME_YEAR_SPACE_STATION_ADT).AddHours(3);
text = text.Replace("$time$", $"{_gameTiming.CurTime.Subtract(_ticker.RoundStartTimeSpan).ToString("hh\\:mm\\:ss")} | {(time.Day < 10 ? $"0{time.Day}" : time.Day)}.{(time.Month < 10 ? $"0{time.Month}" : time.Month)}.{time.Year}");
if (pda?.StationName is not null)
if (pda is not null)
{
text = text.Replace("Station XX-000", pda.StationName);
}
if (meta_id is null)
{
text = text.Replace("$name$", "");
text = text.Replace("$job$", "");
}
else
{
int startIndex = meta_id.EntityName.IndexOf("("); int endIndex = meta_id.EntityName.IndexOf(")");
if (startIndex.Equals(-1) || startIndex.Equals(-1))
if (pda?.StationName is not null)
{
text = text.Replace("Station XX-000", pda.StationName);
}
if (meta_id is null)
{
text = text.Replace("$name$", "");
text = text.Replace("$job$", "");
}
else
{
string id_card_word = "ID карта ";
text = text.Replace("$name$", meta_id.EntityName.Replace(id_card_word, "").Substring(0, startIndex - id_card_word.Length - 2));
text = text.Replace("$job$", meta_id.EntityName.Substring(startIndex + 1, endIndex - startIndex - 1));
int startIndex = meta_id.EntityName.IndexOf("("); int endIndex = meta_id.EntityName.IndexOf(")");
if (startIndex.Equals(-1) || endIndex.Equals(-1))
{
text = text.Replace("$name$", "");
text = text.Replace("$job$", "");
}
else
{
string id_card_word = "ID карта ";
if (startIndex - id_card_word.Length - 2 > 0)
text = text.Replace("$name$", meta_id.EntityName.Replace(id_card_word, "").Substring(0, startIndex - id_card_word.Length - 2));
else
text = text.Replace("$name$", "");
if (startIndex + 1 != endIndex)
text = text.Replace("$job$", meta_id.EntityName.Substring(startIndex + 1, endIndex - startIndex - 1));

else
text = text.Replace("$name$", "");
}
}
paperComponent.Content = text;
// if (!TryComp<MetaDataComponent>(args.Actor, out var comp)) return; // was for test, STFU JUST LEAVE IT HERE
}
else
{
text = text.Replace("$name$", "");
text = text.Replace("$job$", "");
paperComponent.Content = text;
}
paperComponent.Content = text;
// if (!TryComp<MetaDataComponent>(args.Actor, out var comp)) return; // was for test, STFU JUST LEAVE IT HERE
}
else
{
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Holosign/HolosignComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server.Holosign
{
[RegisterComponent]
public sealed partial class HolosignComponent : Component
{
}
}
16 changes: 13 additions & 3 deletions Content.Server/Holosign/HolosignSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using Content.Server.PowerCell;
using Content.Shared.Interaction;
using Content.Shared.Storage;
using System.Linq;

namespace Content.Server.Holosign;

public sealed class HolosignSystem : EntitySystem
{
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; // ADT-Tweak


public override void Initialize()
Expand Down Expand Up @@ -41,13 +43,21 @@ private void OnExamine(EntityUid uid, HolosignProjectorComponent component, Exam

private void OnBeforeInteract(EntityUid uid, HolosignProjectorComponent component, BeforeRangedInteractEvent args)
{

if (args.Handled
// ADT-Tweak-Start
if (
args.Handled
|| !args.CanReach // prevent placing out of range
|| HasComp<StorageComponent>(args.Target) // if it's a storage component like a bag, we ignore usage so it can be stored
)
return;

var entities = _lookup.GetEntitiesInRange(args.ClickLocation.SnapToGrid(EntityManager), .1f).ToList().Where(e => HasComp<HolosignComponent>(e));
if (
entities.Any()
|| !_powerCell.TryUseCharge(uid, component.ChargeUse) // if no battery or no charge, doesn't work
)
)
return;
// ADT-Tweak-End

// places the holographic sign at the click location, snapped to grid.
// overlapping of the same holo on one tile remains allowed to allow holofan refreshes
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Silicons/Laws/SiliconLawEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public override EuiStateBase GetNewState()

public void UpdateLaws(SiliconLawBoundComponent? lawBoundComponent, EntityUid player)
{
if (!IsAllowed())
return;
// if (!IsAllowed())
// return; ADT Custom ai law

var laws = _siliconLawSystem.GetLaws(player, lawBoundComponent);
_laws = laws.Laws;
Expand All @@ -48,8 +48,8 @@ public override void HandleMessage(EuiMessageBase msg)
return;
}

if (!IsAllowed())
return;
// if (!IsAllowed())
// return; ADT Custom ai law

var player = _entityManager.GetEntity(message.Target);

Expand Down
20 changes: 18 additions & 2 deletions Content.Server/Silicons/Laws/SiliconLawSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Toolshed;
using Content.Shared.NPC.Components;
using Content.Shared.NPC.Systems;

namespace Content.Server.Silicons.Laws;

Expand All @@ -34,6 +36,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
[Dependency] private readonly SharedRoleSystem _roles = default!;
[Dependency] private readonly NpcFactionSystem _faction = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -286,17 +289,30 @@ public void SetLaws(List<SiliconLaw> newLaws, EntityUid target)
protected override void OnUpdaterInsert(Entity<SiliconLawUpdaterComponent> ent, ref EntInsertedIntoContainerMessage args)
{
// TODO: Prediction dump this
if (!TryComp(args.Entity, out SiliconLawProviderComponent? provider))
if (!TryComp(args.Entity, out SiliconLawBoundComponent? provider)) //ADT custom AI law
return;

var lawset = GetLawset(provider.Laws).Laws;
var lawset = GetLaws(args.Entity, provider).Laws; //ADT custom AI law
var query = EntityManager.CompRegistryQueryEnumerator(ent.Comp.Components);

while (query.MoveNext(out var update))
{
SetLaws(lawset, update);
}
///ADT AI Custom law start
UpdateBorgsNTLaws(lawset);
}
private void UpdateBorgsNTLaws(List<SiliconLaw> newLaws)
{
var headRevs = AllEntityQuery<SiliconLawProviderComponent, NpcFactionMemberComponent>();
while (headRevs.MoveNext(out var uid, out var lawprov, out _))
{
if (_faction.IsMember(uid, "NanoTrasen") && lawprov.Lawset != null)
lawprov.Lawset.Laws = newLaws;
}
return;
}
///ADT AI Custom law end
}

[ToolshedCommand, AdminCommand(AdminFlags.Admin)]
Expand Down
36 changes: 36 additions & 0 deletions Resources/Changelog/1ChangelogADT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3768,3 +3768,39 @@ Entries:
type: Tweak}
time: '2024-10-25T23:21:26Z'
id: 466
- author: Mirokko
changes:
- {message: Добавлена кнопка в АХ для открытия логов конкретного игрока., type: Add}
time: '2024-10-26T19:22:49Z'
id: 467
- author: Mirokko
changes:
- {message: 'Теперь сумеречники не копят энергию, пока находятся в криохранилище.',
type: Fix}
time: '2024-10-26T19:23:26Z'
id: 468
- author: jungarikjan
changes:
- {message: Исправил айдишник в GuideEntityEmbed, type: Fix}
time: '2024-10-27T03:10:00Z'
id: 469
- author: PyotrIgn
changes:
- {message: Добавлена именная одежда для Шредингера, type: Add}
time: '2024-10-27T05:55:34Z'
id: 470
- author: KorolCharodey
changes:
- {message: Исправлены некоторые проблемы с принтером., type: Fix}
time: '2024-10-27T07:37:15Z'
id: 471
- author: PyotrIgn
changes:
- {message: Добавлено хеллоуинские версии некоторых карт, type: Add}
time: '2024-10-27T07:52:17Z'
id: 472
- author: Mirokko
changes:
- {message: Теперь голобарьеры не стакаются, type: Fix}
time: '2024-10-27T07:56:50Z'
id: 473
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ADTCustomLawCircuitBoard = плата смены законов ИИ
.desc = Модификация обычный платы законов, позволяющая полностью переписать их при помощи мультитула.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
silicon-law-ui-verb = Управление законами
silicon-law-ui-title = Кремниевые законы
silicon-law-ui-title = Законы ИИ
silicon-law-ui-new-law = Новый закон
silicon-law-ui-save = Сохранить изменения
silicon-law-ui-plus-one = +1
Expand Down
Loading

0 comments on commit 86cc36b

Please sign in to comment.