second
This commit is contained in:
parent
84a1d573f0
commit
b99f4c2d61
3 changed files with 24 additions and 17 deletions
|
|
@ -396,9 +396,10 @@ public sealed partial class VampireSystem
|
|||
}
|
||||
|
||||
|
||||
var bloodEssence = _vampire.GetBloodEssence(vampire);
|
||||
|
||||
//Update abilities, add new unlocks
|
||||
//UpdateAbilities(vampire);
|
||||
UpdateAbilities(vampire, vampire.Comp, "ActionVampireBloodSteal", "BloodSteal" , bloodEssence >= FixedPoint2.New(200) && vampire.Comp.CurrentMutation == VampireMutationsType.Hemomancer);
|
||||
}
|
||||
private bool CloakOfDarkness(Entity<VampireComponent> vampire, float upkeep, float passiveVisibilityRate, float movementVisibilityRate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
[Dependency] private readonly MetabolizerSystem _metabolism = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly SharedVampireSystem _vampire = default!;
|
||||
|
||||
private Dictionary<string, AbilityInfo> _actionEntities = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -89,7 +87,7 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
SubscribeLocalEvent<VampireComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<VampireComponent, VampireBloodChangedEvent>(OnVampireBloodChangedEvent);
|
||||
|
||||
SubscribeLocalEvent<VampireComponent, ComponentGetState>(GetState);
|
||||
SubscribeLocalEvent<VampireComponent, AfterAutoHandleStateEvent>(GetState);
|
||||
SubscribeLocalEvent<VampireComponent, VampireMutationPrototypeSelectedMessage>(OnMutationSelected);
|
||||
|
||||
InitializePowers();
|
||||
|
|
@ -215,16 +213,15 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
|
||||
private void OnVampireBloodChangedEvent(EntityUid uid, VampireComponent component, VampireBloodChangedEvent args)
|
||||
{
|
||||
var bloodEssence = _vampire.GetBloodEssence(uid);
|
||||
|
||||
AbilityInfo entity = default;
|
||||
|
||||
if (TryComp<VampireAlertComponent>(uid, out var alertComp))
|
||||
_vampire.SetAlertBloodAmount(alertComp,_vampire.GetBloodEssence(uid).Int());
|
||||
|
||||
if (_actionEntities.TryGetValue("ActionVampireCloakOfDarkness", out entity) && !HasComp<VampireSealthComponent>(uid) && _vampire.GetBloodEssence(uid) < FixedPoint2.New(300))
|
||||
_actionEntities.Remove("ActionVampireCloakOfDarkness");
|
||||
|
||||
var bloodEssence = _vampire.GetBloodEssence(uid);
|
||||
|
||||
EntityUid? newEntity = null;
|
||||
AbilityInfo entity = default;
|
||||
if (component.actionEntities.TryGetValue("ActionVampireCloakOfDarkness", out entity) && !HasComp<VampireSealthComponent>(uid) && _vampire.GetBloodEssence(uid) < FixedPoint2.New(300))
|
||||
component.actionEntities.Remove("ActionVampireCloakOfDarkness");
|
||||
|
||||
UpdateAbilities(uid, component , VampireComponent.MutationsActionPrototype, null , bloodEssence >= FixedPoint2.New(50) && !HasComp<VampireSealthComponent>(uid));
|
||||
|
||||
|
|
@ -278,12 +275,12 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
EntityUid? actionEntity = null;
|
||||
if (addAction)
|
||||
{
|
||||
if (!_actionEntities.ContainsKey(actionId))
|
||||
if (!component.actionEntities.ContainsKey(actionId))
|
||||
{
|
||||
_action.AddAction(uid, ref actionEntity, actionId);
|
||||
if (actionEntity != null)
|
||||
{
|
||||
_actionEntities[actionId] = new AbilityInfo(uid, actionEntity.Value);
|
||||
component.actionEntities[actionId] = new AbilityInfo(uid, actionEntity.Value);
|
||||
if (powerId != null && !component.UnlockedPowers.ContainsKey(powerId))
|
||||
component.UnlockedPowers.Add(powerId, actionEntity.Value);
|
||||
}
|
||||
|
|
@ -291,12 +288,12 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_actionEntities.TryGetValue(actionId, out var abilityInfo) && abilityInfo.Owner == uid)
|
||||
if (component.actionEntities.TryGetValue(actionId, out var abilityInfo) && abilityInfo.Owner == uid)
|
||||
{
|
||||
if (TryComp(uid, out ActionsComponent? comp))
|
||||
{
|
||||
_action.RemoveAction(uid, abilityInfo.Action, comp);
|
||||
_actionEntities.Remove(actionId);
|
||||
component.actionEntities.Remove(actionId);
|
||||
if (powerId != null && component.UnlockedPowers.ContainsKey(powerId))
|
||||
component.UnlockedPowers.Remove(powerId);
|
||||
}
|
||||
|
|
@ -356,7 +353,7 @@ public sealed partial class VampireSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
private void GetState(EntityUid uid, VampireComponent component, ref ComponentGetState args)
|
||||
private void GetState(EntityUid uid, VampireComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
args.State = new VampireMutationComponentState
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ using Robust.Shared.GameStates;
|
|||
|
||||
namespace Content.Shared.Vampire.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
public sealed partial class VampireComponent : Component
|
||||
{
|
||||
//Static prototype references
|
||||
|
|
@ -92,7 +92,16 @@ public sealed partial class VampireComponent : Component
|
|||
/// <summary>
|
||||
/// All unlocked abilities
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[AutoNetworkedField]
|
||||
public Dictionary<string, EntityUid?> UnlockedPowers = new();
|
||||
|
||||
/// <summary>
|
||||
/// All abilities
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[AutoNetworkedField]
|
||||
public Dictionary<string, AbilityInfo> actionEntities = new();
|
||||
|
||||
/// <summary>
|
||||
/// Current available balance, used to sync currency across heirlooms and add essence as we feed
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue