Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d9732c6
stats core
rhailrake Apr 28, 2024
e8a9779
skills core
rhailrake Apr 28, 2024
6eb3f5e
ahhhh
rhailrake Apr 28, 2024
dd2f539
dreaming
rhailrake Apr 28, 2024
b8385ea
refactor stats
rhailrake Apr 29, 2024
a7f0c23
skills refactor
rhailrake Apr 29, 2024
442cafc
skibidi update
rhailrake Apr 29, 2024
e943e95
тз так сказать
rhailrake Apr 29, 2024
cda9713
luck stat
rhailrake Apr 29, 2024
5871980
d20/roller
rhailrake Apr 29, 2024
151a298
poxuy
rhailrake Apr 29, 2024
ccdb56f
skilled healing
rhailrake Apr 29, 2024
e26aa11
preparation
rhailrake Apr 29, 2024
96676ea
вот это мы умные(нет)
rhailrake Apr 29, 2024
49845d0
no < 1
rhailrake Apr 29, 2024
d8650b7
predictedrandom yea
rhailrake Apr 30, 2024
ccbe005
skibidi combat v1.0
rhailrake Apr 30, 2024
a16e86d
insane(insanity)
rhailrake Apr 30, 2024
b28bc52
fuck
rhailrake Apr 30, 2024
883ecf4
still dreaming
rhailrake May 2, 2024
4da83a4
refactor time
rhailrake May 2, 2024
0a6f7b1
Рефактор боевки(частично) по заветам гурпса.
rhailrake May 2, 2024
fb4d219
TryCrit gurps ed.
rhailrake May 2, 2024
f1a3985
oh uh
rhailrake May 2, 2024
6aa27e8
dop dop dop yes yes yes
rhailrake May 2, 2024
3161fc4
sussy sus
rhailrake May 2, 2024
d6bceaa
sheesh
rhailrake May 2, 2024
430a60a
bug fix 1
rhailrake May 2, 2024
8d83b9a
bug fix 2
rhailrake May 2, 2024
2e36e6b
fixes
rhailrake May 2, 2024
33c25c7
health scales with str stat
rhailrake May 2, 2024
7bba975
nigga wtf
rhailrake May 2, 2024
78860e1
stamina scales with endurance
rhailrake May 2, 2024
54b177b
dajfiuasdhfuiahdsuifd
rhailrake May 2, 2024
7cb188a
похуй гойда
rhailrake May 2, 2024
b216759
SkibidiShootingSystem.cs
rhailrake May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Content.Client.UserInterface.Systems.Character.Controls;
using Content.Client.UserInterface.Systems.Character.Windows;
using Content.Client.UserInterface.Systems.Objectives.Controls;
using Content.Shared._Lfwb.Skills;
using Content.Shared._Lfwb.Stats;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
Expand All @@ -23,12 +25,20 @@ namespace Content.Client.UserInterface.Systems.Character;
public sealed class CharacterUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>, IOnSystemChanged<CharacterInfoSystem>
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[UISystemDependency] private readonly CharacterInfoSystem _characterInfo = default!;
[UISystemDependency] private readonly SpriteSystem _sprite = default!;

private CharacterWindow? _window;
private MenuButton? CharacterButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.CharacterButton;

public override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);
}

public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_window == null);
Expand Down Expand Up @@ -184,6 +194,71 @@ private void CharacterUpdated(CharacterData data)

_window.RolePlaceholder.Visible = briefing == null && controls.Count == 0 && objectives.Count == 0;
_window.MemoriesPlaceholder.Visible = memories.Count == 0;

FillStat();
FillSkills();
}

private void FillStat()
{
_window?.StatsLabel.RemoveAllChildren();

var playerEntity = _playerManager.LocalPlayer!.ControlledEntity;

if (!playerEntity.HasValue)
return;

if (!_entityManager.TryGetComponent<StatsComponent>(playerEntity, out var stats))
{
_window?.StatsLabel.SetMessage("");
return;
}

var msg = new FormattedMessage();

msg.Clear();

msg.PushNewline();

foreach (var stat in stats.Stats)
{
if (stat.Key == Stat.Luck)
continue;

var statLoc = Loc.GetString($"stat-{stat.Key}");
msg.AddMarkup($"[color=#7980ad]{statLoc}[/color]: [color=yellow]{stat.Value}[/color]\n");
}

_window?.StatsLabel.SetMessage(msg);
}

private void FillSkills()
{
_window?.SkillsLabel.RemoveAllChildren();

var playerEntity = _playerManager.LocalPlayer!.ControlledEntity;

if (!playerEntity.HasValue)
return;

if (!_entityManager.TryGetComponent<SkillsComponent>(playerEntity, out var skills))
{
_window?.SkillsLabel.SetMessage("");
return;
}

var msg = new FormattedMessage();

msg.Clear();

msg.PushNewline();

foreach (var skill in skills.Skills)
{
msg.AddMarkup($"[color=#7980ad]{skill.Key.ToString()}[/color]: [color=yellow]{skill.Value.Item1.ToString()}[/color]\n");
}

_window?.SkillsLabel.SetMessage(msg);
}

private void CharacterDetached(EntityUid uid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
</BoxContainer>

<!-- WD EDIT -->
<Label Text="{Loc 'character-info-memories-label'}" HorizontalAlignment="Center" />
<Label Text="Память:" HorizontalAlignment="Center" />
Copy link

Choose a reason for hiding this comment

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

Translation tags are missing for new labels. This might affect localization support.

- <Label Text="Память:" HorizontalAlignment="Center" />
- <Label Text="Статы:" HorizontalAlignment="Center" />
- <Label Text="Скиллы:" HorizontalAlignment="Center" />
- <Label Name="ObjectivesLabel" Access="Public" Text="Цели:" HorizontalAlignment="Center" />
+ <Label Text="{Loc 'memory-label'}" HorizontalAlignment="Center" />
+ <Label Text="{Loc 'stats-label'}" HorizontalAlignment="Center" />
+ <Label Text="{Loc 'skills-label'}" HorizontalAlignment="Center" />
+ <Label Name="ObjectivesLabel" Access="Public" Text="{Loc 'objectives-label'}" HorizontalAlignment="Center" />

Also applies to: 25-25, 28-28, 31-31

<BoxContainer Orientation="Vertical" Name="Memories" Access="Public" />
<cc:Placeholder Name="MemoriesPlaceholder" Access="Public"
PlaceholderText="{Loc 'character-info-memories-placeholder-text'}" />
<!-- WD EDIT END -->

<Label Name="ObjectivesLabel" Access="Public" Text="{Loc 'character-info-objectives-label'}"
<Label Text="Статы:" HorizontalAlignment="Center" />
<RichTextLabel Name="StatsLabel" Access="Public" HorizontalAlignment="Left" HorizontalExpand="True"/>

<Label Text="Скиллы:" HorizontalAlignment="Center" />
<RichTextLabel Name="SkillsLabel" Access="Public" HorizontalAlignment="Left" HorizontalExpand="True"/>

<Label Name="ObjectivesLabel" Access="Public" Text="Цели:"
HorizontalAlignment="Center" />
<BoxContainer Orientation="Vertical" Name="Objectives" Access="Public" />
<cc:Placeholder Name="RolePlaceholder" Access="Public"
Expand Down
111 changes: 111 additions & 0 deletions Content.Client/_Lfwb/CombatMusic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using Content.Client.Audio;
using Content.Client.CombatMode;
using Content.Shared.CombatMode;
using Content.Shared.GameTicking;
using Robust.Client.Player;
using Robust.Client.ResourceManagement;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client._Lfwb;

public sealed class CombatMusic : EntitySystem
{
#region Values

private EntityUid? _combatMusicStream;

#endregion

#region Dependencies

[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ContentAudioSystem _contentAudio = default!;
[Dependency] private readonly CombatModeSystem _combat = default!;
[Dependency] private readonly IResourceCache _resource = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

#endregion

#region Event Handling

public override void Initialize()
{
base.Initialize();

PreloadTracks();

SubscribeLocalEvent<CombatModeComponent, PlayerDetachedEvent>(OnPlayerDetached);

SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRestart);

_combat.LocalPlayerCombatModeUpdated += OnCombatModeUpdated;
}

public override void Shutdown()
{
base.Shutdown();

_combat.LocalPlayerCombatModeUpdated -= OnCombatModeUpdated;

_audio.Stop(_combatMusicStream);
}

#endregion


#region Main Process

private void OnCombatModeUpdated(bool inCombatMode)
{
(inCombatMode ? (Action) StartCombatMusic : StopCombatMusic).Invoke();
}

private void OnPlayerDetached(EntityUid uid, CombatModeComponent component, PlayerDetachedEvent args)
{
if (args.Player != _playerManager.LocalSession)
return;

StopCombatMusic();
}

private void OnRestart(RoundRestartCleanupEvent args)
{
StopCombatMusic();
}

#endregion


#region Helpers

private void PreloadTracks()
{
foreach (var audio in _proto.Index<SoundCollectionPrototype>("CombatMusic").PickFiles)
{
_resource.GetResource<AudioResource>(audio.ToString());
}
}

private void StartCombatMusic()
{
var stream = _audio.PlayGlobal(new SoundCollectionSpecifier("CombatMusic"), Filter.Local(), false, AudioParams.Default.WithLoop(true).WithVolume(-4));

if (!stream.HasValue)
return;

_combatMusicStream = stream.Value.Entity;
_contentAudio.FadeIn(_combatMusicStream, stream.Value.Component, 3f);
}

private void StopCombatMusic()
{
_contentAudio.FadeOut(_combatMusicStream);
_combatMusicStream = null;
}

#endregion
}
14 changes: 14 additions & 0 deletions Content.Server/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Robust.Server.Player;
using Robust.Shared.Asynchronous;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Replays;
Expand Down Expand Up @@ -58,6 +59,7 @@ internal sealed partial class ChatManager : IChatManager
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ReputationManager _repManager = default!;
[Dependency] private readonly ITaskManager _taskManager = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!;
/// WD-EDIT

/// <summary>
Expand Down Expand Up @@ -407,6 +409,18 @@ public void ChatMessageToOne(ChatChannel channel, string message, string wrapped
}
}

public void ChatMessageToManyButHueta(Filter filter, string message)
{
if (!filter.Recipients.Any())
return;

var clients = filter.Recipients.ToList();
foreach (var client in clients)
{
_consoleHost.RemoteExecuteCommand(client, $"notice [font size=15][color=#890000]{message}[/color][/font]");
}
}
Comment on lines +412 to +422
Copy link

Choose a reason for hiding this comment

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

Introduced new method ChatMessageToManyButHueta to send formatted messages to multiple clients.

- _consoleHost.RemoteExecuteCommand(client, $"notice [font size=15][color=#890000]{message}[/color][/font]");
+ // Ensure to sanitize the message or validate user permissions before executing commands.
+ _consoleHost.RemoteExecuteCommand(client, $"notice [font size=15][color=#890000]{Security.Escape(message)}[/color][/font]");

Consider sanitizing the message to prevent potential injection attacks or validating user permissions before executing commands to enhance security.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void ChatMessageToManyButHueta(Filter filter, string message)
{
if (!filter.Recipients.Any())
return;
var clients = filter.Recipients.ToList();
foreach (var client in clients)
{
_consoleHost.RemoteExecuteCommand(client, $"notice [font size=15][color=#890000]{message}[/color][/font]");
}
}
public void ChatMessageToManyButHueta(Filter filter, string message)
{
if (!filter.Recipients.Any())
return;
var clients = filter.Recipients.ToList();
foreach (var client in clients)
{
// Ensure to sanitize the message or validate user permissions before executing commands.
_consoleHost.RemoteExecuteCommand(client, $"notice [font size=15][color=#890000]{Security.Escape(message)}[/color][/font]");
}
}


public void ChatMessageToMany(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, bool recordReplay, IEnumerable<INetChannel> clients, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0, NetUserId? author = null)
{
ChatMessageToMany(channel, message, wrappedMessage, source, hideChat, recordReplay, clients.ToList(),
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Chat/Managers/IChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public interface IChatManager
void ChatMessageToOne(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat,
INetChannel client, Color? colorOverride = null, bool recordReplay = false, string? audioPath = null, float audioVolume = 0, NetUserId? author = null);

void ChatMessageToManyButHueta(Filter filter, string message);
Copy link

@coderabbitai coderabbitai bot Jun 18, 2024

Choose a reason for hiding this comment

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

Consider renaming ChatMessageToManyButHueta to better reflect its functionality and maintain professionalism in the codebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ну так подскажи название человеку

Copy link

Choose a reason for hiding this comment

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

@RavMorgan, considering the functionality of the method ChatMessageToManyButHueta, which involves sending a message to multiple users based on a specified filter, a more descriptive and professional name could be BroadcastFilteredMessage. This name reflects the method's purpose and maintains a professional tone in the codebase.

If you have any more specific functionalities or behaviors of this method that should be reflected in the name, please let me know!


void ChatMessageToMany(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, bool recordReplay,
IEnumerable<INetChannel> clients, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0, NetUserId? author = null);

Expand Down
8 changes: 7 additions & 1 deletion Content.Server/HealthExaminable/HealthExaminableSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Damage;
using Content.Shared._Lfwb.Skills;
using Content.Shared.Damage;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement;
Expand All @@ -10,6 +11,7 @@ namespace Content.Server.HealthExaminable;
public sealed class HealthExaminableSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
[Dependency] private readonly SharedSkillsSystem _skillsSystem = default!;

public override void Initialize()
{
Expand All @@ -20,6 +22,10 @@ public override void Initialize()

private void OnGetExamineVerbs(EntityUid uid, HealthExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
{
var skillLevel = _skillsSystem.GetSkillLevel(args.User, Skill.Medicine);
if (skillLevel < SkillLevel.Skilled)
return;

if (!TryComp<DamageableComponent>(uid, out var damage))
return;

Expand Down
22 changes: 17 additions & 5 deletions Content.Server/Medical/DefibrillatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Content.Server.Popups;
using Content.Server.PowerCell;
using Content.Server.Traits.Assorted;
using Content.Shared._Lfwb.Skills;
using Content.Shared._Lfwb.Stats;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Interaction;
Expand Down Expand Up @@ -46,6 +48,8 @@ public sealed class DefibrillatorSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly SharedSkillsSystem _skillsSystem = default!;
[Dependency] private readonly SharedStatsSystem _statsSystem = default!;

/// <inheritdoc/>
public override void Initialize()
Expand Down Expand Up @@ -174,7 +178,7 @@ public bool TryStartZap(EntityUid uid, EntityUid target, EntityUid user, Defibri
return false;

_audio.PlayPvs(component.ChargeSound, uid);
return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.DoAfterDuration, new DefibrillatorZapDoAfterEvent(),
return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, _skillsSystem.SkillLevelToDelay[_skillsSystem.GetSkillLevel(user, Skill.Medicine)], new DefibrillatorZapDoAfterEvent(),
uid, target, uid)
{
BlockDuplicate = true,
Expand All @@ -188,11 +192,17 @@ public void Zap(EntityUid uid, EntityUid target, EntityUid user, DefibrillatorCo
if (!Resolve(uid, ref component) || !Resolve(target, ref mob, ref thresholds, false))
return;

// clowns zap themselves
if (HasComp<ClumsyComponent>(user) && user != target)
if (_skillsSystem.GetSkillLevel(user, Skill.Medicine) == SkillLevel.Weak)
{
Zap(uid, user, user, component);
return;
var intStat = _statsSystem.GetStat(user, Stat.Intelligence);
var (_, response, result) = _statsSystem.D20(intStat);

if (!result)
{
_popup.PopupEntity(response, user, user);
_electrocution.TryDoElectrocution(user, null, component.ZapDamage, component.WritheDuration, true, ignoreInsulation: true);
return;
}
Comment on lines +197 to +205
Copy link

Choose a reason for hiding this comment

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

Consider adding detailed logging for the failure scenario in the defibrillation process.

+ AdminLogger.Add(LogType.FailedAction, $"{ToPrettyString(user):user} failed to defibrillate {ToPrettyString(target):target} due to low skill level.");

Adding detailed logging for when defibrillation fails due to a low skill level can help in debugging and understanding user interactions with the system.

Committable suggestion was skipped due to low confidence.

}

if (!_powerCell.TryUseActivatableCharge(uid, user: user))
Expand Down Expand Up @@ -251,6 +261,8 @@ public void Zap(EntityUid uid, EntityUid target, EntityUid user, DefibrillatorCo
: component.SuccessSound;
_audio.PlayPvs(sound, uid);

_skillsSystem.ApplySkillThreshold(user, Skill.Medicine, 10);

// if we don't have enough power left for another shot, turn it off
if (!_powerCell.HasActivatableCharge(uid))
TryDisable(uid, component);
Expand Down
Loading