kinda fixes

This commit is contained in:
EnefFlow
2023-11-15 23:31:43 +03:00
committed by Aviu00
parent eea0e86d87
commit 8c9c17e6de
13 changed files with 45 additions and 28 deletions

View File

@@ -452,7 +452,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
if (backPack != null) if (backPack != null)
{ {
_storageSystem.Insert(backPack.Value, itemEntity); _storageSystem.Insert(backPack.Value, itemEntity, out _);
} }
} }
} }
@@ -462,10 +462,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
_chatManager.DispatchServerMessage(cultist, Loc.GetString("cult-role-greeting")); _chatManager.DispatchServerMessage(cultist, Loc.GetString("cult-role-greeting"));
if (_prototypeManager.TryIndex<ObjectivePrototype>("CultistKillObjective", out var cultistObjective)) _mindSystem.TryAddObjective(mind.Value, mindComponent, "CultistKillObjective");
{
_mindSystem.TryAddObjective(mind.Value, mindComponent,cultistObjective);
}
return true; return true;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Server.White.Cult.Items.Components;
public sealed partial class TorchCultistsProviderComponent : Component public sealed partial class TorchCultistsProviderComponent : Component
{ {
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultTeleporterUiKey.Key); public Enum UserInterfaceKey = CultTeleporterUiKey.Key;
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public EntityUid? ItemSelected; public EntityUid? ItemSelected;

View File

@@ -95,7 +95,9 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
return; return;
} }
if (provider.UserInterface == null) var ui = _ui.GetUiOrNull(uid, comp.UserInterfaceKey);
if (ui == null)
return; return;
provider.ItemSelected = args.Target; provider.ItemSelected = args.Target;
@@ -120,12 +122,12 @@ public sealed class TorchCultistsProviderSystem : EntitySystem
return; return;
} }
UserInterfaceSystem.SetUiState(provider.UserInterface, new TorchWindowBUIState(list)); _ui.SetUiState(ui, new TorchWindowBUIState(list));
if (!TryComp<ActorComponent>(args.User, out var actorComponent)) if (!TryComp<ActorComponent>(args.User, out var actorComponent))
return; return;
_ui.ToggleUi(provider.UserInterface, actorComponent.PlayerSession); _ui.ToggleUi(ui, actorComponent.PlayerSession);
} }
private void OnCultistSelected( private void OnCultistSelected(

View File

@@ -135,7 +135,9 @@ public sealed class VoidTeleportSystem : EntitySystem
private void CreatePulse(EntityUid uid, VoidTeleportComponent component) private void CreatePulse(EntityUid uid, VoidTeleportComponent component)
{ {
if (TryComp<PointLightComponent>(uid, out var light)) if (TryComp<PointLightComponent>(uid, out var light))
#pragma warning disable RA0002
light.Energy = 5f; light.Energy = 5f;
#pragma warning restore RA0002
Timer.Spawn(component.TimerDelay, () => TurnOffPulse(uid, component), component.Token.Token); Timer.Spawn(component.TimerDelay, () => TurnOffPulse(uid, component), component.Token.Token);
} }
@@ -145,7 +147,9 @@ public sealed class VoidTeleportSystem : EntitySystem
if (!TryComp<PointLightComponent>(uid, out var light)) if (!TryComp<PointLightComponent>(uid, out var light))
return; return;
#pragma warning disable RA0002
light.Energy = 1f; light.Energy = 1f;
#pragma warning restore RA0002
comp.Token = new CancellationTokenSource(); comp.Token = new CancellationTokenSource();
@@ -154,7 +158,9 @@ public sealed class VoidTeleportSystem : EntitySystem
comp.Active = false; comp.Active = false;
UpdateAppearance(uid, comp); UpdateAppearance(uid, comp);
#pragma warning disable RA0002
light.Enabled = false; light.Enabled = false;
#pragma warning restore RA0002
} }
} }
} }

View File

@@ -222,7 +222,9 @@ public sealed class PylonSystem : EntitySystem
if (!TryComp<PointLightComponent>(uid, out var light)) if (!TryComp<PointLightComponent>(uid, out var light))
return; return;
#pragma warning disable RA0002
light.Enabled = comp.Activated; light.Enabled = comp.Activated;
#pragma warning restore RA0002
var toggleMsg = Loc.GetString(comp.Activated ? "pylon-toggle-on" : "pylon-toggle-off"); var toggleMsg = Loc.GetString(comp.Activated ? "pylon-toggle-on" : "pylon-toggle-off");
_popupSystem.PopupEntity(toggleMsg, uid); _popupSystem.PopupEntity(toggleMsg, uid);

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.White.Cult;
public sealed partial class RuneDrawerProviderComponent : Component public sealed partial class RuneDrawerProviderComponent : Component
{ {
[ViewVariables] [ViewVariables]
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(ListViewSelectorUiKey.Key); public Enum UserInterfaceKey = ListViewSelectorUiKey.Key;
[DataField("runePrototypes")] [DataField("runePrototypes")]
public List<string> RunePrototypes = new(); public List<string> RunePrototypes = new();

View File

@@ -25,14 +25,18 @@ public partial class CultSystem
private void OnShellSelected(EntityUid uid, ConstructShellComponent component, ConstructFormSelectedEvent args) private void OnShellSelected(EntityUid uid, ConstructShellComponent component, ConstructFormSelectedEvent args)
{ {
var construct = Spawn(args.SelectedForm, Transform(args.Entity).MapPosition); if (args.Session.AttachedEntity != null)
var mind = Comp<MindContainerComponent>(args.Session.AttachedEntity!.Value); {
var construct = Spawn(args.SelectedForm, Transform(args.Session.AttachedEntity.Value).MapPosition);
var mind = Comp<MindContainerComponent>(args.Session.AttachedEntity!.Value);
if(!mind.HasMind) if(!mind.HasMind)
return; return;
_mindSystem.TransferTo(mind.Mind.Value, construct); _mindSystem.TransferTo(mind.Mind.Value, construct);
Del(args.Entity); }
Del(args.Session.AttachedEntity);
} }
private void OnShellInit(EntityUid uid, ConstructShellComponent component, ComponentInit args) private void OnShellInit(EntityUid uid, ConstructShellComponent component, ComponentInit args)

View File

@@ -135,7 +135,7 @@ public sealed partial class CultSystem : EntitySystem
private void OnRuneDrawerUseInHand(EntityUid uid, RuneDrawerProviderComponent component, UseInHandEvent args) private void OnRuneDrawerUseInHand(EntityUid uid, RuneDrawerProviderComponent component, UseInHandEvent args)
{ {
if (component.UserInterface == null) if (!_ui.TryGetUi(uid, component.UserInterfaceKey, out _))
return; return;
if (!TryComp<ActorComponent>(args.User, out var actorComponent)) if (!TryComp<ActorComponent>(args.User, out var actorComponent))

View File

@@ -25,10 +25,10 @@ public sealed class CultStructureCraftSystem : EntitySystem
if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession) if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession)
return; return;
if (component.UserInterface != null) if (_uiSystem.TryGetUi(uid, component.UserInterfaceKey, out var bui))
{ {
_uiSystem.CloseUi(component.UserInterface, playerSession); _uiSystem.CloseUi(bui, playerSession);
_uiSystem.OpenUi(component.UserInterface, playerSession); _uiSystem.OpenUi(bui, playerSession);
} }
} }
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Server.White.Cult.Structures;
public sealed partial class RunicMetalComponent : Component public sealed partial class RunicMetalComponent : Component
{ {
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultStructureCraftUiKey.Key); public Enum UserInterfaceKey = CultStructureCraftUiKey.Key;
[ViewVariables(VVAccess.ReadWrite), DataField("delay")] [ViewVariables(VVAccess.ReadWrite), DataField("delay")]
public float Delay = 1; public float Delay = 1;

View File

@@ -20,7 +20,7 @@ public sealed partial class CultistFactoryComponent : Component
[DataField("products", customTypeSerializer: typeof(PrototypeIdListSerializer<CultistFactoryProductionPrototype>))] [DataField("products", customTypeSerializer: typeof(PrototypeIdListSerializer<CultistFactoryProductionPrototype>))]
public IReadOnlyCollection<string> Products = ArraySegment<string>.Empty; public IReadOnlyCollection<string> Products = ArraySegment<string>.Empty;
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultistAltarUiKey.Key); public Enum UserInterfaceKey = CultistAltarUiKey.Key;
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public bool Active = true; public bool Active = true;

View File

@@ -81,7 +81,7 @@ public sealed class CultistFactorySystem : EntitySystem
if (_ui.TryGetUi(uid, CultistAltarUiKey.Key, out var bui)) if (_ui.TryGetUi(uid, CultistAltarUiKey.Key, out var bui))
{ {
UserInterfaceSystem.SetUiState(bui, new CultistFactoryBUIState(component.Products)); _ui.SetUiState(bui, new CultistFactoryBUIState(component.Products));
_ui.OpenUi(bui, actor.PlayerSession); _ui.OpenUi(bui, actor.PlayerSession);
} }
} }
@@ -128,7 +128,7 @@ public sealed class CultistFactorySystem : EntitySystem
var xform = Transform(uid); var xform = Transform(uid);
var ev = new CultAnchorDoAfterEvent(xform.Anchored); var ev = new CultAnchorDoAfterEvent(xform.Anchored);
var doArgs = new DoAfterArgs(user, time, ev, uid, uid); var doArgs = new DoAfterArgs(_entityManager, user, time, ev, uid, uid);
_doAfterSystem.TryStartDoAfter(doArgs); _doAfterSystem.TryStartDoAfter(doArgs);
} }

View File

@@ -1,5 +1,11 @@
- type: objective - type: entity
noSpawn: true
parent: BaseObjective
id: CultistKillObjective id: CultistKillObjective
issuer: Cult description: objective-condition-kill-person-description
conditions: components:
- !type:KillCultistTarget {} - type: Objective
icon:
sprite: /White/Cult/interface.rsi
state: icon
- type: KillCultistTargetCondition