Merge pull request #111 from frosty-dev/ups

Ups
This commit is contained in:
Jabak
2024-08-11 18:35:19 +03:00
committed by GitHub
202 changed files with 2224 additions and 756 deletions

View File

@@ -170,7 +170,7 @@ public sealed class MessagesCartridgeSystem : EntitySystem
/// <summary>
/// Updates the user's name in the storage component.
/// </summary>
private void SendName(EntityUid uid, MessagesCartridgeComponent component, CartridgeComponent cartComponent, string? address)
public void SendName(EntityUid uid, MessagesCartridgeComponent component, CartridgeComponent cartComponent, string? address)
{
TryGetMessagesUser(component, cartComponent, out var messagesUser);

View File

@@ -28,6 +28,7 @@ using Content.Shared._White.Antag;
using Content.Shared._White.Cult.Components;
using Content.Shared._White.Cult.Systems;
using Content.Shared._White.Mood;
using Content.Shared.Alert;
using Content.Shared.Cloning;
using Content.Shared.Mind;
using Content.Shared.NPC.Systems;
@@ -55,6 +56,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
[Dependency] private readonly BloodSpearSystem _bloodSpear = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly HandsSystem _hands = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
private const int PlayerPerCultist = 10;
private int _minStartingCultists;
@@ -95,7 +97,6 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
private void OnGetBriefing(Entity<CultistRoleComponent> ent, ref GetBriefingEvent args)
{
args.Append(Loc.GetString("cult-role-briefing-short"));
args.Append(Loc.GetString("cult-role-briefing-hint"));
}
private void OnStartAttempt(RoundStartAttemptEvent ev)
@@ -166,6 +167,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
private void OnCultistComponentInit(EntityUid uid, CultistComponent component, ComponentInit args)
{
RaiseLocalEvent(uid, new MoodEffectEvent("CultFocused"));
_alertsSystem.ShowAlert(uid, AlertType.BloodSpells);
var query = QueryActiveRules();
while (query.MoveNext(out _, out var cult, out _))
@@ -213,6 +215,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
RemoveAllCultistItems(uid);
RemoveCultistAppearance(uid);
RaiseLocalEvent(uid, new MoodRemoveEffectEvent("CultFocused"));
_alertsSystem.ClearAlert(uid, AlertType.BloodSpells);
}
_bloodSpear.DetachSpearFromUser((uid, component));

View File

@@ -6,12 +6,9 @@ public sealed partial class CultStunHandComponent : BaseMagicHandComponent
[DataField]
public TimeSpan Duration = TimeSpan.FromSeconds(16);
[DataField]
public TimeSpan HaloDuration = TimeSpan.FromSeconds(1.5);
[DataField]
public TimeSpan MuteDuration = TimeSpan.FromSeconds(12);
[DataField]
public TimeSpan HaloMuteDuration = TimeSpan.FromSeconds(1);
public float PentagramDurationMultiplier = 0.1f;
}

View File

@@ -245,11 +245,18 @@ public sealed class MagicHandSystem : EntitySystem
return;
}
var halo = HasComp<PentagramComponent>(args.User);
var stunDuration = comp.Duration;
var muteDuration = comp.MuteDuration;
_statusEffects.TryAddStatusEffect(target, "Muted", halo ? comp.HaloMuteDuration : comp.MuteDuration, true,
"Muted", status);
_stun.TryParalyze(target, halo ? comp.HaloDuration : comp.Duration, true, status);
if (HasComp<PentagramComponent>(args.User))
{
var multiplier = comp.PentagramDurationMultiplier;
stunDuration *= multiplier;
muteDuration *= multiplier;
}
_statusEffects.TryAddStatusEffect(target, "Muted", muteDuration, true, "Muted", status);
_stun.TryParalyze(target, stunDuration, true, status);
}
private void Popup(string msg, EntityUid user, PopupType type = PopupType.Small)

View File

@@ -3,16 +3,14 @@ using Content.Server.Body.Components;
using Content.Shared._White.Cult;
using Content.Shared._White.Cult.Components;
using Content.Shared.DoAfter;
using Content.Shared.Verbs;
using Robust.Shared.Player;
namespace Content.Server._White.Cult.Runes.Systems;
public sealed partial class CultSystem
{
public void InitializeVerb()
public void InitializeSpells()
{
SubscribeLocalEvent<CultistComponent, GetVerbsEvent<Verb>>(OnGetVerbs);
SubscribeLocalEvent<CultistComponent, CultEmpowerSelectedBuiMessage>(OnCultistEmpowerSelected);
SubscribeLocalEvent<CultistComponent, CultEmpowerRemoveBuiMessage>(OnCultistEmpowerRemove);
SubscribeLocalEvent<CultistComponent, SpellCreatedEvent>(OnSpellCreated);
@@ -57,7 +55,7 @@ public sealed partial class CultSystem
if (comp.SelectedEmpowers.Count >= 2)
{
_popupSystem.PopupEntity(Loc.GetString("verb-spell-create-too-much"), ent, ent);
_popupSystem.PopupEntity(Loc.GetString("blood-spell-create-too-much"), ent, ent);
return;
}
@@ -71,42 +69,16 @@ public sealed partial class CultSystem
});
}
private void OnGetVerbs(Entity<CultistComponent> ent, ref GetVerbsEvent<Verb> args)
public void CreateSpell(Entity<CultistComponent> ent, ICommonSession session)
{
if (ent.Owner != args.User || !TryComp<ActorComponent>(args.User, out var actor))
return;
var createSpellVerb = new Verb
{
Text = Loc.GetString("verb-spell-create-text"),
Message = Loc.GetString("verb-spell-create-message"),
Category = VerbCategory.Cult,
Act = () =>
{
_ui.TryOpen(ent, CultEmpowerUiKey.Key, actor.PlayerSession);
}
};
var removeSpellVerb = new Verb
{
Text = Loc.GetString("verb-spell-remove-text"),
Message = Loc.GetString("verb-spell-remove-message"),
Category = VerbCategory.Cult,
Act = () =>
{
RemoveSpell(ent, actor.PlayerSession);
}
};
args.Verbs.Add(createSpellVerb);
args.Verbs.Add(removeSpellVerb);
_ui.TryOpen(ent, CultEmpowerUiKey.Key, session);
}
private void RemoveSpell(Entity<CultistComponent> ent, ICommonSession session)
public void RemoveSpell(Entity<CultistComponent> ent, ICommonSession session)
{
if (ent.Comp.SelectedEmpowers.Count == 0)
{
_popupSystem.PopupEntity(Loc.GetString("verb-spell-remove-no-spells"), ent, ent);
_popupSystem.PopupEntity(Loc.GetString("blood-spell-remove-no-spells"), ent, ent);
return;
}

View File

@@ -127,7 +127,7 @@ public sealed partial class CultSystem : EntitySystem
InitializeBarrierSystem();
InitializeConstructsAbilities();
InitializeActions();
InitializeVerb();
InitializeSpells();
}
private float _timeToDraw;

View File

@@ -0,0 +1,53 @@
using Content.Server.EUI;
using Content.Server.Popups;
using Content.Server._White.Cult.Runes.Comps;
using Content.Server._White.Cult.Runes.Systems;
using Content.Shared._White.Cult.Components;
using Content.Shared.Eui;
using Content.Shared.Popups;
using Content.Shared._White.Cult.UI;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server._White.Cult.UI;
public sealed class CultBloodSpellsEui : BaseEui
{
private readonly IEntityManager _entityManager;
private readonly CultSystem _cult;
private readonly EntityUid _performer;
public CultBloodSpellsEui(EntityUid performer, IEntityManager entityManager)
{
_entityManager = entityManager;
_cult = _entityManager.System<CultSystem>();
_performer = performer;
}
public override void HandleMessage(EuiMessageBase msg)
{
base.HandleMessage(msg);
if (msg is not BloodSpellMessage cast || cast.State == BloodSpellMessageState.Cancel)
{
Close();
return;
}
if (!_entityManager.TryGetComponent(_performer, out CultistComponent? cultist))
{
Close();
return;
}
if (cast.State == BloodSpellMessageState.Create)
_cult.CreateSpell((_performer, cultist), Player);
else if (cast.State == BloodSpellMessageState.Remove)
_cult.RemoveSpell((_performer, cultist), Player);
Close();
}
}

View File

@@ -0,0 +1,21 @@
using Content.Server.EUI;
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Shared.Player;
namespace Content.Server._White.Cult.UI;
[UsedImplicitly, DataDefinition]
public sealed partial class OpenBloodSpellsUi : IAlertClick
{
public void AlertClicked(EntityUid player)
{
var euiManager = IoCManager.Resolve<EuiManager>();
var entManager = IoCManager.Resolve<IEntityManager>();
if (!entManager.TryGetComponent(player, out ActorComponent? actor))
return;
euiManager.OpenEui(new CultBloodSpellsEui(player, entManager), actor.PlayerSession);
}
}

View File

@@ -4,6 +4,7 @@ using Content.Server._White.Radio.Components;
using Content.Server.Administration.Logs;
using Content.Server.Chat.Systems;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Station.Systems;
using Content.Shared._White.CartridgeLoader.Cartridges;
using Content.Shared.CartridgeLoader;
using Content.Shared.Database;
@@ -19,6 +20,7 @@ public sealed class MessagesServerSystem : EntitySystem
[Dependency] private readonly MessagesCartridgeSystem _messagesSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
public override void Initialize()
{
@@ -30,19 +32,12 @@ public sealed class MessagesServerSystem : EntitySystem
private void OnInit(EntityUid uid, MessagesServerComponent component, ComponentInit args)
{
var query = EntityQueryEnumerator<MessagesCartridgeComponent>();
var stationId = _stationSystem.GetOwningStation(uid);
while (query.MoveNext(out var entityUid, out var cartridge))
{
if (!TryComp(entityUid, out CartridgeComponent? cartComponent))
continue;
_messagesSystem.TryGetMessagesUser(cartridge, cartComponent, out var messagesUser);
if (cartridge.UserUid == null || messagesUser.Name == Loc.GetString("messages-pda-unknown-name"))
continue;
component.Dictionary[cartridge.UserUid.Value] = messagesUser;
cartridge.LastServer = uid;
if (stationId.HasValue && _singletonServerSystem.TryGetActiveServerAddress<MessagesServerComponent>(stationId.Value, out var address) && TryComp(entityUid, out CartridgeComponent? cartComponent))
_messagesSystem.SendName(entityUid, cartridge, cartComponent, address);
}
}

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Content.Shared._White.Telescope;
using Content.Shared._White.WeaponModules;
using Content.Shared.Weapons.Ranged.Components;
@@ -128,7 +128,7 @@ public sealed class WeaponModulesSystem : EntitySystem
return;
weaponModulesComponent.WeaponFireEffect = true;
Dirty(module, weaponModulesComponent);
Dirty(weapon, weaponModulesComponent);
}
private void SilencerModuleOnInsert(EntityUid module, SilencerModuleComponent component, EntGotInsertedIntoContainerMessage args)
@@ -145,7 +145,7 @@ public sealed class WeaponModulesSystem : EntitySystem
weaponModulesComponent.WeaponFireEffect = true;
_gunSystem.SetSound(weapon, component.NewSoundGunshot);
Dirty(module, weaponModulesComponent);
Dirty(weapon, weaponModulesComponent);
}
private void AcceleratorModuleOnInsert(EntityUid module, AcceleratorModuleComponent component, EntGotInsertedIntoContainerMessage args)
@@ -224,7 +224,7 @@ public sealed class WeaponModulesSystem : EntitySystem
return;
weaponModulesComponent.WeaponFireEffect = false;
Dirty(module, weaponModulesComponent);
Dirty(weapon, weaponModulesComponent);
}
private void SilencerModuleOnEject(EntityUid module, SilencerModuleComponent component, EntGotRemovedFromContainerMessage args)
@@ -236,7 +236,7 @@ public sealed class WeaponModulesSystem : EntitySystem
weaponModulesComponent.WeaponFireEffect = false;
_gunSystem.SetSound(weapon, component.OldSoundGunshot!);
Dirty(module, weaponModulesComponent);
Dirty(weapon, weaponModulesComponent);
}
private void AcceleratorModuleOnEject(EntityUid module, AcceleratorModuleComponent component, EntGotRemovedFromContainerMessage args)

View File

@@ -17,6 +17,7 @@ using Content.Server.EUI;
using Content.Server.Lightning;
using Content.Server.Magic;
using Content.Server.Mind;
using Content.Server.Polymorph.Systems;
using Content.Server.Singularity.EntitySystems;
using Content.Server.Standing;
using Content.Server.Weapons.Ranged.Systems;
@@ -33,6 +34,7 @@ using Content.Shared.Cluwne;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Humanoid;
@@ -44,7 +46,10 @@ using Content.Shared.Magic;
using Content.Shared.Maps;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Physics;
using Content.Shared.Polymorph;
using Content.Shared.Popups;
using Content.Shared.Revolutionary.Components;
using Content.Shared.StatusEffect;
@@ -90,6 +95,8 @@ public sealed class WizardSpellsSystem : EntitySystem
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
[Dependency] private readonly ChargingSystem _charging = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly PolymorphSystem _polymorph = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
#endregion
@@ -113,6 +120,9 @@ public sealed class WizardSpellsSystem : EntitySystem
SubscribeLocalEvent<FireballSpellEvent>(OnFireballSpell);
SubscribeLocalEvent<ForceSpellEvent>(OnForceSpell);
SubscribeLocalEvent<ArcSpellEvent>(OnArcSpell);
SubscribeLocalEvent<RodFormSpellEvent>(OnRodFormSpell);
SubscribeLocalEvent<BlindSpellEvent>(OnBlindSpell);
SubscribeAllEvent<MutateSpellEvent>(OnMutateSpell);
SubscribeLocalEvent<MagicComponent, BeforeCastSpellEvent>(OnBeforeCastSpell);
}
@@ -838,6 +848,86 @@ public sealed class WizardSpellsSystem : EntitySystem
#endregion
#region Rod Form
private void OnRodFormSpell(RodFormSpellEvent msg)
{
if (!CanCast(msg))
return;
var config = new PolymorphConfiguration
{
Entity = "ImmovableRodWizard",
Duration = 2,
Forced = true,
TransferDamage = true
};
var rod = _polymorph.PolymorphEntity(msg.Performer, config);
var angle = _transformSystem.GetWorldRotation(msg.Performer).ToWorldVec();
if (rod.HasValue)
{
RemComp<InputMoverComponent>(rod.Value);
_throwingSystem.TryThrow(rod.Value, angle, 20, msg.Performer);
}
Cast(msg);
}
#endregion
#region Blind
private void OnBlindSpell(BlindSpellEvent msg)
{
if (!CanCast(msg))
return;
foreach (var e in _lookup.GetEntitiesInRange(msg.Performer, 8))
{
var wizardQuery = GetEntityQuery<WizardComponent>();
var humanoidQuery = GetEntityQuery<HumanoidAppearanceComponent>();
if (!humanoidQuery.HasComponent(e) || !_mobState.IsAlive(e) ||
wizardQuery.HasComponent(e))
continue;
_statusEffectsSystem.TryAddStatusEffect<TemporaryBlindnessComponent>(e, "TemporaryBlindness",
TimeSpan.FromSeconds(5), false);
_chat.TryEmoteWithChat(e, "Scream");
}
Cast(msg);
}
#endregion
#region Mutate
private void OnMutateSpell(MutateSpellEvent msg)
{
if (!CanCast(msg))
return;
var config = new PolymorphConfiguration
{
Entity = "MobHulk",
Duration = 30,
Forced = true,
TransferDamage = true
};
_polymorph.PolymorphEntity(msg.Performer, config);
Cast(msg);
}
#endregion
#region Helpers
private void TurnOffShield(EntityUid uid)