Фиксы рефлекта

This commit is contained in:
Vigers Ray 2024-12-05 14:59:30 +03:00
parent 52c8a839bc
commit 8a06ab5f14
9 changed files with 130 additions and 14 deletions

View file

@ -30,6 +30,20 @@ public sealed partial class ReflectComponent : Component
[DataField("soundOnReflect")]
public SoundSpecifier? SoundOnReflect = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
// Sunrise-Start
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public string? Slot;
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public bool NeedHand;
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public bool NeedActiveHand;
// Sunrise-End
}
[Flags]

View file

@ -5,6 +5,7 @@ using Content.Shared.Alert;
using Content.Shared.Audio;
using Content.Shared.Database;
using Content.Shared.Hands;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item.ItemToggle;
@ -38,6 +39,7 @@ public sealed class ReflectSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
public override void Initialize()
{
@ -62,7 +64,7 @@ public sealed class ReflectSystem : EntitySystem
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.All & ~SlotFlags.POCKET))
{
if (!TryReflectHitscan(uid, ent, args.Shooter, args.SourceItem, args.Direction, out var dir))
if (!TryReflectHitscan(uid, ent, args.Shooter, args.SourceItem, args.Direction, args.Reflective, out var dir)) // Sunrise-Edit
continue;
args.Direction = dir.Value;
@ -158,13 +160,12 @@ public sealed class ReflectSystem : EntitySystem
private void OnReflectHitscan(EntityUid uid, ReflectComponent component, ref HitScanReflectAttemptEvent args)
{
if (args.Reflected ||
(component.Reflects & args.Reflective) == 0x0)
if (args.Reflected) // Sunrise-Edit
{
return;
}
if (TryReflectHitscan(uid, uid, args.Shooter, args.SourceItem, args.Direction, out var dir))
if (TryReflectHitscan(uid, uid, args.Shooter, args.SourceItem, args.Direction, args.Reflective, out var dir)) // Sunrise-Edit
{
args.Direction = dir.Value;
args.Reflected = true;
@ -177,6 +178,7 @@ public sealed class ReflectSystem : EntitySystem
EntityUid? shooter,
EntityUid shotSource,
Vector2 direction,
ReflectType reflective, // Sunrise-Edit
[NotNullWhen(true)] out Vector2? newDirection)
{
if (!TryComp<ReflectComponent>(reflector, out var reflect) ||
@ -187,6 +189,52 @@ public sealed class ReflectSystem : EntitySystem
return false;
}
// Sunrise-Start
if ((reflect.Reflects & reflective) == 0x0)
{
newDirection = null;
return false;
}
if (reflect.Slot != null &&
!_inventorySystem.TryGetSlotEntity(user, reflect.Slot, out var slotEntity) &&
slotEntity != reflector)
{
newDirection = null;
return false;
}
if (reflect.NeedHand)
{
var inHand = false;
var hands = _handsSystem.EnumerateHands(user);
{
foreach (var hand in hands)
{
if (hand.HeldEntity == reflector)
{
inHand = true;
}
}
}
if (!inHand)
{
newDirection = null;
return false;
}
}
if (reflect.NeedActiveHand && !_handsSystem.TryGetActiveItem(user, out var activeItem))
{
if (activeItem != reflector)
{
newDirection = null;
return false;
}
}
// Sunrise-End
if (_netManager.IsServer)
{
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);

View file

@ -7230,3 +7230,35 @@
type: Add
id: 507
time: '2024-12-05T11:53:49.428876+00:00'
- author: VigersRay
changes:
- message: "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043E\u0442\u0440\
\u0430\u0436\u0430\u044E\u0449\u0438\u0439 \u0431\u0440\u043E\u043D\u0435\u0436\
\u0438\u043B\u0435\u0442. \u0411\u043E\u043B\u044C\u0448\u0435 \u043D\u0435\
\ \u043E\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043F\u0443\u043B\u0438\
, \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u043E\u0442\u0440\u0430\
\u0436\u0430\u0435\u0442 \u043A\u043E\u0433\u0434\u0430 \u0432 \u0440\u0443\u043A\
\u0430\u0445, \u0431\u043E\u043B\u044C\u0448\u0435 \u043E\u0442\u0440\u0430\u0436\
\u0435\u043D\u0438\u0435 \u043D\u0435 \u0440\u0430\u0432\u043D\u043E 100%."
type: Fix
- message: "\u0422\u0435\u043F\u0435\u0440\u044C \u0434\u043B\u044F \u043E\u0442\
\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0441\u043D\u0430\u0440\u044F\u0434\
\u043E\u0432 \u043F\u0440\u0438 \u043F\u043E\u043C\u043E\u0449\u0438 \u043E\u0440\
\u0443\u0436\u0438\u044F \u0431\u043B\u0438\u0436\u043D\u0435\u0433\u043E \u0431\
\u043E\u044F \u0435\u0433\u043E \u043D\u0443\u0436\u043D\u043E \u0434\u0435\u0440\
\u0436\u0430\u0442\u044C \u0432 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0439\
\ \u0440\u0443\u043A\u0435."
type: Tweak
- message: "\u041E\u0442\u0440\u0430\u0436\u0430\u044E\u0449\u0438\u0435 \u0449\u0438\
\u0442\u044B \u0442\u0435\u043F\u0435\u0440\u044C \u0440\u0430\u0431\u043E\u0442\
\u0430\u044E\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u043A\u043E\u0433\u0434\
\u0430 \u043D\u0430\u0445\u043E\u0434\u044F\u0442\u0441\u044F \u0432 \u0440\u0443\
\u043A\u0430\u0445."
type: Tweak
- message: "\u041F\u0440\u043E\u0442\u0438\u0432\u043E\u043B\u0430\u0437\u0435\u0440\
\u043D\u044B\u0439 \u0449\u0438\u0442 \u0442\u0435\u043F\u0435\u0440\u044C \u043E\
\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043B\u0430\u0437\u0435\u0440\u044B\
\ \u0441 \u0448\u0430\u043D\u0441\u043E\u043C \u0432 75%."
type: Tweak
id: 508
time: '2024-12-05T11:59:20.701354+00:00'

View file

@ -95,9 +95,10 @@
Piercing: 0.9
Heat: 0.4 # this technically means it protects against fires pretty well? -heat is just for lasers and stuff, not atmos temperature
- type: Reflect
reflectProb: 1
reflectProb: 0.8
reflects:
- Energy
slot: outerClothing # Sunrise-Edit
- type: entity
parent: [ClothingOuterBaseLarge, AllowSuitStorageClothing, BaseSyndicateContraband ]
@ -387,4 +388,4 @@
- type: ExplosionResistance
damageCoefficient: 0.5
- type: GroupExamine
- type: Unremoveable
- type: Unremoveable

View file

@ -102,6 +102,13 @@
Heat: 0.5
flatReductions:
Heat: 1
# Sunrise-Start
- type: Reflect
reflectProb: 0.75
reflects:
- Energy
needHand: true
# Sunrise-End
- type: entity
name: riot bullet shield
@ -332,6 +339,7 @@
reflectProb: 0.95
reflects:
- Energy
needHand: true # Sunrise-Edit
- type: Blocking #Mirror shield reflects heat/laser, but is relatively weak to everything else.
passiveBlockModifier:
coefficients:
@ -421,6 +429,7 @@
reflectProb: 0.95
reflects:
- Energy
needHand: true # Sunrise-Edit
- type: Blocking
passiveBlockModifier:
coefficients:
@ -579,4 +588,4 @@
acts: [ "Destruction" ]
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
collection: MetalBreak

View file

@ -13,3 +13,4 @@
- type: Reflect
reflectProb: 0.05
spread: 90
needActiveHand: true

View file

@ -69,8 +69,9 @@
- state: inhand-right-blade
shader: unshaded
- type: Reflect
reflectProb: .20
reflectProb: .35
spread: 45
needActiveHand: true
# Sunrise-start
- type: Tag
tags:
@ -230,6 +231,7 @@
- type: Reflect
reflectProb: .15
spread: 45
needActiveHand: true
- type: Tag
tags:
- Write
@ -321,7 +323,7 @@
wieldSound: null # esword light sound instead
- type: MeleeWeapon
wideAnimationRotation: -135
attackRate: 1.75
attackRate: 2
angle: 100
damage:
types:
@ -339,8 +341,9 @@
size: Small
sprite: Objects/Weapons/Melee/e_sword_double-inhands.rsi
- type: Reflect
reflectProb: .40
reflectProb: .50
spread: 90
needActiveHand: true
- type: entity
suffix: One-Handed, For Borgs

View file

@ -35,8 +35,11 @@
soundHit:
path: /Audio/Weapons/bladeslice.ogg
- type: Reflect
reflectProb: .1
reflects:
- NonEnergy
reflectProb: 0.20
spread: 90
needActiveHand: true
- type: Item
sprite: Objects/Weapons/Melee/captain_sabre.rsi
- type: Tag
@ -98,6 +101,9 @@
- Back
- Belt
- type: Reflect
reflectProb: 0.40
spread: 90
needActiveHand: true
- type: entity
name: machete
@ -186,6 +192,7 @@
- type: Reflect
reflectProb: .25
spread: 90
needActiveHand: true
- type: Item
size: Ginormous
sprite: Objects/Weapons/Melee/Throngler-in-hand.rsi

View file

@ -12,10 +12,10 @@
wideAnimationRotation: -135
angle: 0
animation: WeaponArcThrust
attackRate: 1
attackRate: 1.2
damage:
types:
Piercing: 15
Piercing: 14
resistanceBypass: true
soundHit:
path: /Audio/Weapons/bladeslice.ogg
@ -34,8 +34,9 @@
- type: Reflect
reflects:
- NonEnergy
reflectProb: 0.10
reflectProb: 0.15
spread: 90
needActiveHand: true
- type: Item
sprite: _Sunrise/Objects/Weapons/Melee/syndicate_rapier.rsi
- type: Tag