Skip to content

Commit

Permalink
Переносище
Browse files Browse the repository at this point in the history
  • Loading branch information
Pe4henika committed Aug 15, 2024
1 parent d056c64 commit bd10e91
Show file tree
Hide file tree
Showing 8,842 changed files with 107,230 additions and 231 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
27 changes: 0 additions & 27 deletions Content.Client/Cabinet/ItemCabinetSystem.cs

This file was deleted.

4 changes: 4 additions & 0 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public sealed class ClientClothingSystem : ClothingSystem
{"pocket1", "POCKET1"},
{"pocket2", "POCKET2"},
{"suitstorage", "SUITSTORAGE"},
{"tail", "TAIL"},
{"socks", "SOCKS"},
{"underwear", "UNDERWEAR"},
{"breast", "BREAST"},
};

[Dependency] private readonly IResourceCache _cache = default!;
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/_LostParadise/RCDFAP/RCDFAPMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<!-- Entry layer (shows main categories) -->
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64" ReserveSpaceForHiddenChildren="False">
<ui:RadialMenuTextureButton StyleClasses="RadialMenuButton" SetSize="64 64" ToolTip="{Loc 'rcd-component-DisposalPipe'}" TargetLayer="DisposalPipe" Visible="False">
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/LPP/Interface/Radial/RCDFAP/DisposalPipe.png"/>
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/_LostParadise/Interface/Radial/RCDFAP/DisposalPipe.png"/>
</ui:RadialMenuTextureButton>
<ui:RadialMenuTextureButton StyleClasses="RadialMenuButton" SetSize="64 64" ToolTip="{Loc 'rcd-component-Gaspipes'}" TargetLayer="Gaspipes" Visible="False">
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/LPP/Interface/Radial/RCDFAP/Gaspipes.png"/>
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/_LostParadise/Interface/Radial/RCDFAP/Gaspipes.png"/>
</ui:RadialMenuTextureButton>
<ui:RadialMenuTextureButton StyleClasses="RadialMenuButton" SetSize="64 64" ToolTip="{Loc 'rcd-component-Devices'}" TargetLayer="Devices" Visible="False">
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/LPP/Interface/Radial/RCDFAP/Devices.png"/>
<TextureRect VerticalAlignment="Center" HorizontalAlignment="Center" TextureScale="2 2" TexturePath="/Textures/_LostParadise/Interface/Radial/RCDFAP/Devices.png"/>
</ui:RadialMenuTextureButton>
</ui:RadialContainer>

Expand Down
9 changes: 0 additions & 9 deletions Content.Server/Cabinet/ItemCabinetSystem.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void OnShootCam(Entity<AIEyeComponent> ent, ref AIEyeCampShootActionEven

var ammo = Spawn(LPPBulletDisablerBorg, camPos);
_gun.ShootProjectile(ammo, targetPos.Position - camMapPos.Position, Vector2.One, ent.Comp.Camera.Value, args.Performer);
_audio.PlayPvs("/Audio/LPP/Weapons/AILaser.ogg", ent.Comp.Camera.Value);
_audio.PlayPvs("/Audio/_LostParadise/Weapons/AILaser.ogg", ent.Comp.Camera.Value);
}

private void OnMoveToCam(Entity<AIEyeComponent> ent, ref EyeMoveToCam args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ private void OnShutdown(EntityUid uid, StationAIComponent component, ComponentSh
}

private static readonly SoundSpecifier AiDeath =
new SoundPathSpecifier("/Audio/LPP/IPC/borg_deathsound.ogg");
new SoundPathSpecifier("/Audio/_LostParadise/IPC/borg_deathsound.ogg");

private void OnMobStateChanged(EntityUid uid, StationAIComponent component, MobStateChangedEvent args)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using Content.Shared.Damage.Components;
using Content.Shared.Examine;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.SwitchableWeapon;
using Content.Shared.Toggleable;
using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Audio.Systems;

namespace Content.Server.SwitchableWeapon;

public sealed class SwitchableWeaponSystem : EntitySystem
{
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SwitchableWeaponComponent, UseInHandEvent>(Toggle);
SubscribeLocalEvent<SwitchableWeaponComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<SwitchableWeaponComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
SubscribeLocalEvent<SwitchableWeaponComponent, ComponentAdd>(OnComponentAdded);
}

private void OnComponentAdded(EntityUid uid, SwitchableWeaponComponent component, ComponentAdd args)
{
UpdateState(uid, component);
}

private void OnGetMeleeDamage(EntityUid uid, SwitchableWeaponComponent component, ref GetMeleeDamageEvent args)
{
args.Damage = component.IsOpen ? component.DamageOpen : component.DamageFolded;
}

private void OnExamined(EntityUid uid, SwitchableWeaponComponent comp, ExaminedEvent args)
{
var msg = comp.IsOpen
? Loc.GetString("comp-switchable-examined-on")
: Loc.GetString("comp-switchable-examined-off");
args.PushMarkup(msg);
}

private void UpdateState(EntityUid uid, SwitchableWeaponComponent comp)
{
if (TryComp<ItemComponent>(uid, out var item))
{
_item.SetSize(uid, comp.IsOpen ? comp.SizeOpened : comp.SizeClosed, item);
_item.SetHeldPrefix(uid, comp.IsOpen ? "on" : "off", component: item);
}

if (TryComp<AppearanceComponent>(uid, out var appearance))
_appearance.SetData(uid, ToggleVisuals.Toggled, comp.IsOpen, appearance);

if (TryComp<StaminaDamageOnHitComponent>(uid, out var stamComp))
{
stamComp.Damage = comp.IsOpen ? comp.StaminaDamageOpen : comp.StaminaDamageFolded;
}
}

private void Toggle(EntityUid uid, SwitchableWeaponComponent comp, UseInHandEvent args)
{
comp.IsOpen = !comp.IsOpen;
UpdateState(uid, comp);

var soundToPlay = comp.IsOpen ? comp.OpenSound : comp.CloseSound;
_audio.PlayPvs(soundToPlay, args.User);
}
}
44 changes: 13 additions & 31 deletions Content.Shared/Cabinet/ItemCabinetComponent.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;

namespace Content.Shared.Cabinet;

/// <summary>
/// Used for entities that can be opened, closed, and can hold one item. E.g., fire extinguisher cabinets.
/// Used for entities that can be opened, closed, and can hold one item. E.g., fire extinguisher cabinets.
/// Requires <c>OpenableComponent</c>.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
[RegisterComponent, NetworkedComponent, Access(typeof(ItemCabinetSystem))]
public sealed partial class ItemCabinetComponent : Component
{
/// <summary>
/// Sound to be played when the cabinet door is opened.
/// Name of the <see cref="ItemSlot"/> that stores the actual item.
/// </summary>
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier? DoorSound;

/// <summary>
/// The <see cref="ItemSlot"/> that stores the actual item. The entity whitelist, sounds, and other
/// behaviours are specified by this <see cref="ItemSlot"/> definition.
/// </summary>
[DataField, ViewVariables]
public ItemSlot CabinetSlot = new();

/// <summary>
/// Whether the cabinet is currently open or not.
/// </summary>
[DataField, AutoNetworkedField]
public bool Opened;

/// <summary>
/// The state for when the cabinet is open
/// </summary>
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? OpenState;
[DataField]
public string Slot = "ItemCabinet";
}

/// <summary>
/// The state for when the cabinet is closed
/// </summary>
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
public string? ClosedState;
[Serializable, NetSerializable]
public enum ItemCabinetVisuals : byte
{
ContainsItem,
Layer
}
95 changes: 95 additions & 0 deletions Content.Shared/Cabinet/ItemCabinetSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Interaction;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Shared.Containers;
using System.Diagnostics.CodeAnalysis;

namespace Content.Shared.Cabinet;

/// <summary>
/// Controls ItemCabinet slot locking and visuals.
/// </summary>
public sealed class ItemCabinetSystem : EntitySystem
{
[Dependency] private readonly ItemSlotsSystem _slots = default!;
[Dependency] private readonly OpenableSystem _openable = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;

/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ItemCabinetComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ItemCabinetComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ItemCabinetComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
SubscribeLocalEvent<ItemCabinetComponent, EntRemovedFromContainerMessage>(OnContainerModified);
SubscribeLocalEvent<ItemCabinetComponent, OpenableOpenedEvent>(OnOpened);
SubscribeLocalEvent<ItemCabinetComponent, OpenableClosedEvent>(OnClosed);
}

private void OnStartup(Entity<ItemCabinetComponent> ent, ref ComponentStartup args)
{
UpdateAppearance(ent);
}

private void OnMapInit(Entity<ItemCabinetComponent> ent, ref MapInitEvent args)
{
// update at mapinit to avoid copy pasting locked: true and locked: false for each closed/open prototype
SetSlotLock(ent, !_openable.IsOpen(ent));
}

private void UpdateAppearance(Entity<ItemCabinetComponent> ent)
{
_appearance.SetData(ent, ItemCabinetVisuals.ContainsItem, HasItem(ent));
}

private void OnContainerModified(EntityUid uid, ItemCabinetComponent component, ContainerModifiedMessage args)
{
if (args.Container.ID == component.Slot)
UpdateAppearance((uid, component));
}

private void OnOpened(Entity<ItemCabinetComponent> ent, ref OpenableOpenedEvent args)
{
SetSlotLock(ent, false);
}

private void OnClosed(Entity<ItemCabinetComponent> ent, ref OpenableClosedEvent args)
{
SetSlotLock(ent, true);
}

/// <summary>
/// Tries to get the cabinet's item slot.
/// </summary>
public bool TryGetSlot(Entity<ItemCabinetComponent> ent, [NotNullWhen(true)] out ItemSlot? slot)
{
slot = null;
if (!TryComp<ItemSlotsComponent>(ent, out var slots))
return false;

return _slots.TryGetSlot(ent, ent.Comp.Slot, out slot, slots);
}

/// <summary>
/// Returns true if the cabinet contains an item.
/// </summary>
public bool HasItem(Entity<ItemCabinetComponent> ent)
{
return TryGetSlot(ent, out var slot) && slot.HasItem;
}

/// <summary>
/// Lock or unlock the underlying item slot.
/// </summary>
public void SetSlotLock(Entity<ItemCabinetComponent> ent, bool closed)
{
if (!TryComp<ItemSlotsComponent>(ent, out var slots))
return;

if (_slots.TryGetSlot(ent, ent.Comp.Slot, out var slot, slots))
_slots.SetLock(ent, slot, closed, slots);
}
}
Loading

0 comments on commit bd10e91

Please sign in to comment.