* Adjust vampire features and add construction category Increased vampire skill points from 1 to 3 and removed SendOnlyToOwner override. Updated power punch spell: removed cast slowdown, increased paralyze durations, and raised cooldown. Added new construction category for vampires with English and Russian localization, and updated vampire construction recipes to use this category. Reduced furnace recipe craft times from 4 to 1. Cleaned up unused usings in vampire components. * Improve vampire skill popups and clan heart features Added missing popup when no essence is left to gather and improved popup handling for skill point changes. Updated localization for clan progress and essence messages, added WarpPoint to vampire clan heart, and adjusted vampire skill tree structure and UI positions. * Add vampire hypnosis skill and rebalance vampire content Introduces the Hypnosys vampire skill and associated spell, including new status effects and alerts for forced sleep. Adjusts vampire skill tree progression, rebalances bite spell effects, modifies construction recipes to use stone instead of iron, and updates entity drop behaviors. Also tweaks skill point defaults and hunger/thirst effect order for plant growth spells. * Adjust hunger settings and map spawner modifiers Removed baseDecayRate and starvationDamage from Hunger components for NightChildrens, Devourers, and Unnameable in subgamemodes.yml. Updated comoss.yml and venicialis.yml to replace or add spawner modifiers, introducing Boar and Rabbits while removing EnemyFlem, MonsterMosquito, and MobSlimeIce. * Add SSD block to magic system and vampire bite spell Introduced CP14MagicEffectSSDBlockComponent to prevent magic use on SSD (disconnected) players. Updated the magic system to check for SSD status and added localization strings for SSD block messages in English and Russian. Applied the SSD block effect to the vampire bite spell. Also fixed a typo in the PacifiedBlockComponent filename. * Make blood reagents unrecognizable and adjust effects Set all blood reagent variants to 'recognizable: false' to prevent easy identification. Simplified and unified damage effects for blood reagents, removing some specific reactions and adjusting damage groups, particularly for vampire-related blood types. Also fixed a duplicate 'allowedStates' key in the vampire bite spell action. * Enable map initialization and clean up power punch spell Changed map creation in Demiplane and CrashToWildlands systems to run map initialization by setting runMapInit to true. Removed redundant map initialization check in CP14SpawnProceduralLocationJob. Also removed the CP14ActionSpellVampirePower2 entity from the vampire power punch spell prototype.
224 lines
7.7 KiB
C#
224 lines
7.7 KiB
C#
using Content.Shared._CP14.Skill;
|
|
using Content.Shared._CP14.Skill.Components;
|
|
using Content.Shared._CP14.Skill.Prototypes;
|
|
using Content.Shared._CP14.Vampire.Components;
|
|
using Content.Shared.Actions;
|
|
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Buckle.Components;
|
|
using Content.Shared.DoAfter;
|
|
using Content.Shared.Examine;
|
|
using Content.Shared.FixedPoint;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.Jittering;
|
|
using Content.Shared.Popups;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared._CP14.Vampire;
|
|
|
|
public abstract partial class CP14SharedVampireSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedBloodstreamSystem _bloodstream = default!;
|
|
[Dependency] private readonly SharedActionsSystem _action = default!;
|
|
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
|
[Dependency] private readonly SharedJitteringSystem _jitter = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly CP14SharedSkillSystem _skill = default!;
|
|
[Dependency] protected readonly IPrototypeManager Proto = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
private readonly ProtoId<CP14SkillPointPrototype> _skillPointType = "Blood";
|
|
private readonly ProtoId<CP14SkillPointPrototype> _memorySkillPointType = "Memory";
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
InitializeSpell();
|
|
|
|
SubscribeLocalEvent<CP14VampireComponent, MapInitEvent>(OnVampireInit);
|
|
SubscribeLocalEvent<CP14VampireComponent, ComponentRemove>(OnVampireRemove);
|
|
|
|
SubscribeLocalEvent<CP14VampireComponent, CP14ToggleVampireVisualsAction>(OnToggleVisuals);
|
|
SubscribeLocalEvent<CP14VampireComponent, CP14VampireToggleVisualsDoAfter>(OnToggleDoAfter);
|
|
|
|
SubscribeLocalEvent<CP14VampireVisualsComponent, ComponentInit>(OnVampireVisualsInit);
|
|
SubscribeLocalEvent<CP14VampireVisualsComponent, ComponentShutdown>(OnVampireVisualsShutdown);
|
|
SubscribeLocalEvent<CP14VampireVisualsComponent, ExaminedEvent>(OnVampireExamine);
|
|
|
|
SubscribeLocalEvent<CP14VampireEssenceHolderComponent, ExaminedEvent>(OnEssenceHolderExamined);
|
|
}
|
|
|
|
private void OnEssenceHolderExamined(Entity<CP14VampireEssenceHolderComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
if (!HasComp<CP14ShowVampireEssenceComponent>(args.Examiner))
|
|
return;
|
|
|
|
if (!args.IsInDetailsRange)
|
|
return;
|
|
|
|
args.PushMarkup(Loc.GetString("cp14-vampire-essence-holder-examine", ("essence", ent.Comp.Essence)));
|
|
}
|
|
|
|
protected virtual void OnVampireInit(Entity<CP14VampireComponent> ent, ref MapInitEvent args)
|
|
{
|
|
//Bloodstream
|
|
_bloodstream.ChangeBloodReagent(ent.Owner, ent.Comp.NewBloodReagent);
|
|
|
|
//Actions
|
|
foreach (var proto in ent.Comp.ActionsProto)
|
|
{
|
|
EntityUid? newAction = null;
|
|
_action.AddAction(ent, ref newAction, proto);
|
|
}
|
|
|
|
//Skill tree
|
|
_skill.AddSkillPoints(ent, ent.Comp.SkillPointProto, ent.Comp.SkillPointCount, silent: true);
|
|
_skill.AddSkillTree(ent, ent.Comp.SkillTreeProto);
|
|
|
|
//Skill tree base nerf
|
|
_skill.RemoveSkillPoints(ent, _memorySkillPointType, 2, true);
|
|
|
|
//Remove blood essence
|
|
if (TryComp<CP14VampireEssenceHolderComponent>(ent, out var essenceHolder))
|
|
{
|
|
essenceHolder.Essence = 0;
|
|
Dirty(ent, essenceHolder);
|
|
}
|
|
}
|
|
|
|
private void OnVampireRemove(Entity<CP14VampireComponent> ent, ref ComponentRemove args)
|
|
{
|
|
RemCompDeferred<CP14VampireVisualsComponent>(ent);
|
|
|
|
//Bloodstream todo
|
|
|
|
//Metabolism todo
|
|
|
|
//Actions
|
|
foreach (var action in ent.Comp.Actions)
|
|
{
|
|
_action.RemoveAction(ent.Owner, action);
|
|
}
|
|
|
|
//Skill tree
|
|
_skill.RemoveSkillTree(ent, ent.Comp.SkillTreeProto);
|
|
if (TryComp<CP14SkillStorageComponent>(ent, out var storage))
|
|
{
|
|
foreach (var skill in storage.LearnedSkills)
|
|
{
|
|
if (!Proto.TryIndex(skill, out var indexedSkill))
|
|
continue;
|
|
|
|
if (indexedSkill.Tree == ent.Comp.SkillTreeProto)
|
|
_skill.TryRemoveSkill(ent, skill);
|
|
}
|
|
}
|
|
_skill.RemoveSkillPoints(ent, ent.Comp.SkillPointProto, ent.Comp.SkillPointCount);
|
|
_skill.AddSkillPoints(ent, _memorySkillPointType, 2, null, true);
|
|
}
|
|
|
|
private void OnToggleVisuals(Entity<CP14VampireComponent> ent, ref CP14ToggleVampireVisualsAction args)
|
|
{
|
|
if (_timing.IsFirstTimePredicted)
|
|
_jitter.DoJitter(ent, ent.Comp.ToggleVisualsTime, true);
|
|
|
|
var doAfterArgs = new DoAfterArgs(EntityManager, ent, ent.Comp.ToggleVisualsTime, new CP14VampireToggleVisualsDoAfter(), ent)
|
|
{
|
|
Hidden = true,
|
|
NeedHand = false,
|
|
};
|
|
|
|
_doAfter.TryStartDoAfter(doAfterArgs);
|
|
}
|
|
|
|
private void OnToggleDoAfter(Entity<CP14VampireComponent> ent, ref CP14VampireToggleVisualsDoAfter args)
|
|
{
|
|
if (args.Cancelled || args.Handled)
|
|
return;
|
|
|
|
if (HasComp<CP14VampireVisualsComponent>(ent))
|
|
{
|
|
RemCompDeferred<CP14VampireVisualsComponent>(ent);
|
|
}
|
|
else
|
|
{
|
|
EnsureComp<CP14VampireVisualsComponent>(ent);
|
|
}
|
|
|
|
args.Handled = true;
|
|
}
|
|
|
|
protected virtual void OnVampireVisualsShutdown(Entity<CP14VampireVisualsComponent> vampire, ref ComponentShutdown args)
|
|
{
|
|
if (!EntityManager.TryGetComponent(vampire, out HumanoidAppearanceComponent? humanoidAppearance))
|
|
return;
|
|
|
|
humanoidAppearance.EyeColor = vampire.Comp.OriginalEyesColor;
|
|
|
|
Dirty(vampire, humanoidAppearance);
|
|
}
|
|
|
|
protected virtual void OnVampireVisualsInit(Entity<CP14VampireVisualsComponent> vampire, ref ComponentInit args)
|
|
{
|
|
if (!EntityManager.TryGetComponent(vampire, out HumanoidAppearanceComponent? humanoidAppearance))
|
|
return;
|
|
|
|
vampire.Comp.OriginalEyesColor = humanoidAppearance.EyeColor;
|
|
humanoidAppearance.EyeColor = vampire.Comp.EyesColor;
|
|
|
|
Dirty(vampire, humanoidAppearance);
|
|
}
|
|
|
|
private void OnVampireExamine(Entity<CP14VampireVisualsComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
args.PushMarkup(Loc.GetString("cp14-vampire-examine"));
|
|
}
|
|
|
|
public void GatherEssence(Entity<CP14VampireComponent?> vampire,
|
|
Entity<CP14VampireEssenceHolderComponent?> victim,
|
|
FixedPoint2 amount)
|
|
{
|
|
if (!Resolve(vampire, ref vampire.Comp, false))
|
|
return;
|
|
|
|
if (!Resolve(victim, ref victim.Comp, false))
|
|
return;
|
|
|
|
var extractedEssence = MathF.Min(victim.Comp.Essence.Float(), amount.Float());
|
|
|
|
if (TryComp<BuckleComponent>(victim, out var buckle) && buckle.BuckledTo is not null)
|
|
{
|
|
if (TryComp<CP14VampireAltarComponent>(buckle.BuckledTo, out var altar))
|
|
{
|
|
extractedEssence *= altar.Multiplier;
|
|
}
|
|
}
|
|
|
|
if (extractedEssence <= 0)
|
|
{
|
|
_popup.PopupClient(Loc.GetString("cp14-vampire-gather-essence-no-left"), victim, vampire, PopupType.SmallCaution);
|
|
return;
|
|
}
|
|
|
|
_skill.AddSkillPoints(vampire, _skillPointType, extractedEssence);
|
|
victim.Comp.Essence -= amount;
|
|
|
|
Dirty(victim);
|
|
}
|
|
}
|
|
|
|
|
|
public sealed partial class CP14ToggleVampireVisualsAction : InstantActionEvent;
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed partial class CP14VampireToggleVisualsDoAfter : SimpleDoAfterEvent;
|
|
|
|
|
|
// Appearance Data key
|
|
[Serializable, NetSerializable]
|
|
public enum VampireClanLevelVisuals : byte
|
|
{
|
|
Level,
|
|
}
|