diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index f270fe76d2..c47a94f41b 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -1,5 +1,10 @@ -using Content.Server.Body.Systems; +using System.Linq; +using Content.Server.Body.Systems; +using Content.Server.GameTicking.Rules.Components; +using Content.Server.Ghost.Components; using Content.Server.Kitchen.Components; +using Content.Server.Mind.Components; +using Content.Server.Roles; using Content.Shared.Body.Components; using Content.Shared.Interaction; using Content.Shared.Nutrition.Components; @@ -59,6 +64,16 @@ public sealed class SharpSystem : EntitySystem return; } + // WD START + if (butcher.SyndieRoleRequired && !HasComp(user) && !HasComp(user) && + TryComp(user, out MindContainerComponent? mc) && mc.Mind != null && + !mc.Mind.Roles.OfType().Any()) + { + _popupSystem.PopupEntity("Вы не можете разделать столь милое существо.", user, user); + return; + } + // WD END + if (TryComp(target, out var mobState) && !_mobStateSystem.IsDead(target, mobState)) return; diff --git a/Content.Server/White/Crossbow/PoweredSystem.cs b/Content.Server/White/Crossbow/PoweredSystem.cs index e349354e7c..e0e5a1e9ad 100644 --- a/Content.Server/White/Crossbow/PoweredSystem.cs +++ b/Content.Server/White/Crossbow/PoweredSystem.cs @@ -14,6 +14,7 @@ public sealed class PoweredSystem : EntitySystem [Dependency] private readonly BatterySystem _battery = default!; private const string CellSlot = "cell_slot"; + private const string CrystalSlot = "crystal_slot"; public override void Initialize() { @@ -27,7 +28,7 @@ public sealed class PoweredSystem : EntitySystem if (!TryGetBatteryComponent(uid, out var battery, out var batteryUid)) return; - var (factor, charge) = GetFactor(component, battery, batteryUid.Value); + var (factor, charge) = GetFactor(uid, component, battery, batteryUid.Value); // Чтобы затриггерить взрыв на полную мощь, если есть плазма в батарейке _battery.SetCharge(batteryUid.Value, battery.CurrentCharge, battery); @@ -54,17 +55,24 @@ public sealed class PoweredSystem : EntitySystem !TryGetBatteryComponent(uid, out var battery, out var batteryUid)) return 1f; - return 1f + GetFactor(component, battery, batteryUid.Value).Item1; + return 1f + GetFactor(uid, component, battery, batteryUid.Value).Item1; } - private (float, float) GetFactor(PoweredComponent component, BatteryComponent battery, EntityUid batteryUid) + private (float, float) GetFactor(EntityUid uid, PoweredComponent component, BatteryComponent battery, EntityUid batteryUid) { DebugTools.Assert(component.Charge != 0f); var charge = MathF.Min(battery.CurrentCharge, component.Charge); var factor = charge / component.Charge; + var multiplier = 1f; if (TryComp(batteryUid, out RiggableComponent? rig) && rig.IsRigged) - factor *= 2f; + multiplier += 1f; + + if (_containers.TryGetContainer(uid, CrystalSlot, out var container) && container is ContainerSlot slot && + slot.ContainedEntity.HasValue) + multiplier += 1f; + + factor *= multiplier; return (factor, charge); } diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs index 9310617634..c1b46c3d91 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs @@ -219,6 +219,9 @@ namespace Content.Shared.Containers.ItemSlots [DataField("priority")] public int Priority = 0; + [DataField("maxStackAmount")] // WD + public int MaxStackAmount; + /// /// If false, errors when adding an item slot with a duplicate key are suppressed. Local==true implies that /// the slot was added via client component state handling. diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index d832cdfef8..d555c1a4db 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Popups; +using Content.Shared.Stacks; using Content.Shared.Verbs; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; @@ -206,6 +207,20 @@ namespace Content.Shared.Containers.ItemSlots if (!CanInsert(uid, args.Used, args.User, slot, swap: slot.Swap, popup: args.User)) continue; + // WD START + if (slot.MaxStackAmount > 0 && TryComp(args.Used, out StackComponent? stack) && + stack.Count > slot.MaxStackAmount) + { + if (_netManager.IsClient && _timing.IsFirstTimePredicted) + { + _popupSystem.PopupEntity( + $"Невозможно одновременно вставить {stack.Count}, максимум: {slot.MaxStackAmount}.", uid, + args.User); + } + continue; + } + // WD END + // Drop the held item onto the floor. Return if the user cannot drop. if (!_handsSystem.TryDrop(args.User, args.Used, handsComp: hands)) return; diff --git a/Content.Shared/Nutrition/Components/ButcherableComponent.cs b/Content.Shared/Nutrition/Components/ButcherableComponent.cs index 4fce45422a..202686602e 100644 --- a/Content.Shared/Nutrition/Components/ButcherableComponent.cs +++ b/Content.Shared/Nutrition/Components/ButcherableComponent.cs @@ -18,6 +18,9 @@ namespace Content.Shared.Nutrition.Components [ViewVariables(VVAccess.ReadWrite), DataField("butcheringType")] public ButcheringType Type = ButcheringType.Knife; + [DataField("syndieRoleRequired")] // WD + public bool SyndieRoleRequired; + /// /// Prevents butchering same entity on two and more spikes simultaneously and multiple doAfters on the same Spike /// diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index 2a44bdc033..62ea46bbb7 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -531,6 +531,7 @@ interactSuccessSound: path: /Audio/Animals/fox_squeak.ogg - type: Butcherable + syndieRoleRequired: true spawned: - id: FoodMeat amount: 3 diff --git a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml index b6046ced3a..0179ca3aaf 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml @@ -21,6 +21,9 @@ - type: Currency price: Telecrystal: 1 + - type: Tag + tags: + - Telecrystal - type: entity parent: Telecrystal diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml index 032467ed41..09daa3f9ff 100644 --- a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml @@ -34,17 +34,24 @@ ballistic-ammo: !type:Container ents: [] cell_slot: !type:ContainerSlot + crystal_slot: !type:ContainerSlot - type: PowerCellSlot cellSlotId: cell_slot - type: ItemSlots slots: cell_slot: name: power-cell-slot-component-slot-name-default + crystal_slot: + name: Кристалл + whitelist: + tags: + - Telecrystal + maxStackAmount: 1 - type: Drawable - type: Appearance - type: ModifyDamageOnShoot addEmbedding: true - offset: 0.2,0.2 + offset: 0.1,0.1 damage: types: Piercing: 15 diff --git a/Resources/Prototypes/White/Recipes/hidden_crafts.yml b/Resources/Prototypes/White/Recipes/hidden_crafts.yml index 2399b9da40..89f8eecdb1 100644 --- a/Resources/Prototypes/White/Recipes/hidden_crafts.yml +++ b/Resources/Prototypes/White/Recipes/hidden_crafts.yml @@ -119,6 +119,14 @@ - to: snatcherprod steps: - material: Telecrystal - traitorOnly: true - node: snatcherprod entity: Snatcherprod + edges: + - to: rod + steps: + - tool: Cutting + doAfter: 5 + completed: + - !type:SpawnPrototype + prototype: Telecrystal1 + - !type:EmptyAllContainers diff --git a/Resources/Prototypes/White/tags.yml b/Resources/Prototypes/White/tags.yml index 158a4d5753..9b53e3b41c 100644 --- a/Resources/Prototypes/White/tags.yml +++ b/Resources/Prototypes/White/tags.yml @@ -39,3 +39,6 @@ - type: Tag id: WallMountConsoleElectronics + +- type: Tag + id: Telecrystal