fish-station/Content.Server/Vampire/VampireSystem.Transform.cs
Rinary a85433e877
Новый антагонист: Вампиры (#560)
* Initial Commit

* Unfinished

* Continuing, more abilities

* Remove necromicon healing

* oops

* Continuing

* Continuing

* Checkpoint incase i need to undo something

* Rewrite to use event per power, working passives

* refactor fixes

* so many fixes

* some fixes

* some fixes

* new textures, status icon

* vampire antag role, mind role

* проверку на дауна вызывали?(если Null, у сервера ступор головного фатала)

* fix 1

* fix 2

* fix fatal, fix build

* breafing audio

* fix icons style, store in action

* clear store things, add gamerule, mid round game rule

* some rework

* clear any store systems

* clear x2

* if you have 150 Blood Essence, you get mutation

* upd

* some changes

* simple mutation menu

* я вот сижу, в 12 ночи, пишу какую-то очередную хуйню, вместо приятного сна...

* upd

* normal mutations menu

* actions translate

* None type, base actions list

* passive abilities

* ability earning

* fix

* translate vampire preset

* translate vampire mutations menu

* mutations menu textures

* disable some

* ДРАНЫЙ БРИФ ФАТАЛКУ ПО ПРИКОЛУ БЕЕМ

* game preset

* mutation can infinity changed

* fix

* fully rework abilities update system

* gargantua info

* update ignore list

* fix gargantua passives

* vampire objectives

* new icons

* balance

* fix

* upd objectives

* fix metabolizer type, balance 2

* fix metabolizer type 2

* fix syntax

* clear translation

* xd

* update

* round end info

* fix

* drain objective fix

* fix

* fix syntax

* fix

* clear

---------

Co-authored-by: Rainfey <rainfey0+github@gmail.com>
2024-10-31 19:06:01 +03:00

145 lines
5.1 KiB
C#

using Content.Server.Atmos.Components;
using Content.Server.Body.Components;
using Content.Server.Temperature.Components;
using Content.Shared.Actions;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Rotting;
using Content.Shared.Body.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry;
using Content.Shared.Nutrition.Components;
using Content.Shared.Vampire;
using Content.Shared.Vampire.Components;
using Content.Shared.Weapons.Melee;
using Robust.Shared.Audio;
namespace Content.Server.Vampire;
public sealed partial class VampireSystem
{
/// <summary>
/// Convert the players into a vampire, all programatic because i dont want to replace the players body
/// </summary>
private void MakeVampire(EntityUid vampireUid)
{
var vampireComponent = EnsureComp<VampireComponent>(vampireUid);
var vampire = new Entity<VampireComponent>(vampireUid, vampireComponent);
//Render them unable to rot, immune to pressure and thirst
RemComp<PerishableComponent>(vampire);
RemComp<BarotraumaComponent>(vampire);
RemComp<ThirstComponent>(vampire); //Unsure, should vampires thirst.. or hunger?
//Render immune to cold, but not heat
if (TryComp<TemperatureComponent>(vampire, out var temperatureComponent))
temperatureComponent.ColdDamageThreshold = Atmospherics.TCMB;
MakeVulnerableToHoly(vampire);
//Initialise currency
vampireComponent.Balance = new() { { VampireComponent.CurrencyProto, 0 } };
//Add the summon heirloom ability
AddStartingAbilities(vampire);
//Order of operation requirement, must be called after initialising balance
UpdateBloodDisplay(vampire);
}
/// <summary>
/// Add vulnerability to holy water when ingested or slashed, and take damage from the bible
/// </summary>
private void MakeVulnerableToHoly(Entity<VampireComponent> vampire)
{
//React to being beaten with the bible
EnsureComp<UnholyComponent>(vampire);
//Take damage from holy water splash
if (TryComp<ReactiveComponent>(vampire, out var reactive))
{
if (reactive.ReactiveGroups == null)
reactive.ReactiveGroups = new();
if (!reactive.ReactiveGroups.ContainsKey("Unholy"))
{
reactive.ReactiveGroups.Add("Unholy", new() { ReactionMethod.Touch });
}
}
if (!TryComp<BodyComponent>(vampire, out var bodyComponent))
return;
//Add vampire and bloodsucker to all metabolizing organs
//And restrict diet to Pills (and liquids)
foreach (var organ in _body.GetBodyOrgans(vampire, bodyComponent))
{
if (TryComp<MetabolizerComponent>(organ.Id, out var metabolizer))
{
if (TryComp<StomachComponent>(organ.Id, out var stomachComponent))
{
//Override the stomach, prevents humans getting sick when ingesting blood
_metabolism.ClearMetabolizerTypes(metabolizer);
_stomach.SetSpecialDigestible(stomachComponent, VampireComponent.AcceptableFoods);
}
_metabolism.TryAddMetabolizerType(metabolizer, VampireComponent.MetabolizerVampire);
_metabolism.TryAddMetabolizerType(metabolizer, VampireComponent.MetabolizerBloodsucker);
}
}
}
public void AddStartingAbilities(EntityUid vampire)
{
if (!TryComp<VampireComponent>(vampire, out var comp))
return;
foreach (var actionId in comp.BaseVampireActions)
{
var action = _action.AddAction(vampire, actionId);
if (!action.HasValue)
return;
if (!TryComp<InstantActionComponent>(action, out var instantActionComponent))
return;
var actionEvent = instantActionComponent.Event as VampireSelfPowerEvent;
if (actionEvent == null)
return;
comp.UnlockedPowers.Add(actionEvent.DefinitionName, action);
}
UpdateBloodDisplay(vampire);
}
//Remove weakeness to holy items
private void MakeImmuneToHoly(EntityUid vampire)
{
if (!TryComp<BodyComponent>(vampire, out var bodyComponent))
return;
//Add vampire and bloodsucker to all metabolizing organs
//And restrict diet to Pills (and liquids)
foreach (var organ in _body.GetBodyOrgans(vampire, bodyComponent))
{
if (TryComp<MetabolizerComponent>(organ.Id, out var metabolizer))
{
_metabolism.TryRemoveMetabolizerType(metabolizer, VampireComponent.MetabolizerVampire);
}
}
if (TryComp<ReactiveComponent>(vampire, out var reactive))
{
if (reactive.ReactiveGroups == null)
return;
reactive.ReactiveGroups.Remove("Unholy");
}
RemComp<UnholyComponent>(vampire);
}
}