Modular weapon crafting WIP (#611)
* data initalizing * modular assembling * grips and blades sprites * first prototypes * jewerly decoration * disassemble modular weapon * grip start stats * blade modifiers * inhand sprites generation * resprites inhand, add sickle, add attempt modify size * auto inhand sprite parsing * icon default parsing * spear blade * mace ball * sword blade * sharedization + autonetwork hotswipe * wielding sprite support! * iron long grip * wielded sickle, fix ERROR sprite if state not added * Update grips.yml * wielded spear + ruby rework * wielding damage bonus modifier * modular size fix * fix storedOffset rotation * parts offset * fix inheriting modifiers * some bugfix and balance tweaks * DPS Meter * fix dividing by zero * rebalance * replace baseknife to modular knife. Delete ice knife spell * sickle and mace modular replace * modular spear & sword replacement. add wielded icons * Update CP14DPSMeterSystem.cs * back to serverization * grip disassemble drop again * clothing sprite generation code * back slot long grips and mace * remove jewerly slot, add more clothing states * finish clothing states * shovel modular * YEEEEE * anvil modular craft * bugfixes * more integration check fixes
This commit is contained in:
20
Content.Server/_CP14/ModularCraft/Modifiers/AddComponents.cs
Normal file
20
Content.Server/_CP14/ModularCraft/Modifiers/AddComponents.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class AddComponents : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField]
|
||||
public ComponentRegistry? Components;
|
||||
|
||||
[DataField]
|
||||
public bool Override = false;
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
if (Components is not null)
|
||||
entManager.AddComponents(start, Components, Override);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Content.Shared._CP14.Damageable;
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class EditDamageableModifier : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public float Multiplier = 1f;
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
if (!entManager.TryGetComponent<CP14DamageableModifierComponent>(start, out var damageable))
|
||||
return;
|
||||
|
||||
damageable.Modifier *= Multiplier;
|
||||
entManager.Dirty(start);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Wieldable.Components;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class EditIncreaseDamageOnWield : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField]
|
||||
public DamageSpecifier? BonusDamage;
|
||||
|
||||
[DataField]
|
||||
public float? DamageMultiplier;
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
if (!entManager.TryGetComponent<IncreaseDamageOnWieldComponent>(start, out var wield))
|
||||
return;
|
||||
|
||||
if (BonusDamage is not null)
|
||||
wield.BonusDamage += BonusDamage;
|
||||
|
||||
if (DamageMultiplier is not null)
|
||||
wield.BonusDamage *= DamageMultiplier.Value;
|
||||
}
|
||||
|
||||
}
|
||||
48
Content.Server/_CP14/ModularCraft/Modifiers/EditItem.cs
Normal file
48
Content.Server/_CP14/ModularCraft/Modifiers/EditItem.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Linq;
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class EditItem : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField]
|
||||
public ProtoId<ItemSizePrototype>? NewSize;
|
||||
|
||||
/// <summary>
|
||||
/// Only works if the item has 1 shape. Increases or decreases it size.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Vector2i? AdjustShape;
|
||||
|
||||
[DataField]
|
||||
public Vector2i? StoredOffsetBonus;
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
if (!entManager.TryGetComponent<ItemComponent>(start, out var itemComp) || itemComp.Shape is null)
|
||||
return;
|
||||
|
||||
var itemSystem = entManager.System<SharedItemSystem>();
|
||||
|
||||
if (NewSize is not null)
|
||||
itemSystem.SetSize(start, NewSize.Value);
|
||||
|
||||
var itemShape = itemSystem.GetItemShape((start, itemComp));
|
||||
if (AdjustShape is not null && itemShape.Count == 1)
|
||||
{
|
||||
var box = itemComp.Shape.First();
|
||||
box.Right += AdjustShape.Value.X;
|
||||
box.Top += AdjustShape.Value.Y;
|
||||
itemSystem.SetShape(start, new List<Box2i>{box});
|
||||
}
|
||||
|
||||
if (StoredOffsetBonus is not null)
|
||||
{
|
||||
var newOffset = itemComp.StoredOffset + StoredOffsetBonus.Value;
|
||||
itemSystem.SetStoredOffset(start, newOffset, itemComp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class EditMeleeWeapon : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField]
|
||||
public EntProtoId? NewAnimation;
|
||||
|
||||
[DataField]
|
||||
public EntProtoId? NewWideAnimation;
|
||||
|
||||
[DataField]
|
||||
public float? AngleMultiplier;
|
||||
|
||||
[DataField]
|
||||
public DamageSpecifier? BonusDamage;
|
||||
|
||||
[DataField]
|
||||
public float? DamageMultiplier;
|
||||
|
||||
[DataField]
|
||||
public float? AttackRateMultiplier;
|
||||
|
||||
[DataField]
|
||||
public float? BonusRange;
|
||||
|
||||
[DataField]
|
||||
public bool? ResetOnHandSelected;
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
if (!entManager.TryGetComponent<MeleeWeaponComponent>(start, out var melee))
|
||||
return;
|
||||
|
||||
if (NewAnimation is not null)
|
||||
melee.Animation = NewAnimation.Value;
|
||||
|
||||
if (NewWideAnimation is not null)
|
||||
melee.WideAnimation = NewWideAnimation.Value;
|
||||
|
||||
if (AngleMultiplier is not null)
|
||||
melee.Angle = Angle.FromDegrees(melee.Angle.Degrees * AngleMultiplier.Value);
|
||||
|
||||
if (BonusDamage is not null)
|
||||
melee.Damage += BonusDamage;
|
||||
|
||||
if (DamageMultiplier is not null)
|
||||
melee.Damage *= DamageMultiplier.Value;
|
||||
|
||||
if (AttackRateMultiplier is not null)
|
||||
melee.AttackRate *= AttackRateMultiplier.Value;
|
||||
|
||||
if (BonusRange is not null)
|
||||
melee.Range += BonusRange.Value;
|
||||
|
||||
if (ResetOnHandSelected is not null)
|
||||
melee.ResetOnHandSelected = ResetOnHandSelected.Value;
|
||||
}
|
||||
}
|
||||
25
Content.Server/_CP14/ModularCraft/Modifiers/Inherit.cs
Normal file
25
Content.Server/_CP14/ModularCraft/Modifiers/Inherit.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Content.Shared._CP14.ModularCraft;
|
||||
using Content.Shared._CP14.ModularCraft.Components;
|
||||
using Content.Shared._CP14.ModularCraft.Prototypes;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.ModularCraft.Modifiers;
|
||||
|
||||
public sealed partial class Inherit : CP14ModularCraftModifier
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public List<ProtoId<CP14ModularCraftPartPrototype>> CopyFrom = new();
|
||||
|
||||
public override void Effect(EntityManager entManager, Entity<CP14ModularCraftStartPointComponent> start, Entity<CP14ModularCraftPartComponent>? part)
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
foreach (var copy in CopyFrom)
|
||||
{
|
||||
foreach (var modifier in prototypeManager.Index(copy).Modifiers)
|
||||
{
|
||||
modifier.Effect(entManager, start, part);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user