diff --git a/Content.Shared/_White/DamageableClothing/Components/DamageableClothingComponent.cs b/Content.Shared/_White/DamageableClothing/Components/DamageableClothingComponent.cs new file mode 100644 index 0000000000..ea7dd2c437 --- /dev/null +++ b/Content.Shared/_White/DamageableClothing/Components/DamageableClothingComponent.cs @@ -0,0 +1,25 @@ +using Content.Shared.Damage; +using Robust.Shared.GameStates; +// WD Engi Exclusive +namespace Content.Shared.DamageableClothing; + +/// +/// This component goes on an equippable item that should take damage while in use. +/// +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class DamageableClothingComponent : Component +{ + + /// + /// The entity that's wearing the item. + /// + [ViewVariables, AutoNetworkedField] + public EntityUid? User; + + /// + /// The damage modifier to use on item. + /// + [DataField] + public DamageModifierSet DamageModifier = default!; + +} diff --git a/Content.Shared/_White/DamageableClothing/Components/DamageableClothingUserComponent.cs b/Content.Shared/_White/DamageableClothing/Components/DamageableClothingUserComponent.cs new file mode 100644 index 0000000000..ef78a0b308 --- /dev/null +++ b/Content.Shared/_White/DamageableClothing/Components/DamageableClothingUserComponent.cs @@ -0,0 +1,16 @@ +// WD Engi Exclusive +namespace Content.Shared.DamageableClothing; + +/// +/// This component gets dynamically added to an Entity via the +/// +[RegisterComponent] +public sealed partial class DamageableClothingUserComponent : Component +{ + /// + /// The entity that's also being damaged. + /// + [DataField] + public EntityUid? ItemId; + +} diff --git a/Content.Shared/_White/DamageableClothing/DamageableClothingSystem.cs b/Content.Shared/_White/DamageableClothing/DamageableClothingSystem.cs new file mode 100644 index 0000000000..c32ed9614b --- /dev/null +++ b/Content.Shared/_White/DamageableClothing/DamageableClothingSystem.cs @@ -0,0 +1,43 @@ +using Robust.Shared.Timing; +using Content.Shared.Inventory.Events; +// WD Engi Exclusive +namespace Content.Shared.DamageableClothing; + +public sealed partial class DamageableClothingSystem : EntitySystem +{ + [Dependency] private readonly IGameTiming _gameTiming = default!; + + public override void Initialize() + { + base.Initialize(); + InitializeUser(); + + SubscribeLocalEvent(OnEquipped); + SubscribeLocalEvent(OnUnequipped); + SubscribeLocalEvent(OnShutdown); + } + + private void OnEquipped(EntityUid uid, DamageableClothingComponent component, GotEquippedEvent args) + { + if (_gameTiming.ApplyingState) + return; + component.User = args.Equipee; + var userComp = EnsureComp(args.Equipee); + userComp.ItemId = args.Equipment; + } + + private void OnUnequipped(EntityUid uid, DamageableClothingComponent component, GotUnequippedEvent args) + { + RemCompDeferred(args.Equipee); + component.User = null; + } + + private void OnShutdown(EntityUid uid, DamageableClothingComponent component, ComponentShutdown args) + { + if (component.User != null) + { + RemCompDeferred(component.User.Value); + component.User = null; + } + } +} diff --git a/Content.Shared/_White/DamageableClothing/DamageableClothingUserSystem.cs b/Content.Shared/_White/DamageableClothing/DamageableClothingUserSystem.cs new file mode 100644 index 0000000000..7d1f031725 --- /dev/null +++ b/Content.Shared/_White/DamageableClothing/DamageableClothingUserSystem.cs @@ -0,0 +1,46 @@ +using Content.Shared.Damage; +// WD Engi Exclusive +namespace Content.Shared.DamageableClothing; + +public sealed partial class DamageableClothingSystem +{ + [Dependency] private readonly DamageableSystem _damageable = default!; + + private void InitializeUser() + { + SubscribeLocalEvent(OnUserDamageModified); + SubscribeLocalEvent(OnDamageModified); + SubscribeLocalEvent(OnEntityTerminating); + } + + private void OnUserDamageModified(EntityUid uid, DamageableClothingUserComponent component, DamageModifyEvent args) + { + if (TryComp(component.ItemId, out var blocking)) + { + if (args.Damage.GetTotal() <= 0) + return; + + if (!TryComp(component.ItemId, out var dmgComp)) + return; + + var blockFraction = 1; + blockFraction = Math.Clamp(blockFraction, 0, 1); + _damageable.TryChangeDamage(component.ItemId, blockFraction * args.OriginalDamage); + } + } + + private void OnDamageModified(EntityUid uid, DamageableClothingComponent component, DamageModifyEvent args) + { + var modifier = component.DamageModifier; + args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, modifier); + } + + private void OnEntityTerminating(EntityUid uid, DamageableClothingUserComponent component, ref EntityTerminatingEvent args) + { + if (!TryComp(component.ItemId, out var blockingComponent)) + return; + + RemCompDeferred(uid); + } + +} diff --git a/Resources/Locale/ru-RU/White/clothing-outer-armor-reflective-ghetto.ftl b/Resources/Locale/ru-RU/White/clothing-outer-armor-reflective-ghetto.ftl new file mode 100644 index 0000000000..491be27338 --- /dev/null +++ b/Resources/Locale/ru-RU/White/clothing-outer-armor-reflective-ghetto.ftl @@ -0,0 +1,2 @@ +ent-ClothingOuterArmorReflectiveGhetto = самодельный отражающий жилет + .desc = Два зеркала соединённые проводами для сомнительной защиты от лазеров. diff --git a/Resources/Locale/ru-RU/White/ghetto-mirror-shield.ftl b/Resources/Locale/ru-RU/White/ghetto-mirror-shield.ftl new file mode 100644 index 0000000000..0a5b6a25db --- /dev/null +++ b/Resources/Locale/ru-RU/White/ghetto-mirror-shield.ftl @@ -0,0 +1,2 @@ +ent-MirrorShieldGhetto = самодельный зеркальный щит + .desc = Сделанное на скорую руку зеркало с рукояткой для использования как сомнительная защита от лазеров. diff --git a/Resources/Prototypes/_White/Entities/Clothing/OuterClothing/ClothingOuterArmorReflectiveGhetto.yml b/Resources/Prototypes/_White/Entities/Clothing/OuterClothing/ClothingOuterArmorReflectiveGhetto.yml new file mode 100644 index 0000000000..310aeb1f84 --- /dev/null +++ b/Resources/Prototypes/_White/Entities/Clothing/OuterClothing/ClothingOuterArmorReflectiveGhetto.yml @@ -0,0 +1,53 @@ +- type: entity # WD Engi Exclusive + parent: ClothingOuterArmorBasic + id: ClothingOuterArmorReflectiveGhetto + name: makeshift reflective vest + description: Two mirrors connected by wires for dubious laser protection. + components: + - type: Sprite + sprite: White/Clothing/OuterClothing/armor_reflect_ghetto.rsi + state: icon + - type: Clothing + sprite: White/Clothing/OuterClothing/armor_reflect_ghetto.rsi + - type: Armor + modifiers: + coefficients: + Slash: 0.9 + Heat: 0.7 + - type: Reflect + reflectProb: 0.7 + innate: true + placement: + - Body + reflects: + - Energy + - type: Construction + graph: ClothingOuterArmorReflectiveGhetto + node: vest + - type: DamageableClothing + damageModifier: + coefficients: + Blunt: 2 + Slash: 0.9 + Piercing: 1.5 + Heat: .5 + flatReductions: + Heat: 0.5 + - type: Damageable + damageContainer: Shield + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 60 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - !type:PlaySoundBehavior + sound: + collection: GlassBreak + - !type:SpawnEntitiesBehavior + spawn: + ShardGlass: + min: 3 + max: 5 diff --git a/Resources/Prototypes/_White/Entities/Objects/Shields/MirrorShieldGhetto.yml b/Resources/Prototypes/_White/Entities/Objects/Shields/MirrorShieldGhetto.yml new file mode 100644 index 0000000000..0b30b8833b --- /dev/null +++ b/Resources/Prototypes/_White/Entities/Objects/Shields/MirrorShieldGhetto.yml @@ -0,0 +1,62 @@ +- type: entity # WD Engi Exclusive + name: makeshift mirror shield + parent: BaseItem + id: MirrorShieldGhetto + description: A makeshift mirror with a handle, used as dubious laser protection. + components: + - type: Sprite + sprite: White/Objects/Weapons/ghetto_mirror_shield.rsi + state: icon + - type: Item + sprite: White/Objects/Weapons/ghetto_mirror_shield.rsi + size: Ginormous + - type: Tag + tags: + - MirrorShieldGhetto + - type: Reflect + reflectProb: 0.7 + innate: true + reflects: + - Energy + - type: Blocking + passiveBlockModifier: + coefficients: + Blunt: 2 + Slash: 0.9 + Piercing: 1.5 + Heat: .6 + activeBlockModifier: + coefficients: + Blunt: 2 + Slash: 0.9 + Piercing: 1.5 + Heat: .3 + flatReductions: + Heat: 0.5 + blockSound: !type:SoundPathSpecifier + path: /Audio/Effects/glass_step.ogg + - type: MeleeBlock + - type: Damageable + damageContainer: Shield + - type: Construction + graph: MirrorShieldGhetto + node: shield + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 40 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - !type:PlaySoundBehavior + sound: + collection: GlassBreak + - !type:SpawnEntitiesBehavior + spawn: + ShardGlass: + min: 2 + max: 3 + - type: StaticPrice + price: 50 + - type: DisarmMalus diff --git a/Resources/Prototypes/_White/Recipes/Crafting/Graphs/ghettoMirrorShield.yml b/Resources/Prototypes/_White/Recipes/Crafting/Graphs/ghettoMirrorShield.yml new file mode 100644 index 0000000000..e36d8bf12a --- /dev/null +++ b/Resources/Prototypes/_White/Recipes/Crafting/Graphs/ghettoMirrorShield.yml @@ -0,0 +1,43 @@ +# WD Engi Exclusive +- type: constructionGraph + id: MirrorShieldGhetto + start: start + graph: + - node: start + edges: + - to: shield + steps: + - material: Glass + amount: 5 + doAfter: 3 + - material: Steel + amount: 3 + doAfter: 3 + - node: shield + entity: MirrorShieldGhetto + +- type: constructionGraph + id: ClothingOuterArmorReflectiveGhetto + start: start + graph: + - node: start + edges: + - to: vest + steps: + - material: Cable + amount: 5 + - tag: MirrorShieldGhetto + name: самодельный зеркальный щит + icon: + sprite: White/Objects/Weapons/ghetto_mirror_shield.rsi + state: icon + amount: 1 + - tag: MirrorShieldGhetto + name: самодельный зеркальный щит + icon: + sprite: White/Objects/Weapons/ghetto_mirror_shield.rsi + state: icon + amount: 1 + doAfter: 6 + - node: vest + entity: ClothingOuterArmorReflectiveGhetto diff --git a/Resources/Prototypes/_White/Recipes/Crafting/ghettoMirrorShield.yml b/Resources/Prototypes/_White/Recipes/Crafting/ghettoMirrorShield.yml new file mode 100644 index 0000000000..588f18da36 --- /dev/null +++ b/Resources/Prototypes/_White/Recipes/Crafting/ghettoMirrorShield.yml @@ -0,0 +1,26 @@ +# WD Engi Exclusive +- type: construction + name: самодельный зеркальный щит + id: MirrorShieldGhetto + graph: MirrorShieldGhetto + startNode: start + targetNode: shield + category: construction-category-weapons + objectType: Item + description: Сделанное на скорую руку зеркало с рукояткой для использования как сомнительная защита от лазеров. + icon: + sprite: White/Objects/Weapons/ghetto_mirror_shield.rsi + state: icon + +- type: construction + name: самодельный отражающий жилет + id: ClothingOuterArmorReflectiveGhetto + graph: ClothingOuterArmorReflectiveGhetto + startNode: start + targetNode: vest + category: construction-category-clothing + objectType: Item + description: Два зеркала соединённые проводами для сомнительной защиты от лазеров. + icon: + sprite: White/Clothing/OuterClothing/armor_reflect_ghetto.rsi + state: icon diff --git a/Resources/Prototypes/_White/tags.yml b/Resources/Prototypes/_White/tags.yml index 375c824a14..40e48a923a 100644 --- a/Resources/Prototypes/_White/tags.yml +++ b/Resources/Prototypes/_White/tags.yml @@ -120,3 +120,7 @@ - type: Tag id: VoiceActivatedBombImplant + +# WD Engi Exclusive +- type: Tag + id: MirrorShieldGhetto diff --git a/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/equipped-OUTERCLOTHING.png b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/equipped-OUTERCLOTHING.png new file mode 100644 index 0000000000..5572ecd007 Binary files /dev/null and b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/equipped-OUTERCLOTHING.png differ diff --git a/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/icon.png b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/icon.png new file mode 100644 index 0000000000..a4205712d8 Binary files /dev/null and b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/icon.png differ diff --git a/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-left.png b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-left.png new file mode 100644 index 0000000000..edc2a32edb Binary files /dev/null and b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-left.png differ diff --git a/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-right.png b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-right.png new file mode 100644 index 0000000000..5e35789113 Binary files /dev/null and b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/inhand-right.png differ diff --git a/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/meta.json b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/meta.json new file mode 100644 index 0000000000..61fc5a5260 --- /dev/null +++ b/Resources/Textures/White/Clothing/OuterClothing/armor_reflect_ghetto.rsi/meta.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "stepppasha", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "equipped-OUTERCLOTHING", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/icon.png b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/icon.png new file mode 100644 index 0000000000..f1bc32c7d6 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/icon.png differ diff --git a/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-left.png b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-left.png new file mode 100644 index 0000000000..ccfebc408c Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-right.png b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-right.png new file mode 100644 index 0000000000..237cb837c3 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/inhand-right.png differ diff --git a/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/meta.json b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/meta.json new file mode 100644 index 0000000000..cb084b7fa0 --- /dev/null +++ b/Resources/Textures/White/Objects/Weapons/ghetto_mirror_shield.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/Citadel-Station-13/Citadel-Station-13/commit/84223c65f5caf667a84f3c0f49bc2a41cdc6c4e3", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + } + ] +}