Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Очередной фикс суперматерии #1045

Merged
merged 1 commit into from
Jan 8, 2025
Merged
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
31 changes: 20 additions & 11 deletions Content.Server/Supermatter/EntitySystems/SupermatterSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Supermatter.Components;
using Content.Shared.Atmos;
using Content.Server.Lightning;
Expand Down Expand Up @@ -103,6 +103,7 @@ public void Cycle(EntityUid uid, SupermatterComponent sm)
SupermatterAlert(uid, Loc.GetString($"supermatter-announcement-{loc}", ("integrity", (int)(sm.DelaminationPoint - sm.Damage))));
}
}
sm.DamageArchive = sm.Damage;

if (sm.AreWeDelaming)
DelamCountdown(uid, sm);
Expand Down Expand Up @@ -217,18 +218,17 @@ private void ProcessDamage(EntityUid uid, SupermatterComponent sm)
damageHealHeat = Math.Clamp((sm.AbsorbedGasMix.TotalMoles - sm.TempLimit) / 6000, -.1f, 0);

var totalDamage = damageHeat + damagePower + damageMoles + damageHealHeat;

var oldDamage = sm.Damage;
sm.Damage += Math.Max(totalDamage, 0);

if (sm.Damage > sm.DelaminationPoint)
sm.AreWeDelaming = true;

if (sm.Damage > sm.DamageDangerPoint)
if (sm.Damage >= sm.DelaminationPoint && !sm.AreWeDelaming)
{
if (_random.Prob(.0001f))
GenerateAnomaly(uid);
return;
sm.AreWeDelaming = true;
SupermatterAlert(uid, Loc.GetString("supermatter-announcement-delam"));
}

if (sm.Damage > sm.DamageDangerPoint && _random.Prob(.0001f))
GenerateAnomaly(uid);
}
/// <summary>
/// Process waste, release hot plasma and oxygen.
Expand Down Expand Up @@ -439,8 +439,14 @@ private void OnClick(EntityUid uid, SupermatterComponent sm, InteractUsingEvent
{
if (HasComp<SharpComponent>(args.Used))
{
if (sm.Damage >= 100)
{
_popup.PopupEntity(Loc.GetString("supermatter-tamper-fail"), args.User, args.User);
return;
}

_adminLogger.Add(LogType.Action, LogImpact.High, $"{EntityManager.ToPrettyString(args.User):player} is trying to extract a sliver from the supermatter crystal.");
_popup.PopupClient(Loc.GetString("supermatter-tamper-begin"), args.User, args.User);
_popup.PopupEntity(Loc.GetString("supermatter-tamper-begin"), args.User, args.User);

var doAfterArgs = new DoAfterArgs(EntityManager, args.User, 30, new SupermatterDoAfterEvent(), uid, target: uid, used: args.Used)
{
Expand All @@ -457,11 +463,14 @@ private void OnClick(EntityUid uid, SupermatterComponent sm, InteractUsingEvent

private void OnGetSliver(EntityUid uid, SupermatterComponent sm, SupermatterDoAfterEvent args)
{
if (args.Cancelled)
return;

sm.Damage += 10; // your criminal actions will not go unnoticed
SupermatterAlert(uid, Loc.GetString("supermatter-announcement-tamper", ("integrity", (int)(100 - sm.Damage))));

Spawn(sm.SliverPrototype, _transform.GetMapCoordinates(args.User));
_popup.PopupClient(Loc.GetString("supermatter-tamper-end"), args.User);
_popup.PopupEntity(Loc.GetString("supermatter-tamper-end"), args.User, args.User);
}

private void OnGetHit(EntityUid uid, SupermatterComponent sm, DamageChangedEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ supermatter-announcement-delam-tesla = Скорое высвобождение
supermatter-announcement-delam-cascade = Превышены пределы гармонической частоты. Поле дестабилизации для предотвращения потерь не удалось активировать.
supermatter-tamper-begin = Вы начинаете аккуратно срезать осколок с кристалла суперматерии...
supermatter-tamper-end = Вы чувствуете себя богом, держа в руках кусок суперматерии. Или это просто радиация?
supermatter-tamper-fail = Кристалл слишком поврежден, чтобы извлечь из него еще осколки.
supermatter-announcement-tamper = Внимание! Обнаружено несанкционированное вмешательство в кристалл суперматерии! Целостность: { $integrity }%
Loading