-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grab #30011
Open
FaDeOkno
wants to merge
23
commits into
space-wizards:master
Choose a base branch
from
FaDeOkno:grab-intent
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+916
−40
Open
Grab #30011
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0323aac
Grab intent
FaDeOkno 9047101
Throwing is not so unholy anymore
FaDeOkno f76466d
throw-fix-2
FaDeOkno df6f65a
throw-fix?-3
FaDeOkno b3dc232
VirtualItem becoming an instrument instead of being crutch
FaDeOkno f6a67fe
oops
FaDeOkno c77f51c
Return PullMovingComponent to Content.Server
FaDeOkno 5c12126
More popups
FaDeOkno 961e6a7
MORE POPUPS
FaDeOkno 87e449e
oh
FaDeOkno 297b7be
Comments for reviewers
FaDeOkno a896687
Popup spam fix again
FaDeOkno 1684016
Fixix
FaDeOkno 8f1a243
oops
FaDeOkno 6b947a0
Martial arts. CQC.
FaDeOkno e835ce8
fix attempt via serialization
FaDeOkno 9700b02
fix attempt via [ImplicitDataDefinitionForInheritors]
FaDeOkno f30cb0f
One more cqc passive ability - 50% stealing enemy's weapon
FaDeOkno 877dce7
Structure + Remove CQC
FaDeOkno 9f118e5
Fully remove CQC
FaDeOkno d613174
namespace fix
FaDeOkno 97051ee
why
FaDeOkno d623c7c
Code improvements by TornadoTech (THX!!) + Removing shit
FaDeOkno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Content.Shared/MartialArts/Components/GrabThrownComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Robust.Shared.GameStates; | ||
using Content.Shared.Damage; | ||
|
||
namespace Content.Shared.MartialArts.Components; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class GrabThrownComponent : Component | ||
{ | ||
public DamageSpecifier? DamageOnCollide; | ||
|
||
public DamageSpecifier? WallDamageOnCollide; | ||
|
||
public float? StaminaDamageOnCollide; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using Content.Shared.Damage.Systems; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Effects; | ||
using Content.Shared.MartialArts.Components; | ||
using Content.Shared.Throwing; | ||
using Robust.Shared.Network; | ||
using Robust.Shared.Physics.Events; | ||
using Robust.Shared.Player; | ||
using System.Numerics; | ||
|
||
namespace Content.Shared.MartialArts.Systems; | ||
|
||
public sealed class GrabThrownSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly DamageableSystem _damageable = default!; | ||
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!; | ||
[Dependency] private readonly StaminaSystem _stamina = default!; | ||
[Dependency] private readonly ThrowingSystem _throwing = default!; | ||
[Dependency] private readonly INetManager _netMan = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<GrabThrownComponent, StartCollideEvent>(HandleCollide); | ||
SubscribeLocalEvent<GrabThrownComponent, StopThrowEvent>(OnStopThrow); | ||
} | ||
|
||
private void HandleCollide(EntityUid uid, GrabThrownComponent component, ref StartCollideEvent args) | ||
{ | ||
if (_netMan.IsClient) // To avoid effect spam | ||
return; | ||
|
||
if (!HasComp<ThrownItemComponent>(uid)) | ||
{ | ||
RemComp<GrabThrownComponent>(uid); | ||
return; | ||
} | ||
|
||
if (!args.OurFixture.Hard || !args.OtherFixture.Hard) | ||
return; | ||
|
||
if (!HasComp<DamageableComponent>(uid)) | ||
RemComp<GrabThrownComponent>(uid); | ||
|
||
var speed = args.OurBody.LinearVelocity.Length(); | ||
|
||
|
||
if (component.StaminaDamageOnCollide != null) | ||
_stamina.TakeStaminaDamage(uid, component.StaminaDamageOnCollide.Value); | ||
|
||
var damageScale = speed; | ||
|
||
if (component.DamageOnCollide != null) | ||
_damageable.TryChangeDamage(uid, component.DamageOnCollide * damageScale); | ||
|
||
if (component.WallDamageOnCollide != null) | ||
_damageable.TryChangeDamage(args.OtherEntity, component.WallDamageOnCollide * damageScale); | ||
|
||
_color.RaiseEffect(Color.Red, new List<EntityUid>() { uid }, Filter.Pvs(uid, entityManager: EntityManager)); | ||
|
||
RemComp<GrabThrownComponent>(uid); | ||
} | ||
|
||
private void OnStopThrow(EntityUid uid, GrabThrownComponent comp, StopThrowEvent args) // We dont need this comp to exsist after fall | ||
{ | ||
if (HasComp<GrabThrownComponent>(uid)) | ||
RemComp<GrabThrownComponent>(uid); | ||
} | ||
|
||
/// <summary> | ||
/// Throwing entity to the direction and ensures GrabThrownComponent with params | ||
/// </summary> | ||
/// <param name="uid">Entity to throw</param> | ||
/// <param name="vector">Direction</param> | ||
/// <param name="staminaDamage">Stamina damage on collide</param> | ||
/// <param name="damageToUid">Damage to entity on collide</param> | ||
/// <param name="damageToWall">Damage to wall or anything that was hit by entity</param> | ||
public void Throw( | ||
EntityUid uid, | ||
Vector2 vector, | ||
float? staminaDamage = null, | ||
DamageSpecifier? damageToUid = null, | ||
DamageSpecifier? damageToWall = null) | ||
{ | ||
_throwing.TryThrow(uid, vector, 5f, animated: false); | ||
|
||
var comp = EnsureComp<GrabThrownComponent>(uid); | ||
comp.StaminaDamageOnCollide = staminaDamage; | ||
comp.DamageOnCollide = damageToUid; | ||
comp.WallDamageOnCollide = damageToWall; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is IAlertClick (12,47)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's an old thing
I guess, i should already close this PR