Fix errors

This commit is contained in:
Aviu00
2024-01-11 09:44:36 +03:00
parent 4f6be99853
commit 35e533b865
14 changed files with 56 additions and 90 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Random;
@@ -16,7 +15,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player == null)
{
shell.WriteLine("You cannot use this command from the server console.");
return;
@@ -36,7 +35,7 @@ namespace Content.Server.Administration.Commands
var random = IoCManager.Resolve<IRobustRandom>();
var chatManager = IoCManager.Resolve<IChatManager>();
chatManager.DispatchServerAnnouncement($"{player.Name} has thrown the D{maxNum} and the {random.Next(1, maxNum)} rolled.");
chatManager.DispatchServerAnnouncement($"{shell.Player.Name} has thrown the D{maxNum} and the {random.Next(1, maxNum)} rolled.");
}
}

View File

@@ -66,7 +66,7 @@ namespace Content.Server.Body.Components
[DataField("CPRSound")]
public SoundSpecifier CPRSound { get; set; } = new SoundPathSpecifier("/White/Audio/CPR.ogg");
public IPlayingAudioStream? CPRPlayingStream;
public EntityUid? CPRPlayingStream;
public EntityUid? CPRPerformedBy = null;
// WD end

View File

@@ -291,7 +291,7 @@ namespace Content.Server.Body.Systems
private void DoCPR(EntityUid target, RespiratorComponent comp, EntityUid user)
{
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, comp.CycleDelay * 4, new CPREndedEvent(user, target), target, target: target)
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, comp.CycleDelay * 4, new CPREndedEvent(), target, target: target)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
@@ -309,7 +309,7 @@ namespace Content.Server.Body.Systems
comp.CPRPerformedBy = user;
_popupSystem.PopupEntity(Loc.GetString("cpr-started", ("target", Identity.Entity(target, EntityManager)), ("user", Identity.Entity(user, EntityManager))), target, PopupType.Medium);
comp.CPRPlayingStream = _audio.PlayPvs(comp.CPRSound, target, audioParams: AudioParams.Default.WithVolume(-3f).WithLoop(true));
comp.CPRPlayingStream = _audio.PlayPvs(comp.CPRSound, target, audioParams: AudioParams.Default.WithVolume(-3f).WithLoop(true)).Value.Entity;
_adminLogger.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(user):entity} начал произовдить СЛР на {ToPrettyString(target):entity}");
}
@@ -321,7 +321,7 @@ namespace Content.Server.Body.Systems
if (args.Cancelled || !TryComp<MobStateComponent>(args.Target, out var targetState) || targetState!.CurrentState != MobState.Critical)
{
component.CPRPlayingStream?.Stop();
_audio.Stop(component.CPRPlayingStream);
component.CPRPerformedBy = null;
_popupSystem.PopupEntity(Loc.GetString("cpr-failed"), args.User, args.User);
_adminLogger.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.User):entity} не удалось произвести СЛР на {ToPrettyString(args.Target):entity}");
@@ -336,7 +336,7 @@ namespace Content.Server.Body.Systems
_adminLogger.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.User):entity} произвёл СЛР на {ToPrettyString(args.Target):entity}");
if (CanCPR(args.Target, component, args.User))
if (args.Target != null && CanCPR(args.Target.Value, component, args.User))
args.Repeat = true;
else
component.CPRPerformedBy = null;

View File

@@ -1,24 +1,18 @@
using Content.Server.Mind.Components;
using Content.Server.Traitor;
using Content.Server.Mind;
using Content.Server.Roles;
using Content.Shared.Store;
namespace Content.Server.Store.Conditions;
public sealed class BuyerBlockForAntagCondition : ListingCondition
public sealed partial class BuyerBlockForAntagCondition : ListingCondition
{
public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var mind) || mind.Mind == null)
var roleSystem = ent.System<RoleSystem>();
var mindSystem = ent.System<MindSystem>();
if (!mindSystem.TryGetMind(args.Buyer, out var mindId, out var mind))
return false;
foreach (var role in mind.Mind.AllRoles)
{
if (role is TraitorRole traitorRole)
return false;
}
return true;
return !roleSystem.MindIsAntagonist(mindId);
}
}

View File

@@ -1,21 +1,20 @@
using Content.Server.Mind.Components;
using Content.Server.Mind;
using Content.Server.Roles.Jobs;
using Content.Shared.Store;
namespace Content.Server.Store.Conditions;
public sealed class BuyerBlockForMindProtected : ListingCondition
public sealed partial class BuyerBlockForMindProtected : ListingCondition
{
public override bool Condition(ListingConditionArgs args)
{
var buyer = args.Buyer;
var ent = args.EntityManager;
if (!ent.TryGetComponent<MindComponent>(buyer, out var mind) || mind.Mind == null)
var roleSystem = ent.System<JobSystem>();
var mindSystem = ent.System<MindSystem>();
if (!mindSystem.TryGetMind(args.Buyer, out var mindId, out var mind))
return false;
if (mind.Mind.CurrentJob?.CanBeAntag != true)
if (mind.Session == null)
return false;
return true;
return !roleSystem.CanBeAntag(mind.Session);
}
}

View File

@@ -1,10 +1,10 @@
using Content.Server.White.Sponsors;
using Content.Shared.Store;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
namespace Content.Server.Store.Conditions;
public sealed class DonationTierLockCondition : ListingCondition
public sealed partial class DonationTierLockCondition : ListingCondition
{
[DataField("tier", required: true)]
public int Tier;

View File

@@ -227,7 +227,7 @@ public sealed partial class StoreSystem
UpdateUserInterface(buyer, uid, component);
}
public void CloseUi(EntityUid user, StoreComponent component)
public void CloseSessionUi(EntityUid user, StoreComponent component)
{
if (!TryComp<ActorComponent>(user, out var actor))
return;

View File

@@ -6,13 +6,14 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Projectiles;
using Content.Shared.Weapons.Ranged;
using Content.Shared.Weapons.Ranged.Components;
using Robust.Server.Audio;
using Robust.Shared.Prototypes;
namespace Content.Server.Weapons.Ranged.Systems;
public sealed partial class GunSystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly AudioSystem _audio = default!;
protected override void InitializeBattery()
{
@@ -31,7 +32,7 @@ public sealed partial class GunSystem
//TwoModeEnergy
SubscribeLocalEvent<TwoModeEnergyAmmoProviderComponent, ComponentStartup>(OnBatteryStartup);
SubscribeLocalEvent<TwoModeEnergyAmmoProviderComponent, ChargeChangedEvent>(OnBatteryChargeChange);
SubscribeLocalEvent<ProjectileBatteryAmmoProviderComponent, DamageExamineEvent>(OnBatteryDamageExamine);
SubscribeLocalEvent<TwoModeEnergyAmmoProviderComponent, DamageExamineEvent>(OnBatteryDamageExamine);
SubscribeLocalEvent<TwoModeEnergyAmmoProviderComponent, UseInHandEvent>(OnBatteryModeChange);
}

View File

@@ -21,7 +21,7 @@ public sealed class PoshelnahuiCommand : IConsoleCommand
}
var playerManager = IoCManager.Resolve<IPlayerManager>();
var players = playerManager.ServerSessions.ToList();
var players = playerManager.Sessions.ToList();
var player = players.Find(x => x.Name == args[0]);
@@ -40,7 +40,7 @@ public sealed class PoshelnahuiCommand : IConsoleCommand
if (args.Length == 1)
{
var playerMgr = IoCManager.Resolve<IPlayerManager>();
var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
return CompletionResult.FromHintOptions(options, "ckey");
}

View File

@@ -1,35 +1,28 @@
using System.Linq;
using Content.Server.Actions;
using Content.Server.Administration.Managers;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Rules;
using Content.Server.Mind.Components;
using Content.Server.Mind;
using Content.Server.Roles;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Server.White.Sponsors;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.FixedPoint;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Mind;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Nuke;
using Content.Shared.Roles.Jobs;
using Content.Shared.Verbs;
using Content.Shared.White;
using Content.Shared.White.MeatyOre;
using Content.Shared.White.Sponsors;
using Robust.Server.GameObjects;
using Robust.Server.GameStates;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server.White;
@@ -37,14 +30,15 @@ public sealed class MeatyOreStoreSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly StoreSystem _storeSystem = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly TraitorRuleSystem _traitorRuleSystem = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly PVSOverrideSystem _pvsOverrideSystem = default!;
[Dependency] private readonly PvsOverrideSystem _pvsOverrideSystem = default!;
[Dependency] private readonly RoleSystem _roleSystem = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly SharedJobSystem _jobSystem = default!;
private static readonly string StorePresetPrototype = "StorePresetMeatyOre";
@@ -75,11 +69,11 @@ public sealed class MeatyOreStoreSystem : EntitySystem
if(!TryComp<MobStateComponent>(ev.Target, out var state) || state?.CurrentState != MobState.Alive) return;
if(!TryGetStore(actorComponent.PlayerSession, out var store)) return;
if(!TryComp<MindComponent>(ev.Target, out var targetMind) || !targetMind.HasMind) return;
if (targetMind!.Mind!.AllRoles.Any(x => x.Antagonist)) return;
if(!_mindSystem.TryGetMind(ev.Target, out var mindId, out var mind)) return;
if (_roleSystem.MindIsAntagonist(mindId)) return;
if(targetMind.Mind.CurrentJob?.CanBeAntag != true) return;
if(targetMind.Mind.Session == null) return;
if(mind.Session == null) return;
if(!_jobSystem.CanBeAntag(mind.Session)) return;
if (!store.Balance.TryGetValue("MeatyOreCoin", out var currency)) return;
@@ -93,7 +87,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
Act = () =>
{
_storeSystem.TryAddCurrency(new Dictionary<string, FixedPoint2> {{MeatyOreCurrensyPrototype, -10}}, store.Owner, store);
_traitorRuleSystem.MakeTraitor(targetMind.Mind.Session);
_traitorRuleSystem.MakeTraitor(mind.Session);
},
Category = VerbCategory.MeatyOre
};
@@ -113,7 +107,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
var playerEntity = session.AttachedEntity;
if(!playerEntity.HasValue) continue;
_storeSystem.CloseUi(playerEntity.Value, meatyOreStoreData.Value);
_storeSystem.CloseSessionUi(playerEntity.Value, meatyOreStoreData.Value);
}
}
MeatyOrePanelEnabled = newValue;
@@ -122,16 +116,15 @@ public sealed class MeatyOreStoreSystem : EntitySystem
private void OnAntagPurchase(EntityUid uid, MindComponent component, MeatyTraitorRequestActionEvent args)
{
if(component.Mind == null) return;
if(component.Mind.Session == null) return;
if(component.Session == null) return;
_traitorRuleSystem.MakeTraitor(component.Mind?.Session!);
_traitorRuleSystem.MakeTraitor(component.Session!);
}
private void OnShopRequested(MeatyOreShopRequestEvent msg, EntitySessionEventArgs args)
{
var playerSession = args.SenderSession as IPlayerSession;
var playerSession = args.SenderSession;
if (!MeatyOrePanelEnabled)
{
@@ -149,7 +142,7 @@ public sealed class MeatyOreStoreSystem : EntitySystem
_storeSystem.ToggleUi(playerEntity.Value, storeComponent.Owner, storeComponent);
}
private bool TryGetStore(IPlayerSession session, out StoreComponent store)
private bool TryGetStore(ICommonSession session, out StoreComponent store)
{
store = null!;
@@ -190,8 +183,4 @@ public sealed class MeatyOreStoreSystem : EntitySystem
return storeComponent;
}
}

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Weapons.Ranged.Components;
[RegisterComponent, NetworkedComponent]
public sealed class TwoModeEnergyAmmoProviderComponent : BatteryAmmoProviderComponent
public sealed partial class TwoModeEnergyAmmoProviderComponent : BatteryAmmoProviderComponent
{
[ViewVariables(VVAccess.ReadOnly),
DataField("projProto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]

View File

@@ -74,13 +74,13 @@ public abstract partial class SharedGunSystem
{
if (!TryComp<AppearanceComponent>(uid, out var appearance))
return;
if (!TryComp<ItemComponent?>(uid, out var item))
if (!TryComp<ItemComponent>(uid, out var item))
return;
if (component.InStun)
_item.SetHeldPrefix(uid, null, item);
_item.SetHeldPrefix(uid, null, false, item);
else
_item.SetHeldPrefix(uid, "laser", item);
_item.SetHeldPrefix(uid, "laser", false, item);
Appearance.SetData(uid, AmmoVisuals.InStun, component.InStun, appearance);

View File

@@ -4,23 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.White.CPR.Events;
[Serializable, NetSerializable]
public sealed class CPREndedEvent : DoAfterEvent
public sealed partial class CPREndedEvent : DoAfterEvent
{
[DataField("user", required: true)]
public readonly EntityUid User = default!;
[DataField("target", required: true)]
public readonly EntityUid Target = default!;
private CPREndedEvent()
{
}
public CPREndedEvent(EntityUid user, EntityUid target)
{
User = user;
Target = target;
}
public override DoAfterEvent Clone() => this;
}

View File

@@ -17,7 +17,7 @@ public sealed class MeatyTraitorRequestActionEvent
}
[NetworkedComponent, RegisterComponent]
public sealed class IgnorBUIInteractionRangeComponent : Component
public sealed partial class IgnorBUIInteractionRangeComponent : Component
{
}