-
Notifications
You must be signed in to change notification settings - Fork 89
Новый костер на топливе #204
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
base: develop
Are you sure you want to change the base?
Conversation
| using Content.Shared.DoAfter; | ||
| using Content.Server.Temperature.Systems; | ||
|
|
||
| namespace Content.Server.Imperial.Medieval.Bonfire; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Система не понятно почему на сервере, это кринж
|
|
||
| public sealed class BonfireSystem : EntitySystem | ||
| { | ||
| [Dependency] protected readonly SharedAudioSystem _audio = default!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем здесь протектед хз, нигде не наследуется
| [Dependency] protected readonly SharedAudioSystem _audio = default!; | |
| [Dependency] private readonly SharedAudioSystem _audio = default!; |
| [Dependency] private readonly TemperatureSystem _temperature = default!; | ||
| [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; | ||
|
|
||
| private const float FuelDecreasePerSecond = 0.11f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему эти данные хардкодно зашиты в системе, а не находятся в компоненте - под вопросом.
Перенести в компонент по-хорошему
| } | ||
|
|
||
| bonfire.CurrentFuel = MathF.Max(0, bonfire.CurrentFuel - FuelDecreasePerSecond * frameTime); | ||
| UpdateBonfireVisuals(uid, bonfire); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
каждый тик обновляется визуализация костра т.е. вызываются
_lights.SetEnergy(uid, energy);
_lights.SetRadius(uid, radius, light);
что потенциально может привести к лагам.
| { | ||
| if (component.IsLit == BonfireVisuals.Off) | ||
| { | ||
| args.PushText("Костёр не горит."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хардкод локализация.
Совет:
Loc.GetString("loc-key", ("var-name", component.IsLit == BonfireVisuals.Off));loc-key =
{ $var-name ->
[true] Тру
*[other] Фолс
}|
|
||
| EnsureComp<AmbientSoundComponent>(uid); | ||
|
|
||
| _ambientSound.SetSound(uid, new SoundPathSpecifier("/Audio/Ambience/Objects/fireplace.ogg")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хардкод звук, должно быть в компоненте
| EnsureComp<PointLightComponent>(uid); | ||
|
|
||
| _lights.SetEnabled(uid, true); | ||
| _lights.SetColor(uid, Color.FromHex("#FFC90C")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хардкод значения. Тож по хорошему должно быть в компоненте
| _ambientSound.SetAmbience(uid, true); | ||
|
|
||
| _appearance.SetData(uid, BonfireVisualLayers.Fire, true); | ||
| _audio.PlayPvs(new SoundPathSpecifier(component.IgnitionSound), uid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему SoundPathSpecifier здесь, а не в компоненте?
| public sealed partial class BonfireComponent : Component | ||
| { | ||
| [DataField] | ||
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; | |
| public SoundSpecifier IgnitionSound = new SoundPathSpecifier("/Audio/Items/Flare/flare_on.ogg"); |
| public string IgnitionSound = "/Audio/Items/Flare/flare_on.ogg"; | ||
|
|
||
| [DataField] | ||
| public string ExtinguishSound = "/Audio/Items/candle_blowing.ogg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То же самое что и IgnitionSound
О ПР`е
Технические детали
Изменения кода официальных разработчиков