Fix clown not being clumsy (#5208)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
parent
6b7919678e
commit
8b1a711843
|
|
@ -1,3 +1,4 @@
|
|||
using Content.Shared.Damage;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
|
|
@ -12,6 +13,9 @@ namespace Content.Server.Interaction.Components
|
|||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
[DataField("clumsyDamage", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public DamageSpecifier ClumsyDamage = default!;
|
||||
public bool RollClumsy(float chance)
|
||||
{
|
||||
return Running && _random.Prob(chance);
|
||||
|
|
|
|||
|
|
@ -1,25 +1,35 @@
|
|||
using Content.Shared.Roles;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
|
||||
namespace Content.Server.Jobs
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class AddComponentSpecial : JobSpecial
|
||||
{
|
||||
// TODO: Type serializer that ensures the component exists.
|
||||
[DataField("component", required:true)]
|
||||
public string Component { get; } = string.Empty;
|
||||
|
||||
[DataField("components")]
|
||||
[AlwaysPushInheritance]
|
||||
public EntityPrototype.ComponentRegistry Components { get; } = new();
|
||||
|
||||
public override void AfterEquip(EntityUid mob)
|
||||
{
|
||||
// Yes, this will throw if your component is invalid.
|
||||
var component = (Component)IoCManager.Resolve<IComponentFactory>().GetComponent(Component);
|
||||
// now its a registry of components, still throws i bet.
|
||||
// TODO: This is hot garbage and probably needs an engine change to not be a POS.
|
||||
var factory = IoCManager.Resolve<IComponentFactory>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var serializationManager = IoCManager.Resolve<ISerializationManager>();
|
||||
|
||||
foreach (var (name, data) in Components)
|
||||
{
|
||||
var component = (Component) factory.GetComponent(name);
|
||||
component.Owner = mob;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().AddComponent(mob, component);
|
||||
var copied = (Component?) serializationManager.Copy(data, component, null);
|
||||
if (copied != null)
|
||||
entityManager.AddComponent(mob, copied);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ public sealed partial class GunSystem
|
|||
gun.LastFireTime = curTime;
|
||||
var coordinates = Transform(gun.Owner).Coordinates;
|
||||
|
||||
if (gun.ClumsyCheck && gun.ClumsyDamage != null && ClumsyComponent.TryRollClumsy(user, gun.ClumsyExplodeChance))
|
||||
if (gun.ClumsyCheck && EntityManager.TryGetComponent<ClumsyComponent>(user, out var clumsyComponent) && ClumsyComponent.TryRollClumsy(user, gun.ClumsyExplodeChance))
|
||||
{
|
||||
//Wound them
|
||||
_damageable.TryChangeDamage(user, gun.ClumsyDamage);
|
||||
_damageable.TryChangeDamage(user, clumsyComponent.ClumsyDamage);
|
||||
_stun.TryParalyze(user, TimeSpan.FromSeconds(3f), true);
|
||||
|
||||
// Apply salt to the wound ("Honk!")
|
||||
|
|
|
|||
|
|
@ -31,8 +31,5 @@ namespace Content.Server.Weapon.Ranged
|
|||
[DataField("clumsyWeaponShotSound")]
|
||||
public SoundSpecifier ClumsyWeaponShotSound = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/bang.ogg");
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("clumsyDamage")]
|
||||
public DamageSpecifier? ClumsyDamage;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
- Maintenance
|
||||
special:
|
||||
- !type:AddComponentSpecial
|
||||
component: BibleUser #Lets them heal with bibles
|
||||
components:
|
||||
- type: BibleUser #Lets them heal with bibles
|
||||
|
||||
- type: startingGear
|
||||
id: ChaplainGear
|
||||
|
|
|
|||
|
|
@ -11,7 +11,14 @@
|
|||
- Maintenance
|
||||
special:
|
||||
- !type:AddComponentSpecial
|
||||
component: Clumsy # Adds ClumsyComponent to the mob.
|
||||
components:
|
||||
- type: Clumsy
|
||||
clumsyDamage:
|
||||
types: #literally just picked semi random valus. i tested this once and tweaked it.
|
||||
Blunt: 5
|
||||
Piercing: 4
|
||||
groups:
|
||||
Burn: 3
|
||||
|
||||
- type: startingGear
|
||||
id: ClownGear
|
||||
|
|
|
|||
Loading…
Reference in New Issue