-
Notifications
You must be signed in to change notification settings - Fork 46
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
Система пробивания препятствий пулями #26
base: master
Are you sure you want to change the base?
Changes from 5 commits
8ddc64e
b24b351
a3229c9
b10731f
ae4f085
f6a8ce0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
using Content.Server.Administration.Logs; | ||
using Content.Server.Effects; | ||
using Content.Server.Weapons.Ranged.Systems; | ||
using Content.Shared._CorvaxNext.Penetration; | ||
using Content.Shared.Camera; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Database; | ||
|
@@ -18,9 +19,14 @@ public sealed class ProjectileSystem : SharedProjectileSystem | |
[Dependency] private readonly GunSystem _guns = default!; | ||
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!; | ||
|
||
private EntityQuery<PenetratableComponent> _penetratableQuery; | ||
|
||
private Random _random = new(); | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
_penetratableQuery = GetEntityQuery<PenetratableComponent>(); | ||
SubscribeLocalEvent<ProjectileComponent, StartCollideEvent>(OnStartCollide); | ||
} | ||
|
||
|
@@ -67,9 +73,19 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St | |
_sharedCameraRecoil.KickCamera(target, direction); | ||
} | ||
|
||
component.DamagedEntity = true; | ||
// Corvax-Next-Penetration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Надо открыть и закрыть подобный комментарий, для удобства |
||
if (component.PenetrationScore > 0 | ||
&& _penetratableQuery.TryGetComponent(target, out var penetratable) | ||
&& _random.Next(component.PenetrationScore + penetratable.StoppingPower) >= penetratable.StoppingPower) | ||
{ | ||
component.DamagedEntity = component.PenetrationScore < penetratable.StoppingPower; | ||
|
||
component.PenetrationScore -= penetratable.StoppingPower; | ||
} | ||
else | ||
component.DamagedEntity = true; | ||
|
||
if (component.DeleteOnCollide) | ||
if (component.DeleteOnCollide && component.DamagedEntity) | ||
QueueDel(uid); | ||
|
||
if (component.ImpactEffect != null && TryComp(uid, out TransformComponent? xform)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared._CorvaxNext.Penetration; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class PenetratableComponent : Component | ||
{ | ||
[DataField] | ||
public int StoppingPower; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ | |
components: | ||
- type: Damageable | ||
damageContainer: Biological | ||
- type: Penetratable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Подобные изменение должны иметь комментарий, если вы меняете прототипы официального контента There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Этот компонент и так новый. Мы договорились не помечать в прототипах новые компоненты, так как и так понятно, что он не оффами добавлен. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Гадэм, в любом случае это будет на совести тех, кто делает апстртмы, чем я не занимаюсь There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
чзх, добавляй |
||
stoppingPower: 1 | ||
- type: Destructible | ||
thresholds: | ||
- trigger: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
types: | ||
Piercing: 40 | ||
Structural: 30 | ||
penetrationScore: 3 | ||
- type: StaminaDamageOnCollide | ||
damage: 35 |
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.
Почему не IRobustRandom, который предоставляется нам через зависимости в IoC