Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public override void Update(float frameTime)
if (altDown == BoundKeyState.Up && attackTime >= TimeSpan.FromSeconds(charged.MinAttackTime) || attackTime >= TimeSpan.FromSeconds(charged.MaxAttackTime))
{
RaisePredictiveEvent(new ChargedAttackEnd(GetNetCoordinates(coordinates), GetNetEntity(weaponUid), attackTime));
Log.Info("1");
return;
}
else if (altDown == BoundKeyState.Up && attackTime <= TimeSpan.FromSeconds(charged.MinAttackTime))
Expand Down
540 changes: 251 additions & 289 deletions Content.Server/Imperial/Medieval/Cult/Bloodspells/CultCastSystem.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
namespace Content.Server.Imperial.Medieval.Cult.Bloodspells.mateials;
namespace Content.Server.Imperial.Medieval.Cult.Bloodspells.Materials;

/// <summary>
/// This is used for...
/// </summary>
[RegisterComponent]
public sealed partial class BloodMaterialComponent : Component
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Server.Imperial.Medieval.Cult.Bloodspells;

[RegisterComponent]
public sealed partial class MedievalBloodedComponent : Component
{
[DataField("blood"), ViewVariables(VVAccess.ReadWrite)]
public int Blood;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@
using Content.Shared.Popups;
using Robust.Shared.Timing;

namespace Content.Server.Imperial.Medieval.Cult.Bloodspells.light;
namespace Content.Server.Imperial.Medieval.Cult.Bloodspells.Light;

/// <summary>
/// This handles...
/// </summary>
public sealed class DeathCurseSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;

/// <inheritdoc/>
private TimeSpan _nextCheckTime;
private TimeSpan _nextCheckTimePopup;

Expand Down
13 changes: 6 additions & 7 deletions Content.Server/Imperial/Medieval/Cult/CultMemberComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Robust.Shared.Prototypes;
using System.Collections.Generic;
using System;
using System.Linq;
using Content.Shared.Alert;

namespace Content.Server.Cult.Components;
Expand All @@ -12,25 +11,25 @@ namespace Content.Server.Cult.Components;
public sealed partial class CultMemberComponent : Component
{
[DataField]
public EntityUid? parent;
public EntityUid? Parent;

[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public DamageSpecifier Damage = new()
{
DamageDict = new()
{
{ "Poison", 10 },
{ "Asphyxiation", 10}
}
{
{ "Poison", 10 },
{ "Asphyxiation", 10 }
}
};

[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public Queue<(string message, TimeSpan time)> LastSpokenMessages = new();

[DataField]
public bool DeathCusre = true;
public bool DeathCurse = true;

[DataField]
public ProtoId<AlertPrototype> DeathCurseAlert = "CultDeathCurse";
Expand Down
14 changes: 7 additions & 7 deletions Content.Server/Imperial/Medieval/Cult/CultSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using Content.Server.Construction.Completions;
using Content.Server.Construction.Conditions;
using Content.Server.Imperial.Medieval.Cult.Bloodspells;
using Content.Server.Imperial.Medieval.Cult.Bloodspells.mateials;
using Content.Server.Imperial.Medieval.Cult.Bloodspells.Materials;
using Content.Shared.Alert;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Components;
Expand Down Expand Up @@ -249,7 +249,7 @@ public override void Update(float frameTime)
if (picture.CollegiumUnlocked) continue;
foreach (var cultist in EntityManager.EntityQuery<CultMemberComponent>())
{
if (TryComp<CultMapBlockerComponent>(cultist.parent, out var blocker))
if (TryComp<CultMapBlockerComponent>(cultist.Parent, out var blocker))
{
switch (blocker.Sector)
{
Expand Down Expand Up @@ -332,7 +332,7 @@ private void OnChangeParent(EntityUid uid, CultMemberComponent comp, ref MoveEve
if (!args.ParentChanged)
return;

comp.parent = newParent;
comp.Parent = newParent;
}
public void OnActivated(EntityUid uid, CultCheckPictureComponent comp, ActivateInWorldEvent args)
{
Expand Down Expand Up @@ -931,7 +931,7 @@ private bool CheckCrystals(EntityUid uid, CultCheckPictureComponent comp, int bl
if (_itemSlotsSystem.TryGetSlot(slot.Item.Value, "Conductor" + i, out var container) &&
container.HasItem && container.Item != null)
{
if (TryComp<MedievalBlodedComponent>(container.Item.Value, out var bloodcomp))
if (TryComp<MedievalBloodedComponent>(container.Item.Value, out var bloodcomp))
{
bloodcomp.Blood += bloodyCost * 3 + redCost;
if (bloodcomp.Blood >= 10)
Expand All @@ -945,13 +945,13 @@ private bool CheckCrystals(EntityUid uid, CultCheckPictureComponent comp, int bl
}
else
{
AddComp<MedievalBlodedComponent>(container.Item.Value);
EnsureComp<MedievalBloodedComponent>(container.Item.Value);
}
}
}


if (TryComp<MedievalBlodedComponent>(slot.Item.Value, out var blodcomp))
if (TryComp<MedievalBloodedComponent>(slot.Item.Value, out var blodcomp))
{
blodcomp.Blood += bloodyCost * 3 + redCost;
if (blodcomp.Blood >= 10)
Expand All @@ -967,7 +967,7 @@ private bool CheckCrystals(EntityUid uid, CultCheckPictureComponent comp, int bl
}
else
{
AddComp<MedievalBlodedComponent>(slot.Item.Value);
EnsureComp<MedievalBloodedComponent>(slot.Item.Value);
}
comp.BloodyCrystall -= bloodyCost;
comp.RedCrystall -= redCost;
Expand Down
194 changes: 69 additions & 125 deletions Content.Server/Imperial/Medieval/MedievalRevive/MedievalReviveSystem.cs
Original file line number Diff line number Diff line change
@@ -1,167 +1,111 @@
using System.Linq;
using System.Numerics;
using Content.Server.Administration.Logs;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.Ghost.Components;
using Content.Server.MagicBarrier.Components;
using Content.Server.Mind;
using Content.Server.Roles.Jobs;
using Content.Shared.Actions;
using Content.Shared.CCVar;
using Content.Shared.Coordinates;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Eye;
using Content.Shared.FixedPoint;
using Content.Shared.Follower;
using Content.Shared.Ghost;
using Content.Shared.Imperial.Medieval.CCVar;
using Content.Shared.Imperial.Medieval.MedievalReviveSpawner;
using Content.Shared.Imperial.Medieval.Revive;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.NameModifier.EntitySystems;
using Content.Shared.Players;
using Content.Shared.Popups;
using Content.Shared.Storage.Components;
using Content.Shared.Tag;
using Content.Shared.Warps;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Server.Imperial.Medieval.Revive
namespace Content.Server.Imperial.Medieval.Revive;

public sealed class MedievalReviveSystem : EntitySystem
{
public sealed class MedievalReviveSystem : EntitySystem
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;

private const int MaxRevives = 3;

public override void Initialize()
{
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IAdminLogManager _adminlog = default!;
SubscribeNetworkEvent<GhostReviveRequestEvent>(OnGhostReviveRequest);
SubscribeNetworkEvent<ReviveCountRequestEvent>(OnReviveCountRequest);
}

private const int MaxRevives = 3;
private void OnGhostReviveRequest(GhostReviveRequestEvent ev, EntitySessionEventArgs args)
{
if (!_cfg.GetCVar(MedievalCCVars.GhostRevive))
return;

var session = args.SenderSession;
var userId = session.UserId;

public override void Initialize()
if (!EntityQuery<MagicBarrierComponent>().TryFirstOrDefault(out var barrier))
{
base.Initialize();
SubscribeNetworkEvent<GhostReviveRequestEvent>(OnGhostReviveRequest);
SubscribeNetworkEvent<ReviveCountRequestEvent>(OnReviveCountRequest);
_adminLog.Add(LogType.Action, LogImpact.Low, $"Игрок {session.Name} попытался возродиться, но барьер не найден");
return;
}
private void OnGhostReviveRequest(GhostReviveRequestEvent msg, EntitySessionEventArgs args)
{
var revivesOn = _cfg.GetCVar(MedievalCCVars.GhostRevive);
if (!revivesOn)
return;

var player = args.SenderSession;
var playerUid = player.UserId;
if (!EntityQuery<MagicBarrierComponent>().TryFirstOrDefault(out var barrier))
{
_adminlog.Add(LogType.Action, LogImpact.Low, $"Игрок {player.Name} попытался возродиться, но барьер не найден");
return;
}

if (!barrier.ReviveCount.ContainsKey(playerUid))
barrier.ReviveCount[playerUid] = 0;

if (barrier.ReviveCount[playerUid] >= MaxRevives)
{
_adminlog.Add(LogType.Action, LogImpact.High, $"Игрок {player.Name} попытался возродиться, но у него уже {MaxRevives} возрождений");
return;
}
if (!_minds.TryGetNetEntity(player.GetMind(), out var netEntity))
{
_adminlog.Add(LogType.Action, LogImpact.High, $"Разум {player.GetMind()} не имеет значения");
return;
}
if (EntityManager.GetEntity(netEntity) == null)
{
_adminlog.Add(LogType.Action, LogImpact.High, $"Сущность {netEntity} не имеет значения");
return;
}

var playerMind = EntityManager.GetEntity(netEntity);

if (!playerMind.HasValue)
{
_adminlog.Add(LogType.Action, LogImpact.High, $"Разум {playerMind} не имеет значения");
return;
}

var playerEntity = EntityManager.GetComponent<MindComponent>(playerMind.Value).CurrentEntity;

if (!barrier.ReviveCount.TryGetValue(userId, out var reviveCount))
reviveCount = 0;

if (reviveCount >= MaxRevives)
{
_adminLog.Add(LogType.Action, LogImpact.High, $"Игрок {session.Name} превысил лимит возрождений ({MaxRevives})");
return;
}

if (!HasComp<GhostComponent>(playerEntity))
{
_adminlog.Add(LogType.Action, LogImpact.High, $"Обнаружена подозрительная активность, разум {netEntity} в теле {playerEntity} пытался возродится, либо софт либо баг менюшки");
return;
}
if (!_minds.TryGetMind(userId, out _, out var oldMind))
{
_adminLog.Add(LogType.Action, LogImpact.High, $"Игрок {session.Name} не имеет разума");
return;
}

var reviveQuery = EntityManager.EntityQuery<MedievalReviveSpawnerComponent>();
var currentEntity = oldMind.CurrentEntity;
if (currentEntity == null || !HasComp<GhostComponent>(currentEntity))
{
_adminLog.Add(LogType.Action, LogImpact.High, $"Игрок {session.Name} попытался возродиться не находясь в состоянии призрака");
return;
}

if (reviveQuery.Count() == 0)
return;
var spawnerQuery = EntityQuery<MedievalReviveSpawnerComponent>();
if (!spawnerQuery.Any())
return;

var reviveList = reviveQuery.ToList();
var spawner = _random.Pick<MedievalReviveSpawnerComponent>(spawnerQuery.ToList());
var spawnerCoords = _transform.GetMoverCoordinates(spawner.Owner);
var mob = Spawn(spawner.Prototype, spawnerCoords);

_random.Shuffle<MedievalReviveSpawnerComponent>(reviveList);
var component = reviveList.ElementAt(0);
var spawner = component.Owner;
_transform.AttachToGridOrMap(mob);
EnsureComp<MindContainerComponent>(mob);

var mob = Spawn(component.Prototype, Transform(spawner).Coordinates);
_transformSystem.AttachToGridOrMap(mob);
if (!oldMind.IsVisitingEntity)
_minds.WipeMind(session);

EnsureComp<MindContainerComponent>(mob);
var newMind = _minds.CreateMind(userId, Comp<MetaDataComponent>(mob).EntityName);

if (_minds.TryGetMind(player.UserId, out _, out var mind) && !mind.IsVisitingEntity)
_minds.WipeMind(player);
_minds.SetUserId(newMind, userId);
_minds.TransferTo(newMind, mob);

var newMind = _minds.CreateMind(player.UserId,
Comp<MetaDataComponent>(mob).EntityName);
barrier.ReviveCount[userId] = reviveCount + 1;
}

_minds.SetUserId(newMind, player.UserId);
_minds.TransferTo(newMind, mob);
barrier.ReviveCount[playerUid]++;
}
private void OnReviveCountRequest(ReviveCountRequestEvent _, EntitySessionEventArgs args)
{
var session = args.SenderSession;
var userId = session.UserId;

private void OnReviveCountRequest(ReviveCountRequestEvent msg, EntitySessionEventArgs args)
if (!EntityQuery<MagicBarrierComponent>().TryFirstOrDefault(out var barrier))
{
var player = args.SenderSession;
var playerUid = player.UserId;
if (!EntityQuery<MagicBarrierComponent>().TryFirstOrDefault(out var barrier))
{
_adminlog.Add(LogType.Action,
LogImpact.High,
$"Player {player.Name} tried to revive but magic barrier was not found");
return;
}

if (!barrier.ReviveCount.ContainsKey(playerUid))
barrier.ReviveCount[playerUid] = 0;

// Отправляем ответ
RaiseNetworkEvent(new ReviveCountResponseEvent(barrier.ReviveCount[playerUid], MaxRevives), args.SenderSession);
_adminLog.Add(LogType.Action, LogImpact.High, $"Игрок {session.Name} запросил количество возрождений, но барьер не найден");
return;
}

if (!barrier.ReviveCount.TryGetValue(userId, out var reviveCount))
reviveCount = 0;

RaiseNetworkEvent(new ReviveCountResponseEvent(reviveCount, MaxRevives), session);
}
}
Loading
Loading