Skip to content

Commit

Permalink
требует баланса
Browse files Browse the repository at this point in the history
  • Loading branch information
rhailrake committed Dec 26, 2024
1 parent 79fd150 commit 09971b1
Show file tree
Hide file tree
Showing 27 changed files with 119 additions and 99 deletions.
5 changes: 1 addition & 4 deletions Content.Client/Physics/Controllers/MoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ public override void SetSprinting(Entity<InputMoverComponent> entity, ushort sub
// Logger.Info($"[{_gameTiming.CurTick}/{subTick}] Sprint: {enabled}");
base.SetSprinting(entity, subTick, walking);

if (walking && _cfg.GetCVar(CCVars.ToggleWalk))
_alerts.ShowAlert(entity, WalkingAlert, showCooldown: false, autoRemove: false);
else
_alerts.ClearAlert(entity, WalkingAlert);

}
}
4 changes: 4 additions & 0 deletions Content.Shared/Damage/Components/StaminaComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ public sealed partial class StaminaComponent : Component

[DataField]
public ProtoId<AlertPrototype> StaminaAlert = "Stamina";

// Урон от бега. ЗАБАЛАНСИ МЕНЯ!!!!!!!
[ViewVariables(VVAccess.ReadWrite), DataField("sprintStaminaMultiplier"), AutoNetworkedField]
public float SprintStaminaMultiplier = 3f;
}
2 changes: 1 addition & 1 deletion Content.Shared/Movement/Components/InputMoverComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public sealed partial class InputMoverComponent : Component

public const float LerpTime = 1.0f;

public bool Sprinting => (HeldMoveButtons & MoveButtons.Walk) == 0x0;
public bool Sprinting => (HeldMoveButtons & MoveButtons.Walk) != 0x0;

[ViewVariables(VVAccess.ReadWrite)]
public bool CanMove = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class MovementSpeedModifierComponent : Component
public const float DefaultFriction = 20f;
public const float DefaultFrictionNoInput = 20f;

public const float DefaultBaseWalkSpeed = 2.5f;
public const float DefaultBaseWalkSpeed = 3f;
public const float DefaultBaseSprintSpeed = 4.5f;

[AutoNetworkedField, ViewVariables]
Expand Down
21 changes: 20 additions & 1 deletion Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Numerics;
using Content.Shared.Bed.Sleep;
using Content.Shared.CCVar;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.Friction;
using Content.Shared.Gravity;
using Content.Shared.Inventory;
Expand Down Expand Up @@ -46,6 +48,7 @@ public abstract partial class SharedMoverController : VirtualController
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly StaminaSystem _staminaSystem = default!;

protected EntityQuery<InputMoverComponent> MoverQuery;
protected EntityQuery<MobMoverComponent> MobMoverQuery;
Expand Down Expand Up @@ -160,6 +163,22 @@ protected void HandleMobMovement(
// Specifically don't use mover.Owner because that may be different to the actual physics body being moved.
var weightless = _gravity.IsWeightless(physicsUid, physicsComponent, xform);
var (walkDir, sprintDir) = GetVelocityInput(mover);

if (TryComp<StaminaComponent>(uid, out var stamina))
{
if (stamina.StaminaDamage >= stamina.CritThreshold * 0.7f)
{
walkDir = sprintDir + walkDir;
sprintDir = Vector2.Zero;
}
else if (sprintDir != Vector2.Zero)
{
var sprintAmount = sprintDir.Length();
var staminaDamage = sprintAmount * frameTime * stamina.SprintStaminaMultiplier;
_staminaSystem.TakeStaminaDamage(uid, staminaDamage, stamina, visual: false);
}
}

var touching = false;

// Handle wall-pushes.
Expand Down Expand Up @@ -255,7 +274,7 @@ protected void HandleMobMovement(
if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) &&
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound, tileDef: tileDef))
{
var soundModifier = mover.Sprinting ? 3.5f : 1.5f;
var soundModifier = sprintDir != Vector2.Zero ? 3.5f : 1.5f;

var audioParams = sound.Params
.WithVolume(sound.Params.Volume + soundModifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ui-options-function-move-up = Двигаться вверх
ui-options-function-move-left = Двигаться налево
ui-options-function-move-down = Двигаться вниз
ui-options-function-move-right = Двигаться направо
ui-options-function-walk = Идти
ui-options-function-walk = Идти/Бежать.
ui-options-function-camera-rotate-left = Повернуть налево
ui-options-function-camera-rotate-right = Повернуть направо
ui-options-function-camera-reset = Сбросить камеру
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
layer:
- MobLayer
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 4.5
- type: Sprite
sprite: Mobs/Silicon/chassis.rsi
Expand Down
8 changes: 4 additions & 4 deletions Resources/Prototypes/Entities/Mobs/Cyborgs/borg_chassis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
- type: TTS
voice: Sentrybot
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseSprintSpeed : 3.5
baseWalkSpeed : 3
baseSprintSpeed : 4.5
- type: InnateItem
worldTargetActions:
- Emag
Expand Down Expand Up @@ -214,7 +214,7 @@
- type: TTS
voice: Sentrybot
- type: MovementSpeedModifier
baseWalkSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 4.5
- type: InnateItem
worldTargetActions:
Expand Down Expand Up @@ -288,4 +288,4 @@
interactSuccessString: petting-success-derelict-cyborg
interactFailureString: petting-failure-derelict-cyborg
interactSuccessSound:
path: /Audio/Ambience/Objects/periodic_beep.ogg
path: /Audio/Ambience/Objects/periodic_beep.ogg
18 changes: 9 additions & 9 deletions Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
0: Alive
1: Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 5
- type: DamageStateVisuals
states:
Expand Down Expand Up @@ -500,8 +500,8 @@
40: Critical
60: Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseSprintSpeed : 4
baseWalkSpeed : 3
baseSprintSpeed : 4.5
weightlessAcceleration: 1.5
weightlessFriction: 1
weightlessModifier: 1
Expand Down Expand Up @@ -1665,7 +1665,7 @@
10: Critical
20: Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 5
- type: DamageStateVisuals
states:
Expand Down Expand Up @@ -1895,7 +1895,7 @@
description: A harmless dragon.
components:
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseWalkSpeed: 3
baseSprintSpeed: 3
- type: Sprite
drawdepth: Mobs
Expand Down Expand Up @@ -1951,7 +1951,7 @@
description: And they called this a lizard?
components:
- type: MovementSpeedModifier
baseWalkSpeed : 2
baseWalkSpeed : 3
baseSprintSpeed : 3
- type: Sprite
drawdepth: Mobs
Expand Down Expand Up @@ -2058,7 +2058,7 @@
description: Infiltrates your domain, spies on you, and somehow still a cool pet.
components:
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 6
- type: Sprite
drawdepth: Mobs
Expand Down Expand Up @@ -3267,7 +3267,7 @@
40: Critical
60: Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 4
- type: Inventory
speciesId: hamster
Expand Down Expand Up @@ -3478,7 +3478,7 @@
30: Critical
60: Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 4.5
- type: Grammar
attributes:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/NPCs/asteroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
Dead:
Base: goliath_dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.00
baseSprintSpeed : 2.00
baseWalkSpeed : 3
baseSprintSpeed : 3
- type: MobThresholds
thresholds:
0: Alive
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
0: Alive
40: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 3.5
- type: Stamina
critThreshold: 100
Expand Down
12 changes: 6 additions & 6 deletions Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
layer:
- MobLayer
- type: MovementSpeedModifier
baseWalkSpeed : 2
baseSprintSpeed : 3
baseWalkSpeed : 3
baseSprintSpeed : 3.5
- type: Sprite
noRot: true
drawdepth: Mobs
Expand Down Expand Up @@ -94,8 +94,8 @@
types:
Blunt: 6
- type: MovementSpeedModifier
baseWalkSpeed : 2
baseSprintSpeed : 2.5
baseWalkSpeed : 3
baseSprintSpeed : 3.5
- type: NpcFactionMember
factions:
- SimpleHostile
Expand Down Expand Up @@ -138,8 +138,8 @@
types:
Blunt: 5
- type: MovementSpeedModifier
baseWalkSpeed : 1.5
baseSprintSpeed : 2
baseWalkSpeed : 2
baseSprintSpeed : 2.5
- type: Destructible
thresholds:
- trigger:
Expand Down
28 changes: 14 additions & 14 deletions Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
sprite: Mobs/Aliens/flesh.rsi
- type: MovementAlwaysTouching
- type: MovementSpeedModifier
baseWalkSpeed: 1
baseSprintSpeed: 1.5
baseWalkSpeed: 2
baseSprintSpeed: 2.5
- type: MobState
allowedStates:
- Alive
Expand Down Expand Up @@ -135,8 +135,8 @@
0: Alive
30: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 3.5

- type: entity
parent: BaseMobFlesh
Expand All @@ -159,8 +159,8 @@
0: Alive
30: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 3.5

- type: entity
parent: BaseMobFlesh
Expand Down Expand Up @@ -189,8 +189,8 @@
0: Alive
100: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 1.5
baseSprintSpeed: 2.5
baseWalkSpeed: 2.5
baseSprintSpeed: 3.5
- type: MeleeWeapon
soundHit:
path: /Audio/Weapons/Xeno/alien_claw_flesh3.ogg
Expand Down Expand Up @@ -228,8 +228,8 @@
sprite: Mobs/Aliens/flesh.rsi
- type: MovementAlwaysTouching
- type: MovementSpeedModifier
baseWalkSpeed: 1
baseSprintSpeed: 1.5
baseWalkSpeed: 2
baseSprintSpeed: 2.5
- type: MobState
allowedStates:
- Alive
Expand Down Expand Up @@ -334,8 +334,8 @@
0: Alive
30: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 3.5

- type: entity
parent: BaseMobFleshSalvage
Expand All @@ -358,5 +358,5 @@
0: Alive
30: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2.5
baseWalkSpeed: 3
baseSprintSpeed: 3.5
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/NPCs/hellspawn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
damageContainer: BiologicalMetaphysical
damageModifierSet: HellSpawn
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 3
baseWalkSpeed: 3
baseSprintSpeed: 3.5
- type: Sprite
sprite: Mobs/Demons/hellspawn.rsi
layers:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/NPCs/mimic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
types:
Blunt: 20
- type: MovementSpeedModifier
baseWalkSpeed : 1
baseSprintSpeed : 1
baseWalkSpeed : 2
baseSprintSpeed : 2.5
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
0: Alive
100: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseWalkSpeed: 3
baseSprintSpeed: 5
- type: Tag
tags:
Expand Down
8 changes: 4 additions & 4 deletions Resources/Prototypes/Entities/Mobs/NPCs/shadows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
color: "#793a80dd"
radius: 1.1
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2
baseWalkSpeed: 3
baseSprintSpeed: 3.5
- type: Fixtures
fixtures:
fix1:
Expand All @@ -36,7 +36,7 @@
speedModifierThresholds:
60: 0.7
80: 0.5

- type: entity
name: shadow cat
parent: BaseShadowMob
Expand Down Expand Up @@ -64,4 +64,4 @@
gender: epicene
- type: Tag
tags:
- VimPilot
- VimPilot
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@
absorbed:
maxVol: 50
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 3
baseWalkSpeed: 3
baseSprintSpeed: 3.5
- type: HTN
rootTask:
task: CleanbotCompound
Expand Down
Loading

0 comments on commit 09971b1

Please sign in to comment.