Some shit (#380)
* telegraphy effects * shadow step spell backend * add component spell * predict sharpening * Update ring.yml * locale sync * Update entities.ftl * icon shadow step
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
using Content.Server._CP14.MeleeWeapon;
|
||||
using Content.Server._CP14.MeleeWeapon.Components;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Weapons.Ranged.Systems;
|
||||
using Content.Shared._CP14.MeleeWeapon.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Events;
|
||||
@@ -43,7 +42,7 @@ namespace Content.Server.Damage.Systems
|
||||
damage *= sharp.Sharpness;
|
||||
|
||||
var dmg = _damageable.TryChangeDamage(args.Target, damage, component.IgnoreResistances, origin: args.Component.Thrower);
|
||||
//CrystallPunk Melee pgrade end
|
||||
//CrystallPunk Melee upgrade end
|
||||
|
||||
// Log damage only for mobs. Useful for when people throw spears at each other, but also avoids log-spam when explosions send glass shards flying.
|
||||
if (dmg != null && HasComp<MobStateComponent>(args.Target))
|
||||
|
||||
@@ -16,7 +16,7 @@ public sealed partial class CP14MagicSystem : CP14SharedMagicSystem
|
||||
SubscribeLocalEvent<CP14MagicEffectVerbalAspectComponent, CP14VerbalAspectSpeechEvent>(OnSpellSpoken);
|
||||
|
||||
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14StartCastMagicEffectEvent>(OnSpawnMagicVisualEffect);
|
||||
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14StopCastMagicEffectEvent>(OnDespawnMagicVisualEffect);
|
||||
SubscribeLocalEvent<CP14MagicEffectCastingVisualComponent, CP14EndCastMagicEffectEvent>(OnDespawnMagicVisualEffect);
|
||||
}
|
||||
|
||||
private void OnSpellSpoken(Entity<CP14MagicEffectVerbalAspectComponent> ent, ref CP14VerbalAspectSpeechEvent args)
|
||||
@@ -32,7 +32,7 @@ public sealed partial class CP14MagicSystem : CP14SharedMagicSystem
|
||||
ent.Comp.SpawnedEntity = vfx;
|
||||
}
|
||||
|
||||
private void OnDespawnMagicVisualEffect(Entity<CP14MagicEffectCastingVisualComponent> ent, ref CP14StopCastMagicEffectEvent args)
|
||||
private void OnDespawnMagicVisualEffect(Entity<CP14MagicEffectCastingVisualComponent> ent, ref CP14EndCastMagicEffectEvent args)
|
||||
{
|
||||
QueueDel(ent.Comp.SpawnedEntity);
|
||||
ent.Comp.SpawnedEntity = null;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using Content.Shared.Damage;
|
||||
|
||||
namespace Content.Server._CP14.MeleeWeapon.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class CP14MeleeSelfDamageComponent : Component
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public DamageSpecifier DamageToSelf;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
using Content.Server._CP14.MeleeWeapon.EntitySystems;
|
||||
|
||||
namespace Content.Server._CP14.MeleeWeapon.Components;
|
||||
|
||||
/// <summary>
|
||||
/// allows the object to become blunt with use
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharpeningSystem))]
|
||||
public sealed partial class CP14SharpenedComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public float Sharpness = 1f;
|
||||
|
||||
[DataField]
|
||||
public float SharpnessDamageBy1Damage = 0.002f; //500 damage
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using Content.Server._CP14.MeleeWeapon.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server._CP14.MeleeWeapon.Components;
|
||||
|
||||
/// <summary>
|
||||
/// component allows you to sharpen objects by restoring their damage.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(CP14SharpeningSystem))]
|
||||
public sealed partial class CP14SharpeningStoneComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// the amount of acuity recoverable per use
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float SharpnessHeal = 0.05f;
|
||||
|
||||
/// <summary>
|
||||
/// sound when used
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public SoundSpecifier SharpeningSound =
|
||||
new SoundPathSpecifier("/Audio/_CP14/Items/sharpening_stone.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVariation(0.02f),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// the damage that the sharpening stone does to itself for use
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public DamageSpecifier SelfDamage = new()
|
||||
{
|
||||
DamageDict = new()
|
||||
{
|
||||
{ "Blunt", 1 }
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// the damage the sharpening stone does to the target
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public DamageSpecifier TargetDamage = new()
|
||||
{
|
||||
DamageDict = new()
|
||||
{
|
||||
{ "Blunt", 1 }
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using Content.Server._CP14.MeleeWeapon.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
|
||||
namespace Content.Server._CP14.MeleeWeapon.EntitySystems;
|
||||
|
||||
public sealed class CP14MeleeSelfDamageSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<CP14MeleeSelfDamageComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
}
|
||||
|
||||
private void OnMeleeHit(Entity<CP14MeleeSelfDamageComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
if (!args.IsHit)
|
||||
return;
|
||||
if (args.HitEntities.Count == 0)
|
||||
return;
|
||||
_damageable.TryChangeDamage(ent, ent.Comp.DamageToSelf);
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
using System.Linq;
|
||||
using Content.Server._CP14.MeleeWeapon.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Timing;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Content.Shared.Wieldable;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Server._CP14.MeleeWeapon.EntitySystems;
|
||||
|
||||
public sealed class CP14SharpeningSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14SharpenedComponent, GetMeleeDamageEvent>(OnGetMeleeDamage, after: new[] { typeof(WieldableSystem) });
|
||||
SubscribeLocalEvent<CP14SharpenedComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<CP14SharpenedComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
|
||||
SubscribeLocalEvent<CP14SharpeningStoneComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
SubscribeLocalEvent<CP14SharpeningStoneComponent, ActivateInWorldEvent>(OnInteract);
|
||||
}
|
||||
|
||||
private void OnMeleeHit(Entity<CP14SharpenedComponent> sharpened, ref MeleeHitEvent args)
|
||||
{
|
||||
if (!args.HitEntities.Any())
|
||||
return;
|
||||
|
||||
sharpened.Comp.Sharpness = MathHelper.Clamp(sharpened.Comp.Sharpness - args.BaseDamage.GetTotal().Float() * sharpened.Comp.SharpnessDamageBy1Damage, 0.1f, 1f);
|
||||
}
|
||||
|
||||
private void OnInteract(Entity<CP14SharpeningStoneComponent> stone, ref ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!TryComp<ItemPlacerComponent>(stone, out var itemPlacer))
|
||||
return;
|
||||
|
||||
if (itemPlacer.PlacedEntities.Count <= 0)
|
||||
return;
|
||||
|
||||
foreach (var item in itemPlacer.PlacedEntities)
|
||||
{
|
||||
if (!TryComp<CP14SharpenedComponent>(item, out var sharpened))
|
||||
continue;
|
||||
|
||||
SharpThing(stone, item, sharpened, args.User);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAfterInteract(Entity<CP14SharpeningStoneComponent> stone, ref AfterInteractEvent args)
|
||||
{
|
||||
if (!args.CanReach || args.Target == null || !TryComp<CP14SharpenedComponent>(args.Target, out var sharpened))
|
||||
return;
|
||||
|
||||
if (TryComp<UseDelayComponent>(stone, out var useDelay) && _useDelay.IsDelayed( new Entity<UseDelayComponent>(stone, useDelay)))
|
||||
return;
|
||||
|
||||
SharpThing(stone, args.Target.Value, sharpened, args.User);
|
||||
}
|
||||
|
||||
private void SharpThing(Entity<CP14SharpeningStoneComponent> stone, EntityUid target, CP14SharpenedComponent component, EntityUid user)
|
||||
{
|
||||
var ev = new SharpingEvent()
|
||||
{
|
||||
User = user,
|
||||
Target = target,
|
||||
};
|
||||
RaiseLocalEvent(stone, ev);
|
||||
|
||||
if (!ev.Canceled)
|
||||
{
|
||||
_audio.PlayPvs(stone.Comp.SharpeningSound, target);
|
||||
Spawn("EffectSparks", Transform(target).Coordinates);
|
||||
|
||||
_damageableSystem.TryChangeDamage(stone, stone.Comp.SelfDamage);
|
||||
_damageableSystem.TryChangeDamage(target, stone.Comp.TargetDamage);
|
||||
|
||||
component.Sharpness = MathHelper.Clamp01(component.Sharpness + stone.Comp.SharpnessHeal);
|
||||
}
|
||||
|
||||
_useDelay.TryResetDelay(stone);
|
||||
}
|
||||
|
||||
private void OnExamined(Entity<CP14SharpenedComponent> sharpened, ref ExaminedEvent args)
|
||||
{
|
||||
|
||||
if (sharpened.Comp.Sharpness > 0.95f)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("sharpening-examined-95"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sharpened.Comp.Sharpness > 0.75f)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("sharpening-examined-75"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sharpened.Comp.Sharpness > 0.5f)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("sharpening-examined-50"));
|
||||
return;
|
||||
}
|
||||
args.PushMarkup(Loc.GetString("sharpening-examined-25"));
|
||||
}
|
||||
|
||||
private void OnGetMeleeDamage(Entity<CP14SharpenedComponent> sharpened, ref GetMeleeDamageEvent args)
|
||||
{
|
||||
args.Damage *= sharpened.Comp.Sharpness;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caused on a sharpening stone when someone tries to sharpen an object with it
|
||||
/// </summary>
|
||||
public sealed class SharpingEvent : EntityEventArgs
|
||||
{
|
||||
public bool Canceled = false;
|
||||
public EntityUid User;
|
||||
public EntityUid Target;
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
using System.Numerics;
|
||||
using Content.Server._CP14.Alchemy;
|
||||
using Content.Server._CP14.MeleeWeapon;
|
||||
using Content.Server._CP14.MeleeWeapon.EntitySystems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._CP14.MeleeWeapon.EntitySystems;
|
||||
using Content.Shared._CP14.Skills;
|
||||
using Content.Shared._CP14.Skills.Components;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
|
||||
Reference in New Issue
Block a user