diff --git a/Content.Server/_Arcane/StationEvents/Components/WackyLawComponent.cs b/Content.Server/_Arcane/StationEvents/Components/WackyLawComponent.cs new file mode 100644 index 00000000000..57baa3cb6e0 --- /dev/null +++ b/Content.Server/_Arcane/StationEvents/Components/WackyLawComponent.cs @@ -0,0 +1,35 @@ +using Content.Server._Arcane.StationEvents.Events; +using Content.Shared.Dataset; +using Robust.Shared.Prototypes; + +namespace Content.Server._Arcane.StationEvents.Components; + +[RegisterComponent] +[Access(typeof(WackyLawRule))] +public sealed partial class WackyLawComponent : Component +{ + /// + /// Dataset of objects for event "wacky law" + /// + [DataField] + public ProtoId ItemDataset = "ArcaneItem"; + + /// + /// Beverage Dataset for event "wacky law" (use text instead of IDs) + /// + [DataField] + public ProtoId HalfProhibitionDataset = "ArcaneHalfProhibition"; + + /// + /// Department Dataset for event "wacky law" + /// + [DataField] + public ProtoId DepartmentDataset = "ArcaneDepartments"; + + /// + /// Laws dataset for event "wacky law" + /// + [DataField] + public ProtoId LawsDataset = "ArcaneLaws"; + +} diff --git a/Content.Server/_Arcane/StationEvents/Events/WackyLawRule.cs b/Content.Server/_Arcane/StationEvents/Events/WackyLawRule.cs new file mode 100644 index 00000000000..4383f266649 --- /dev/null +++ b/Content.Server/_Arcane/StationEvents/Events/WackyLawRule.cs @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +using System.Collections.Generic; +using Content.Server.Fax; +using Content.Server.StationEvents.Events; +using Content.Server._Arcane.StationEvents.Components; +using Content.Shared.Dataset; +using Content.Shared.Fax.Components; +using Content.Shared.GameTicking.Components; +using Content.Shared.Paper; +using Content.Shared.Roles; +using Robust.Shared.Maths; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; + +namespace Content.Server._Arcane.StationEvents.Events; + +/// +/// An event related to a strange law from the Central Command. I tried to set it up so that new laws could be added without having to edit the code. The dataset file contains instructions. +/// +public sealed class WackyLawRule : StationEventSystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly FaxSystem _fax = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; + + private string GetDepartmentText(string department) + { + if (department == "All") + return Loc.GetString("wacky-law-department-all"); + + var name = _proto.TryIndex(department, out var dept) + ? Loc.GetString(dept.Name) + : department; + + return Loc.GetString(name); + } + private string PickRandomEntityName(ProtoId datasetId) + { + var dataset = _proto.Index(datasetId); + var protoId = _random.Pick(dataset.Values); + + if (_proto.TryIndex(protoId, out var proto) && !string.IsNullOrEmpty(proto.Name)) + return Loc.GetString(proto.Name); + + return protoId; + } + + protected override void Started(EntityUid uid, WackyLawComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) + { + base.Started(uid, component, gameRule, args); + + if (!TryGetRandomStation(out var station)) + return; + var lawEntry = _random.Pick(_proto.Index(component.LawsDataset).Values); + var lawParts = lawEntry.Split('|', 2); + var contentLoc = lawParts[0]; + var itemName = string.Empty; + if (lawParts.Length == 2 && _proto.TryIndex(lawParts[1], out _)) + itemName = PickRandomEntityName(lawParts[1]); + + var departmentEntry = _random.Pick(_proto.Index(component.DepartmentDataset).Values); + var departmentText = GetDepartmentText(departmentEntry); + var content = Loc.GetString( + contentLoc, + ("station", MetaData(station.Value).EntityName), + ("item", itemName), + ("department", departmentText) + ); + + var documentRelease = new FaxPrintout( + content, + "Указ Центрального Командования", + label: null, + prototypeId: "PaperOffice", + stampState: "paper_stamp-centcom", + stampedBy: new List + { + new() + { + StampedName = Loc.GetString("stamp-component-stamped-name-centcom"), + StampedColor = Color.Green, + } + }, + locked: true + ); + + var faxQuery = EntityQueryEnumerator(); + while (faxQuery.MoveNext(out var faxUid, out var faxComp)) + { + if (!faxComp.ReceiveAllStationGoals && !(faxComp.ReceiveStationGoal && StationSystem.GetOwningStation(faxUid) == station.Value)) + continue; + + _fax.Receive(faxUid, documentRelease, null, faxComp); + } + } +} diff --git a/Resources/Locale/ru-RU/_Arcane/station-events/wacky-law.ftl b/Resources/Locale/ru-RU/_Arcane/station-events/wacky-law.ftl new file mode 100644 index 00000000000..bffab9c6e41 --- /dev/null +++ b/Resources/Locale/ru-RU/_Arcane/station-events/wacky-law.ftl @@ -0,0 +1,83 @@ +# Locales must contain { $station}, { $item}, { $department} + +station-event-wacky-law-announcement = Внимание, экипаж. Центральное Командование издало новый указ для вашей станции. Копия документа выслана на факс Капитана станции. Слава НТ. + +wacky-law-paper-name = указ Центрального Командования + +wacky-law-department-all = весь персонал станции + +# compulsion to wear an item + +wacky-law-content-force-item = ███░███░░░░██░░░░ + ░██░████░░░██░░░░ [head=3]Бланк документа[/head] + ░░█░██░██░░██░█░░ [head=3]НаноТрейзен[/head] + ░░░░██░░██░██░██░ [bold]ЦК-КОМ[/bold] + ░░░░██░░░████░ + ================================================[bold] + УКАЗ + ================================================[/bold] + Настоящим указом Центральное Командование ПРЕДПИСЫВАЕТ: + С момента получения документа сотрудники станции { $station } ОБЯЗАНЫ носить при себе следующий предмет: [bold]{ $item }[/bold]. + Данный указ распространяется на { $department } + Отсутствие указанного предмета при себе приравнивается к нарушению корпоративного законодательства и подлежит рассмотрению службой безопасности. + Контроль исполнения возлагается на капитана и службу безопасности станции. Указ вступает в силу немедленно. + Слава НаноТрейзен! + ================================================[italic] + Место для печати[/italic] + +# Prohibition on Carrying an Item + +wacky-law-content-ban-item = ███░███░░░░██░░░░ + ░██░████░░░██░░░░ [head=3]Бланк документа[/head] + ░░█░██░██░░██░█░░ [head=3]НаноТрейзен[/head] + ░░░░██░░██░██░██░ [bold]ЦК-КОМ[/bold] + ░░░░██░░░████░ + ================================================[bold] + УКАЗ + ================================================[/bold] + Настоящим указом Центральное Командование ЗАПРЕЩАЕТ: + С момента получения документа ношение, хранение и использование предмета [bold]{ $item }[/bold] на территории станции { $station } строго воспрещается. + Данный указ распространяется на { $department } + Все обнаруженные экземпляры подлежат изъятию службой безопасности и утилизации. + Контроль исполнения возлагается на капитана и службу безопасности станции. Указ вступает в силу немедленно. + Слава НаноТрейзен! + ================================================[italic] + Место для печати[/italic] + +# semi-dry law (ban on alcohol at the bar) + +wacky-law-content-half-prohibition = ███░███░░░░██░░░░ + ░██░████░░░██░░░░ [head=3]Бланк документа[/head] + ░░█░██░██░░██░█░░ [head=3]НаноТрейзен[/head] + ░░░░██░░██░██░██░ [bold]ЦК-КОМ[/bold] + ░░░░██░░░████░ + ================================================[bold] + УКАЗ + ================================================[/bold] + В рамках программы повышения трудоспособности экипажа Центральное Командование вводит ЧАСТИЧНЫЙ запрет: + Барменам воспрещается подавать сотрудникам { $department } { $item } + Нарушители подлежат взысканию по корпоративному законодательству. + Указ вступает в силу немедленно. + Слава НаноТрейзен! + ================================================[italic] + Место для печати[/italic] + +# Prohibition + +wacky-law-content-full-prohibition = ███░███░░░░██░░░░ + ░██░████░░░██░░░░ [head=3]Бланк документа[/head] + ░░█░██░██░░██░█░░ [head=3]НаноТрейзен[/head] + ░░░░██░░██░██░██░ [bold]ЦК-КОМ[/bold] + ░░░░██░░░████░ + ================================================[bold] + УКАЗ + ================================================[/bold] + В целях поддержания трудовой дисциплины Центральное Командование вводит СУХОЙ ЗАКОН: + С момента получения документа хранение, распитие, продажа и передача любых алкогольных напитков на территории станции { $station } строго запрещается до конца смены. + Бар и иные точки раздачи алкоголя подлежат чуткому надзору сил безопасности станции. + Нарушители задерживаются службой безопасности. Указ вступает в силу немедленно. + Слава НаноТрейзен! + ================================================[italic] + Место для печати[/italic] + + diff --git a/Resources/Prototypes/GameRules/events.yml b/Resources/Prototypes/GameRules/events.yml index c5450cf3a82..9ba5b649132 100644 --- a/Resources/Prototypes/GameRules/events.yml +++ b/Resources/Prototypes/GameRules/events.yml @@ -38,6 +38,7 @@ - id: FloorGoblinMidRound # Goobstation - id: ClownGoblinMigration # Goobstation - New Midrounds # - id: SantaClausSpawn # Goobstation, remove after new year + - id: WackyCentComLaw # Arcane - type: entityTable id: BasicAntagEventsTable @@ -1096,3 +1097,20 @@ min: 1 max: 1 pickPlayer: false + +# Arcane-start +- type: entity + id: WackyCentComLaw + parent: BaseGameRule + components: + - type: StationEvent + startAnnouncement: station-event-wacky-law-announcement + weight: 5 + duration: 1 + earliestStart: 10 + reoccurrenceDelay: 30 + eventType: Chaotic + - type: GameRule + chaosScore: 50 + - type: WackyLaw +# Arcane-end diff --git a/Resources/Prototypes/_Arcane/Datasets/Events/wackylaw.yml b/Resources/Prototypes/_Arcane/Datasets/Events/wackylaw.yml new file mode 100644 index 00000000000..f6d84469fe4 --- /dev/null +++ b/Resources/Prototypes/_Arcane/Datasets/Events/wackylaw.yml @@ -0,0 +1,82 @@ +# To add a new rule, you need to specify its locale from the FTL and the dataset that will be used. +# All of this needs to be specified in “ArcaneLaws”; if the law does not specify the use of any particular dataset, just leave the locale as is. +# To increase the hit rate, add it to the dataset again + +- type: dataset + id: ArcaneItem + values: + - ClothingUniformJumpsuitColorTeal + - ClothingSocksAssBlastUSAThigh + - ClothingHandsBDSMgloves + - ClothingJumpsuitBDSMress + - ClothingUniformJumpsuitTurtleneckWhite + - ClothingUniformJumpsuitColorWhite + - ClothingOuterHospitalGown + - ClothingHeadHatWitch + - ClothingUniformJumpskirtMaidLong + - ClothingOuterWinterRobo + - ClothingHandsGlovesCaptain + - ClothingUniformJumpsuitRoboticist + - ClothingUniformJumpsuitAviator + - ClothingCloakHOSRed + - ClothingShoesBootsWinterMed + - ClothingHandsGlovesNitrile + - ClothingEyesHudBeer + - ClothingSocksBeer + - ClothingUniformJumpskirtJanimaid + - ClothingBeltJanitor + - ClothingHandsGlovesJanitor + - ClothingHandsGlovesRobohands + - ClothingUniformJumpskirtMaidPink + - BlowPink + - BlowGreen + - BlowPurple + - PussyVulpaBlue + - PussyVulpaBlue + - OnaholeGreen + - SlimeDildo + - DogDildo + - ClothingWristsClockworkSlab + - ClothingNeckStoleChaplain + - ClothingSocksThinThigh + - ClothingShoesColorBlack + - ClothingSocksThigh + - ClothingSocksCandyCaneGreenThigh + - ClothingUnderwearPantiesCommie + - ClothingUnderwearPantiesFishnetLowerAlt + +- type: dataset + id: ArcaneHalfProhibition + values: + - "Вермут" + - "Вино" + - "Виски" + - "Водка" + - "Джин" + - "Коньяк" + - "Кофейный ликёр" + - "Медовуха" + - "Пиво" + - "Ром" + - "Текила" + - "Эль" + +- type: dataset + id: ArcaneDepartments + values: + - All + - Cargo + - Command + - Engineering + - Medical + - Science + - Security + - Service + +- type: dataset + id: ArcaneLaws + values: + - "wacky-law-content-force-item|ArcaneItem" + - "wacky-law-content-ban-item|ArcaneItem" + - "wacky-law-content-half-prohibition|ArcaneHalfProhibition" + - "wacky-law-content-full-prohibition"