Skip to content
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

armory update 1 #377

Merged
merged 7 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions Content.Client/Starshine/Eye/NightVision/NightVisionOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.GG.Eye.NightVision
namespace Content.Client.Starshine.Eye.NightVision
{
public sealed class NightVisionOverlay : Overlay
{
Expand All @@ -17,16 +17,16 @@ public sealed class NightVisionOverlay : Overlay
public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _greyscaleShader;
public Color NightvisionColor = Color.Green;
public Color Color;

private NightVisionComponent _nightvisionComponent = default!;
private NightVisionComponent _nightVisionComponent = default!;

public NightVisionOverlay(Color color)
{
IoCManager.InjectDependencies(this);
_greyscaleShader = _prototypeManager.Index<ShaderPrototype>("GreyscaleFullscreen").InstanceUnique();

NightvisionColor = color;
Color = color;
}
protected override bool BeforeDraw(in OverlayDrawArgs args)
{
Expand All @@ -41,45 +41,43 @@ protected override bool BeforeDraw(in OverlayDrawArgs args)
if (playerEntity == null)
return false;

if (!_entityManager.TryGetComponent<NightVisionComponent>(playerEntity, out var nightvisionComp))
if (!_entityManager.TryGetComponent<NightVisionComponent>(playerEntity, out var nightVisionComponent))
return false;

_nightvisionComponent = nightvisionComp;
_nightVisionComponent = nightVisionComponent;

var nightvision = _nightvisionComponent.IsNightVision;
var nightVision = _nightVisionComponent.IsOn;

if (!nightvision && _nightvisionComponent.DrawShadows) // Disable our Night Vision
{
_lightManager.DrawLighting = true;
_nightvisionComponent.DrawShadows = false;
_nightvisionComponent.GraceFrame = true;
return true;
}
if (nightVision || !_nightVisionComponent.DrawShadows) // Disable our Night Vision
return nightVision;
_lightManager.DrawLighting = true;
_nightVisionComponent.DrawShadows = false;
_nightVisionComponent.GraceFrame = true;
return true;

return nightvision;
}

protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null)
return;

if (!_nightvisionComponent.GraceFrame)
if (!_nightVisionComponent.GraceFrame)
{
_nightvisionComponent.DrawShadows = true; // Enable our Night Vision
_nightVisionComponent.DrawShadows = true; // Enable our Night Vision
_lightManager.DrawLighting = false;
}
else
{
_nightvisionComponent.GraceFrame = false;
_nightVisionComponent.GraceFrame = false;
}

_greyscaleShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_greyscaleShader.SetParameter("SCREEN_TEXTURE", ScreenTexture);

var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
worldHandle.UseShader(_greyscaleShader);
worldHandle.DrawRect(viewport, NightvisionColor);
worldHandle.DrawRect(viewport, Color);
worldHandle.UseShader(null);
}
}
Expand Down
9 changes: 3 additions & 6 deletions Content.Client/Starshine/Eye/NightVision/NightVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using Content.Client.Overlays;
using Content.Shared.GameTicking;
using Content.Shared.Starshine.Eye.NightVision.Components;
using Content.Shared.Inventory.Events;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.GG.Eye.NightVision;
namespace Content.Client.Starshine.Eye.NightVision;

public sealed class NightVisionSystem : EquipmentHudSystem<NightVisionComponent>
{
Expand All @@ -20,7 +17,7 @@ public override void Initialize()
{
base.Initialize();

_overlay = new(Color.Green);
_overlay = new NightVisionOverlay(Color.Green);
}

protected override void UpdateInternal(RefreshEquipmentHudEvent<NightVisionComponent> component)
Expand All @@ -29,7 +26,7 @@ protected override void UpdateInternal(RefreshEquipmentHudEvent<NightVisionCompo

foreach (var comp in component.Components)
{
_overlay.NightvisionColor = comp.NightVisionColor;
_overlay.Color = comp.Color;
}
if (!_overlayMan.HasOverlay<NightVisionOverlay>())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ namespace Content.Shared.Starshine.Eye.NightVision.Components;

[RegisterComponent]
[NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(NightVisionSystem))]
[Access(typeof(NightVisionSystem), typeof(PNVSystem))]
public sealed partial class NightVisionComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("isOn"), AutoNetworkedField]
public bool IsNightVision;
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public bool IsOn;

[DataField("color")]
public Color NightVisionColor = Color.Green;
[ViewVariables(VVAccess.ReadWrite), DataField]
public Color Color = Color.FromHex("#5cd65c");

[DataField]
public bool IsToggle = false;
public bool IsToggle;

[DataField] public EntityUid? ActionContainer;

Expand All @@ -27,9 +27,13 @@ public sealed partial class NightVisionComponent : Component
[Access(Other = AccessPermissions.ReadWriteExecute)]
public bool GraceFrame = false;

[DataField("playSoundOn")]
[DataField]
public bool PlaySoundOn = true;
public SoundSpecifier OnOffSound = new SoundPathSpecifier("/Audio/Backmen/Misc/night-vision-sound-effect_E_minor.ogg");

[DataField]
public SoundSpecifier OffSound = new SoundPathSpecifier("/Audio/Starshine/Misc/night_vision.ogg");
}

public sealed partial class NVInstantActionEvent : InstantActionEvent { }
public sealed partial class NvInstantActionEvent : InstantActionEvent
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Content.Shared.Starshine.Eye.NightVision.Components;
[RegisterComponent, NetworkedComponent]
public sealed partial class PNVComponent : Component
{
[DataField] public EntProtoId<InstantActionComponent> ActionProto = "NVToggleAction";
[DataField] public EntityUid? ActionContainer;
[DataField]
public EntProtoId<InstantActionComponent> ActionProto = "NVToggleAction";

[DataField]
public EntityUid? ActionContainer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override void Initialize()

if(_net.IsServer)
SubscribeLocalEvent<NightVisionComponent, ComponentStartup>(OnComponentStartup);
SubscribeLocalEvent<NightVisionComponent, NVInstantActionEvent>(OnActionToggle);
SubscribeLocalEvent<NightVisionComponent, NvInstantActionEvent>(OnActionToggle);
}

[ValidatePrototypeId<EntityPrototype>]
Expand All @@ -30,20 +30,19 @@ private void OnComponentStartup(EntityUid uid, NightVisionComponent component, C
{
if (component.IsToggle)
_actionsSystem.AddAction(uid, ref component.ActionContainer, SwitchNightVisionAction);
_actionsSystem.SetCooldown(component.ActionContainer, TimeSpan.FromSeconds(1)); // GCD?
}

private void OnActionToggle(EntityUid uid, NightVisionComponent component, NVInstantActionEvent args)
private void OnActionToggle(EntityUid uid, NightVisionComponent component, NvInstantActionEvent args)
{
component.IsNightVision = !component.IsNightVision;
var changeEv = new NightVisionnessChangedEvent(component.IsNightVision);
component.IsOn = !component.IsOn;
var changeEv = new NightVisionChangedEvent(component.IsOn);
RaiseLocalEvent(uid, ref changeEv);
Dirty(uid, component);
_actionsSystem.SetCooldown(component.ActionContainer, TimeSpan.FromSeconds(1));
if (component is { IsNightVision: true, PlaySoundOn: true })
{
if(_net.IsServer)
_audioSystem.PlayPvs(component.OnOffSound, uid);
}
if (component is not { IsOn: true, PlaySoundOn: true })
return;
if(_net.IsServer)
_audioSystem.PlayPvs(component.OffSound, uid);
}

[PublicAPI]
Expand All @@ -52,24 +51,24 @@ public void UpdateIsNightVision(EntityUid uid, NightVisionComponent? component =
if (!Resolve(uid, ref component, false))
return;

var old = component.IsNightVision;
var old = component.IsOn;


var ev = new CanVisionAttemptEvent();
RaiseLocalEvent(uid, ev);
component.IsNightVision = ev.NightVision;
component.IsOn = ev.NightVision;

if (old == component.IsNightVision)
if (old == component.IsOn)
return;

var changeEv = new NightVisionnessChangedEvent(component.IsNightVision);
var changeEv = new NightVisionChangedEvent(component.IsOn);
RaiseLocalEvent(uid, ref changeEv);
Dirty(uid, component);
}
}

[ByRefEvent]
public record struct NightVisionnessChangedEvent(bool NightVision);
public record struct NightVisionChangedEvent(bool IsOn);


public sealed class CanVisionAttemptEvent : CancellableEntityEventArgs, IInventoryRelayEvent
Expand Down
17 changes: 8 additions & 9 deletions Content.Shared/Starshine/Eye/NightVision/Systems/PNVSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ private void OnEquipped(EntityUid uid, PNVComponent component, GotEquippedEvent
if (HasComp<NightVisionComponent>(args.Equipee))
return;

var nvcomp = EnsureComp<NightVisionComponent>(args.Equipee);
var nvComp = EnsureComp<NightVisionComponent>(args.Equipee);

_nightvisionableSystem.UpdateIsNightVision(args.Equipee, nvcomp);
_nightvisionableSystem.UpdateIsNightVision(args.Equipee, nvComp);
if(component.ActionContainer == null)
_actionsSystem.AddAction(args.Equipee, ref component.ActionContainer, component.ActionProto);
_actionsSystem.SetCooldown(component.ActionContainer, TimeSpan.FromSeconds(1)); // GCD?

if (nvcomp.PlaySoundOn)
{
if(_net.IsServer)
_audioSystem.PlayPvs(nvcomp.OnOffSound, uid);
}
if (!nvComp.PlaySoundOn)
return;
if(_net.IsServer)
_audioSystem.PlayPvs(nvComp.OffSound, uid);

}

Expand All @@ -56,10 +55,10 @@ private void OnUnequipped(EntityUid uid, PNVComponent component, GotUnequippedEv
if (args.Slot is not ("eyes" or "mask" or "head"))
return;

if (!TryComp<NightVisionComponent>(args.Equipee, out var nvcomp))
if (!TryComp<NightVisionComponent>(args.Equipee, out var nvComp))
return;

_nightvisionableSystem.UpdateIsNightVision(args.Equipee, nvcomp);
_nightvisionableSystem.UpdateIsNightVision(args.Equipee, nvComp);
_actionsSystem.RemoveAction(args.Equipee, component.ActionContainer);
component.ActionContainer = null;

Expand Down
Binary file added Resources/Audio/Starshine/Misc/night_vision.ogg
Binary file not shown.
21 changes: 0 additions & 21 deletions Resources/Locale/ru-RU/research/technologies.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,3 @@ research-technology-advanced-spray = Продвинутый спрей
research-technology-bluespace-cargo-transport = Блюспейс грузовой транспорт
research-technology-bluespace-chemistry = Блюспейс Химия
research-technology-quantum-fiber-weaving = Плетение квантовых волокон

## Starshine

research-technology-modsuitscraft = МОД-Костюмы
research-technology-comp-bows = Композитные луки
research-technology-standard-ammunition = Стандартные боеприпасы
research-technology-firearms = Огнестрельное оружие
research-technology-laser-weapons = Лазерное оружие
research-technology-armor-produce = Производство брони
research-technology-advanced-laser-weapons = Продвинутое лазерное оружие
research-technology-advanced-firearms = Продвинутое огнестрельное оружие
research-technology-advanced-ammunition = Продвинутые боеприпасы
research-technology-advanced-magazines = Продвинутые магазины
research-technology-incendiary-ammunition = Зажигательные боеприпасы
research-technology-spec-ammunition = Специализированные боеприпасы
research-technology-salvage-weapons-adv = Продвинутое оружие утилизаторов

research-technology-clarke-aplu = КШГ Кларк
research-technology-Odyssey = ГМС Одиссей
research-technology-gygax = АБНТ Гайгэкс
research-technology-durand = БМП Дюранд
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ ent-WeaponRevolverPythonAP = { ent-WeaponRevolverPython }
ent-WeaponRevolverPirate = пиратский револьвер
.desc = Странный, старый на вид револьвер, который использовали пираты. Использует патроны калибра .45 магнум.
.suffix = Револьвер
ent-WeaponRevolverRsh18 = РШ18
.desc = Редкий, изготавливаемый на заказ револьвер. Выдавался ограниченной партией офицерам синего щита. Использует патроны калибра 12.7 безгильзовые.
.suffix = Револьвер
23 changes: 23 additions & 0 deletions Resources/Locale/ru-RU/starshine/research/technologies.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Starshine

research-technology-modsuitscraft = МОД-Костюмы
research-technology-comp-bows = Композитные луки
research-technology-standard-ammunition = Стандартные боеприпасы
research-technology-firearms = Огнестрельное оружие
research-technology-laser-weapons = Лазерное оружие
research-technology-armor-produce = Производство брони
research-technology-advanced-laser-weapons = Продвинутое лазерное оружие
research-technology-advanced-firearms = Продвинутое огнестрельное оружие
research-technology-advanced-ammunition = Продвинутые боеприпасы
research-technology-advanced-magazines = Продвинутые магазины
research-technology-incendiary-ammunition = Зажигательные боеприпасы
research-technology-spec-ammunition = Специализированные боеприпасы
research-technology-salvage-weapons-adv = Продвинутое оружие утилизаторов
research-technology-large-caliber = Большой калибр

research-technology-clarke-aplu = КШГ Кларк
research-technology-Odyssey = ГМС Одиссей
research-technology-gygax = АБНТ Гайгэкс
research-technology-durand = БМП Дюранд

research-technology-nvd = Прибор ночного видения
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ClothingEyesVision = ПНВ
.desc = Прибор ночного видения. Обеспечивает изображение местности в условиях низкой освещенности.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-SpeedLoaderAntiMaterial = спидлоадер (.60 антиматериальные)
.desc = { ent-BaseItem.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ent-WeaponRevolverRsh18 = РШ18
.desc = Редкий, изготавливаемый на заказ револьвер. Выдавался ограниченной партией офицерам синего щита. Использует патроны калибра 12.7 безгильзовые.
.suffix = Револьвер
ent-WeaponRevolverSuppressor = Подавитель
.desc = Сверх тяжёлый револьвер для самых упитанных целей.
.suffix = Револьвер
25 changes: 25 additions & 0 deletions Resources/Locale/ru-RU/starshine/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Starshine
uplink-bow-bundle-name = Набор композитного лука
uplink-bow-bundle-desc = Скрытая угроза: Композитный лук, созданный компанией Cybersun. Имеет с собой колчан стрел.
uplink-bow-compound-red-name = Кровавый композитный лук
uplink-bow-compound-red-desc = Залит кровью грейтайдов. Отличный легкий лук, в паре с пробивными стрелами. Можно модернизировать при помощи С4.
uplink-syndie-miner-armor-name = Кроваво-красная шахтерская броня
uplink-syndie-miner-armor-desc = Кроваво-красный вариант шахтерской брони. Мы надеемся, вы купили её, зная что делаете.
uplink-kr51-bundle-name = Набор КР51
uplink-kr51-bundle-desc = Скрытая угроза: Классическая автоматическая винтовка КР51, в наборе с 3 магазинами.
uplink-magazine-caseless-rifle-name = Магазин винтовки (.25 безгильзовые)
uplink-magazine-caseless-rifle-desc = Магазин для винтовки с 30 безгильзовыми патронами. Совместим с КР51.
uplink-magazine-caseless-rifle-bundle-name = Набор с магазинами винтовки (.25)
uplink-magazine-caseless-rifle-bundle-desc = Набор, содержащий 4 расширенных магазина для дробовика. Совместим с КР51.
uplink-miniature-energy-crossbow-syndie-green-name = Энергетический мини арбалет
uplink-miniature-energy-crossbow-syndie-green-desc = Энергетический арбалет синдиката, маленький, бесшумный и смертоносный.
uplink-syringe-cartridge-name = Коробка шприцевых картриджей
uplink-syringe-cartridge-desc = Коробка шприцевых картриджей для шприцевого пистолета
uplink-gygax-syndie-name = АБМС «Гайгэкс»
uplink-gygax-desc = Перекрашенный синдикатом АБМНТ «Гайгэкс», потрёпан и сильно изношен, но все еще функционирует в штатном режиме. Прямо как с последней корпоротивной войны.
uplink-mauler-name = АБМС «Маулер»
uplink-mauler-desc = Перекрашенный синдикатом мародёр, был изрядно изменен, но все тот же старый добрый мародёр.
uplink-clothing-pnv-name = ПНВ
uplink-clothing-pnv-desc = Прибор ночного видения.
uplink-m90gl-bundle-name = Набор m90-gl
uplink-m90gl-bundle-desc = Старая винтовка типа булпап. И нет, подствольник не настоящий.
Loading
Loading