- add: Mjolnir. (#350)

This commit is contained in:
Aviu00
2024-06-13 23:56:59 +00:00
committed by GitHub
parent caa6531da4
commit e9b634c6c9
18 changed files with 183 additions and 5 deletions

View File

@@ -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;
}
}

View File

@@ -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<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit);
SubscribeLocalEvent<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit,
before: new[] {typeof(MeleeThrowOnHitSystem)}); // WD EDIT
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine);
}
@@ -55,7 +57,7 @@ namespace Content.Server.Damage.Systems
_color.RaiseEffect(Color.Red, new List<EntityUid>() { 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<PhysicsComponent>(uid, out var body) && body.LinearVelocity.LengthSquared() > 0f)
{
var direction = body.LinearVelocity.Normalized();

View File

@@ -159,6 +159,7 @@ public sealed class WizardSpellsSystem : EntitySystem
_handsSystem.TryForcePickupAnyHand(msg.Performer, recallComponent.Item.Value);
msg.Handled = true;
Speak(msg);
return;
}

View File

@@ -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
}
/// <summary>

View File

@@ -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
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<MeleeThrowOnHitComponent, ThrowDoHitEvent>(OnDoHit); // WD
SubscribeLocalEvent<MeleeThrowOnHitComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<MeleeThrownComponent, ComponentStartup>(OnThrownStartup);
SubscribeLocalEvent<MeleeThrownComponent, ComponentShutdown>(OnThrownShutdown);
SubscribeLocalEvent<MeleeThrownComponent, StartCollideEvent>(OnStartCollide);
}
private void OnDoHit(Entity<MeleeThrowOnHitComponent> 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<MeleeThrownComponent>(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<MeleeThrowOnHitComponent> 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);
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -281,6 +281,7 @@
sprite: Objects/Magic/magicactions.rsi
state: summons
event: !type:InstantRecallSpellEvent
speech: "GAR YOK!"
- type: entity
id: ActionTeleportSpell

View File

@@ -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

View File

@@ -10,7 +10,7 @@
- type: entity
name: Холод
description: Клинок заклинаний наделяется замораживать врагов. И тот, кто удерживает клинок в руках, становится неуязвимым к низкой температуре.
description: Клинок заклинаний наделяется способностью замораживать врагов. И тот, кто удерживает клинок в руках, становится неуязвимым к низкой температуре.
id: AspectFrost
noSpawn: true
components:

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

View File

@@ -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
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B