Оверлей урона
This commit is contained in:
parent
53dce75216
commit
65db2701fe
13 changed files with 160 additions and 7 deletions
|
|
@ -14,6 +14,9 @@
|
|||
StyleClasses="LabelKeyText"/>
|
||||
<ui:OptionDropDown Name="DropDownLobbyBackground" Title="{Loc 'ui-options-lobby-background'}" />
|
||||
<ui:OptionSlider Name="LobbyOpacitySlider" Title="{Loc 'ui-options-lobby-opacity'}" />
|
||||
<Label Text="{Loc 'ui-options-general-figth'}"
|
||||
StyleClasses="LabelKeyText"/>
|
||||
<CheckBox Name="DamageOverlayCheckBox" Text="{Loc 'ui-options-damage-overlay'}" />
|
||||
<!-- Sunrise-End -->
|
||||
<Label Text="{Loc 'ui-options-general-discord'}"
|
||||
StyleClasses="LabelKeyText"/>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public sealed partial class MiscTab : Control
|
|||
}
|
||||
Control.AddOptionDropDown(SunriseCCVars.LobbyBackground, DropDownLobbyBackground, lobbyBackgroundEntries);
|
||||
Control.AddOptionPercentSlider(SunriseCCVars.LobbyOpacity, LobbyOpacitySlider);
|
||||
Control.AddOptionCheckBox(SunriseCCVars.DamageOverlay, DamageOverlayCheckBox);
|
||||
// Sunrise-End
|
||||
|
||||
Control.AddOptionCheckBox(CVars.DiscordEnabled, DiscordRich);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,12 @@ public sealed class PopupUIController : UIController, IOnStateEntered<GameplaySt
|
|||
font = _largeFont;
|
||||
color = Color.Red;
|
||||
break;
|
||||
// Sunrise-Start
|
||||
case PopupType.LargeGreen:
|
||||
font = _largeFont;
|
||||
color = Color.LightGreen;
|
||||
break;
|
||||
// Sunrise-End
|
||||
}
|
||||
|
||||
var dimensions = handle.GetDimensions(font, popup.Text, scale);
|
||||
|
|
|
|||
29
Content.Client/_Sunrise/DamageOverlay/DamageOverlaySystem.cs
Normal file
29
Content.Client/_Sunrise/DamageOverlay/DamageOverlaySystem.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using Content.Shared._Sunrise.DamageOverlay;
|
||||
using Content.Shared._Sunrise.SunriseCCVars;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Client._Sunrise.DamageOverlay;
|
||||
|
||||
public sealed class DamageOverlaySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_cfg.OnValueChanged(SunriseCCVars.DamageOverlay, OnDamageOverlayOptionChanged, true);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
_cfg.UnsubValueChanged(SunriseCCVars.DamageOverlay, OnDamageOverlayOptionChanged);
|
||||
}
|
||||
|
||||
private void OnDamageOverlayOptionChanged(bool option)
|
||||
{
|
||||
RaiseNetworkEvent(new DamageOverlayOptionEvent(option));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Content.Server._Sunrise.DamageOverlay;
|
||||
|
||||
[RegisterComponent, Access(typeof(DamageOverlaySystem))]
|
||||
public sealed partial class DamageOverlayComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
72
Content.Server/_Sunrise/DamageOverlay/DamageOverlaySystem.cs
Normal file
72
Content.Server/_Sunrise/DamageOverlay/DamageOverlaySystem.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using Content.Server.Mind;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._Sunrise.DamageOverlay;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server._Sunrise.DamageOverlay;
|
||||
|
||||
public sealed class DamageOverlaySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
|
||||
private readonly List<ICommonSession> _disabledSessions = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DamageOverlayComponent, DamageChangedEvent>(OnDamageChange);
|
||||
SubscribeNetworkEvent<DamageOverlayOptionEvent>(OnDamageOverlayOption);
|
||||
}
|
||||
|
||||
private async void OnDamageOverlayOption(DamageOverlayOptionEvent ev, EntitySessionEventArgs args)
|
||||
{
|
||||
if (ev.Enabled)
|
||||
_disabledSessions.Remove(args.SenderSession);
|
||||
else
|
||||
_disabledSessions.Add(args.SenderSession);
|
||||
}
|
||||
|
||||
private void OnDamageChange(EntityUid uid, DamageOverlayComponent component, DamageChangedEvent args)
|
||||
{
|
||||
if (args.DamageDelta == null)
|
||||
return;
|
||||
|
||||
var damageDelta = args.DamageDelta.GetTotal();
|
||||
|
||||
if (_mindSystem.TryGetMind(uid, out _, out var mindTarget) && mindTarget.Session != null)
|
||||
{
|
||||
if (_disabledSessions.Contains(mindTarget.Session))
|
||||
return;
|
||||
|
||||
if (damageDelta > 0)
|
||||
{
|
||||
_popupSystem.PopupEntity($"-{damageDelta}", uid, mindTarget.Session, PopupType.LargeCaution);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Origin == null)
|
||||
return;
|
||||
|
||||
if (_mindSystem.TryGetMind(args.Origin.Value, out _, out var mindOrigin) && mindOrigin.Session != null)
|
||||
{
|
||||
if (_disabledSessions.Contains(mindOrigin.Session))
|
||||
return;
|
||||
|
||||
if (damageDelta > 0)
|
||||
{
|
||||
if (args.Origin == uid)
|
||||
return;
|
||||
|
||||
_popupSystem.PopupEntity($"-{damageDelta}", uid, mindOrigin.Session, PopupType.LargeCaution);
|
||||
}
|
||||
else
|
||||
{
|
||||
_popupSystem.PopupEntity($"+{FixedPoint2.Abs(damageDelta)}", uid, mindOrigin.Session, PopupType.LargeGreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -196,6 +196,7 @@ namespace Content.Shared.Popups
|
|||
/// but is not life-threatening.
|
||||
/// </summary>
|
||||
Large,
|
||||
LargeCaution
|
||||
LargeCaution,
|
||||
LargeGreen
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._Sunrise.DamageOverlay;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class DamageOverlayOptionEvent : EntityEventArgs
|
||||
{
|
||||
public bool Enabled { get; }
|
||||
public DamageOverlayOptionEvent(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
|
@ -204,9 +204,12 @@ public sealed class SunriseCCVars
|
|||
CVarDef.Create("cryo_teleport.enable", false, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* Damage variance
|
||||
* Damage
|
||||
*/
|
||||
|
||||
public static readonly CVarDef<bool> DamageOverlay =
|
||||
CVarDef.Create("damage.overlay", true, CVar.CLIENTONLY | CVar.ARCHIVE);
|
||||
|
||||
public static readonly CVarDef<float> DamageVariance =
|
||||
CVarDef.Create("damage.variance", 0.15f, CVar.SERVER | CVar.REPLICATED);
|
||||
|
||||
|
|
|
|||
|
|
@ -2328,3 +2328,14 @@
|
|||
type: Tweak
|
||||
id: 170
|
||||
time: '2024-08-07T20:10:55.993503+00:00'
|
||||
- author: VigersRay
|
||||
changes:
|
||||
- message: "\u041E\u0444\u0438\u0446\u0435\u0440\u044B \u0421\u0411 \u0442\u0435\
|
||||
\u043F\u0435\u0440\u044C \u043C\u043E\u0433\u0443\u0442 \u0438\u0441\u043F\u043E\
|
||||
\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u043B\u043E\u0443\u043D\
|
||||
\u0430 \u043A\u0430\u043A \u043C\u0438\u0448\u0435\u043D\u044C - \u0434\u043E\
|
||||
\u0431\u0430\u0432\u043B\u0435\u043D \u043E\u0432\u0435\u0440\u043B\u0435\u0439\
|
||||
\ \u0443\u0440\u043E\u043D\u0430."
|
||||
type: Tweak
|
||||
id: 171
|
||||
time: '2024-08-08T05:08:32.401551+00:00'
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ ui-options-general-speech = Речь
|
|||
ui-options-general-storage = Инвентарь
|
||||
ui-options-general-accessibility = Доступность
|
||||
ui-options-general-lobby = Лобби
|
||||
ui-options-general-figth = Бой
|
||||
|
||||
## Audio menu
|
||||
|
||||
|
|
@ -48,8 +49,7 @@ ui-options-interface-label = Интерфейс
|
|||
|
||||
ui-options-lobby-opacity = Прозрачность лобби
|
||||
ui-options-lobby-background = Фон лобби
|
||||
ui-options-show-lobby-changelog = Показывать чейнжлог в лобби
|
||||
ui-options-show-lobby-servers-hub = Показывать хаб серверов в лобби
|
||||
ui-options-damage-overlay = Оверлей урона
|
||||
ui-options-show-held-item = Показать удерживаемый элемент рядом с курсором
|
||||
ui-options-show-combat-mode-indicators = Показать индикатор боевого режима рядом с курсором
|
||||
ui-options-opaque-storage-window = Непрозрачность окна хранилища
|
||||
|
|
|
|||
|
|
@ -216,10 +216,12 @@
|
|||
- CanPilot
|
||||
- FootstepSound
|
||||
- DoorBumpOpener
|
||||
# Sunrise-Start
|
||||
- type: Paws
|
||||
screamInterval: 3
|
||||
thresholdDamage: 5
|
||||
coughInterval: 5
|
||||
# Sunrise-End
|
||||
|
||||
- type: entity
|
||||
save: false
|
||||
|
|
@ -232,8 +234,10 @@
|
|||
id: BaseMobSpeciesOrganic
|
||||
abstract: true
|
||||
components:
|
||||
- type: Carriable # Sunrise-edit
|
||||
- type: CanEscapeInventory # Sunrise-edit
|
||||
# Sunrise-Start
|
||||
- type: Carriable
|
||||
- type: CanEscapeInventory
|
||||
# Sunrise-End
|
||||
- type: Barotrauma
|
||||
damage:
|
||||
types:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@
|
|||
- type: StatusIcon
|
||||
- type: RequireProjectileTarget
|
||||
active: False
|
||||
- type: TTS # Sunrise-TTS
|
||||
# Sunrise-Start
|
||||
- type: TTS
|
||||
- type: DamageOverlay
|
||||
# Sunrise-End
|
||||
|
||||
# Used for mobs that have health and can take damage.
|
||||
- type: entity
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue