Skip to content

Commit

Permalink
Resomi (#27)
Browse files Browse the repository at this point in the history
* resomi

* locale + fix sprites

* displacements

* add sprites (not full (need to check up)) + agillity skill

* some stuff

* -_-

* фыф

* add

* fix

* Add sprites

* localisation

* fix

* вы нахуй меня дрочите?!!

---------

Co-authored-by: AwareFoxy <[email protected]>
  • Loading branch information
pofitlo-Git and AwareFoxy authored Nov 25, 2024
1 parent 1826f6f commit 46bb84e
Show file tree
Hide file tree
Showing 502 changed files with 3,991 additions and 1,238 deletions.
3 changes: 2 additions & 1 deletion Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,9 @@ private void SendEntityWhisper(
if (MessageRangeCheck(session, data, range) != MessageRangeCheckResult.Full)
continue; // Won't get logged to chat, and ghosts are too far away to see the pop-up, so we just won't send it to them.

if (data.Range <= WhisperClearRange)
if (data.Range <= (TryComp<ChatModifierComponent>(listener, out var modifier) ? modifier.WhisperListeningRange : WhisperClearRange)) //Corvax-Next-Resomi
_chatManager.ChatMessageToOne(ChatChannel.Whisper, message, wrappedMessage, source, false, session.Channel);

//If listener is too far, they only hear fragments of the message
else if (_examineSystem.InRangeUnOccluded(source, listener, WhisperMuffledRange))
_chatManager.ChatMessageToOne(ChatChannel.Whisper, obfuscatedMessage, wrappedobfuscatedMessage, source, false, session.Channel);
Expand Down
6 changes: 6 additions & 0 deletions Content.Server/Flash/FlashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ public void Flash(EntityUid target,
bool melee = false,
TimeSpan? stunDuration = null)
{
//CorvaxNext duration modifier for resomi
if (TryComp<FlashModifierComponent>(target, out var flashModifier))
{
flashDuration *= flashModifier.Modifier;
}

var attempt = new FlashAttemptEvent(target, user, used);
RaiseLocalEvent(target, attempt, true);

Expand Down
108 changes: 108 additions & 0 deletions Content.Server/_CorvaxNext/Resomi/Abilities/AgillitySkillSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using Content.Shared.Actions;
using Content.Shared.Alert;
using Content.Shared.Maps;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Timing;
using Content.Shared._CorvaxNext.Resomi;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared._CorvaxNext.Resomi.Abilities;
using Content.Shared.Damage.Components;
using Robust.Shared.Physics;

namespace Content.Server._CorvaxNext.Resomi.Abilities;

public sealed class AgillitySkillSystem : SharedAgillitySkillSystem
{
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;

private Entity<BaseActionComponent> action;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AgillitySkillComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<AgillitySkillComponent, SwitchAgillityActionEvent>(SwitchAgility);
SubscribeLocalEvent<AgillitySkillComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
}

private void OnComponentInit(Entity<AgillitySkillComponent> ent, ref ComponentInit args)
{
_actionsSystem.AddAction(ent.Owner, ref ent.Comp.SwitchAgilityActionEntity, ent.Comp.SwitchAgilityAction, ent.Owner);
}

private void SwitchAgility(Entity<AgillitySkillComponent> ent, ref SwitchAgillityActionEvent args)
{
action = args.Action;

if (!ent.Comp.Active)
{
ActivateAgility(ent, action);
}
else
{
DeactivateAgility(ent.Owner, ent.Comp, action);
}
}

private void ActivateAgility(Entity<AgillitySkillComponent> ent, Entity<BaseActionComponent> action)
{
if (!TryComp<MovementSpeedModifierComponent>(ent.Owner, out var comp))
return;

_popup.PopupEntity(Loc.GetString("agility-activated-massage"), ent.Owner);

ent.Comp.SprintSpeedCurrent += ent.Comp.SprintSpeedModifier; // adding a modifier to the base running speed
_movementSpeedModifier.RefreshMovementSpeedModifiers(ent.Owner);

ent.Comp.Active = !ent.Comp.Active;

var ev = new SwitchAgillity(action, ent.Comp.Active);
RaiseLocalEvent(ent.Owner, ref ev);
}

private void DeactivateAgility(EntityUid uid, AgillitySkillComponent component, Entity<BaseActionComponent> action)
{
if (!TryComp<MovementSpeedModifierComponent>(uid, out var comp))
return;

_popup.PopupEntity(Loc.GetString("agility-deactivated-massage"), uid);

component.SprintSpeedCurrent = 1f; // return the base running speed to normal
_movementSpeedModifier.RefreshMovementSpeedModifiers(uid);

_actions.SetCooldown(action.Owner, component.CooldownDelay);

component.Active = !component.Active;

var ev = new SwitchAgillity(action, component.Active);
RaiseLocalEvent(uid, ref ev);
}

private void OnRefreshMovespeed(Entity<AgillitySkillComponent> ent, ref RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(1f, ent.Comp.SprintSpeedCurrent);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<AgillitySkillComponent>();
while (query.MoveNext(out var uid, out var resomiComp))
{
if (!TryComp<StaminaComponent>(uid, out var stamina)
|| !resomiComp.Active
|| Timing.CurTime < resomiComp.NextUpdateTime)
continue;

resomiComp.NextUpdateTime = Timing.CurTime + resomiComp.UpdateRate;

_stamina.TryTakeStamina(uid, resomiComp.StaminaDamagePassive);
if (stamina.StaminaDamage > stamina.CritThreshold * 0.50f)
DeactivateAgility(uid, resomiComp, action);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server._CorvaxNext.Speech.Components;

[RegisterComponent]
public sealed partial class ResomiAccentComponent : Component;
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Text.RegularExpressions;
using Content.Server._CorvaxNext.Speech.Components;
using Content.Server.Speech;
using Robust.Shared.Random;

namespace Content.Server._CorvaxNext.Speech.EntitySystems;

public sealed class ResomiAccentSystem : EntitySystem
{

[Dependency] private readonly IRobustRandom _random = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ResomiAccentComponent, AccentGetEvent>(OnAccent);
}

private void OnAccent(EntityUid uid, ResomiAccentComponent component, AccentGetEvent args)
{
var message = args.Message;

// ш => шшш
message = Regex.Replace(
message,
"ш+",
_random.Pick(new List<string>() { "шш", "шшш" })
);
// Ш => ШШШ
message = Regex.Replace(
message,
"Ш+",
_random.Pick(new List<string>() { "ШШ", "ШШШ" })
);
// ч => щщщ
message = Regex.Replace(
message,
"ч+",
_random.Pick(new List<string>() { "щщ", "щщщ" })
);
// Ч => ЩЩЩ
message = Regex.Replace(
message,
"Ч+",
_random.Pick(new List<string>() { "ЩЩ", "ЩЩЩ" })
);
// р => ррр
message = Regex.Replace(
message,
"р+",
_random.Pick(new List<string>() { "рр", "ррр" })
);
// Р => РРР
message = Regex.Replace(
message,
"Р+",
_random.Pick(new List<string>() { "РР", "РРР" })
);
args.Message = message;
}
}
10 changes: 10 additions & 0 deletions Content.Shared/Chat/ChatModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Content.Shared.Chat;
/// <summary>
/// Corvax-Next-Resomi
/// </summary>
[RegisterComponent]
public sealed partial class ChatModifierComponent : Component
{
[DataField("whisperListeningRange")]
public int WhisperListeningRange = SharedChatSystem.WhisperClearRange;
}
13 changes: 13 additions & 0 deletions Content.Shared/Flash/Components/FlashModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Content.Shared.Flash.Components;


/// <summary>
/// Corvax-Next-Resomi
/// </summary>

[RegisterComponent]
public sealed partial class FlashModifierComponent : Component
{
[DataField]
public float Modifier = 1f;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;

Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/Wieldable/Components/WieldableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public sealed partial class WieldableComponent : Component
public string? WieldedInhandPrefix = "wielded";

public string? OldInhandPrefix = null;

public EntityUid? User = null; // Corvax-Next-Resomi
}

[Serializable, NetSerializable]
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/Wieldable/WieldableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Timing;
using Content.Shared._CorvaxNext.Resomi.Abilities;

namespace Content.Shared.Wieldable;

Expand Down Expand Up @@ -109,7 +110,7 @@ private void OnDeselectWieldable(EntityUid uid, WieldableComponent component, Ha
private void OnGunRefreshModifiers(Entity<GunWieldBonusComponent> bonus, ref GunRefreshModifiersEvent args)
{
if (TryComp(bonus, out WieldableComponent? wield) &&
wield.Wielded)
wield.Wielded && !HasComp<WeaponsUseInabilityComponent>(wield.User)) //Corvax-Next-Resomi
{
args.MinAngle += bonus.Comp.MinAngle;
args.MaxAngle += bonus.Comp.MaxAngle;
Expand Down Expand Up @@ -257,6 +258,8 @@ public bool TryWield(EntityUid used, WieldableComponent component, EntityUid use
var othersMessage = Loc.GetString("wieldable-component-successful-wield-other", ("user", Identity.Entity(user, EntityManager)), ("item", used));
_popupSystem.PopupPredicted(selfMessage, othersMessage, user, user);

component.User = user; //Corvax-Next-Resomi

var targEv = new ItemWieldedEvent();
RaiseLocalEvent(used, ref targEv);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared._CorvaxNext.Resomi.Abilities;

[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState]
public sealed partial class AgillitySkillComponent : Component
{
[AutoNetworkedField, DataField]
public Dictionary<string, int> DisabledJumpUpFixtureMasks = new();
[AutoNetworkedField, DataField]
public Dictionary<string, int> DisabledJumpDownFixtureMasks = new();

[DataField("active")]
public bool Active = false;

/// <summary>
/// if we want the ability to not give the opportunity to jump on the tables and only accelerate
/// </summary>
[DataField("jumpEnabled")]
public bool JumpEnabled = true;

[DataField("switchAgilityAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? SwitchAgilityAction = "SwitchAgilityAction";

[DataField("switchAgilityActionEntity")] public EntityUid? SwitchAgilityActionEntity;

/// <summary>
/// how much stamina will be spent for each jump
/// </summary>
[DataField("staminaDamageOnJump")]
public float StaminaDamageOnJump = 10f;

/// <summary>
/// how much stamina will be passive spent while abilitty is activated
/// </summary>
[DataField("staminaDamagePassive")]
public float StaminaDamagePassive = 3f;

[DataField("sprintSpeedModifier")]
public float SprintSpeedModifier = 0.1f; //+10%
public float SprintSpeedCurrent = 1f;

/// <summary>
/// once in how many seconds is our stamina taken away while the ability is on
/// </summary>
[DataField("delay")]
public double Delay = 1.0;
public TimeSpan UpdateRate => TimeSpan.FromSeconds(Delay);
public TimeSpan NextUpdateTime;

/// <summary>
/// cooldown of ability. Called when the ability is disabled
/// </summary>
[DataField("cooldown")]
public double Cooldown = 20.0;
public TimeSpan CooldownDelay => TimeSpan.FromSeconds(Cooldown);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Robust.Shared.Timing;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Physics;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Robust.Shared.Physics.Events;
using Robust.Shared.Log;
using Content.Shared.Climbing.Systems;
using Content.Shared.Damage.Systems;
using Content.Shared.Actions;

namespace Content.Shared._CorvaxNext.Resomi.Abilities;

public abstract class SharedAgillitySkillSystem : EntitySystem
{
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly SharedPopupSystem _popup = default!;
[Dependency] protected readonly ClimbSystem _climb = default!;
[Dependency] protected readonly StaminaSystem _stamina = default!;
[Dependency] protected readonly SharedActionsSystem _actions = default!;

protected const int BaseCollisionGroup = (int)(CollisionGroup.MobMask);

public override void Initialize()
{
SubscribeLocalEvent<AgillitySkillComponent, StartCollideEvent>(DoJump);
SubscribeLocalEvent<AgillitySkillComponent, SwitchAgillity>(OnHandleStateChange);
}

private void DoJump(Entity<AgillitySkillComponent> ent, ref StartCollideEvent args)
{
if (!ent.Comp.Active || !ent.Comp.JumpEnabled
|| args.OurFixture.CollisionMask != BaseCollisionGroup
|| args.OtherFixture.CollisionMask != (int)CollisionGroup.TableMask)
return;

_stamina.TryTakeStamina(ent.Owner, ent.Comp.StaminaDamageOnJump);
_climb.ForciblySetClimbing(ent.Owner, args.OtherEntity);
}

private void OnHandleStateChange(Entity<AgillitySkillComponent> ent, ref SwitchAgillity args)
{
_actions.SetToggled(args.action.Owner, args.toggled);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Content.Shared._CorvaxNext.Resomi.Abilities;


/// <summary>
/// It does not allow you to fire a weapon that requires two hands.
/// Increases the spread, as if shooting was conducted from one hand.
/// </summary>
[RegisterComponent]
public sealed partial class WeaponsUseInabilityComponent : Component;
15 changes: 15 additions & 0 deletions Content.Shared/_CorvaxNext/Resomi/SharedResomi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Shared.Actions;
using Content.Shared.DoAfter;
using Robust.Shared.Serialization;

namespace Content.Shared._CorvaxNext.Resomi;

public sealed partial class SwitchAgillityActionEvent : InstantActionEvent;

/// <summary>
/// Rises when the action state changes
/// </summary>
/// <param name="action"> Entity of Action that we want change the state</param>
/// <param name="toggled"> </param>
[ByRefEvent]
public readonly record struct SwitchAgillity(Entity<BaseActionComponent> action, bool toggled);
Binary file not shown.
Loading

0 comments on commit 46bb84e

Please sign in to comment.