diff --git a/Content.Client/_CP14/UserInterface/GuardBellBoundUserInterface.cs b/Content.Client/_CP14/UserInterface/GuardBellBoundUserInterface.cs deleted file mode 100644 index b907b1989a..0000000000 --- a/Content.Client/_CP14/UserInterface/GuardBellBoundUserInterface.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Content.Shared.CCVar; -using Content.Shared.Chat; -using Content.Shared.Communications; -using Robust.Client.UserInterface; -using Robust.Shared.Configuration; -using Robust.Shared.Timing; - -namespace Content.Client._CP14.UserInterface -{ - public sealed class GuardBellBoundUserInterface : BoundUserInterface - { - [Dependency] private readonly IConfigurationManager _cfg = default!; - - [ViewVariables] - private GuardBellMenu? _menu; - - public GuardBellBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } - - protected override void Open() - { - base.Open(); - - _menu = this.CreateWindow(); - _menu.OnAlertLevel += AlertLevelSelected; - } - - public void AlertLevelSelected(string level) - { - if (_menu!.AlertLevelSelectable) - { - _menu.CurrentLevel = level; - SendMessage(new CommunicationsConsoleSelectAlertLevelMessage(level)); - } - } - - - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); - - if (state is not CommunicationsConsoleInterfaceState commsState) - return; - - if (_menu != null) - { - _menu.AlertLevelSelectable = commsState.AlertLevels != null && !float.IsNaN(commsState.CurrentAlertDelay) && commsState.CurrentAlertDelay <= 0; - _menu.CurrentLevel = commsState.CurrentAlert; - _menu.UpdateAlertLevels(commsState.AlertLevels, _menu.CurrentLevel); - _menu.AlertLevelButton.Disabled = !_menu.AlertLevelSelectable; - } - } - } -} diff --git a/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml b/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml deleted file mode 100644 index 70b63deba0..0000000000 --- a/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml.cs b/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml.cs deleted file mode 100644 index 3423421325..0000000000 --- a/Content.Client/_CP14/UserInterface/GuardBellMenu.xaml.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Globalization; -using Content.Client.UserInterface.Controls; -using Content.Shared.CCVar; -using Robust.Client.AutoGenerated; -using Robust.Client.UserInterface.XAML; -using Robust.Shared.Configuration; -using Robust.Shared.Timing; -using Robust.Shared.Utility; - -namespace Content.Client._CP14.UserInterface -{ - [GenerateTypedNameReferences] - public sealed partial class GuardBellMenu : FancyWindow - { - [Dependency] private readonly IConfigurationManager _cfg = default!; - [Dependency] private readonly IGameTiming _timing = default!; - [Dependency] private readonly ILocalizationManager _loc = default!; - - public bool AlertLevelSelectable; - public string CurrentLevel = string.Empty; - - - public event Action? OnAlertLevel; - - public GuardBellMenu() - { - IoCManager.InjectDependencies(this); - RobustXamlLoader.Load(this); - - AlertLevelButton.OnItemSelected += args => - { - var metadata = AlertLevelButton.GetItemMetadata(args.Id); - if (metadata != null && metadata is string cast) - { - OnAlertLevel?.Invoke(cast); - } - }; - - - AlertLevelButton.Disabled = !AlertLevelSelectable; - - } - - protected override void FrameUpdate(FrameEventArgs args) - { - base.FrameUpdate(args); - } - - // The current alert could make levels unselectable, so we need to ensure that the UI reacts properly. - // If the current alert is unselectable, the only item in the alerts list will be - // the current alert. Otherwise, it will be the list of alerts, with the current alert - // selected. - public void UpdateAlertLevels(List? alerts, string currentAlert) - { - AlertLevelButton.Clear(); - - if (alerts == null) - { - var name = currentAlert; - if (_loc.TryGetString($"cp14-alert-level-{currentAlert}", out var locName)) - { - name = locName; - } - AlertLevelButton.AddItem(name); - AlertLevelButton.SetItemMetadata(AlertLevelButton.ItemCount - 1, currentAlert); - } - else - { - foreach (var alert in alerts) - { - var name = alert; - if (_loc.TryGetString($"cp14-alert-level-{alert}", out var locName)) - { - name = locName; - } - AlertLevelButton.AddItem(name); - AlertLevelButton.SetItemMetadata(AlertLevelButton.ItemCount - 1, alert); - if (alert == currentAlert) - { - AlertLevelButton.Select(AlertLevelButton.ItemCount - 1); - } - } - } - } - } -} diff --git a/Content.Server/AlertLevel/AlertLevelSystem.cs b/Content.Server/AlertLevel/AlertLevelSystem.cs index 606f1242ec..bc02808e7d 100644 --- a/Content.Server/AlertLevel/AlertLevelSystem.cs +++ b/Content.Server/AlertLevel/AlertLevelSystem.cs @@ -18,8 +18,7 @@ public sealed class AlertLevelSystem : EntitySystem [Dependency] private readonly StationSystem _stationSystem = default!; // Until stations are a prototype, this is how it's going to have to be. - // public const string DefaultAlertLevelSet = "stationAlerts"; // OLD VANILA. Changed by CP14. - public const string DefaultAlertLevelSet = "CP14TownAlerts"; + public const string DefaultAlertLevelSet = "stationAlerts"; public override void Initialize() { @@ -185,8 +184,7 @@ public sealed class AlertLevelSystem : EntitySystem } // The full announcement to be spat out into chat. - // var announcementFull = Loc.GetString("alert-level-announcement", ("name", name), ("announcement", announcement)); // OLD VANILA. Changed by CP14. - var announcementFull = Loc.GetString("cp14-alert-level-announcement", ("name", name), ("announcement", announcement)); + var announcementFull = Loc.GetString("alert-level-announcement", ("name", name), ("announcement", announcement)); var playDefault = false; if (playSound) diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index f3a3f0c87c..662d31f762 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -95,6 +95,7 @@ namespace Content.Server.Explosion.EntitySystems InitializeTimedCollide(); InitializeVoice(); InitializeMobstate(); + InitializeDamageReceived(); //CP14 trigger on damage partial SubscribeLocalEvent(OnSpawnTriggered); SubscribeLocalEvent(OnTriggerCollide); diff --git a/Content.Server/_CP14/Explosion/Components/CP14TriggerOnDamageReceivedComponent.cs b/Content.Server/_CP14/Explosion/Components/CP14TriggerOnDamageReceivedComponent.cs new file mode 100644 index 0000000000..cc606d0464 --- /dev/null +++ b/Content.Server/_CP14/Explosion/Components/CP14TriggerOnDamageReceivedComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Explosion.Components; + +/// +/// Triggers when the entity is damaged. +/// +[RegisterComponent] +public sealed partial class CP14TriggerOnDamageReceivedComponent : Component { } diff --git a/Content.Server/_CP14/Explosion/EntitySystems/CP14TriggerSystem.Damage.cs b/Content.Server/_CP14/Explosion/EntitySystems/CP14TriggerSystem.Damage.cs new file mode 100644 index 0000000000..5d570090ef --- /dev/null +++ b/Content.Server/_CP14/Explosion/EntitySystems/CP14TriggerSystem.Damage.cs @@ -0,0 +1,20 @@ +using Content.Server.Explosion.Components; +using Content.Shared.Damage; + +namespace Content.Server.Explosion.EntitySystems; + +public sealed partial class TriggerSystem +{ + private void InitializeDamageReceived() + { + SubscribeLocalEvent(OnDamageReceived); + } + + private void OnDamageReceived(EntityUid uid, CP14TriggerOnDamageReceivedComponent component, DamageChangedEvent args) + { + if (!args.DamageIncreased) + return; + + Trigger(uid); + } +} diff --git a/Resources/Audio/_CP14/Misc/attributions.yml b/Resources/Audio/_CP14/Misc/attributions.yml index 72c34db847..dfe2e4a911 100644 --- a/Resources/Audio/_CP14/Misc/attributions.yml +++ b/Resources/Audio/_CP14/Misc/attributions.yml @@ -1,16 +1,21 @@ # Attempted to keep the files in alphabetical order so its easier to audit. # Finding individual authors is an unfeasible task. If you can reference the author please do so. -- files: ["safe-alert.ogg"] - license: "CC-BY-4.0" - copyright: "Created by kevp888" - source: "https://freesound.org/s/688445" +- files: ["doom-bell-short.ogg"] + license: "CC-BY-NC-3.0" + copyright: "Created by Ev-Dawg" + source: "https://freesound.org/s/335991" -- files: ["minor-alert.ogg"] +- files: ["minor-alert-short.ogg"] license: "CC0-1.0" copyright: "Created by Horrormarkus" source: "https://freesound.org/s/659672" -- files: ["major-alert.ogg"] +- files: ["major-alert-short.ogg"] license: "CC0-1.0" copyright: "Created by Aeonomi" source: "https://freesound.org/s/180329" + +- files: ["scary-bell-short.ogg"] + license: "CC-BY-NC-4.0" + copyright: "Created by WesleyExtremeGamer" + source: "https://freesound.org/s/530340" diff --git a/Resources/Audio/_CP14/Misc/doom-bell-short.ogg b/Resources/Audio/_CP14/Misc/doom-bell-short.ogg new file mode 100644 index 0000000000..6619a9c251 Binary files /dev/null and b/Resources/Audio/_CP14/Misc/doom-bell-short.ogg differ diff --git a/Resources/Audio/_CP14/Misc/major-alert-short.ogg b/Resources/Audio/_CP14/Misc/major-alert-short.ogg new file mode 100644 index 0000000000..afb9bfa56e Binary files /dev/null and b/Resources/Audio/_CP14/Misc/major-alert-short.ogg differ diff --git a/Resources/Audio/_CP14/Misc/major-alert.ogg b/Resources/Audio/_CP14/Misc/major-alert.ogg deleted file mode 100644 index 5caf3bdb7b..0000000000 Binary files a/Resources/Audio/_CP14/Misc/major-alert.ogg and /dev/null differ diff --git a/Resources/Audio/_CP14/Misc/minor-alert-short.ogg b/Resources/Audio/_CP14/Misc/minor-alert-short.ogg new file mode 100644 index 0000000000..782aceb459 Binary files /dev/null and b/Resources/Audio/_CP14/Misc/minor-alert-short.ogg differ diff --git a/Resources/Audio/_CP14/Misc/minor-alert.ogg b/Resources/Audio/_CP14/Misc/minor-alert.ogg deleted file mode 100644 index 2881b3d1ae..0000000000 Binary files a/Resources/Audio/_CP14/Misc/minor-alert.ogg and /dev/null differ diff --git a/Resources/Audio/_CP14/Misc/safe-alert.ogg b/Resources/Audio/_CP14/Misc/safe-alert.ogg deleted file mode 100644 index 575b2331d4..0000000000 Binary files a/Resources/Audio/_CP14/Misc/safe-alert.ogg and /dev/null differ diff --git a/Resources/Audio/_CP14/Misc/scary-bell-short.ogg b/Resources/Audio/_CP14/Misc/scary-bell-short.ogg new file mode 100644 index 0000000000..32a8a908dd Binary files /dev/null and b/Resources/Audio/_CP14/Misc/scary-bell-short.ogg differ diff --git a/Resources/Locale/en-US/_CP14/alert-levels/alert-levels.ftl b/Resources/Locale/en-US/_CP14/alert-levels/alert-levels.ftl deleted file mode 100644 index 3a74cfb21c..0000000000 --- a/Resources/Locale/en-US/_CP14/alert-levels/alert-levels.ftl +++ /dev/null @@ -1,10 +0,0 @@ -cp14-alert-level-announcement = Attention! Towns threat level is now {$name}! {$announcement} - -cp14-alert-level-safe = Safe -cp14-alert-level-safe-announcement = There is no threat to the town. Town folk may return to their duties safely. - -cp14-alert-level-minor = Minor -cp14-alert-level-minor-announcement = There is a minor threat to the town. Townsfolk should return to the town for their own safety. Guards are to be at their posts armed and combat ready. - -cp14-alert-level-major = Major -cp14-alert-level-major-announcement = There is a major threat to the town. Everyone must return to the town and protect it. diff --git a/Resources/Locale/en-US/_CP14/construction/guard-bell.ftl b/Resources/Locale/en-US/_CP14/construction/guard-bell.ftl deleted file mode 100644 index 9365e0c0cc..0000000000 --- a/Resources/Locale/en-US/_CP14/construction/guard-bell.ftl +++ /dev/null @@ -1,2 +0,0 @@ -cp14-guard-bell-menu-title = Guard Bell -cp14-guard-bell-alert-button = Change the towns threat level. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/alert-levels/alert-levels.ftl b/Resources/Locale/ru-RU/_CP14/alert-levels/alert-levels.ftl deleted file mode 100644 index 85e5f5784f..0000000000 --- a/Resources/Locale/ru-RU/_CP14/alert-levels/alert-levels.ftl +++ /dev/null @@ -1,10 +0,0 @@ -cp14-alert-level-announcement = Внимание! Уровень угрозы города теперь { $name }! { $announcement } - -cp14-alert-level-safe = Безопасно -cp14-alert-level-safe-announcement = Угрозы городу нет. Горожане могут спокойно вернуться к своим обязанностям. - -cp14-alert-level-minor = Незначительная угроза -cp14-alert-level-minor-announcement = Городу предстоит небольшая угроза. Горожанам рекомендуется быть внимательными и не покидать пределы города в темное время суток. Стража должна находиться на своих постах вооруженными и готовыми к бою. - -cp14-alert-level-major = Большая угроза -cp14-alert-level-major-announcement = Городу предстоит большая угроза! Призываем всех жителей объединиться и подготовиться к защите своих домов и семей. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/construction/guard-bell.ftl b/Resources/Locale/ru-RU/_CP14/construction/guard-bell.ftl deleted file mode 100644 index 52eb0f3f7d..0000000000 --- a/Resources/Locale/ru-RU/_CP14/construction/guard-bell.ftl +++ /dev/null @@ -1,2 +0,0 @@ -cp14-guard-bell-menu-title = Колокол стражи -cp14-guard-bell-alert-button = Изменяет уровень угрозы города. \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/AlertLevels/alert_levels.yml b/Resources/Prototypes/_CP14/AlertLevels/alert_levels.yml deleted file mode 100644 index 5b0bf5b0be..0000000000 --- a/Resources/Prototypes/_CP14/AlertLevels/alert_levels.yml +++ /dev/null @@ -1,23 +0,0 @@ -- type: alertLevels - id: CP14TownAlerts - defaultLevel: safe - levels: - safe: - announcement: cp14-alert-level-safe-announcement - sound: /Audio/_CP14/Misc/safe-alert.ogg - color: Green - emergencyLightColor: LawnGreen - shuttleTime: 600 - minor: - announcement: cp14-alert-level-minor-announcement - sound: /Audio/_CP14/Misc/minor-alert.ogg - color: DodgerBlue - emergencyLightColor: DodgerBlue - shuttleTime: 600 - major: - announcement: cp14-alert-level-major-announcement - sound: /Audio/_CP14/Misc/major-alert.ogg - color: Red - emergencyLightColor: Red - shuttleTime: 600 - diff --git a/Resources/Prototypes/_CP14/Entities/Stations/base.yml b/Resources/Prototypes/_CP14/Entities/Stations/base.yml index 68f5be042e..3ad8198e88 100644 --- a/Resources/Prototypes/_CP14/Entities/Stations/base.yml +++ b/Resources/Prototypes/_CP14/Entities/Stations/base.yml @@ -5,7 +5,7 @@ - BaseStation - BaseStationAllEventsEligible - BaseStationJobsSpawning - - CP14BaseTownAlerts + - BaseStationAlertLevels - BaseStationRecords # Required for lobby manifest + cryo leave - CP14BaseStationCommonObjectives - CP14BaseStationDemiplaneMap @@ -18,13 +18,6 @@ components: - type: CP14StationCommonObjectives -- type: entity - id: CP14BaseTownAlerts - abstract: true - components: - - type: AlertLevel - alertLevelPrototype: CP14TownAlerts - - type: entity id: CP14BaseStationDemiplaneMap abstract: true diff --git a/Resources/Prototypes/_CP14/Entities/Structures/Specific/Guard/guard_bell.yml b/Resources/Prototypes/_CP14/Entities/Structures/Specific/Guard/guard_bell.yml index 87db3e4f62..e52ac065e1 100644 --- a/Resources/Prototypes/_CP14/Entities/Structures/Specific/Guard/guard_bell.yml +++ b/Resources/Prototypes/_CP14/Entities/Structures/Specific/Guard/guard_bell.yml @@ -1,9 +1,10 @@ - type: entity parent: BaseStructure - id: CP14GuardBell + id: CP14BaseGuardBell name: guard bell description: A strong bell to alert the entire settlement of a possible threat. categories: [ ForkFiltered ] + abstract: true components: - type: Sprite drawdepth: Mobs @@ -12,11 +13,123 @@ sprite: _CP14/Structures/Specific/Guard/guard_bell.rsi layers: - state: base - - type: ActivatableUI - key: enum.CommunicationsConsoleUiKey.Key - - type: CommunicationsConsole - title: cp14-guard-bell-menu-title - - type: UserInterface - interfaces: - enum.CommunicationsConsoleUiKey.Key: - type: GuardBellBoundUserInterface + - type: Damageable + damageContainer: Inorganic + - type: TriggerOnActivate + - type: CP14TriggerOnDamageReceived + - type: SpawnOnTrigger + proto: GuardBellEffect1 + - type: UseDelay + delay: 2.0 + +- type: entity + id: CP14GuardBell + parent: CP14BaseGuardBell + components: + - type: Sprite + layers: + - state: base + - type: SpawnOnTrigger + proto: CP14GuardBellEffect1 + +- type: entity + id: CP14GuardBell2 + parent: CP14BaseGuardBell + components: + - type: Sprite + layers: + - state: base-2 + - type: SpawnOnTrigger + proto: CP14GuardBellEffect2 + +- type: entity + id: CP14GuardBell3 + parent: CP14BaseGuardBell + components: + - type: Sprite + layers: + - state: base-3 + - type: SpawnOnTrigger + proto: CP14GuardBellEffect3 + +- type: entity + id: CP14GuardBell4 + parent: CP14BaseGuardBell + components: + - type: Sprite + layers: + - state: base-4 + - type: SpawnOnTrigger + proto: CP14GuardBellEffect4 + +# Effects +- type: entity + id: CP14BaseGuardBellEffect + categories: [ HideSpawnMenu ] + abstract: true + components: + - type: CP14PvsOverride + - type: EmitSoundOnSpawn + sound: + path: /Audio/_CP14/Misc/scary-bell-short.ogg + params: + variation: 0.1 + maxDistance: 200 + - type: TimedDespawn + lifetime: 4.8 + - type: Sprite + drawdepth: Effects + offset: 0, 0.5 + layers: + - state: circle_increase + sprite: _CP14/Effects/Magic/cast_impact.rsi + shader: unshaded + +- type: entity + id: CP14GuardBellEffect1 + parent: CP14BaseGuardBellEffect + categories: [ HideSpawnMenu ] + components: + - type: EmitSoundOnSpawn + sound: + path: /Audio/_CP14/Misc/scary-bell-short.ogg + params: + variation: 0.1 + maxDistance: 200 + +- type: entity + id: CP14GuardBellEffect2 + parent: CP14BaseGuardBellEffect + categories: [ HideSpawnMenu ] + components: + - type: EmitSoundOnSpawn + sound: + path: /Audio/_CP14/Misc/doom-bell-short.ogg + params: + variation: 0.1 + maxDistance: 200 + +- type: entity + id: CP14GuardBellEffect3 + parent: CP14BaseGuardBellEffect + categories: [ HideSpawnMenu ] + components: + - type: EmitSoundOnSpawn + sound: + path: /Audio/_CP14/Misc/minor-alert-short.ogg + params: + volume: 20 + variation: 0.1 + maxDistance: 200 + +- type: entity + id: CP14GuardBellEffect4 + parent: CP14BaseGuardBellEffect + categories: [ HideSpawnMenu ] + components: + - type: EmitSoundOnSpawn + sound: + path: /Audio/_CP14/Misc/major-alert-short.ogg + params: + variation: 0.1 + maxDistance: 200 diff --git a/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-2.png b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-2.png new file mode 100644 index 0000000000..61c521106d Binary files /dev/null and b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-2.png differ diff --git a/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-3.png b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-3.png new file mode 100644 index 0000000000..0e613a7e05 Binary files /dev/null and b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-3.png differ diff --git a/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-4.png b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-4.png new file mode 100644 index 0000000000..18446749c1 Binary files /dev/null and b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/base-4.png differ diff --git a/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/meta.json b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/meta.json index 466ccadb2b..8bc4d741b8 100644 --- a/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/meta.json +++ b/Resources/Textures/_CP14/Structures/Specific/Guard/guard_bell.rsi/meta.json @@ -5,10 +5,19 @@ "y": 64 }, "license": "CC-BY-SA-4.0", - "copyright": "Created by Jaba", + "copyright": "Created by Jaba. Variant 2, 3 and 4 by Kryyto.", "states": [ { "name": "base" + }, + { + "name": "base-2" + }, + { + "name": "base-3" + }, + { + "name": "base-4" } ] } \ No newline at end of file