diff --git a/Content.Server/Damage/Components/DamageOtherOnHitComponent.cs b/Content.Server/Damage/Components/DamageOtherOnHitComponent.cs index 3123e251af..5135211fd0 100644 --- a/Content.Server/Damage/Components/DamageOtherOnHitComponent.cs +++ b/Content.Server/Damage/Components/DamageOtherOnHitComponent.cs @@ -1,5 +1,6 @@ using Content.Server.Damage.Systems; using Content.Shared.Damage; +using Robust.Shared.Audio; namespace Content.Server.Damage.Components { @@ -15,5 +16,7 @@ namespace Content.Server.Damage.Components [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier Damage = default!; + [DataField, ViewVariables(VVAccess.ReadWrite)] // WD + public SoundSpecifier? Sound; } } diff --git a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs index 8d5f1687b9..406ad69a3b 100644 --- a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs +++ b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs @@ -11,6 +11,7 @@ using Content.Shared.Effects; using Content.Shared.Mobs.Components; using Content.Shared.Projectiles; using Content.Shared.Throwing; +using Content.Shared.Weapons.Melee; using Robust.Shared.Physics.Components; using Robust.Shared.Player; @@ -28,7 +29,8 @@ namespace Content.Server.Damage.Systems public override void Initialize() { - SubscribeLocalEvent(OnDoHit); + SubscribeLocalEvent(OnDoHit, + before: new[] {typeof(MeleeThrowOnHitSystem)}); // WD EDIT SubscribeLocalEvent(OnDamageExamine); } @@ -55,7 +57,7 @@ namespace Content.Server.Damage.Systems _color.RaiseEffect(Color.Red, new List() { args.Target }, Filter.Pvs(args.Target, entityManager: EntityManager)); } - _guns.PlayImpactSound(args.Target, dmg, null, false); + _guns.PlayImpactSound(args.Target, dmg, component.Sound, component.Sound != null); // WD EDIT if (TryComp(uid, out var body) && body.LinearVelocity.LengthSquared() > 0f) { var direction = body.LinearVelocity.Normalized(); diff --git a/Content.Server/_White/Wizard/Magic/WizardSpellsSystem.cs b/Content.Server/_White/Wizard/Magic/WizardSpellsSystem.cs index 6c0dec15af..3e0ac10fa8 100644 --- a/Content.Server/_White/Wizard/Magic/WizardSpellsSystem.cs +++ b/Content.Server/_White/Wizard/Magic/WizardSpellsSystem.cs @@ -159,6 +159,7 @@ public sealed class WizardSpellsSystem : EntitySystem _handsSystem.TryForcePickupAnyHand(msg.Performer, recallComponent.Item.Value); msg.Handled = true; + Speak(msg); return; } diff --git a/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs b/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs index 82ffc5e51f..43425ad798 100644 --- a/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs +++ b/Content.Shared/Weapons/Melee/Components/MeleeThrowOnHitComponent.cs @@ -47,6 +47,16 @@ public sealed partial class MeleeThrowOnHitComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] public bool Enabled = true; + + // WD START + [DataField, ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public float StunTime; + + [DataField, ViewVariables(VVAccess.ReadWrite)] + [AutoNetworkedField] + public bool ThrowOnThrowHit; + // WD END } /// diff --git a/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs b/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs index 7886356233..8b76d14a02 100644 --- a/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs +++ b/Content.Shared/Weapons/Melee/MeleeThrowOnHitSystem.cs @@ -1,5 +1,7 @@ using System.Numerics; using Content.Shared.Construction.Components; +using Content.Shared.Stunnable; +using Content.Shared.Throwing; using Content.Shared.Weapons.Melee.Components; using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Physics; @@ -18,22 +20,67 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; + [Dependency] private readonly SharedStunSystem _stun = default!; // WD + [Dependency] private readonly ThrownItemSystem _thrownItem = default!; // WD /// public override void Initialize() { + SubscribeLocalEvent(OnDoHit); // WD + SubscribeLocalEvent(OnMeleeHit); SubscribeLocalEvent(OnThrownStartup); SubscribeLocalEvent(OnThrownShutdown); SubscribeLocalEvent(OnStartCollide); } + private void OnDoHit(Entity ent, ref ThrowDoHitEvent args) // WD + { + if (!ent.Comp.ThrowOnThrowHit) + return; + + if (!CanThrowOnHit(ent, args.Target)) + return; + + if (!TryComp(ent, out PhysicsComponent? physics)) + return; + + var velocity = physics.LinearVelocity.Normalized() * ent.Comp.Speed; + + RemComp(args.Target); + var thrownComp = new MeleeThrownComponent + { + Velocity = velocity, + Lifetime = ent.Comp.Lifetime, + MinLifetime = ent.Comp.MinLifetime + }; + AddComp(args.Target, thrownComp); + if (ent.Comp.StunTime != 0f) + _stun.TryParalyze(args.Target, TimeSpan.FromSeconds(ent.Comp.StunTime), true); + + _thrownItem.LandComponent(ent, args.Component, physics, false); + _physics.SetLinearVelocity(ent, Vector2.Zero); + } + private void OnMeleeHit(Entity ent, ref MeleeHitEvent args) { var (_, comp) = ent; if (!args.IsHit) return; + // WD START + var stunTime = comp.StunTime; + var speed = comp.Speed; + var lifetime = comp.Lifetime; + + if (args.Direction != null) // Heavy attack + { + stunTime = 0f; + speed *= 0.5f; + lifetime *= 0.5f; + } + // WD END + var mapPos = _transform.GetMapCoordinates(args.User).Position; foreach (var hit in args.HitEntities) { @@ -55,11 +102,13 @@ public sealed class MeleeThrowOnHitSystem : EntitySystem RaiseLocalEvent(hit, ref ev); var thrownComp = new MeleeThrownComponent { - Velocity = angle.Normalized() * comp.Speed, - Lifetime = comp.Lifetime, + Velocity = angle.Normalized() * speed, // WD EDIT + Lifetime = lifetime, // WD EDIT MinLifetime = comp.MinLifetime }; AddComp(hit, thrownComp); + if (stunTime != 0f) + _stun.TryParalyze(hit, TimeSpan.FromSeconds(stunTime), true); } } diff --git a/Resources/Audio/White/Magic/Mjolnir/hit.ogg b/Resources/Audio/White/Magic/Mjolnir/hit.ogg new file mode 100644 index 0000000000..17abf06675 Binary files /dev/null and b/Resources/Audio/White/Magic/Mjolnir/hit.ogg differ diff --git a/Resources/Audio/White/Magic/Mjolnir/swing.ogg b/Resources/Audio/White/Magic/Mjolnir/swing.ogg new file mode 100644 index 0000000000..43a2ea9790 Binary files /dev/null and b/Resources/Audio/White/Magic/Mjolnir/swing.ogg differ diff --git a/Resources/Prototypes/Magic/white.yml b/Resources/Prototypes/Magic/white.yml index 19f55b7f49..92be6e994f 100644 --- a/Resources/Prototypes/Magic/white.yml +++ b/Resources/Prototypes/Magic/white.yml @@ -281,6 +281,7 @@ sprite: Objects/Magic/magicactions.rsi state: summons event: !type:InstantRecallSpellEvent + speech: "GAR YOK!" - type: entity id: ActionTeleportSpell diff --git a/Resources/Prototypes/_White/Wizard/magic_items.yml b/Resources/Prototypes/_White/Wizard/magic_items.yml index c1555ee2c7..ab79803482 100644 --- a/Resources/Prototypes/_White/Wizard/magic_items.yml +++ b/Resources/Prototypes/_White/Wizard/magic_items.yml @@ -36,6 +36,7 @@ types: Slash: 30 - type: Clothing + quickEquip: false sprite: White/Objects/Weapons/Chaplain/spellblade.rsi slots: - back @@ -51,3 +52,55 @@ inHandsOnly: true closeOnHandDeselect: true - type: SpellBlade + +- type: entity + name: мьёльнир + parent: BaseItem + id: Mjolnir + description: Могучий молот, заимствованный у Тора, бога грома. Он трещит от едва сдерживаемой силы. + components: + - type: Sprite + sprite: White/Objects/Weapons/mjolnir.rsi + state: icon + - type: MeleeWeapon + wideAnimationRotation: -135 + attackRate: 0.75 + damage: + types: + Blunt: 25 + Structural: 20 + soundHit: + path: /Audio/White/Magic/Mjolnir/hit.ogg + soundSwing: + path: /Audio/White/Magic/Mjolnir/swing.ogg + - type: Wieldable + - type: IncreaseDamageOnWield + damage: + types: + Blunt: 15 + Structural: 60 + - type: Item + size: Huge + sprite: White/Objects/Weapons/mjolnir.rsi + - type: Clothing + quickEquip: false + sprite: White/Objects/Weapons/mjolnir.rsi + slots: + - back + - suitStorage + - type: DisarmMalus + - type: MeleeThrowOnHit + lifetime: 0.05 + minLifetime: 0.01 + speed: 20 + stunTime: 1.5 + throwOnThrowHit: true + - type: DamageOtherOnHit + sound: + path: /Audio/White/Magic/Mjolnir/hit.ogg + damage: + types: + Blunt: 40 + Structural: 80 + - type: ChangeThrowForce + throwForce: 20 diff --git a/Resources/Prototypes/_White/Wizard/spellblade.yml b/Resources/Prototypes/_White/Wizard/spellblade.yml index 635f32a704..fc0fea59a7 100644 --- a/Resources/Prototypes/_White/Wizard/spellblade.yml +++ b/Resources/Prototypes/_White/Wizard/spellblade.yml @@ -10,7 +10,7 @@ - type: entity name: Холод - description: Клинок заклинаний наделяется замораживать врагов. И тот, кто удерживает клинок в руках, становится неуязвимым к низкой температуре. + description: Клинок заклинаний наделяется способностью замораживать врагов. И тот, кто удерживает клинок в руках, становится неуязвимым к низкой температуре. id: AspectFrost noSpawn: true components: diff --git a/Resources/Prototypes/_White/Wizard/spellbook_catalog.yml b/Resources/Prototypes/_White/Wizard/spellbook_catalog.yml index 1d891bba02..a9cd7016b0 100644 --- a/Resources/Prototypes/_White/Wizard/spellbook_catalog.yml +++ b/Resources/Prototypes/_White/Wizard/spellbook_catalog.yml @@ -260,3 +260,16 @@ conditions: - !type:ListingLimitedStockCondition stock: 1 + +- type: listing + id: SpellBookMjolnir + name: spellbook-mjolnir-name + description: spellbook-mjolnir-desc + productEntity: Mjolnir + cost: + SpellPoint: 2 + categories: + - MagicItems + conditions: + - !type:ListingLimitedStockCondition + stock: 1 diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/equipped-BACKPACK.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/equipped-BACKPACK.png new file mode 100644 index 0000000000..22d7516625 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/equipped-BACKPACK.png differ diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/icon.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/icon.png new file mode 100644 index 0000000000..420a46f29a Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/icon.png differ diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-left.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-left.png new file mode 100644 index 0000000000..2b5216cc45 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-right.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-right.png new file mode 100644 index 0000000000..3c4128442b Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/inhand-right.png differ diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/meta.json b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/meta.json new file mode 100644 index 0000000000..8d768337e6 --- /dev/null +++ b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/meta.json @@ -0,0 +1,46 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/pull/49264/commits/d0dffe7ca643db2624424fdcebf45863f85c0448", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon", + "delays": [ + [ + 2, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "wielded-inhand-left", + "directions": 4 + }, + { + "name": "wielded-inhand-right", + "directions": 4 + }, + { + "name": "equipped-BACKPACK", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-left.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-left.png new file mode 100644 index 0000000000..499a827bc9 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-right.png b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-right.png new file mode 100644 index 0000000000..5ef1c92af2 Binary files /dev/null and b/Resources/Textures/White/Objects/Weapons/mjolnir.rsi/wielded-inhand-right.png differ