From 1e68fead1efe942310ac41bc5023df78644307d6 Mon Sep 17 00:00:00 2001 From: nopeingeneer Date: Fri, 22 Dec 2023 06:52:07 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D1=80=D0=B0=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=20=D0=B1=D0=B8=D0=B7=D0=BD=D0=B5?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExplosionResistanceComponent.cs | 18 +++++++++- .../ExplosionSystem.Processing.cs | 8 ++++- .../EntitySystems/ExplosionSystem.cs | 9 ++--- .../EntitySystems/EntityStorageSystem.cs | 4 --- .../SharedEntityStorageComponent.cs | 6 ---- .../en-US/explosions/explosion-resistance.ftl | 1 + .../Catalog/Fills/Crates/salvage.yml | 20 +++++------ .../Entities/Clothing/Back/backpacks.yml | 4 ++- .../Entities/Clothing/Back/duffel.yml | 8 +++++ .../Entities/Clothing/Belt/belts.yml | 6 ++-- .../Entities/Clothing/base_clothing.yml | 13 ++++++++ .../Prototypes/Procedural/salvage_loot.yml | 33 +++++++------------ 12 files changed, 79 insertions(+), 51 deletions(-) diff --git a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs b/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs index a65764c4133..d4a93c2b569 100644 --- a/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs +++ b/Content.Server/Explosion/Components/ExplosionResistanceComponent.cs @@ -5,7 +5,9 @@ namespace Content.Server.Explosion.Components; /// -/// Component that provides entities with explosion resistance. +/// Component that provides entities with explosion resistance. +/// By default this is applied when worn, but to solely protect the entity itself and +/// not the wearer use worn: false. /// /// /// This is desirable over just using damage modifier sets, given that equipment like bomb-suits need to @@ -21,6 +23,20 @@ public sealed partial class ExplosionResistanceComponent : Component [DataField("damageCoefficient")] public float DamageCoefficient = 1; + /// + /// When true, resistances will be applied to the entity wearing this item. + /// When false, only this entity will get th resistance. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public bool Worn = true; + + /// + /// Examine string for explosion resistance. + /// Passed value from 0 to 100. + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public LocId Examine = "explosion-resistance-coefficient-value"; + /// /// Modifiers specific to each explosion type for more customizability. /// diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index 1941ff9d163..e48d9f145eb 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -389,7 +389,13 @@ private DamageSpecifier GetDamage(EntityUid uid, private void GetEntitiesToDamage(EntityUid uid, DamageSpecifier originalDamage, string prototype) { _toDamage.Clear(); - _toDamage.Add((uid, GetDamage(uid, prototype, originalDamage))); + + // don't raise BeforeExplodeEvent if the entity is completely immune to explosions + var thisDamage = GetDamage(uid, prototype, originalDamage); + if (!thisDamage.Any()) + return; + + _toDamage.Add((uid, thisDamage)); for (var i = 0; i < _toDamage.Count; i++) { diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index a246b940859..9df735ff6ac 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -132,7 +132,8 @@ public override void Shutdown() private void RelayedResistance(EntityUid uid, ExplosionResistanceComponent component, InventoryRelayedEvent args) { - OnGetResistance(uid, component, ref args.Args); + if (component.Worn) + OnGetResistance(uid, component, ref args.Args); } private void OnGetResistance(EntityUid uid, ExplosionResistanceComponent component, ref GetExplosionResistanceEvent args) @@ -378,9 +379,9 @@ private void CameraShake(float range, MapCoordinates epicenter, float totalInten private void OnArmorExamine(EntityUid uid, ExplosionResistanceComponent component, ref ArmorExamineEvent args) { + var value = MathF.Round((1f - component.DamageCoefficient) * 100, 1); + args.Msg.PushNewline(); - args.Msg.AddMarkup(Loc.GetString("explosion-resistance-coefficient-value", - ("value", MathF.Round((1f - component.DamageCoefficient) * 100, 1)) - )); + args.Msg.AddMarkup(Loc.GetString(component.Examine, ("value", value))); } } diff --git a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs index efb3734962d..9bc49165eed 100644 --- a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs @@ -102,11 +102,7 @@ private void OnWeldableAttempt(EntityUid uid, EntityStorageComponent component, private void OnExploded(Entity ent, ref BeforeExplodeEvent args) { - if (ent.Comp.ExplosionDamageCoefficient <= 0) - return; - args.Contents.AddRange(ent.Comp.Contents.ContainedEntities); - args.DamageCoefficient *= ent.Comp.ExplosionDamageCoefficient; } protected override void TakeGas(EntityUid uid, SharedEntityStorageComponent component) diff --git a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs index badeffffecb..06bfd534f4d 100644 --- a/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs +++ b/Content.Shared/Storage/Components/SharedEntityStorageComponent.cs @@ -124,12 +124,6 @@ public abstract partial class SharedEntityStorageComponent : Component /// [ViewVariables] public Container Contents = default!; - - /// - /// Multiplier for explosion damage that gets applied to contained entities. - /// - [DataField] - public float ExplosionDamageCoefficient = 1; } [Serializable, NetSerializable] diff --git a/Resources/Locale/en-US/explosions/explosion-resistance.ftl b/Resources/Locale/en-US/explosions/explosion-resistance.ftl index 26fb74346d1..6ebb406b9a9 100644 --- a/Resources/Locale/en-US/explosions/explosion-resistance.ftl +++ b/Resources/Locale/en-US/explosions/explosion-resistance.ftl @@ -1 +1,2 @@ explosion-resistance-coefficient-value = - [color=orange]Explosion[/color] damage reduced by [color=lightblue]{$value}%[/color]. +explosion-resistance-contents-coefficient-value = - [color=orange]Explosion[/color] damage [color=white]to contents[/color] reduced by [color=lightblue]{$value}%[/color]. diff --git a/Resources/Prototypes/Catalog/Fills/Crates/salvage.yml b/Resources/Prototypes/Catalog/Fills/Crates/salvage.yml index 832bd5df1f8..34d4d477034 100644 --- a/Resources/Prototypes/Catalog/Fills/Crates/salvage.yml +++ b/Resources/Prototypes/Catalog/Fills/Crates/salvage.yml @@ -115,29 +115,29 @@ - type: StorageFill contents: - id: QuadraticCapacitorStockPart - prob: 0.1 + amount: 3 - id: FemtoManipulatorStockPart - prob: 0.1 + amount: 3 - id: BluespaceMatterBinStockPart - prob: 0.1 + amount: 3 - id: SuperCapacitorStockPart - prob: 0.1 + amount: 3 - id: PicoManipulatorStockPart - prob: 0.1 + amount: 3 - id: SuperMatterBinStockPart - prob: 0.1 + amount: 3 - type: entity parent: CrateGenericSteel id: CratePartsT4 name: tier 4 parts crate - description: Contains 5 random tier 4 parts for upgrading machines. + description: Contains 18 random tier 4 parts for upgrading machines. components: - type: StorageFill contents: - id: QuadraticCapacitorStockPart - prob: 0.1 + amount: 6 - id: FemtoManipulatorStockPart - prob: 0.1 + amount: 6 - id: BluespaceMatterBinStockPart - prob: 0.1 + amount: 6 diff --git a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml index 59276d68e66..49a0ccbd712 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml @@ -1,5 +1,5 @@ - type: entity - parent: Clothing + parent: [Clothing, ContentsExplosionResistanceBase] id: ClothingBackpack name: backpack description: You wear this on your back and put items into it. @@ -27,6 +27,8 @@ # to prevent bag open/honk spam - type: UseDelay delay: 0.5 + - type: ExplosionResistance + damageCoefficient: 0.9 - type: entity parent: ClothingBackpack diff --git a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml index 291124f2539..c029878001a 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/duffel.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/duffel.yml @@ -163,6 +163,14 @@ components: - type: Sprite sprite: Clothing/Back/Duffels/syndicate.rsi + - type: ExplosionResistance + damageCoefficient: 0.1 + - type: Storage + maxItemSize: Huge + maxTotalWeight: 50 + - type: ClothingSpeedModifier + walkModifier: 1 + sprintModifier: 1 - type: entity parent: ClothingBackpackDuffelSyndicate diff --git a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml index 2c284a160b0..e155307e349 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/belts.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/belts.yml @@ -513,7 +513,7 @@ sprite: Clothing/Belt/salvagewebbing.rsi - type: entity - parent: ClothingBeltStorageBase + parent: [ClothingBeltStorageBase, ContentsExplosionResistanceBase] id: ClothingBeltMilitaryWebbing name: chest rig description: A set of tactical webbing worn by Syndicate boarding parties. @@ -522,9 +522,11 @@ sprite: Clothing/Belt/militarywebbing.rsi - type: Clothing sprite: Clothing/Belt/militarywebbing.rsi + - type: ExplosionResistance + damageCoefficient: 0.5 - type: entity - parent: ClothingBeltStorageBase + parent: ClothingBeltMilitaryWebbing id: ClothingBeltMilitaryWebbingMed name: medical chest rig description: A set of tactical webbing worn by Gorlex Marauder medic operatives. diff --git a/Resources/Prototypes/Entities/Clothing/base_clothing.yml b/Resources/Prototypes/Entities/Clothing/base_clothing.yml index 7e9d6e95681..e360859a8c4 100644 --- a/Resources/Prototypes/Entities/Clothing/base_clothing.yml +++ b/Resources/Prototypes/Entities/Clothing/base_clothing.yml @@ -18,3 +18,16 @@ components: - type: Geiger attachedToSuit: true + +# a piece of clothing that has explosion resistance *for its contents*, not the wearer +- type: entity + abstract: true + id: ContentsExplosionResistanceBase + components: + - type: ExplosionResistance + worn: true # only apply to the clothing itself and items inside, not the wearer + examine: explosion-resistance-contents-coefficient-value + # to show explosion resistance examine + - type: GroupExamine + - type: Armor + modifiers: {} diff --git a/Resources/Prototypes/Procedural/salvage_loot.yml b/Resources/Prototypes/Procedural/salvage_loot.yml index 3125edeaa8a..952523732d5 100644 --- a/Resources/Prototypes/Procedural/salvage_loot.yml +++ b/Resources/Prototypes/Procedural/salvage_loot.yml @@ -43,7 +43,7 @@ prob: 0.5 - proto: PowerCellAntiqueProto cost: 5 - prob: 0.25 + prob: 0.35 - proto: ProtolatheMachineCircuitboard - proto: RandomArtifactSpawner cost: 2 @@ -69,52 +69,41 @@ cost: 2 prob: 0.5 - proto: ResearchAndDevelopmentServerMachineCircuitboard - cost: 5 + cost: 2 prob: 0.5 - proto: ResearchDisk10000 prob: 0.75 - proto: ResearchDisk5000 prob: 0.5 - - proto: RipleyHarness - cost: 3 - prob: 0.5 - - proto: RPED - - proto: SpaceCash1000 - - proto: SpaceCash10000 - cost: 10 - - proto: SpaceCash2500 - cost: 3 - - proto: SpaceCash5000 - cost: 5 - proto: TechnologyDiskRare - cost: 5 + cost: 2 prob: 0.75 - proto: CrateScienceTopDisk cost: 5 - prob: 0.5 + prob: 0.65 - proto: WeldingFuelTankHighCapacity cost: 3 - proto: ADTWeaponWarhammer cost: 5 - prob: 0.1 + prob: 0.3 - proto: CrateSyndicateSuperSurplusBundle cost: 5 - prob: 0.0001 + prob: 0.01 - proto: CrateBerserk cost: 5 - prob: 0.055 + prob: 0.35 - proto: Katana cost: 5 - prob: 0.25 + prob: 0.45 - proto: CrateMaterialPlastic - cost: 5 + cost: 1 prob: 1 - proto: CrateMaterialSteel - cost: 5 + cost: 1 prob: 1 - proto: CargoTelepadMachineCircuitboard cost: 5 - prob: 0.1 + prob: 0.3 # Mob loot table From 89bd345356532bb14f2ecd9c7efd308fdc47e0fc Mon Sep 17 00:00:00 2001 From: nopeingeneer Date: Fri, 22 Dec 2023 06:57:12 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D1=87=D0=B5=D0=B9=D0=BD=D0=B4=D0=B6=D0=BB=D0=BE=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/Changelog/ChangelogADT.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Resources/Changelog/ChangelogADT.yml b/Resources/Changelog/ChangelogADT.yml index e06bb40ab28..c0e8020ee2a 100644 --- a/Resources/Changelog/ChangelogADT.yml +++ b/Resources/Changelog/ChangelogADT.yml @@ -865,4 +865,12 @@ Entries: changes: - {message: "Зрение сумеречников теперь монохромное. Цвет, в котором они видят мир, зависит от цвета их глаз", type: Tweak} id: 55641 #костыль отображения в Обновлениях - time: '2023-12-19T20:04:00.0000000+00:00' \ No newline at end of file + time: '2023-12-19T20:04:00.0000000+00:00' + +- author: Nopeengener + changes: + - {message: Добавлена защита от взрывов сумкам синдиката и разгрузкам, type: Tweak} + - {message: Дуфель синдиката имеет больше места чем обычная сумка, type: Tweak} + - {message: Изменил шансы кастомного и обычного лута на экспедициях карго, type: Tweak} + id: 55669 #костыль отображения в Обновлениях + time: '2023-12-22T06:53:00.0000000+00:00'