Revs (the spooky ones) (#9842)

This commit is contained in:
Nemanja
2022-08-13 09:49:41 -04:00
committed by GitHub
parent ab4e2ef74f
commit 3e1cf73469
68 changed files with 1976 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
namespace Content.Shared.Alert
namespace Content.Shared.Alert
{
/// <summary>
/// Every kind of alert. Corresponds to alertType field in alert prototypes defined in YML
@@ -35,6 +35,8 @@
Muted,
VowOfSilence,
VowBroken,
Essence,
Corporeal,
Debug1,
Debug2,
Debug3,

View File

@@ -36,4 +36,23 @@ namespace Content.Shared.Interaction
Target = target;
}
}
public sealed class InteractNoHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
{
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
public EntityUid User { get; }
/// <summary>
/// Entity that was interacted on.
/// </summary>
public EntityUid Target { get; }
public InteractNoHandEvent(EntityUid user, EntityUid target)
{
User = user;
Target = target;
}
}
}

View File

@@ -230,7 +230,14 @@ namespace Content.Shared.Interaction
// Does the user have hands?
if (!TryComp(user, out SharedHandsComponent? hands) || hands.ActiveHand == null)
{
if (target != null)
{
var ev = new InteractNoHandEvent(user, target.Value);
RaiseLocalEvent(user, ev, true);
}
return;
}
var inRangeUnobstructed = target == null
? !checkAccess || InRangeUnobstructed(user, coordinates)

View File

@@ -0,0 +1,30 @@
using Content.Shared.Actions.ActionTypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
namespace Content.Shared.Revenant;
[Serializable]
[Prototype("revenantListing")]
public sealed class RevenantStoreListingPrototype : IPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; } = default!;
[DataField("actionId", customTypeSerializer:typeof(PrototypeIdSerializer<InstantActionPrototype>))]
public string ActionId { get; } = string.Empty;
[DataField("price")]
public int Price { get; } = 5;
[DataField("description")]
public string Description { get; } = string.Empty;
[DataField("listingName")]
public string ListingName { get; } = string.Empty;
[DataField("icon")]
public SpriteSpecifier? Icon { get; } = null;
}

View File

@@ -0,0 +1,49 @@
using Content.Shared.Actions;
using Robust.Shared.Serialization;
namespace Content.Shared.Revenant;
public sealed class RevenantShopActionEvent : InstantActionEvent { }
public sealed class RevenantDefileActionEvent : InstantActionEvent { }
public sealed class RevenantOverloadLightsActionEvent : InstantActionEvent { }
public sealed class RevenantBlightActionEvent : InstantActionEvent { }
public sealed class RevenantMalfunctionActionEvent : InstantActionEvent { }
[NetSerializable, Serializable]
public enum RevenantVisuals : byte
{
Corporeal,
Stunned,
Harvesting,
}
[NetSerializable, Serializable]
public enum RevenantUiKey : byte
{
Key
}
[Serializable, NetSerializable]
public sealed class RevenantUpdateState : BoundUserInterfaceState
{
public float Essence;
public readonly List<RevenantStoreListingPrototype> Listings;
public RevenantUpdateState(float essence, List<RevenantStoreListingPrototype> listings)
{
Essence = essence;
Listings = listings;
}
}
[Serializable, NetSerializable]
public sealed class RevenantBuyListingMessage : BoundUserInterfaceMessage
{
public RevenantStoreListingPrototype Listing;
public RevenantBuyListingMessage (RevenantStoreListingPrototype listing)
{
Listing = listing;
}
}

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Revenant;
[NetworkedComponent]
public abstract class SharedRevenantComponent : Component
{
}

View File

@@ -92,7 +92,7 @@ namespace Content.Shared.StatusEffect
/// <typeparam name="T">The component type to add and remove from the entity.</typeparam>
public bool TryAddStatusEffect<T>(EntityUid uid, string key, TimeSpan time, bool refresh,
StatusEffectsComponent? status = null)
where T: Component, new()
where T : Component, new()
{
if (!Resolve(uid, ref status, false))
return false;
@@ -152,7 +152,7 @@ namespace Content.Shared.StatusEffect
/// If you want special 'effect merging' behavior, do it your own damn self!
/// </remarks>
public bool TryAddStatusEffect(EntityUid uid, string key, TimeSpan time, bool refresh,
StatusEffectsComponent? status=null)
StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return false;
@@ -168,10 +168,10 @@ namespace Content.Shared.StatusEffect
if (HasStatusEffect(uid, key, status))
{
status.ActiveEffects[key].CooldownRefresh = refresh;
if(refresh)
if (refresh)
{
//Making sure we don't reset a longer cooldown by applying a shorter one.
if((status.ActiveEffects[key].Cooldown.Item2 - _gameTiming.CurTime) < time)
if ((status.ActiveEffects[key].Cooldown.Item2 - _gameTiming.CurTime) < time)
{
//Refresh cooldown time.
status.ActiveEffects[key].Cooldown = cooldown;
@@ -196,7 +196,7 @@ namespace Content.Shared.StatusEffect
}
Dirty(status);
// event?
RaiseLocalEvent(uid, new StatusEffectAddedEvent(uid, key));
return true;
}
@@ -238,7 +238,7 @@ namespace Content.Shared.StatusEffect
/// That's up to the removed component to handle itself when it's removed.
/// </remarks>
public bool TryRemoveStatusEffect(EntityUid uid, string key,
StatusEffectsComponent? status=null)
StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return false;
@@ -258,7 +258,7 @@ namespace Content.Shared.StatusEffect
// Maybe a badmin badminned the component away,
// or perhaps, on the client, the component deletion sync
// was faster than prediction could predict. Either way, let's not assume the component exists.
if(EntityManager.HasComponent(uid, type))
if (EntityManager.HasComponent(uid, type))
EntityManager.RemoveComponent(uid, type);
}
@@ -274,7 +274,7 @@ namespace Content.Shared.StatusEffect
}
Dirty(status);
// event?
RaiseLocalEvent(uid, new StatusEffectEndedEvent(uid, key));
return true;
}
@@ -293,7 +293,7 @@ namespace Content.Shared.StatusEffect
bool failed = false;
foreach (var effect in status.ActiveEffects)
{
if(!TryRemoveStatusEffect(uid, effect.Key, status))
if (!TryRemoveStatusEffect(uid, effect.Key, status))
failed = true;
}
@@ -308,7 +308,7 @@ namespace Content.Shared.StatusEffect
/// <param name="key">The status effect ID to check for</param>
/// <param name="status">The status effect component, should you already have it.</param>
public bool HasStatusEffect(EntityUid uid, string key,
StatusEffectsComponent? status=null)
StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return false;
@@ -346,7 +346,7 @@ namespace Content.Shared.StatusEffect
/// <param name="time">The amount of time to add.</param>
/// <param name="status">The status effect component, should you already have it.</param>
public bool TryAddTime(EntityUid uid, string key, TimeSpan time,
StatusEffectsComponent? status=null)
StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return false;
@@ -377,7 +377,7 @@ namespace Content.Shared.StatusEffect
/// <param name="time">The amount of time to add.</param>
/// <param name="status">The status effect component, should you already have it.</param>
public bool TryRemoveTime(EntityUid uid, string key, TimeSpan time,
StatusEffectsComponent? status=null)
StatusEffectsComponent? status = null)
{
if (!Resolve(uid, ref status, false))
return false;
@@ -448,4 +448,30 @@ namespace Content.Shared.StatusEffect
return true;
}
}
public readonly struct StatusEffectAddedEvent
{
public readonly EntityUid Uid;
public readonly string Key;
public StatusEffectAddedEvent(EntityUid uid, string key)
{
Uid = uid;
Key = key;
}
}
public readonly struct StatusEffectEndedEvent
{
public readonly EntityUid Uid;
public readonly string Key;
public StatusEffectEndedEvent(EntityUid uid, string key)
{
Uid = uid;
Key = key;
}
}
}