Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goal_action #2198

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
56 changes: 56 additions & 0 deletions Content.Server/SS220/Shout/ShoutSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Shared.ActionBlocker;
using Robust.Shared.Audio.Systems;
using Content.Server.Chat.Systems;
using Content.Shared.SS220.Shout;
using Content.Shared.Dataset;
using Robust.Shared.Random;
using Robust.Shared.Prototypes;

namespace Content.Server.SS220.Shout;

public sealed class ShoutSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;

/// <summary>
/// Just handler of a ShoutActionEvent.
/// If there is no sound or phrase it won't do anything.
/// </summary>
Comment on lines +21 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я так думаю это должно быть документацией к классу, так что должно быть прямо перед ним


public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShoutActionEvent>(OnShoutAction);
}

private void OnShoutAction(ShoutActionEvent args)
{
if (args.Handled)
return;

args.Handled = true;

if (!_actionBlocker.CanEmote(args.Performer))
return;

if (args.ShoutSound != null)
{
_audio.PlayEntity(args.ShoutSound, args.Performer, args.Performer);
}

if (args.ShoutPhrases != null)
{
if (!_proto.TryIndex<DatasetPrototype>(args.ShoutPhrases, out var placeholder))//i dont like nested ifs, but idk how to make it more pretty
return;

var emoteType = _random.Pick(placeholder.Values);
_chat.TrySendInGameICMessage(args.Performer, emoteType, InGameICChatType.Emote, ChatTransmitRange.Normal, checkRadioPrefix: false, ignoreActionBlocker: true);
}
}
}
26 changes: 26 additions & 0 deletions Content.Shared/SS220/Shout/ShoutEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Shared.Actions;
using Robust.Shared.Prototypes;
using Robust.Shared.Audio;
using Content.Shared.Dataset;

namespace Content.Shared.SS220.Shout;
/// <summary>
/// Event for memes, or is u want to make some kind of alternative scream button
/// </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Гендер для звука разве что, а для сообщения в чат гендер может переключаться локализацией (просто комментарий, действий не требуется)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, вот я для звука, но может как-то потом

/// ToDo maybe add some gender checks if it will be used be anybody except me?
public sealed partial class ShoutActionEvent : InstantActionEvent
{
/// <summary>
/// Sound played when action button is pressed
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier? ShoutSound;

/// <summary>
/// Shouted phrase when action button is pressed
/// </summary>
[DataField]
public ProtoId<DatasetPrototype>? ShoutPhrases;
}
5 changes: 5 additions & 0 deletions Resources/Audio/SS220/Voice/Goal/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- files:
- gooool.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.myinstants.com/ru/instant/goool-7073/"
Comment on lines +1 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Источник интересный, а у нас есть право лицензировать это как CC0, я уж не говорю о том что использовать?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я, просто, не уверен, что можно писать “No Known Copyright”.

Насчёт использования, то тут на уровне нашего ТТС.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаешь свой где-то записать?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Насчёт использования, то тут на уровне нашего ТТС.

Есть 2 существенных отличия от ТТС:

  1. Данный репозиторий не содержит ни методов генерации голоса, ни моделей для генерации, только механизм получения с сервера, что совершенно легально
  2. Сами модели ТТС хоть и могли быть натренерованы на чужих данных, это пока не признаётся однозначным нарушением прав интелликтуальной собственности

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А с этим звуком, точнее как ты здесь его определил, есть 2 проблемы:

  1. Мы никак не можем публиковать открытую лицензию на этот файл, но для этого можно указать Custom в поле license
  2. Нет подтверждения тому, что у нас есть лицензия на файл

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Короче, снова немного в дебри погрузился. По сути это user generated content, так как постобработка и контекст.

Но что по лицензии хз.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В общем я ещё уточню по этому моменту, но лучше искать звук на который у нас будет лицензия. Можно, я не знаю, попросить Шусса на стриме крикнуть "ГОООЛ" чтоб мы это использовали здесь.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В общем я ещё уточню по этому моменту, но лучше искать звук на который у нас будет лицензия. Можно, я не знаю, попросить Шусса на стриме крикнуть "ГОООЛ" чтоб мы это использовали здесь.

я бы ещё по картинке спросил. Мне её просто пережатую скинули. Лучше попросить наших перерисовать, когда со звуком разберемся?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На самом деле да

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

с картинкой решено

Binary file added Resources/Audio/SS220/Voice/Goal/gooool.ogg
Binary file not shown.
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/ss220/prototypes/actions/types.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ActionGoal = Гол
.desc = ГОООООООООООООООООООЛ!
5 changes: 5 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/space.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
interactFailureString: petting-failure-bear
interactSuccessSound:
path: /Audio/Animals/sloth_squeak.ogg
#SS220 Goal start
- type: ActionGrant
actions:
- ActionGoal
#SS220 Goal end

- type: entity
id: MobBearSpaceSalvage
Expand Down
13 changes: 13 additions & 0 deletions Resources/Prototypes/SS220/Actions/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@
itemIconStyle: NoItem
useDelay: 1 # emote spam
event: !type:ToggleActionEvent

- type: entity
id: ActionGoal
name: Goal!
description: Gooooooooal!
components:
- type: InstantAction
useDelay: 20
icon: { sprite: SS220/Interface/Actions/actions_meme.rsi.rsi, state: goal }
event: !type:ShoutActionEvent
shoutSound:
path: /Audio/SS220/Voice/Goal/gooool.ogg
shoutPhrases: goalPhrases
9 changes: 9 additions & 0 deletions Resources/Prototypes/SS220/Datasets/goal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- type: dataset
id: goalPhrases
values:
- восклицает
- голосует
- бравирует
- возглашает
- выкрикивает
- вскрикивает
Comment on lines +1 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А локализацию можно?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понял

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сами фразы должны быть в локализации, здесь должны быть только ключи

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": 1,
"license": "EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt",
"copyright": "Sprited by Gabbka for SS220",
SkaldetSkaeg marked this conversation as resolved.
Show resolved Hide resolved
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "goal"
}
]
}
Loading