Skip to content

Commit

Permalink
усё(вроде)
Browse files Browse the repository at this point in the history
  • Loading branch information
M1and1B committed Sep 24, 2024
1 parent 6343842 commit dc0a718
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 6 deletions.
34 changes: 28 additions & 6 deletions Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Wieldable.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand All @@ -16,6 +17,8 @@
using Robust.Shared.Input;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

namespace Content.Client.Weapons.Melee;

Expand Down Expand Up @@ -64,7 +67,7 @@ public override void Update(float frameTime)
if (!TryGetWeapon(entity, out var weaponUid, out var weapon))
return;

if (!CombatMode.IsInCombatMode(entity) || !Blocker.CanAttack(entity, weapon: (weaponUid, weapon)))
if (!CombatMode.IsInCombatMode(entity) || !Blocker.CanAttack(entity))
{
weapon.Attacking = false;
return;
Expand Down Expand Up @@ -93,10 +96,29 @@ public override void Update(float frameTime)
// it's kinda tricky.
// I think as long as we make secondaries their own component it's probably fine
// as long as guncomp has an alt-use key then it shouldn't be too much of a PITA to deal with.
if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)

//Frontier: better support melee vs. ranged checks
/*if (TryComp<GunComponent>(weaponUid, out var gun) && gun.UseKey)
{
return;
}*/

// Ranged component has priority over melee if both are supported.
bool gunBoundToUse = false;
bool gunBoundToAlt = false;
if (TryComp<GunComponent>(weaponUid, out var gun)) {
gunBoundToUse = gun.UseKey;
gunBoundToAlt = !gun.UseKey; //Bound to alt-use when false

// If ranged mode only works when wielded, do not block melee attacks when unwielded
// (e.g. crusher & crusher glaive)
if (TryComp<GunRequiresWieldComponent>(weaponUid, out var _) &&
TryComp<WieldableComponent>(weaponUid, out var wield)) {
gunBoundToUse &= wield.Wielded;
gunBoundToAlt &= wield.Wielded;
}
}
//End Frontier

var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition);

Expand All @@ -117,7 +139,7 @@ public override void Update(float frameTime)
}

// Heavy attack.
if (altDown == BoundKeyState.Down)
if (altDown == BoundKeyState.Down && !gunBoundToAlt) //Frontier: add !gunBoundToAlt condition
{
// If it's an unarmed attack then do a disarm
if (weapon.AltDisarm && weaponUid == entity)
Expand All @@ -138,9 +160,9 @@ public override void Update(float frameTime)
}

// Light attack
if (useDown == BoundKeyState.Down)
if (useDown == BoundKeyState.Down && !gunBoundToUse) //Frontier: add !gunBoundToUse condition
{
var attackerPos = TransformSystem.GetMapCoordinates(entity);
var attackerPos = Transform(entity).MapPosition;

if (mousePos.MapId != attackerPos.MapId ||
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
Expand Down Expand Up @@ -220,7 +242,7 @@ private void ClientHeavyAttack(EntityUid user, EntityCoordinates coordinates, En
return;
}

var targetMap = TransformSystem.ToMapCoordinates(coordinates);
var targetMap = coordinates.ToMap(EntityManager, TransformSystem);

if (targetMap.MapId != userXform.MapID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@
- type: Gun
minAngle: 21
maxAngle: 32
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 3
angle: 0
- type: StaminaDamageOnHit
damage: 10
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
path: /Audio/Weapons/Guns/Empty/lmg_empty.ogg
- type: StaticPrice
price: 500
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 7
angle: 0
- type: StaminaDamageOnHit
damage: 10
# No chamber because HMG may want its own

- type: entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
price: 500
- type: UseDelay
delay: 1
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 3
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: L6 SAW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
containers:
ballistic-ammo: !type:Container
ents: []
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 7
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: china lake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@
gun_chamber: !type:ContainerSlot
- type: StaticPrice
price: 500
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 5
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: AKMS
Expand Down Expand Up @@ -221,3 +230,12 @@
path: /Audio/Weapons/Guns/Empty/empty.ogg
clumsyProof: true
- type: PacifismAllowedGun
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 5
angle: 0
- type: StaminaDamageOnHit
damage: 10
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
ents: []
- type: StaticPrice
price: 500
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 5
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: Bulldog
Expand Down Expand Up @@ -100,6 +109,15 @@
- type: Appearance
- type: StaticPrice
price: 500
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 7
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: double-barreled shotgun
Expand All @@ -123,6 +141,13 @@
graph: ShotgunSawn
node: start
deconstructionTarget: null
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 3
angle: 0

- type: entity
name: double-barreled shotgun
Expand All @@ -133,6 +158,13 @@
components:
- type: BallisticAmmoProvider
proto: ShellShotgunBeanbag
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 1
angle: 0

- type: entity
name: Enforcer
Expand Down Expand Up @@ -286,6 +318,13 @@
node: shotgun
- type: StaticPrice
price: 20
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 1
angle: 0

- type: entity
name: improvised shotgun
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
slots:
- Back
- suitStorage
- type: MeleeRequiresWield
- type: AmmoCounter
- type: Gun
fireRate: 0.75
Expand Down Expand Up @@ -46,6 +47,19 @@
components:
- type: Sprite
sprite: Objects/Weapons/Guns/Snipers/bolt_gun_wood.rsi
- type: ThrowingAngle
angle: -135
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Slash: 10
Piercing: 5
angle: 0
animation: WeaponArcThrust
soundHit:
path: /Audio/Weapons/bladeslice.ogg

- type: entity
name: Hristov
Expand All @@ -63,6 +77,15 @@
- CartridgeAntiMateriel
capacity: 5
proto: CartridgeAntiMateriel
- type: MeleeRequiresWield ## MeleeAttack for Gun
- type: MeleeWeapon
attackRate: .85
damage:
types:
Blunt: 5
angle: 0
- type: StaminaDamageOnHit
damage: 10

- type: entity
name: musket
Expand Down

0 comments on commit dc0a718

Please sign in to comment.