Skip to content

Commit 72edcc1

Browse files
dootythefrootyCliveOcelotRichardBlonskiCerberusWolfie
authored
Misc CQC Fixes (ProjectOmu#129)
* cqc fixes, duh * review changes * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: CliveOcelot <165305605+CliveOcelot@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: CliveOcelot <165305605+CliveOcelot@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: CliveOcelot <165305605+CliveOcelot@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Update Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Update Content.Goobstation.Common/MartialArts/MartialArtsComponents.cs Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com> * Fixes Build Failure & Adds `HasManualCqcKnowledge` --------- Co-authored-by: CliveOcelot <165305605+CliveOcelot@users.noreply.github.com> Co-authored-by: Richard Blonski <48651647+RichardBlonski@users.noreply.github.com> Co-authored-by: John Willis <143434770+CerberusWolfie@users.noreply.github.com>
1 parent c606872 commit 72edcc1

5 files changed

Lines changed: 60 additions & 27 deletions

File tree

Content.Goobstation.Common/MartialArts/MartialArtsComponents.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public sealed partial class MartialArtsKnowledgeComponent : GrabStagesOverrideCo
5050
[AutoNetworkedField]
5151
public string OriginalFistDamageType;
5252

53+
//omu start
54+
[DataField]
55+
public bool Removable = false;
56+
//omu end
5357
}
5458

5559
public enum MartialArtsForms

Content.Goobstation.Shared/MartialArts/Components/GrantMartialArtKnowledgeComponent.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public abstract partial class GrantMartialArtKnowledgeComponent : Component
3636

3737
[DataField]
3838
public SoundSpecifier? SoundOnUse = new SoundPathSpecifier("/Audio/Effects/fire.ogg", AudioParams.Default.WithVolume(10));
39+
40+
//omu start
41+
[DataField]
42+
public bool IsRemovable = true;
43+
//omu end
3944
}
4045

4146
[RegisterComponent]

Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.CQC.cs

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@
1111
// SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter <solsticeofthewinter@gmail.com>
1212
// SPDX-FileCopyrightText: 2025 gus <august.eymann@gmail.com>
1313
// SPDX-FileCopyrightText: 2025 pheenty <fedorlukin2006@gmail.com>
14+
// SPDX-FileCopyrightText: 2025 RichardBlonski <48651647+RichardBlonski@users.noreply.github.com>
1415
//
1516
// SPDX-License-Identifier: AGPL-3.0-or-later
1617

1718
using System.Linq;
1819
using Content.Goobstation.Common.MartialArts;
19-
using Content.Goobstation.Maths.FixedPoint;
20+
using Content.Goobstation.Maths.FixedPoint; //omu
2021
using Content.Goobstation.Shared.MartialArts.Components;
2122
using Content.Goobstation.Shared.MartialArts.Events;
23+
using Content.Shared._Goobstation.Heretic.Components; //omu
2224
using Content.Shared._Shitmed.Medical.Surgery.Traumas;
2325
using Content.Shared._Shitmed.Medical.Surgery.Traumas.Components;
2426
using Content.Shared._Shitmed.Medical.Surgery.Wounds.Components;
2527
using Content.Shared._Shitmed.Targeting;
2628
using Content.Shared.Bed.Sleep;
2729
using Content.Shared.Body.Components;
28-
using Content.Shared.Clothing;
29-
using Content.Shared.Clothing.Components;
30+
using Content.Shared.Clothing; //omu
31+
using Content.Shared.Clothing.Components; //omu
3032
using Content.Shared.Damage;
3133
using Content.Shared.Damage.Components;
3234
using Content.Shared.Damage.Prototypes;
@@ -35,7 +37,7 @@
3537
using Content.Shared.Mobs.Components;
3638
using Content.Shared.Movement.Pulling.Components;
3739
using Content.Shared.Standing;
38-
using Content.Shared.Weapons.Melee;
40+
using Content.Shared.Weapons.Melee; //omu
3941
using Robust.Shared.Audio;
4042
using Robust.Shared.Utility;
4143

@@ -55,9 +57,10 @@ private void InitializeCqc()
5557

5658
SubscribeLocalEvent<GrantCqcComponent, UseInHandEvent>(OnGrantCQCUse);
5759
SubscribeLocalEvent<GrantCqcComponent, MapInitEvent>(OnMapInitEvent);
58-
60+
// omu start
5961
SubscribeLocalEvent<GrantCqcComponent, ClothingGotEquippedEvent>(OnWear);
6062
SubscribeLocalEvent<GrantCqcComponent, ClothingGotUnequippedEvent>(OnRemove);
63+
// omu end
6164
}
6265

6366
#region Generic Methods
@@ -97,34 +100,35 @@ private void OnMapInitEvent(Entity<GrantCqcComponent> ent, ref MapInitEvent args
97100

98101
private void OnGrantCQCUse(EntityUid ent, GrantMartialArtKnowledgeComponent comp, UseInHandEvent args)
99102
{
103+
// omu start, remove useless if statement
100104
//Makes CQC check for clothes for CQC belt to function
101105
if (HasComp<ClothingComponent>(ent))
102106
return;
103-
else
104-
{
105-
if (args.Handled)
106-
return;
107107

108-
args.Handled = true;
108+
if (args.Handled)
109+
return;
109110

110-
if (!_netManager.IsServer)
111-
return;
111+
args.Handled = true;
112112

113-
if (!TryGrantMartialArt(args.User, comp))
114-
return;
113+
if (!_netManager.IsServer)
114+
return;
115115

116-
var coords = Transform(args.User).Coordinates;
117-
_audio.PlayPvs(comp.SoundOnUse, coords);
116+
if (!TryGrantMartialArt(args.User, comp))
117+
return;
118118

119-
if (comp.MultiUse)
120-
return;
119+
var coords = Transform(args.User).Coordinates;
120+
_audio.PlayPvs(comp.SoundOnUse, coords);
121121

122-
QueueDel(ent);
123-
if (comp.SpawnedProto == null)
124-
return;
122+
if (comp.MultiUse)
123+
return;
124+
125+
QueueDel(ent);
126+
if (comp.SpawnedProto == null)
127+
return;
128+
129+
Spawn(comp.SpawnedProto, coords);
130+
// omu end
125131

126-
Spawn(comp.SpawnedProto, coords);
127-
}
128132

129133
}
130134

@@ -198,13 +202,17 @@ private void OnWear(EntityUid uid, GrantCqcComponent component, ref ClothingGotE
198202
private void OnRemove(Entity<GrantCqcComponent> ent, ref ClothingGotUnequippedEvent args)
199203
{
200204
var user = args.Wearer;
201-
if (!TryComp<MartialArtsKnowledgeComponent>(user, out var martialArtsKnowledge))
205+
206+
// Omu Station
207+
// Don't proceed if the user has non-removable Martial Arts knowledge
208+
if (HasManualCqcKnowledge(user))
202209
return;
203210

204-
if (martialArtsKnowledge.MartialArtsForm != MartialArtsForms.CloseQuartersCombat)
211+
if (!TryComp<MartialArtsKnowledgeComponent>(user, out var martialArtsKnowledge)
212+
|| !TryComp<MeleeWeaponComponent>(user, out var meleeWeaponComponent)) // Omu
205213
return;
206214

207-
if (!TryComp<MeleeWeaponComponent>(args.Wearer, out var meleeWeaponComponent))
215+
if (martialArtsKnowledge.MartialArtsForm != MartialArtsForms.CloseQuartersCombat)
208216
return;
209217

210218
var originalDamage = new DamageSpecifier();
@@ -214,8 +222,8 @@ private void OnRemove(Entity<GrantCqcComponent> ent, ref ClothingGotUnequippedEv
214222

215223
RemComp<MartialArtsKnowledgeComponent>(user);
216224
RemComp<CanPerformComboComponent>(user);
225+
RemComp<RiposteeComponent>(user); // Omu
217226
}
218-
219227
#endregion
220228

221229
#region Combo Methods
@@ -315,4 +323,18 @@ private void OnCQCConsecutive(Entity<CanPerformComboComponent> ent, ref CqcConse
315323
}
316324

317325
#endregion
326+
327+
/// Omu Station
328+
/// <summary>
329+
/// Checks if the user has Martial Arts knowledge that is non-removable (Such as CQC Old Manual).
330+
/// </summary>
331+
/// <param name="user">The user to check</param>
332+
/// <returns>True if the user has non removeable martial arts knowledge, false otherwise</returns>
333+
private bool HasManualCqcKnowledge(EntityUid user)
334+
335+
{
336+
return TryComp<MartialArtsKnowledgeComponent>(user, out var martialArtsKnowledge) &&
337+
!martialArtsKnowledge.Removable;
338+
}
339+
318340
}

Content.Goobstation.Shared/MartialArts/SharedMartialArtsSystem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ private bool GrantMartialArt(GrantMartialArtKnowledgeComponent comp, EntityUid u
529529
//martialArtsKnowledgeComponent.StartingStage = martialArtsPrototype.StartingStage;
530530
LoadCombos(martialArtsPrototype.RoundstartCombos, canPerformComboComponent);
531531
martialArtsKnowledgeComponent.Blocked = false;
532+
martialArtsKnowledgeComponent.Removable = comp.IsRemovable; //omu
532533

533534
if (meleeWeaponComponent.Damage.DamageDict.Count != 0)
534535
{

Resources/Prototypes/_Goobstation/Entities/Specific/syndicate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- type: StaticPrice
2323
price: 3000
2424
- type: GrantCqc
25+
isRemovable: false #omu change
2526
- type: GuideHelp
2627
guides:
2728
- CQC

0 commit comments

Comments
 (0)