From e64c1b7e811758efe0b6760f738507679ba4a91e Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Mon, 4 Sep 2023 12:03:28 +0300 Subject: [PATCH] Fixes & Tweaks (#356) * Revert "captains sword reflect chance (#18133)" This reverts commit e393eedd09b0cfc3d2498a813f039f57963f77eb. * Mirror shield passive reflect * Traitor stuff fixes and tweaks * Connected dispenser click sound * No medipen heavy attack * Slice sound for blades * Crossbow & material stacking fixes * Hypospray fixes * Chenge crossbow damage type * Fix penetrating on land * Antispam tweak --- Content.Server/Chat/Managers/ChatManager.cs | 4 +- Content.Server/Chat/Managers/IChatManager.cs | 2 +- Content.Server/Chat/Systems/ChatSystem.cs | 2 +- .../EntitySystems/ReagentDispenserSystem.cs | 1 + .../Conditions/KillDepartmentCondition.cs | 106 ++++++++++++++++++ .../White/Other/CritSystem/CritSystem.cs | 10 +- .../Prototypes/Body/Organs/Animal/animal.yml | 2 +- .../Clothing/OuterClothing/hardsuits.yml | 1 + .../Fun/Instruments/instruments_string.yml | 2 +- .../Entities/Objects/Materials/parts.yml | 1 + .../Entities/Objects/Shields/shields.yml | 2 +- .../Entities/Objects/Weapons/Melee/cult.yml | 4 + .../Objects/Weapons/Melee/daggers.yml | 5 +- .../Entities/Objects/Weapons/Melee/sword.yml | 4 - .../Structures/Furniture/Tables/tables.yml | 4 +- .../Entities/Structures/Furniture/altar.yml | 2 +- .../Entities/Structures/Furniture/beds.yml | 2 +- .../Structures/Furniture/bookshelf.yml | 2 +- .../Entities/Structures/Furniture/chairs.yml | 2 +- .../Prototypes/Entities/Tiles/bananium.yml | 2 +- Resources/Prototypes/Store/presets.yml | 2 +- .../Objects/Weapons/Guns/crossbow.yml | 6 +- .../Objects/Weapons/Guns/flamethrower.yml | 2 + 23 files changed, 143 insertions(+), 27 deletions(-) create mode 100644 Content.Server/Objectives/Conditions/KillDepartmentCondition.cs diff --git a/Content.Server/Chat/Managers/ChatManager.cs b/Content.Server/Chat/Managers/ChatManager.cs index 1807a2bed1..1ee36d8bc3 100644 --- a/Content.Server/Chat/Managers/ChatManager.cs +++ b/Content.Server/Chat/Managers/ChatManager.cs @@ -216,9 +216,9 @@ namespace Content.Server.Chat.Managers _utkaSocketWrapper.SendMessageToAll(asayEventMessage); } - public bool TrySendNewMessage(ICommonSession session, string newMessage) + public bool TrySendNewMessage(ICommonSession session, string newMessage, bool checkLength = false) { - if (!_antispam || newMessage.Length < _antispamMinLength) + if (!_antispam || checkLength && newMessage.Length < _antispamMinLength) { _lastMessages.Remove(session.Data.UserId); return true; diff --git a/Content.Server/Chat/Managers/IChatManager.cs b/Content.Server/Chat/Managers/IChatManager.cs index 8069aba82c..2999ff442d 100644 --- a/Content.Server/Chat/Managers/IChatManager.cs +++ b/Content.Server/Chat/Managers/IChatManager.cs @@ -24,7 +24,7 @@ namespace Content.Server.Chat.Managers // WD-EDIT void SendHookAdminChat(string sender, string message); - bool TrySendNewMessage(ICommonSession session, string newMessage); + bool TrySendNewMessage(ICommonSession session, string newMessage, bool checkLength = false); // WD-EDIT void SendAdminAnnouncement(string message); diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 00140301c8..216c782ce1 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -249,7 +249,7 @@ public sealed partial class ChatSystem : SharedChatSystem return; if (desiredType != InGameICChatType.Emote && player is not null && - !_chatManager.TrySendNewMessage(player, message)) // WD + !_chatManager.TrySendNewMessage(player, message, true)) // WD return; // This message may have a radio prefix, and should then be whispered to the resolved radio channel diff --git a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs index ca0cf8011d..1394760a20 100644 --- a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs @@ -236,6 +236,7 @@ namespace Content.Server.Chemistry.EntitySystems bufferSolution.Value.Comp.Solution.AddReagent(message.ReagentId, FixedPoint2.New((int)reagentDispenser.Comp.DispenseAmount)); _chemMasterSystem.UpdateUiState((chemMasterUid.Value, chemMaster)); + ClickSound(reagentDispenser); return; } // WD EDIT END diff --git a/Content.Server/Objectives/Conditions/KillDepartmentCondition.cs b/Content.Server/Objectives/Conditions/KillDepartmentCondition.cs new file mode 100644 index 0000000000..21c4373bb8 --- /dev/null +++ b/Content.Server/Objectives/Conditions/KillDepartmentCondition.cs @@ -0,0 +1,106 @@ +using System.Linq; +using Content.Server.Mind; +using Content.Server.Mind.Components; +using Content.Server.Objectives.Interfaces; +using Content.Server.Roles; +using Content.Shared.Mobs.Components; +using Content.Shared.Mobs.Systems; +using Content.Shared.Roles; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; + +namespace Content.Server.Objectives.Conditions; + +public abstract class KillDepartmentCondition : IObjectiveCondition +{ + private IEntityManager EntityManager => IoCManager.Resolve(); + private IPrototypeManager PrototypeManager => IoCManager.Resolve(); + private MobStateSystem MobStateSystem => EntityManager.EntitySysManager.GetEntitySystem(); + private MindSystem MindSystem => EntityManager.EntitySysManager.GetEntitySystem(); + + protected abstract string TitleHeader { get; } + public abstract IObjectiveCondition GetAssigned(Mind.Mind mind); + + protected List? Targets; + + protected List GetTargets(Mind.Mind mind, string department) + { + var dep = PrototypeManager.Index(department); + var allMinds = EntityManager.EntityQuery(true).Where(mc => + { + var entity = mc.Mind?.OwnedEntity; + + if (entity == default || mc.Mind == mind) + return false; + + var isTargetJob = mc.Mind?.AllRoles.OfType().Any(job => dep.Roles.Contains(job.Prototype.ID)); + + if (isTargetJob is false) + return false; + + return EntityManager.TryGetComponent(entity, out MobStateComponent? mobState) && + MobStateSystem.IsAlive(entity.Value, mobState); + + }).Select(mc => mc.Mind).ToList(); + + return allMinds; + } + + public string Title + { + get + { + var title = TitleHeader; + if (Targets == null) + return title; + + foreach (var target in Targets) + { + if (target?.OwnedEntity is { Valid: true } owned) + { + title += $"\n - {EntityManager.GetComponent(owned).EntityName}, " + + $"{target?.CurrentJob?.Name ?? "Unknown"}"; + } + } + + return title; + } + } + + public string Description => Loc.GetString("objective-condition-department-description"); + + public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ("Objects/Weapons/Guns/Pistols/viper.rsi"), "icon"); + + public float Progress + { + get + { + if (Targets == null) + return 1f; + + var deadTargetsCount = Targets.Count(target => target != null && MindSystem.IsCharacterDeadIc(target)); + + return Math.Min(1f / Targets.Count * deadTargetsCount, 1f); + } + } + + public float Difficulty => 5f; + public bool Equals(IObjectiveCondition? other) + { + return other is KillDepartmentCondition kdc && Equals(Targets, kdc.Targets); + } + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) + return false; + if (ReferenceEquals(this, obj)) + return true; + return obj.GetType() == GetType() && Equals((KillDepartmentCondition) obj); + } + + public override int GetHashCode() + { + return Targets?.GetHashCode() ?? 0; + } +} diff --git a/Content.Server/White/Other/CritSystem/CritSystem.cs b/Content.Server/White/Other/CritSystem/CritSystem.cs index 8ba974512f..e14d7e5d95 100644 --- a/Content.Server/White/Other/CritSystem/CritSystem.cs +++ b/Content.Server/White/Other/CritSystem/CritSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.Examine; using Content.Shared.Mobs.Components; +using Content.Shared.Mobs.Systems; using Content.Shared.Popups; using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Prototypes; @@ -18,6 +19,7 @@ public sealed class CritSystem : EntitySystem [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; + [Dependency] private readonly MobStateSystem _mobState = default!; public override void Initialize() { @@ -44,7 +46,7 @@ public sealed class CritSystem : EntitySystem if (!IsCriticalHit(component)) return; - if (!TryComp(target, out _)) + if (!TryComp(target, out var mobState) || _mobState.IsDead(target, mobState)) continue; var damage = args.BaseDamage.Total * component.CritMultiplier; @@ -55,12 +57,14 @@ public sealed class CritSystem : EntitySystem var damageGroup = _prototypeManager.Index("Brute"); _bloodstream.TryModifyBloodLevel(target, -ohio); - _damageableSystem.TryChangeDamage(args.User, new DamageSpecifier(damageGroup, -ohio)); + _bloodstream.TryModifyBloodLevel(args.User, ohio); + _damageableSystem.TryChangeDamage(args.User, new DamageSpecifier(damageGroup, -ohio * 2)); damage = args.BaseDamage.Total * component.CritMultiplier + ohio; } - args.BonusDamage = new DamageSpecifier(_prototypeManager.Index("Slash"), damage); + args.BonusDamage = new DamageSpecifier(_prototypeManager.Index("Slash"), + damage - args.BaseDamage.Total); _popup.PopupEntity($@"Crit! {damage}", args.User, PopupType.MediumCaution); } diff --git a/Resources/Prototypes/Body/Organs/Animal/animal.yml b/Resources/Prototypes/Body/Organs/Animal/animal.yml index 358fc74bca..7a3c69a142 100644 --- a/Resources/Prototypes/Body/Organs/Animal/animal.yml +++ b/Resources/Prototypes/Body/Organs/Animal/animal.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity id: BaseAnimalOrgan parent: BaseItem abstract: true diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml index 7f109b532a..1ac8769400 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml @@ -367,6 +367,7 @@ tags: - WhitelistChameleon - HighRiskItem + - Hardsuit - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitRd - type: StaticPrice diff --git a/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_string.yml b/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_string.yml index 7224efa9e0..14017d7416 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_string.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_string.yml @@ -135,7 +135,7 @@ path: /Audio/Weapons/guitarsmash.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 2 max: 4 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Objects/Materials/parts.yml b/Resources/Prototypes/Entities/Objects/Materials/parts.yml index 4db618761e..004ff8b78b 100644 --- a/Resources/Prototypes/Entities/Objects/Materials/parts.yml +++ b/Resources/Prototypes/Entities/Objects/Materials/parts.yml @@ -109,6 +109,7 @@ damage: types: Blunt: 0 + ignoreResistances: true - type: Sprite state: rods - type: Stack diff --git a/Resources/Prototypes/Entities/Objects/Shields/shields.yml b/Resources/Prototypes/Entities/Objects/Shields/shields.yml index c7fda9779a..3006cd1753 100644 --- a/Resources/Prototypes/Entities/Objects/Shields/shields.yml +++ b/Resources/Prototypes/Entities/Objects/Shields/shields.yml @@ -163,7 +163,7 @@ sound: /Audio/Effects/metalbreak.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 5 max: 5 - type: StaticPrice diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/cult.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/cult.yml index db24d3e2cd..0a720f9fd0 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/cult.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/cult.yml @@ -14,6 +14,8 @@ damage: types: Slash: 12 + soundHit: + path: /Audio/Weapons/bladeslice.ogg - type: Item size: Normal - type: Clothing @@ -38,6 +40,8 @@ damage: types: Slash: 16 + soundHit: + path: /Audio/Weapons/bladeslice.ogg - type: Item size: Normal - type: Clothing diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/daggers.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/daggers.yml index 7c7cd45153..4dcb959cff 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/daggers.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/daggers.yml @@ -12,6 +12,8 @@ damage: types: Slash: 10.5 + soundHit: + path: /Audio/Weapons/bladeslice.ogg - type: Item size: 20 - type: Clothing @@ -23,6 +25,3 @@ critChance: 20 critMultiplier: 2.2 isBloodDagger: true - - type: Reflect - reflectProb: 0.15 - enabled: true diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml index 05cac3ae7b..028c7713c0 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml @@ -16,10 +16,6 @@ Slash: 17 #cmon, it has to be at least BETTER than the rest. soundHit: path: /Audio/Weapons/bladeslice.ogg - - type: Reflect - enabled: true - reflectProb: .5 - spread: 90 - type: Item size: Normal sprite: Objects/Weapons/Melee/captain_sabre.rsi diff --git a/Resources/Prototypes/Entities/Structures/Furniture/Tables/tables.yml b/Resources/Prototypes/Entities/Structures/Furniture/Tables/tables.yml index 5c42e7cf32..d3252824f9 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/Tables/tables.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/Tables/tables.yml @@ -414,7 +414,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 1 max: 1 - !type:DoActsBehavior @@ -449,7 +449,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 1 max: 1 MaterialCloth1: diff --git a/Resources/Prototypes/Entities/Structures/Furniture/altar.yml b/Resources/Prototypes/Entities/Structures/Furniture/altar.yml index d34030eb97..6039b4d239 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/altar.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/altar.yml @@ -190,7 +190,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 1 max: 5 MaterialCloth1: diff --git a/Resources/Prototypes/Entities/Structures/Furniture/beds.yml b/Resources/Prototypes/Entities/Structures/Furniture/beds.yml index 3f0234a089..1e01d55654 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/beds.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/beds.yml @@ -108,7 +108,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 1 max: 5 diff --git a/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml b/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml index b2c53beaff..0c36587466 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml @@ -29,7 +29,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 2 max: 3 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml index 26829aba2d..a49c211153 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml @@ -194,7 +194,7 @@ path: /Audio/Effects/woodhit.ogg - !type:SpawnEntitiesBehavior spawn: - MaterialWoodPlank: + MaterialWoodPlank1: min: 1 max: 1 - type: Tag diff --git a/Resources/Prototypes/Entities/Tiles/bananium.yml b/Resources/Prototypes/Entities/Tiles/bananium.yml index c9a6ec2844..7f3334fdb8 100644 --- a/Resources/Prototypes/Entities/Tiles/bananium.yml +++ b/Resources/Prototypes/Entities/Tiles/bananium.yml @@ -38,7 +38,7 @@ behaviors: - !type:SpawnEntitiesBehavior spawn: - MaterialBananium: + MaterialBananium1: min: 0 max: 1 - !type:DoActsBehavior diff --git a/Resources/Prototypes/Store/presets.yml b/Resources/Prototypes/Store/presets.yml index c2cc3475b0..3e370a4fab 100644 --- a/Resources/Prototypes/Store/presets.yml +++ b/Resources/Prototypes/Store/presets.yml @@ -21,5 +21,5 @@ minMultiplier: 0.01 maxMultiplier: 0.99 minItems: 3 - maxItems: 8 + maxItems: 10 salesCategory: UplinkSales diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml index 9ee639be99..80145d2ec3 100644 --- a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/crossbow.yml @@ -11,6 +11,7 @@ quickEquip: false slots: - Back + - SuitStorage - type: Item size: Huge sprite: White/Objects/Weapons/crossbow.rsi @@ -46,12 +47,12 @@ offset: 0.2,0.2 damage: types: - Blunt: 15 + Piercing: 15 - type: Powered charge: 180 damage: types: - Blunt: 10 + Piercing: 10 Heat: 10 - type: Construction deconstructionTarget: null @@ -74,6 +75,7 @@ quickEquip: false slots: - Back + - SuitStorage - type: Construction deconstructionTarget: null graph: WeaponPoweredCrossbowGraph diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/flamethrower.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/flamethrower.yml index 1ca14edf61..fe75e898a0 100644 --- a/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/flamethrower.yml +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/Guns/flamethrower.yml @@ -22,6 +22,7 @@ quickEquip: false slots: - Back + - SuitStorage - type: Gun cameraRecoilScalar: 0 fireRate: 2 @@ -83,6 +84,7 @@ quickEquip: false slots: - Back + - SuitStorage - type: Construction deconstructionTarget: null graph: WeaponFlamethrowerGraph