Skip to content

Commit

Permalink
Merge branch 'master' into sprite-repo-clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
EstKemran authored Jan 15, 2025
2 parents 7861d6d + 7d2a47c commit 74a1d34
Show file tree
Hide file tree
Showing 98 changed files with 702 additions and 338 deletions.
5 changes: 5 additions & 0 deletions Content.Server/Bed/Cryostorage/CryostorageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Robust.Shared.Utility;
using Content.Shared.Roles; // SS220 Cryostorage ghost role fix
using Robust.Shared.Prototypes; // SS220 Cryostorage ghost role fix
using Content.Server.SS220.Bed.Cryostorage; //SS220 Cult_hotfix_4

namespace Content.Server.Bed.Cryostorage;

Expand Down Expand Up @@ -222,6 +223,10 @@ public void HandleEnterCryostorage(Entity<CryostorageContainedComponent> ent, Ne
}

comp.AllowReEnteringBody = false;
//SS220 start Cult_hotfix_4
var ev = new BeingCryoDeletedEvent();
RaiseLocalEvent(ent, ref ev);
//SS220 end Cult_hotfix_4
_transform.SetParent(ent, PausedMap.Value);
cryostorageComponent.StoredPlayers.Add(ent);
Dirty(ent, comp);
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Database/ServerBanDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public string FormatBanMessage(IConfigurationManager cfg, ILocalizationManager l

return $"""
{loc.GetString("ban-banned-1")}
{loc.GetString("ban-banned-8", ("banId", Id.HasValue ? Id.Value : "-"))}
{loc.GetString("ban-banned-4", ("admin", BanningAdminName ?? "Console"))}
{loc.GetString("ban-banned-6", ("round", StatedRound != 0 ? StatedRound : loc.GetString("ban-banned-7")))}
{loc.GetString("ban-banned-2", ("reason", Reason))}
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/SS220/Bed/Cryostorage/BeingCryoDeletedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server.SS220.Bed.Cryostorage;

/// <summary>
/// Raised before body will deleted by a cryostorages
/// </summary>
[ByRefEvent]
public readonly record struct BeingCryoDeletedEvent();
50 changes: 26 additions & 24 deletions Content.Server/SS220/CultYogg/Cultists/CultYoggSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public sealed class CultYoggSystem : SharedCultYoggSystem
[Dependency] private readonly ThirstSystem _thirstSystem = default!;
[Dependency] private readonly VomitSystem _vomitSystem = default!;

private const string CultDefaultMarking = "CultStage-Halo";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -78,41 +80,41 @@ private void UpdateStage(Entity<CultYoggComponent> entity, ref ChangeCultYoggSta
huAp.EyeColor = Color.Green;
break;
case 2:
if (!_prototype.HasIndex<MarkingPrototype>("CultStage-Halo"))
{
Log.Error("CultStage-Halo marking doesn't exist");
return;
}

if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special))
if (_prototype.HasIndex<MarkingPrototype>(CultDefaultMarking))
{
huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List<Marking>([new Marking("CultStage-Halo", colorCount: 1)]));
if (!huAp.MarkingSet.Markings.ContainsKey(MarkingCategories.Special))
{
huAp.MarkingSet.Markings.Add(MarkingCategories.Special, new List<Marking>([new Marking(CultDefaultMarking, colorCount: 1)]));
}
else
{
_humanoidAppearance.SetMarkingId(entity.Owner,
MarkingCategories.Special,
0,
CultDefaultMarking,
huAp);
}
}
else
{
_humanoidAppearance.SetMarkingId(entity.Owner,
MarkingCategories.Special,
0,
"CultStage-Halo",
huAp);
Log.Error($"{CultDefaultMarking} marking doesn't exist");
}

Dirty(entity.Owner, huAp);

var newMarkingId = $"CultStage-{huAp.Species}";

if (!_prototype.HasIndex<MarkingPrototype>(newMarkingId))
if (_prototype.HasIndex<MarkingPrototype>(newMarkingId))
{
Log.Error($"{newMarkingId} marking doesn't exist");
return;
if (huAp.MarkingSet.Markings.TryGetValue(MarkingCategories.Special, out var value))
{
entity.Comp.PreviousTail = value.FirstOrDefault();
value.Clear();
huAp.MarkingSet.Markings[MarkingCategories.Special].Add(new Marking(newMarkingId, colorCount: 1));
}
}

if (huAp.MarkingSet.Markings.TryGetValue(MarkingCategories.Tail, out var value))
else
{
entity.Comp.PreviousTail = value.FirstOrDefault();
value.Clear();
huAp.MarkingSet.Markings[MarkingCategories.Special].Add(new Marking(newMarkingId, colorCount: 1));
Dirty(entity.Owner, huAp);
// We have species-marking only for the Nians, so this log only leads to unnecessary errors.
//Log.Error($"{newMarkingId} marking doesn't exist");
}
break;
case 3:
Expand Down
120 changes: 0 additions & 120 deletions Content.Server/SS220/CultYogg/MiGo/MiGoReplacementSystem.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ namespace Content.Server.SS220.CultYogg.Sacraficials;
public sealed class SacraficialReplacementEvent : EntityEventArgs
{
public readonly EntityUid Entity;
public readonly NetUserId Player;

public SacraficialReplacementEvent(EntityUid entity, NetUserId player)
public SacraficialReplacementEvent(EntityUid entity)
{
Entity = entity;
Player = player;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Timing;
using Content.Server.SS220.Bed.Cryostorage;

namespace Content.Server.SS220.CultYogg.Sacraficials;

public sealed partial class SacraficialReplacementSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;


//dictionary of sacraficials uids and time when they left body by gibbing/ghosting/leaving anything
private Dictionary<(EntityUid, NetUserId), TimeSpan> _replaceSacrSchedule = new();
private Dictionary<(EntityUid, NetUserId), TimeSpan> _announceSchedule = new();
private Dictionary<EntityUid, TimeSpan> _replaceSacrSchedule = [];
private Dictionary<EntityUid, TimeSpan> _announceSchedule = [];

//Count down the moment when sacraficial will be raplaced
private TimeSpan _beforeReplacementCooldown = TimeSpan.FromSeconds(900);
Expand All @@ -31,6 +33,7 @@ public override void Initialize()
SubscribeLocalEvent<CultYoggSacrificialComponent, ComponentRemove>(OnRemove);
SubscribeLocalEvent<CultYoggSacrificialComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<CultYoggSacrificialComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<CultYoggSacrificialComponent, BeingCryoDeletedEvent>(OnCryoDeleted);
}
private void OnInit(Entity<CultYoggSacrificialComponent> ent, ref ComponentInit args)
{
Expand All @@ -40,6 +43,9 @@ private void OnInit(Entity<CultYoggSacrificialComponent> ent, ref ComponentInit
{
RaiseLocalEvent(uid, ref ev);
}

var ev2 = new CultYoggAnouncementEvent(ent, Loc.GetString("cult-yogg-sacraficial-was-picked", ("name", MetaData(ent).EntityName)));
RaiseLocalEvent(ent, ref ev, true);
}
private void OnRemove(Entity<CultYoggSacrificialComponent> ent, ref ComponentRemove args)
{
Expand All @@ -52,29 +58,37 @@ private void OnRemove(Entity<CultYoggSacrificialComponent> ent, ref ComponentRem
}
private void OnPlayerAttached(Entity<CultYoggSacrificialComponent> ent, ref PlayerAttachedEvent args)
{
_replaceSacrSchedule.Remove((ent, args.Player.UserId));
_announceSchedule.Remove((ent, args.Player.UserId));
_replaceSacrSchedule.Remove(ent);

var meta = MetaData(ent);
if(_announceSchedule.ContainsKey(ent))//if the announcement was not sent
{
_announceSchedule.Remove(ent);
return;
}

var ev = new CultYoggAnouncementEvent(ent, Loc.GetString("cult-yogg-sacraficial-cant-be-replaced", ("name", meta.EntityName)));
var ev = new CultYoggAnouncementEvent(ent, Loc.GetString("cult-yogg-sacraficial-cant-be-replaced", ("name", MetaData(ent).EntityName)));
RaiseLocalEvent(ent, ref ev, true);
}

private void OnPlayerDetached(Entity<CultYoggSacrificialComponent> ent, ref PlayerDetachedEvent args)
{
_replaceSacrSchedule.Add((ent, args.Player.UserId), _timing.CurTime);
_announceSchedule.Add((ent, args.Player.UserId), _timing.CurTime);
_replaceSacrSchedule.Add(ent, _timing.CurTime + ent.Comp.ReplacementCooldown);
_announceSchedule.Add(ent, _timing.CurTime + ent.Comp.AnnounceReplacementCooldown);
}

private void OnCryoDeleted(Entity<CultYoggSacrificialComponent> ent, ref BeingCryoDeletedEvent args)
{
var ev = new SacraficialReplacementEvent(ent);
RaiseLocalEvent(ent, ref ev, true);
}

private void ReplacamantStatusAnnounce(EntityUid uid)
{
if (!TryComp<CultYoggSacrificialComponent>(uid, out var comp))
return;

var meta = MetaData(uid);

var ev = new CultYoggAnouncementEvent(uid, Loc.GetString("cult-yogg-sacraficial-may-be-replaced", ("name", meta.EntityName)));
var time = (comp.ReplacementCooldown.TotalSeconds - comp.AnnounceReplacementCooldown.TotalSeconds).ToString();
var ev = new CultYoggAnouncementEvent(uid, Loc.GetString("cult-yogg-sacraficial-will-be-replaced", ("name", MetaData(uid).EntityName), ("time", time)));
RaiseLocalEvent(uid, ref ev, true);
}

Expand All @@ -83,21 +97,21 @@ public override void Update(float frameTime)
base.Update(frameTime);
foreach (var pair in _replaceSacrSchedule)
{
if (_timing.CurTime < pair.Value + _beforeReplacementCooldown)
if (_timing.CurTime < pair.Value)
continue;

var ev = new SacraficialReplacementEvent(pair.Key.Item1, pair.Key.Item2);
RaiseLocalEvent(pair.Key.Item1, ref ev, true);
var ev = new SacraficialReplacementEvent(pair.Key);
RaiseLocalEvent(pair.Key, ref ev, true);

_replaceSacrSchedule.Remove(pair.Key);
}

foreach (var pair in _announceSchedule)//it is stupid, but idk how to make it 1 time event without second System :(
{
if (_timing.CurTime < pair.Value + _announceReplacementCooldown)
if (_timing.CurTime < pair.Value)
continue;

ReplacamantStatusAnnounce(pair.Key.Item1);
ReplacamantStatusAnnounce(pair.Key);

_announceSchedule.Remove(pair.Key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public sealed partial class CultYoggRuleComponent : Component
/// <summary>
/// Storage for a sacraficials
/// </summary>
public readonly List<EntityUid> SacraficialsList = [];

public readonly int[] TierOfSacraficials = [1, 2, 3];//trying to save tier in target, so they might be replaced with the same lvl target

/// <summary>
Expand Down
Loading

0 comments on commit 74a1d34

Please sign in to comment.