Skip to content

Commit

Permalink
Vampire Hotfix (#587)
Browse files Browse the repository at this point in the history
* hotfix

* biger mutations menu

* upd

* fix missing using

* fix

* fix hypnotise

* fix

* fix event

* upd
  • Loading branch information
Rinary1 authored Oct 31, 2024
1 parent 1b816d5 commit 60ddf2e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Vampire/VampireMutationMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'vampire-mutation-menu-ui-window-name'}"
MinSize="250 300"
SetSize="250 300">
MinSize="300 300"
SetSize="300 300">
<BoxContainer Orientation="Vertical">
<ScrollContainer VerticalExpand="True">
<GridContainer Name="Grid" Columns="3" Margin="0 5" >
Expand Down
14 changes: 12 additions & 2 deletions Content.Server/GameTicking/Rules/VampireRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Antag;
using Content.Server.Atmos.Components;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Mind;
using Content.Server.Objectives;
Expand All @@ -10,6 +11,9 @@
using Content.Shared.Roles;
using Content.Shared.Store;
using Content.Shared.Store.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Rotting;
using Content.Shared.Nutrition.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
Expand Down Expand Up @@ -82,13 +86,19 @@ public bool MakeVampire(EntityUid target, VampireRuleComponent rule)

if (HasComp<UserInterfaceComponent>(target))
_uiSystem.SetUiState(target, VampireMutationUiKey.Key, new VampireMutationBoundUserInterfaceState(vampireComponent.VampireMutations, vampireComponent.CurrentMutation));

var vampire = new Entity<VampireComponent>(target, vampireComponent);

RemComp<PerishableComponent>(vampire);
RemComp<BarotraumaComponent>(vampire);
RemComp<ThirstComponent>(vampire);

vampireComponent.Balance = new() { { VampireComponent.CurrencyProto, 0 } };

rule.VampireMinds.Add(mindId);

if (HasComp<VampireComponent>(target))
_vampire.AddStartingAbilities(target);
_vampire.AddStartingAbilities(vampire);
_vampire.MakeVulnerableToHoly(vampire);

Random random = new Random();

Expand Down
25 changes: 15 additions & 10 deletions Content.Server/Vampire/VampireSystem.Transform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void MakeVampire(EntityUid vampireUid)
/// <summary>
/// Add vulnerability to holy water when ingested or slashed, and take damage from the bible
/// </summary>
private void MakeVulnerableToHoly(Entity<VampireComponent> vampire)
public void MakeVulnerableToHoly(Entity<VampireComponent> vampire)
{
//React to being beaten with the bible
EnsureComp<UnholyComponent>(vampire);
Expand Down Expand Up @@ -101,16 +101,21 @@ public void AddStartingAbilities(EntityUid vampire)
if (!action.HasValue)
return;

if (!TryComp<InstantActionComponent>(action, out var instantActionComponent))
return;

var actionEvent = instantActionComponent.Event as VampireSelfPowerEvent;

if (actionEvent == null)
return;
if (TryComp<InstantActionComponent>(action, out var instantActionComponent))
{
if (instantActionComponent.Event is VampireSelfPowerEvent instantActionEvent)
{
comp.UnlockedPowers.Add(instantActionEvent.DefinitionName, action);
}
}

comp.UnlockedPowers.Add(actionEvent.DefinitionName, action);

if (TryComp<EntityTargetActionComponent>(action, out var entityActionComponent))
{
if (entityActionComponent.Event is VampireTargetedPowerEvent entityActionEvent)
{
comp.UnlockedPowers.Add(entityActionEvent.DefinitionName, action);
}
}
}

UpdateBloodDisplay(vampire);
Expand Down

0 comments on commit 60ddf2e

Please sign in to comment.