фикс пвн и визора ниндзи
This commit is contained in:
parent
9720362f3e
commit
d03dbf43fb
9 changed files with 57 additions and 96 deletions
|
|
@ -9,7 +9,7 @@ namespace Content.Shared._Sunrise.Eye.NightVision.Components;
|
|||
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
[AutoGenerateComponentState(fieldDeltas: true)]
|
||||
public sealed partial class NightVisionDeviceComponent : Component
|
||||
{
|
||||
[DataField("toggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
|
|
@ -20,9 +20,9 @@ public sealed partial class NightVisionDeviceComponent : Component
|
|||
|
||||
[DataField("requiredSlot"), AutoNetworkedField]
|
||||
public SlotFlags RequiredFlags = SlotFlags.EYES;
|
||||
|
||||
|
||||
[DataField("isPowered"), AutoNetworkedField]
|
||||
public bool isPowered = false;
|
||||
public bool IsPowered;
|
||||
|
||||
[DataField]
|
||||
[AutoNetworkedField]
|
||||
|
|
|
|||
|
|
@ -2,28 +2,21 @@ using Content.Shared._Sunrise.Eye.NightVision.Components;
|
|||
using Content.Shared.PowerCell;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Toggleable;
|
||||
using Content.Shared.PowerCell;
|
||||
using Content.Shared.PowerCell.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Shared._Sunrise.Eye.NightVision.Systems;
|
||||
|
||||
public sealed class NightVisionDeviceSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPowerCellSystem _powerCell = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedPowerCellSystem _cell = default!;
|
||||
|
|
@ -32,10 +25,10 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
SubscribeLocalEvent<NightVisionDeviceComponent, InventoryRelayedEvent<CanVisionAttemptEvent>>(OnNVDTrySee);
|
||||
SubscribeLocalEvent<NightVisionDeviceComponent, NightVisionDeviceUpdateVisualsEvent>(OnNightVisionDeviceUpdateVisuals);
|
||||
|
||||
|
||||
SubscribeLocalEvent<NightVisionDeviceComponent, PowerCellChangedEvent>(OnPowerCellChanged);
|
||||
SubscribeLocalEvent<NightVisionDeviceComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
|
||||
|
||||
|
|
@ -48,11 +41,11 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
{
|
||||
if (!TryComp<PowerCellSlotComponent>(uid, out var slot))
|
||||
return false;
|
||||
|
||||
|
||||
if (!_itemSlots.TryGetSlot(uid, slot.CellSlotId, out var itemSlot))
|
||||
return false;
|
||||
|
||||
return itemSlot.Item != null && _powerCell.HasDrawCharge(uid);
|
||||
return itemSlot.Item != null && _cell.HasDrawCharge(uid);
|
||||
}
|
||||
|
||||
private void OnNVDTrySee(EntityUid uid, NightVisionDeviceComponent component, InventoryRelayedEvent<CanVisionAttemptEvent> args)
|
||||
|
|
@ -64,7 +57,7 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
{
|
||||
var updVisEv = new AfterNvdUpdateVisualsEvent();
|
||||
RaiseLocalEvent(uid, ref updVisEv);
|
||||
|
||||
|
||||
_appearance.SetData(uid, NVDVisuals.Light, component.Activated);
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +73,7 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
{
|
||||
_actionsSystem.RemoveAction(uid, component.ToggleActionEntity);
|
||||
}
|
||||
|
||||
|
||||
private void OnPowerCellSlotEmpty(Entity<NightVisionDeviceComponent> ent, ref PowerCellSlotEmptyEvent args)
|
||||
{
|
||||
if (ent.Comp.Activated)
|
||||
|
|
@ -95,13 +88,13 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
ForceDisable(ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnToggleAction(Entity<NightVisionDeviceComponent> ent, ref ToggleActionEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!HasPowerAndBattery(ent.Owner))
|
||||
|
||||
if (ent.Comp.IsPowered && !HasPowerAndBattery(ent.Owner))
|
||||
{
|
||||
_popup.PopupClient(Loc.GetString("base-computer-ui-component-not-powered", ("machine", ent.Owner)), args.Performer, args.Performer);
|
||||
return;
|
||||
|
|
@ -114,35 +107,32 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
private void ForceDisable(Entity<NightVisionDeviceComponent> ent)
|
||||
{
|
||||
ent.Comp.Activated = false;
|
||||
|
||||
if (!_light.TryGetLight(ent.Owner, out var light))
|
||||
return;
|
||||
|
||||
var draw = Comp<PowerCellDrawComponent>(ent.Owner);
|
||||
_cell.SetDrawEnabled((ent.Owner, draw), false);
|
||||
|
||||
var transform = Transform(ent.Owner);
|
||||
|
||||
if (ent.Comp.IsPowered)
|
||||
{
|
||||
var draw = Comp<PowerCellDrawComponent>(ent.Owner);
|
||||
_cell.SetDrawEnabled((ent.Owner, draw), false);
|
||||
}
|
||||
|
||||
_appearance.SetData(ent, ToggleableLightVisuals.Enabled, false);
|
||||
_light.SetEnabled(ent.Owner, false, comp: light);
|
||||
|
||||
|
||||
var updVisEv = new NightVisionDeviceUpdateVisualsEvent();
|
||||
RaiseLocalEvent(ent, ref updVisEv);
|
||||
|
||||
if (TryComp<TransformComponent>(ent.Owner, out var transform))
|
||||
{
|
||||
var equipped = transform.ParentUid;
|
||||
var changeEv = new NightVisionDeviceToggledEvent(equipped);
|
||||
RaiseLocalEvent(ent.Owner, ref changeEv);
|
||||
}
|
||||
|
||||
|
||||
var equipped = transform.ParentUid;
|
||||
var changeEv = new NightVisionDeviceToggledEvent(equipped);
|
||||
RaiseLocalEvent(ent.Owner, ref changeEv);
|
||||
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
|
||||
public void Toggle(Entity<NightVisionDeviceComponent> ent)
|
||||
{
|
||||
if (!HasPowerAndBattery(ent.Owner))
|
||||
return;
|
||||
|
||||
ent.Comp.Activated = !ent.Comp.Activated;
|
||||
var transform = Transform(ent.Owner);
|
||||
|
||||
DirtyField(ent.Owner, ent.Comp, nameof(NightVisionDeviceComponent.Activated));
|
||||
|
||||
if (_net.IsServer)
|
||||
{
|
||||
|
|
@ -150,26 +140,22 @@ public sealed class NightVisionDeviceSystem : EntitySystem
|
|||
_audioSystem.PlayPvs(sound, ent.Owner);
|
||||
}
|
||||
|
||||
if (!_light.TryGetLight(ent.Owner, out var light))
|
||||
return;
|
||||
|
||||
var draw = Comp<PowerCellDrawComponent>(ent.Owner);
|
||||
_cell.QueueUpdate((ent.Owner, draw));
|
||||
_cell.SetDrawEnabled((ent.Owner, draw), ent.Comp.Activated);
|
||||
if (ent.Comp.IsPowered)
|
||||
{
|
||||
var draw = Comp<PowerCellDrawComponent>(ent.Owner);
|
||||
_cell.QueueUpdate((ent.Owner, draw));
|
||||
_cell.SetDrawEnabled((ent.Owner, draw), ent.Comp.Activated);
|
||||
}
|
||||
|
||||
_appearance.SetData(ent, ToggleableLightVisuals.Enabled, ent.Comp.Activated);
|
||||
_light.SetEnabled(ent.Owner, ent.Comp.Activated, comp: light);
|
||||
|
||||
var updVisEv = new NightVisionDeviceUpdateVisualsEvent();
|
||||
RaiseLocalEvent(ent, ref updVisEv);
|
||||
|
||||
if (TryComp<TransformComponent>(ent.Owner, out var transform))
|
||||
{
|
||||
var equipped = transform.ParentUid;
|
||||
var changeEv = new NightVisionDeviceToggledEvent(equipped);
|
||||
RaiseLocalEvent(ent.Owner, ref changeEv);
|
||||
}
|
||||
|
||||
var equipped = transform.ParentUid;
|
||||
var changeEv = new NightVisionDeviceToggledEvent(equipped);
|
||||
RaiseLocalEvent(ent.Owner, ref changeEv);
|
||||
|
||||
Dirty(ent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8406,3 +8406,11 @@
|
|||
type: Fix
|
||||
id: 590
|
||||
time: '2024-12-21T17:14:41.804322+00:00'
|
||||
- author: VigersRay
|
||||
changes:
|
||||
- message: "\u0418\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u041F\u041D\u0412\
|
||||
\ \u043A\u043E\u0441\u043C\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043D\
|
||||
\u0438\u043D\u0434\u0437\u0438."
|
||||
type: Fix
|
||||
id: 591
|
||||
time: '2024-12-21T22:51:25.923364+00:00'
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@
|
|||
coverage: EYES
|
||||
|
||||
- type: entity
|
||||
parent: [ClothingEyesBase, BaseMajorContraband]
|
||||
parent: [ClothingEyesBase, BaseMajorContraband, PowerCellSlotSmallItem] # Sunrise-Edit
|
||||
id: ClothingEyesVisorNinja
|
||||
name: ninja visor
|
||||
description: An advanced visor protecting a ninja's eyes from flashing lights.
|
||||
|
|
@ -265,6 +265,12 @@
|
|||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Glasses/ninjavisor.rsi
|
||||
- type: FlashImmunity
|
||||
- type: NightVisionDevice #Sunrise - night visions
|
||||
# Sunrise-Start
|
||||
- type: NightVisionDevice
|
||||
isPowered: true
|
||||
displayColor: "#44b855"
|
||||
displayShader: NVDDisplay
|
||||
- type: PowerCellDraw
|
||||
drawRate: 0
|
||||
useRate: 20
|
||||
# Sunrise-End
|
||||
|
|
|
|||
|
|
@ -83,13 +83,8 @@
|
|||
- type: PressureProtection
|
||||
highPressureMultiplier: 0.1
|
||||
lowPressureMultiplier: 1000
|
||||
# Sunrise-Start
|
||||
- type: EyeProtection
|
||||
- type: FlashImmunity
|
||||
# - type: NightVisionDevice
|
||||
# displayColor: "#ebeb00"
|
||||
# displayShader: NVDDisplay
|
||||
# Sunrise-End
|
||||
|
||||
#Spationaut Hardsuit
|
||||
- type: entity
|
||||
|
|
@ -405,9 +400,6 @@
|
|||
Slash: 0.9
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
# - type: NightVisionDevice Sunrise - night vision
|
||||
# displayColor: "#44b855"
|
||||
# displayShader: NVDDisplay
|
||||
|
||||
#Syndicate Elite Hardsuit
|
||||
- type: entity
|
||||
|
|
@ -437,9 +429,6 @@
|
|||
Slash: 0.9
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
# - type: NightVisionDevice Sunrise - night vision
|
||||
# displayColor: "#44b855"
|
||||
# displayShader: NVDDisplay
|
||||
|
||||
#Syndicate Commander Hardsuit
|
||||
- type: entity
|
||||
|
|
@ -464,9 +453,6 @@
|
|||
Slash: 0.9
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
# - type: NightVisionDevice Sunrise - night vision
|
||||
# displayColor: "#44b855"
|
||||
# displayShader: NVDDisplay
|
||||
|
||||
#Cybersun Juggernaut Hardsuit
|
||||
- type: entity
|
||||
|
|
@ -491,9 +477,6 @@
|
|||
Slash: 0.9
|
||||
Piercing: 0.9
|
||||
Heat: 0.9
|
||||
# - type: NightVisionDevice Sunrise - night vision
|
||||
# displayColor: "#44b855"
|
||||
# displayShader: NVDDisplay
|
||||
|
||||
#Wizard Hardsuit
|
||||
- type: entity
|
||||
|
|
|
|||
|
|
@ -451,9 +451,6 @@
|
|||
Slash: 0.80
|
||||
Piercing: 0.90
|
||||
Heat: 0.90
|
||||
- type: NightVisionDevice #Sunrise - night vision
|
||||
displayColor: "#44b855"
|
||||
displayShader: NVDDisplay
|
||||
|
||||
- type: entity
|
||||
parent: ClothingMaskBase
|
||||
|
|
|
|||
|
|
@ -87,15 +87,5 @@
|
|||
components:
|
||||
- type: ShowSyndicateIcons
|
||||
- type: NightVisionDevice
|
||||
isPowered: true
|
||||
displayColor: "#ff6e6e"
|
||||
displayShader: NVDDisplay
|
||||
- type: PowerCellDraw
|
||||
drawRate: 0
|
||||
useRate: 20
|
||||
- type: PointLight
|
||||
color: red
|
||||
enabled: false
|
||||
autoRot: true
|
||||
radius: 0.5
|
||||
energy: 0.5
|
||||
|
|
|
|||
|
|
@ -24,12 +24,6 @@
|
|||
- state: equipped-EYES-unshaded
|
||||
shader: unshaded
|
||||
slots: [ Eyes ]
|
||||
- type: PointLight
|
||||
color: green
|
||||
enabled: false
|
||||
autoRot: true
|
||||
radius: 0.5
|
||||
energy: 0.5
|
||||
- type: Appearance
|
||||
- type: NightVisionDevice
|
||||
isPowered: true
|
||||
|
|
@ -40,7 +34,7 @@
|
|||
useRate: 20
|
||||
|
||||
- type: entity
|
||||
parent: [ClothingEyesNVD,ShowSecurityIcons]
|
||||
parent: [ClothingEyesNVD, ShowSecurityIcons]
|
||||
id: ClothingEyesNVDSyndicate
|
||||
suffix: syndicate
|
||||
components:
|
||||
|
|
|
|||
|
|
@ -161,9 +161,6 @@
|
|||
lowPressureMultiplier: 1000
|
||||
- type: EyeProtection
|
||||
- type: FlashImmunity
|
||||
# - type: NightVisionDevice
|
||||
# displayColor: "#ebeb00"
|
||||
# displayShader: NVDDisplay
|
||||
|
||||
#Для ивентов
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue