Added several variables to make ClumsyComponent more modular for developers. (#33715)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -58,4 +58,46 @@ public sealed partial class ClumsyComponent : Component
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public SoundSpecifier GunShootFailSound = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/bang.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to apply Clumsy to hyposprays.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool ClumsyHypo = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to apply Clumsy to defibs.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool ClumsyDefib = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to apply Clumsy to guns.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool ClumsyGuns = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to apply Clumsy to vaulting.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool ClumsyVaulting = true;
|
||||
|
||||
/// <summary>
|
||||
/// Lets you define a new "failed" message for each event.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public LocId HypoFailedMessage = "hypospray-component-inject-self-clumsy-message";
|
||||
|
||||
[DataField]
|
||||
public LocId GunFailedMessage = "gun-clumsy";
|
||||
|
||||
[DataField]
|
||||
public LocId VaulingFailedMessageSelf = "bonkable-success-message-user";
|
||||
|
||||
[DataField]
|
||||
public LocId VaulingFailedMessageOthers = "bonkable-success-message-others";
|
||||
|
||||
[DataField]
|
||||
public LocId VaulingFailedMessageForced = "forced-bonkable-success-message";
|
||||
}
|
||||
|
||||
@@ -38,6 +38,11 @@ public sealed class ClumsySystem : EntitySystem
|
||||
private void BeforeHyposprayEvent(Entity<ClumsyComponent> ent, ref SelfBeforeHyposprayInjectsEvent args)
|
||||
{
|
||||
// Clumsy people sometimes inject themselves! Apparently syringes are clumsy proof...
|
||||
|
||||
// checks if ClumsyHypo is false, if so, skips.
|
||||
if (!ent.Comp.ClumsyHypo)
|
||||
return;
|
||||
|
||||
if (!_random.Prob(ent.Comp.ClumsyDefaultCheck))
|
||||
return;
|
||||
|
||||
@@ -49,6 +54,11 @@ public sealed class ClumsySystem : EntitySystem
|
||||
private void BeforeDefibrillatorZapsEvent(Entity<ClumsyComponent> ent, ref SelfBeforeDefibrillatorZapsEvent args)
|
||||
{
|
||||
// Clumsy people sometimes defib themselves!
|
||||
|
||||
// checks if ClumsyDefib is false, if so, skips.
|
||||
if (!ent.Comp.ClumsyDefib)
|
||||
return;
|
||||
|
||||
if (!_random.Prob(ent.Comp.ClumsyDefaultCheck))
|
||||
return;
|
||||
|
||||
@@ -61,6 +71,10 @@ public sealed class ClumsySystem : EntitySystem
|
||||
{
|
||||
// Clumsy people sometimes can't shoot :(
|
||||
|
||||
// checks if ClumsyGuns is false, if so, skips.
|
||||
if (!ent.Comp.ClumsyGuns)
|
||||
return;
|
||||
|
||||
if (args.Gun.Comp.ClumsyProof)
|
||||
return;
|
||||
|
||||
@@ -82,6 +96,10 @@ public sealed class ClumsySystem : EntitySystem
|
||||
|
||||
private void OnBeforeClimbEvent(Entity<ClumsyComponent> ent, ref SelfBeforeClimbEvent args)
|
||||
{
|
||||
// checks if ClumsyVaulting is false, if so, skips.
|
||||
if (!ent.Comp.ClumsyVaulting)
|
||||
return;
|
||||
|
||||
// This event is called in shared, thats why it has all the extra prediction stuff.
|
||||
var rand = new System.Random((int)_timing.CurTick.Value);
|
||||
|
||||
@@ -102,8 +120,8 @@ public sealed class ClumsySystem : EntitySystem
|
||||
{
|
||||
// You are slamming yourself onto the table.
|
||||
_popup.PopupPredicted(
|
||||
Loc.GetString("bonkable-success-message-user", ("bonkable", args.BeingClimbedOn)),
|
||||
Loc.GetString("bonkable-success-message-others", ("victim", gettingPutOnTableName), ("bonkable", args.BeingClimbedOn)),
|
||||
Loc.GetString(ent.Comp.VaulingFailedMessageSelf, ("bonkable", args.BeingClimbedOn)),
|
||||
Loc.GetString(ent.Comp.VaulingFailedMessageOthers, ("victim", gettingPutOnTableName), ("bonkable", args.BeingClimbedOn)),
|
||||
ent,
|
||||
ent);
|
||||
}
|
||||
@@ -112,7 +130,7 @@ public sealed class ClumsySystem : EntitySystem
|
||||
// Someone else slamed you onto the table.
|
||||
// This is only run in server so you need to use popup entity.
|
||||
_popup.PopupPredicted(
|
||||
Loc.GetString("forced-bonkable-success-message",
|
||||
Loc.GetString(ent.Comp.VaulingFailedMessageForced,
|
||||
("bonker", puttingOnTableName),
|
||||
("victim", gettingPutOnTableName),
|
||||
("bonkable", args.BeingClimbedOn)),
|
||||
|
||||
Reference in New Issue
Block a user